/* ============================================================
   Susa Deploy Panel — terminal arayüzü
   Her şey tek aralıklı yazı; fosfor rengi temayla değişir
   (matrix / amber / ice / paper). Yerleşim: daralabilen sol menü,
   ortada konsol + komut satırı, sağda geçmiş, altta durum çubuğu.
   CRT efektleri (tarama çizgisi, parıltı, yağmur) `data-fx="off"`
   ile kapanır. Köşeler dik, gölge yerine ışıma.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg:          #040705;
  --panel:       #070c09;
  --panel-hi:    #0c1610;
  --line:        #12301f;
  --line-strong: #1f5238;

  --fg:          #b9f6cf;
  --fg-dim:      #63a880;
  --fg-faint:    #37704f;

  --accent:      #3dff8f;
  --on-accent:   #021207;
  --cmd:         #6fd8ff;
  --ok:          #3dff8f;
  --err:         #ff5468;
  --warn:        #ffc64a;

  --glow:      0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
  --glow-text: 0 0 7px color-mix(in srgb, currentColor 45%, transparent);
  --scan:      rgba(0, 0, 0, .2);

  --menu-w:    264px;
  --menu-w-sm: 60px;
  --topbar-h:  46px;
  --status-h:  26px;
  --rail-w:    280px;
  --gutter:    5ch;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="amber"] {
  --bg:          #080502;
  --panel:       #0d0804;
  --panel-hi:    #181006;
  --line:        #382608;
  --line-strong: #5e400d;
  --fg:          #ffdf9e;
  --fg-dim:      #b98a3c;
  --fg-faint:    #7a5a24;
  --accent:      #ffb000;
  --on-accent:   #1a0f00;
  --cmd:         #8fd3ff;
  --ok:          #8dff7a;
  --err:         #ff5a4d;
  --warn:        #fff275;
}

:root[data-theme="ice"] {
  --bg:          #03070a;
  --panel:       #060c11;
  --panel-hi:    #0b171f;
  --line:        #12303d;
  --line-strong: #1d4d63;
  --fg:          #c9f3ff;
  --fg-dim:      #6aa5ba;
  --fg-faint:    #3b6b82;
  --accent:      #4fe3ff;
  --on-accent:   #01141a;
  --cmd:         #b79cff;
  --ok:          #5dffa0;
  --err:         #ff5d7a;
  --warn:        #ffcc55;
}

/* Açık tema: teleks kâğıdı. Işıma ve tarama çizgisi yok. */
:root[data-theme="paper"] {
  color-scheme: light;
  --bg:          #ece6d6;
  --panel:       #f4efe2;
  --panel-hi:    #e4dcc8;
  --line:        #d2c9b3;
  --line-strong: #a89e86;
  --fg:          #1d1b16;
  --fg-dim:      #5d584b;
  --fg-faint:    #8f8774;
  --accent:      #0a6a43;
  --on-accent:   #f4efe2;
  --cmd:         #1c49a8;
  --ok:          #0a6a43;
  --err:         #b3261e;
  --warn:        #8a5a00;
  --glow:        none;
  --glow-text:   none;
  --scan:        transparent;
}

:root[data-fx="off"] {
  --glow:      none;
  --glow-text: none;
}

/* ---------- temel ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 700; font-size: inherit; }
button, input { font: inherit; color: inherit; border-radius: 0; }
code { font-family: var(--mono); color: var(--accent); }

kbd {
  font: inherit;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  color: var(--fg-dim);
}

::selection { background: var(--accent); color: var(--on-accent); text-shadow: none; }
:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ============================================================
   CRT katmanı: tarama çizgileri, vinyet, yavaşça inen tazeleme bandı
   ============================================================ */

body::before,
body::after,
html::after {
  content: "";
  position: fixed;
  pointer-events: none;
}

body::before {
  inset: 0; z-index: 90;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, var(--scan) 2px 3px);
}

body::after {
  inset: 0; z-index: 91;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .38) 100%);
}

html::after {
  top: 0; left: 0; right: 0; z-index: 92;
  height: 140px;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--accent) 5%, transparent), transparent);
  transform: translateY(-140px);
  animation: band 9s linear infinite;
}

:root[data-fx="off"] body::before,
:root[data-fx="off"] body::after,
:root[data-fx="off"]::after,
:root[data-theme="paper"] body::after,
:root[data-theme="paper"]::after { display: none; }

@keyframes band  { to { transform: translateY(100vh); } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ---------- ortak parçalar ---------- */

.rain { display: block; pointer-events: none; }
:root[data-fx="off"] .rain { display: none; }

.logo {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(7px, 2.6vw, 12px);
  line-height: 1.05;
  color: var(--accent);
  text-shadow: var(--glow);
  user-select: none;
}

/* Arada bir "kayan" başlık: iki renkli kopya kırpılarak üst üste biner. */
.glitch { position: relative; display: inline-block; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
}
.glitch::before { color: var(--cmd); animation: glitch-a 3.4s steps(1) infinite; }
.glitch::after  { color: var(--err); animation: glitch-b 2.9s steps(1) infinite; }

@keyframes glitch-a {
  0%, 91%, 100% { opacity: 0; }
  92% { opacity: .9; transform: translate(-3px, 0); clip-path: inset(8% 0 62% 0); }
  94% { opacity: .9; transform: translate(2px, 0);  clip-path: inset(55% 0 18% 0); }
  96% { opacity: .9; transform: translate(-1px, 0); clip-path: inset(30% 0 40% 0); }
}
@keyframes glitch-b {
  0%, 88%, 100% { opacity: 0; }
  89% { opacity: .9; transform: translate(3px, 0);  clip-path: inset(60% 0 10% 0); }
  91% { opacity: .9; transform: translate(-2px, 0); clip-path: inset(12% 0 70% 0); }
  93% { opacity: .9; transform: translate(1px, 0);  clip-path: inset(40% 0 35% 0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.t-ok   { color: var(--ok); }
.t-warn { color: var(--warn); }
.t-err  { color: var(--err); }
.t-dim  { color: var(--fg-faint); }

/* ============================================================
   Giriş ve "erişim yok" ekranı
   ============================================================ */

body.is-login,
body.is-denied {
  display: grid; place-items: center;
  padding: 24px 16px;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
}

.rain-page {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  opacity: .55;
}

.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 440px; }

.term {
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 0 0 1px #000, 0 0 70px color-mix(in srgb, var(--accent) 14%, transparent);
}
.term.is-alert {
  border-color: var(--err);
  box-shadow: 0 0 0 1px #000, 0 0 70px color-mix(in srgb, var(--err) 22%, transparent);
}

.term-bar {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
}

.term-body { padding: 24px 22px 22px; }

.login-title {
  margin-top: 10px;
  color: var(--fg-dim);
  font-size: 12px; font-weight: 400; letter-spacing: .32em;
}

.boot { list-style: none; margin: 20px 0 16px; padding: 0; font-size: 12px; color: var(--fg-dim); }
.boot li {
  display: grid; grid-template-columns: 7ch 8ch minmax(0, 1fr);
  opacity: 0;
  animation: boot-in .01s linear forwards;
}
.boot li > :last-child { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boot li:nth-child(1) { animation-delay: .12s; }
.boot li:nth-child(2) { animation-delay: .26s; }
.boot li:nth-child(3) { animation-delay: .40s; }
.boot li:nth-child(4) { animation-delay: .58s; }
@keyframes boot-in { to { opacity: 1; } }

.alert {
  margin-bottom: 12px; padding: 8px 12px;
  border: 1px solid var(--err);
  background: color-mix(in srgb, var(--err) 12%, transparent);
  color: var(--err);
  font-size: 12px;
  animation: shake .28s linear 2;
}
.alert::before { content: "[fail] "; font-weight: 700; }

.login-prompt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  cursor: text;
  transition: border-color .12s, box-shadow .12s;
}
.login-prompt:focus-within { border-color: var(--accent); box-shadow: var(--glow); }
.login-prompt .ps1 { font-weight: 400; }
.login-prompt input {
  flex: 1; min-width: 0;
  padding: 0; border: 0; outline: 0;
  background: transparent;
  color: var(--accent); caret-color: var(--accent);
  font-size: 16px; letter-spacing: .18em;
}
.login-prompt input::placeholder { color: var(--fg-faint); letter-spacing: .1em; }

.btn-primary {
  width: 100%; margin-top: 12px; padding: 10px 14px;
  border: 1px solid var(--accent);
  background: transparent; color: var(--accent);
  font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  cursor: pointer;
  transition: background .12s, color .12s, box-shadow .12s;
}
.btn-primary:hover,
.btn-primary:focus-visible { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.btn-primary:active { filter: brightness(.9); }

.denied-title {
  color: var(--err);
  font-size: clamp(20px, 6vw, 30px); letter-spacing: .06em; line-height: 1.2;
  text-shadow: 0 0 14px color-mix(in srgb, var(--err) 55%, transparent);
}
.denied-text { margin: 14px 0 0; color: var(--fg-dim); font-size: 12px; overflow-wrap: anywhere; }
.denied-text code { color: var(--fg); }

/* ============================================================
   Sol menü
   ============================================================ */

.app-menu {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
  width: var(--menu-w);
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  transition: width .18s ease;
}
:root[data-sidebar="sm"] .app-menu { width: var(--menu-w-sm); }

.menu-brand {
  flex: none;
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; text-decoration: none; color: inherit;
}

/* marka işareti: yanıp sönen blok imleç */
.brand-mark {
  flex: none;
  width: 9px; height: 17px;
  background: var(--accent);
  box-shadow: var(--glow);
  animation: blink 1.1s steps(1) infinite;
}

.brand-text {
  color: var(--accent);
  font-weight: 700; letter-spacing: .1em; white-space: nowrap;
  text-shadow: var(--glow-text);
}
.brand-text i { font-style: normal; color: var(--fg-faint); text-shadow: none; }

.menu-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 0; }

.menu-title {
  display: flex; align-items: center;
  margin: 0; padding: 14px 16px 6px;
  font-size: 11px; letter-spacing: .04em;
  color: var(--fg-dim);
  white-space: nowrap; overflow: hidden;
}
.menu-title span { overflow: hidden; text-overflow: ellipsis; }
.menu-title span::before { content: "// "; color: var(--fg-faint); }
.menu-title i { display: none; width: 14px; height: 1px; background: var(--line-strong); }
.menu-title:first-child { padding-top: 4px; }

.menu-list { list-style: none; margin: 0; padding: 0; }

.menu-item {
  position: relative;
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border: 0; border-left: 2px solid transparent;
  background: transparent;
  color: var(--fg-dim);
  text-align: left; text-decoration: none;
  cursor: pointer;
  transition: background .1s, color .1s, border-color .1s;
}
.menu-item:hover:not(:disabled) {
  background: var(--panel-hi);
  border-left-color: var(--accent);
  color: var(--accent);
  text-shadow: var(--glow-text);
}
.menu-item.is-danger:hover:not(:disabled) { border-left-color: var(--warn); color: var(--warn); }
.menu-item:disabled { opacity: .35; cursor: not-allowed; }
.menu-item.is-running,
.menu-item.is-running:disabled {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left-color: var(--accent);
  color: var(--accent);
}

.menu-no { flex: none; font-size: 11px; color: var(--fg-faint); text-shadow: none; }
.menu-item.is-running .menu-no { color: var(--accent); animation: blink 1s steps(1) infinite; }

.menu-icon { flex: none; width: 16px; height: 16px; display: grid; place-items: center; }
.menu-icon svg { width: 16px; height: 16px; }

.menu-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.menu-flag {
  flex: none;
  padding: 0 5px;
  border: 1px solid currentColor;
  color: var(--warn);
  font-size: 10px; font-weight: 700; line-height: 1.5;
  text-shadow: none;
}

.menu-foot { flex: none; border-top: 1px solid var(--line); }
.menu-foot .menu-item { padding-top: 10px; padding-bottom: 10px; }
.menu-foot .menu-item:hover { border-left-color: var(--err); color: var(--err); }

/* ---- daraltılmış menü ---- */

:root[data-sidebar="sm"] .brand-text,
:root[data-sidebar="sm"] .menu-label,
:root[data-sidebar="sm"] .menu-flag,
:root[data-sidebar="sm"] .menu-no,
:root[data-sidebar="sm"] .menu-title span { display: none; }

:root[data-sidebar="sm"] .menu-title { justify-content: center; padding: 14px 0 8px; }
:root[data-sidebar="sm"] .menu-title i { display: block; }
:root[data-sidebar="sm"] .menu-brand { justify-content: center; padding: 0; }
:root[data-sidebar="sm"] .menu-item { justify-content: center; padding: 11px 0; }

/* daraltılmışken ipucu balonu: `fixed` olduğu için kaydırma kutusunda kırpılmaz,
   dikey konumu belirtilmediği için satırın ortasında kalır */
:root[data-sidebar="sm"] .menu-item::after {
  content: attr(data-label);
  position: fixed; left: calc(var(--menu-w-sm) + 8px);
  padding: 4px 9px;
  border: 1px solid var(--accent);
  background: var(--panel); color: var(--accent);
  font-size: 12px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .1s;
  z-index: 5;
}
:root[data-sidebar="sm"] .menu-item:hover::after { opacity: 1; }

/* ============================================================
   İçerik
   ============================================================ */

.app-main {
  height: 100%;
  margin-left: var(--menu-w);
  display: flex; flex-direction: column;
  transition: margin-left .18s ease;
}
:root[data-sidebar="sm"] .app-main { margin-left: var(--menu-w-sm); }

.topbar {
  flex: none;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.head-spacer { flex: 1; }

.run-head { display: flex; align-items: center; gap: 12px; min-width: 0; }

.run-title { color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.run-meta {
  font-size: 12px; color: var(--fg-dim);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  color: var(--fg-dim);
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  white-space: nowrap;
}
.status-glyph { display: inline-block; width: 1.2ch; text-align: center; }

.status[data-state="running"] {
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--glow);
}
.status[data-state="success"] { border-color: currentColor; color: var(--ok); text-shadow: var(--glow-text); }
.status[data-state="failed"],
.status[data-state="timeout"],
.status[data-state="aborted"] {
  border-color: currentColor; color: var(--err);
  text-shadow: var(--glow-text);
  animation: shake .28s linear 2;
}

.controls { display: flex; align-items: center; gap: 4px; }

/* `[x] etiket` biçiminde aç/kapa: hem checkbox hem aria-pressed düğme */
.chk {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 4px 7px;
  border: 0; background: none;
  color: var(--fg-dim);
  font-size: 12px; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: color .1s;
}
.chk:hover { color: var(--fg); }
.chk input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chk span::before { content: "[ ] "; color: var(--fg-faint); }
.chk input:checked + span::before,
.chk[aria-pressed="true"] span::before { content: "[x] "; color: var(--accent); }
.chk:has(input:focus-visible) { outline: 1px dashed var(--accent); outline-offset: 2px; }

.btn-ghost {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg-dim);
  font-size: 12px; white-space: nowrap;
  cursor: pointer;
  transition: color .1s, border-color .1s, background .1s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost b { font-weight: 400; color: var(--accent); }

.icon-btn {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--fg-dim);
  cursor: pointer;
  transition: color .1s;
}
.icon-btn:hover { color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }

.only-mobile { display: none; }
.only-desktop { display: grid; }

/* daraltılmışken düğme ikonu "menü kapalı" hâlini gösterir */
:root[data-sidebar="sm"] #menuPin { color: var(--accent); }

/* ---------- çalışma alanı ---------- */

.work {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-w);
}
:root[data-rail="off"] .work { grid-template-columns: minmax(0, 1fr); }
:root[data-rail="off"] .rail { display: none; }

.console-wrap {
  position: relative;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* görev çalışırken üst kenarda gidip gelen tarayıcı çizgisi */
.console-wrap::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat;
  background-size: 28% 100%;
  opacity: 0;
}
body[data-run="running"] .console-wrap::before {
  opacity: 1;
  animation: sweep 1.3s ease-in-out infinite alternate;
}
@keyframes sweep { from { background-position: 0 0; } to { background-position: 100% 0; } }

.console-wrap.flash-ok  { animation: flash-ok .9s ease-out; }
.console-wrap.flash-err { animation: flash-err .9s ease-out; }
@keyframes flash-ok  { from { box-shadow: inset 0 0 0 2px var(--ok),  inset 0 0 60px color-mix(in srgb, var(--ok) 35%, transparent); } }
@keyframes flash-err { from { box-shadow: inset 0 0 0 2px var(--err), inset 0 0 60px color-mix(in srgb, var(--err) 35%, transparent); } }

.console {
  position: relative;
  flex: 1; min-height: 0;
  overflow: auto;
  padding: 10px 0 14px;
  /* satır numarası oluğunu ayıran dikey çizgi */
  background: linear-gradient(to right,
    transparent calc(var(--gutter) + 8px),
    var(--line) calc(var(--gutter) + 8px),
    var(--line) calc(var(--gutter) + 9px),
    transparent calc(var(--gutter) + 9px));
  color: var(--fg);
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 4;
  counter-reset: ln;
  text-shadow: var(--glow-text);
}
.console:focus-visible { outline-offset: -2px; }

.line {
  position: relative;
  padding: 0 16px 0 calc(var(--gutter) + 18px);
  white-space: pre-wrap; word-break: break-word;
  counter-increment: ln;
}
.line::before {
  content: counter(ln);
  position: absolute; left: 0; top: 0;
  width: var(--gutter);
  text-align: right;
  color: var(--fg-faint); text-shadow: none;
}
.line:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.line:hover::before { color: var(--fg-dim); }

/* panelin kendi satırları loga sayılmaz; vim'deki gibi `~` ile işaretlenir */
.line.local { counter-increment: none; }
.line.local::before { content: "~"; }

.line.cmd    { color: var(--cmd); font-weight: 700; }
.line.meta,
.line.dim    { color: var(--fg-dim); }
.line.rule   { color: var(--fg-faint); text-shadow: none; }
.line.err    { color: var(--err); background: color-mix(in srgb, var(--err) 9%, transparent); }
.line.warn   { color: var(--warn); }
.line.ok     { color: var(--ok); font-weight: 700; }
.line.system { color: var(--fg-dim); font-style: italic; }
.line.head   { color: var(--accent); font-weight: 700; letter-spacing: .1em; }

.tok-hash { color: var(--warn); }
.tok-ref  { color: var(--cmd); }
.tok-ps1  { color: var(--accent); font-weight: 700; }

/* canlı akışta son satırın ucunda blok imleç */
body[data-run="running"] .console .line:last-child::after {
  content: "█";
  margin-left: 2px;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

/* görev bitince basılan sonuç damgası */
.stamp {
  display: flex; gap: 16px;
  width: fit-content; max-width: calc(100% - var(--gutter) - 34px);
  margin: 10px 16px 2px calc(var(--gutter) + 18px);
  padding: 5px 14px;
  border: 1px solid currentColor;
  font-weight: 700; letter-spacing: .1em;
  white-space: nowrap; overflow: hidden;
}
/* yalnızca durum büyük yazılır; `exit` Türkçe kuralla EXİT olmasın */
.stamp span:first-child { text-transform: uppercase; }
.stamp.ok  { color: var(--ok);  box-shadow: 0 0 18px color-mix(in srgb, var(--ok) 28%, transparent),  inset 0 0 18px color-mix(in srgb, var(--ok) 10%, transparent); }
.stamp.err { color: var(--err); box-shadow: 0 0 18px color-mix(in srgb, var(--err) 28%, transparent), inset 0 0 18px color-mix(in srgb, var(--err) 10%, transparent); }
.stamp span + span { font-weight: 400; opacity: .85; }

/* ---------- boş konsol ---------- */

.idle {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  overflow: hidden;
  background: var(--bg);
  text-shadow: none;
}
.idle .rain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .32; }

.idle-body {
  position: relative;
  padding: 48px 56px;
  text-align: center;
  background: radial-gradient(closest-side, var(--bg) 62%, transparent);
}
.idle-sub {
  margin: 10px 0 22px;
  color: var(--fg-dim);
  font-size: 12px; letter-spacing: .5em; text-indent: .5em;
}
.idle-hint { margin: 0; color: var(--fg-dim); font-size: 12.5px; }
.idle-hint::before { content: "> "; color: var(--accent); }

/* daktilo: genişlik harf harf açılır, sağ kenar imleç olur */
.typed {
  display: inline-block; vertical-align: bottom;
  max-width: 100%;
  width: calc(var(--n) * 1ch);
  overflow: hidden; white-space: nowrap;
  border-right: .6em solid var(--accent);
  animation: typing 1.5s steps(var(--n)) .35s both, caret 1s steps(1) infinite;
}
@keyframes typing { from { width: 0; } }
@keyframes caret  { 50% { border-right-color: transparent; } }

/* ---------- komut satırı ---------- */

.prompt {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  cursor: text;
  transition: border-color .12s, box-shadow .12s;
}
.prompt:focus-within {
  border-top-color: var(--accent);
  box-shadow: 0 -8px 24px -12px color-mix(in srgb, var(--accent) 50%, transparent);
}

.ps1 {
  flex: none;
  color: var(--accent);
  font-weight: 700; white-space: nowrap;
  text-shadow: var(--glow-text);
}

.prompt-field { position: relative; flex: 1; min-width: 0; height: 100%; }

.prompt-field input {
  position: relative;
  width: 100%; height: 100%;
  padding: 0; border: 0; outline: 0;
  background: transparent;
  color: var(--fg); caret-color: var(--accent);
}
.prompt-field input::placeholder { color: var(--fg-faint); }

/* tamamlama önerisi: yazılan kısım görünmez, kalanı soluk */
.prompt-ghost {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  overflow: hidden; white-space: pre;
  color: var(--fg-faint);
  pointer-events: none;
}
.ghost-typed { visibility: hidden; }

/* ---------- geçmiş rayı ---------- */

.rail {
  min-height: 0;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.rail-head {
  flex: none;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 14px 8px;
  font-size: 11px; color: var(--fg-faint);
}
.rail-head h2 { font-size: 11px; font-weight: 400; letter-spacing: .04em; color: var(--fg-dim); }
.rail-head h2::before { content: "// "; color: var(--fg-faint); }

.history { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0 0 12px; }
.history .empty { padding: 6px 14px; color: var(--fg-faint); font-size: 12px; }

.history li.run {
  display: grid; grid-template-columns: 1.4ch minmax(0, 1fr) auto;
  column-gap: 8px;
  padding: 6px 14px 6px 12px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.history li.run:hover { background: var(--panel-hi); border-left-color: var(--line-strong); }
.history li.run.is-active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left-color: var(--accent);
}
.history li.run:focus-visible { outline-offset: -2px; }

.h-glyph { color: var(--fg-faint); }
.h-glyph.success { color: var(--ok); }
.h-glyph.failed, .h-glyph.timeout, .h-glyph.aborted { color: var(--err); }
.h-glyph.running { color: var(--accent); animation: blink 1s steps(1) infinite; }

.h-label { font-size: 12.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-code  { font-size: 11px; color: var(--fg-faint); white-space: nowrap; }
.h-code.bad { color: var(--err); }
.h-sub {
  grid-column: 2 / -1;
  font-size: 11px; color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- alt durum çubuğu ---------- */

.statusline {
  flex: none;
  height: var(--status-h);
  display: flex; align-items: stretch;
  overflow: hidden;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 11px; white-space: nowrap;
}

.sl-seg {
  flex: none;
  display: flex; align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--line);
}

.sl-link {
  border-right: 0;
  background: var(--accent); color: var(--on-accent);
  font-weight: 700; letter-spacing: .1em;
}
.sl-link[data-link="down"],
.sl-link[data-link="auth"] { background: var(--err); color: #fff; }

.sl-hints {
  margin-left: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 0 12px;
  overflow: hidden;
  color: var(--fg-faint);
}
.sl-hints kbd { margin-right: 4px; }

.sl-clock {
  border-right: 0; border-left: 1px solid var(--line);
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* ---------- onay penceresi ---------- */

.confirm {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--warn);
  background: var(--panel); color: var(--fg);
  font-family: var(--mono);
  box-shadow: 0 0 0 1px #000, 0 0 60px color-mix(in srgb, var(--warn) 28%, transparent);
}
.confirm::backdrop {
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px),
    rgba(0, 0, 0, .72);
}
.confirm[open] { animation: pop .14s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

.confirm form { margin: 0; }

/* tehlike şeridi */
.confirm-stripe {
  height: 8px;
  background: repeating-linear-gradient(-45deg, var(--warn) 0 10px, transparent 10px 20px);
}

.confirm-bar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--warn);
  font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
}

.confirm-body { padding: 16px 16px 4px; }
.confirm-body p { margin: 0 0 8px; }
.confirm-title { color: var(--warn); font-size: 15px; font-weight: 700; text-shadow: var(--glow-text); }
.confirm-title::before { content: "$ "; opacity: .6; }
.confirm-meta { color: var(--fg-dim); font-size: 12px; }
.confirm-meta:empty { display: none; }

.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; }
.confirm-actions button { padding: 6px 12px; }

.btn-danger {
  border: 1px solid var(--warn);
  background: transparent; color: var(--warn);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background .1s, color .1s;
}
.btn-danger:hover,
.btn-danger:focus-visible { background: var(--warn); color: #140d00; }

/* ---------- bildirim ---------- */

.toast {
  position: fixed; right: 16px; bottom: calc(var(--status-h) + 56px);
  transform: translateX(12px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 8px 14px;
  border: 1px solid var(--line-strong); border-left: 3px solid var(--accent);
  background: var(--panel); color: var(--fg);
  font-size: 12.5px;
  opacity: 0; pointer-events: none;
  transition: opacity .16s, transform .16s;
  z-index: 40;
}
.toast::before { content: "[i] "; color: var(--accent); }
.toast.show { opacity: 1; transform: translateX(0); }
.toast.err { border-color: var(--err); color: var(--err); }
.toast.err::before { content: "[!] "; color: inherit; }

.menu-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 25;
}

/* ============================================================
   Duyarlılık
   ============================================================ */

@media (max-width: 1100px) {
  :root { --rail-w: 230px; }
  .sl-hints span:nth-child(n+3) { display: none; }
}

@media (max-width: 900px) {
  .work { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(240px, 1fr) auto; }
  .rail { border-left: 0; border-top: 1px solid var(--line); max-height: 30vh; }
  :root[data-rail="off"] .work { grid-template-rows: 1fr; }
}

@media (max-width: 760px) {
  :root { --gutter: 3.5ch; }

  .only-mobile { display: grid; }
  .only-desktop { display: none; }

  /* menü mobilde üstüne kayar */
  .app-menu { transform: translateX(-100%); width: var(--menu-w); transition: transform .18s ease; }
  :root[data-sidebar="sm"] .app-menu { width: var(--menu-w); }
  body.menu-open .app-menu { transform: translateX(0); }

  .app-main, :root[data-sidebar="sm"] .app-main { margin-left: 0; }

  /* mobilde her zaman geniş menü göster */
  :root[data-sidebar="sm"] .brand-text,
  :root[data-sidebar="sm"] .menu-label,
  :root[data-sidebar="sm"] .menu-flag,
  :root[data-sidebar="sm"] .menu-no,
  :root[data-sidebar="sm"] .menu-title span { display: initial; }
  :root[data-sidebar="sm"] .menu-title { justify-content: flex-start; padding: 14px 16px 6px; }
  :root[data-sidebar="sm"] .menu-title i { display: none; }
  :root[data-sidebar="sm"] .menu-item { justify-content: flex-start; padding: 8px 14px; }
  :root[data-sidebar="sm"] .menu-item::after { display: none; }
  :root[data-sidebar="sm"] .menu-brand { justify-content: flex-start; padding: 0 16px; }

  /* düğmeler ikinci satıra iner */
  .topbar { flex-wrap: wrap; padding: 8px; row-gap: 4px; }
  .head-spacer { display: none; }
  .run-head { flex: 1; }
  .controls { width: 100%; overflow-x: auto; }

  /* iOS, 16px altındaki girişlerde sayfayı yakınlaştırır */
  .prompt { font-size: 16px; }
  .ps1-long { display: none; }

  .sl-host, .sl-hints { display: none; }
  .sl-clock { margin-left: auto; }

  .idle-body { padding: 32px 20px; }
  .toast { left: 16px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html::after { display: none; }
  .boot li { opacity: 1; animation: none; }
  .glitch::before, .glitch::after { display: none; }
}
