/* Quantum AI web paneli — mobil öncelikli, açık/koyu tema (prefers-color-scheme). */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --border: #dde1ea;
  --text: #161a23;
  --muted: #5b6475;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-contrast: #ffffff;
  --primary-soft: #e9e8fd;
  --danger: #c0262d;
  --danger-soft: #fdecec;
  --success: #17803a;
  --success-soft: #e3f4e8;
  --warning: #935d00;
  --warning-soft: #fff2d4;
  --info: #0b679f;
  --info-soft: #e2f1fa;
  --neutral-soft: #eceef3;
  --bubble-user: #4f46e5;
  --bubble-user-text: #ffffff;
  --bubble-bot: #ffffff;
  --focus: #4f46e5;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 56px;
  --nav-h: 62px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #171a22;
    --surface-2: #1f232d;
    --border: #2b303c;
    --text: #e8eaf0;
    --muted: #a0a8b9;
    --primary: #8b93fa;
    --primary-hover: #a5abfb;
    --primary-contrast: #0f1117;
    --primary-soft: #262a4d;
    --danger: #ff8a8f;
    --danger-soft: #3a1c20;
    --success: #6fdc93;
    --success-soft: #16301f;
    --warning: #f5c35b;
    --warning-soft: #352a12;
    --info: #74c4f2;
    --info-soft: #132b3a;
    --neutral-soft: #262a35;
    --bubble-user: #4f46e5;
    --bubble-user-text: #ffffff;
    --bubble-bot: #1c2029;
    --focus: #a5abfb;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

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

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
a { color: var(--primary); }
img { max-width: 100%; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.875rem; margin: 4px 0 8px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.noscript { padding: var(--gutter); text-align: center; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- form öğeleri ---------- */

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* iOS yakınlaştırmasını önler */
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--primary); }
label { font-weight: 600; font-size: 0.9rem; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; }
.form-error { color: var(--danger); min-height: 1.5em; font-size: 0.9rem; margin: 4px 0; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; flex-direction: column; }
.row.wrap { flex-direction: row; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- butonlar ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 0.95rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--primary-contrast); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn.danger:hover:not(:disabled) { border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.875rem; }
.btn.block { width: 100%; }
.btn svg { flex: none; }

/* ---------- açılış ve giriş ---------- */

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); }

.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px var(--gutter);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 28px 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px;
}
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.login-logo { border-radius: 14px; margin-bottom: 8px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- üst çubuk ve sekmeler ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
.brand-name { white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--muted);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-on { background: var(--success-soft); color: var(--success); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tabs [role="tab"] {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; padding: 6px 2px;
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer;
}
.tabs [role="tab"] svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--primary); }
.tab-badge {
  position: absolute; top: 4px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 0.7rem; line-height: 18px; text-align: center;
}

.content {
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding: var(--gutter);
  padding-bottom: calc(var(--nav-h) + var(--gutter) + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .tabs {
    position: static; display: flex; gap: 4px;
    height: auto; padding: 0; border: 0; background: transparent;
    margin-left: 8px;
  }
  .tabs [role="tab"] {
    flex-direction: row; gap: 8px; padding: 8px 14px; border-radius: 10px; font-size: 0.9rem;
  }
  .tabs [role="tab"] svg { width: 18px; height: 18px; }
  .tabs [role="tab"]:hover { background: var(--surface-2); }
  .tabs [role="tab"][aria-selected="true"] { background: var(--primary-soft); }
  .tab-badge { position: static; }
  .content { padding-bottom: var(--gutter); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  /* beş sekme + sağdaki düğmeler sığsın */
  .brand-name { display: none; }
  .tabs [role="tab"] { padding: 8px 10px; }
}
@media (max-width: 400px) {
  .brand-name { display: none; }
}
@media (max-width: 359px) {
  .tabs [role="tab"] { font-size: 0.68rem; }
}

/* ---------- ortak bileşenler ---------- */

.panel { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); min-width: 0;
}
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid .wide { grid-column: 1 / -1; }
}

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar select { min-width: 0; flex: 1 1 160px; }
.toolbar-label { white-space: nowrap; }

.notice {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--info-soft); color: var(--info); font-size: 0.9rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
  background: var(--neutral-soft); color: var(--muted);
}
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-muted { background: var(--neutral-soft); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

dl.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 0.92rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; }

/* ---------- sohbet ---------- */

.panel-chat {
  gap: 12px;
  height: calc(100vh - var(--header-h) - var(--nav-h) - 2 * var(--gutter));
  height: calc(100dvh - var(--header-h) - var(--nav-h) - 2 * var(--gutter) - env(safe-area-inset-bottom) - env(safe-area-inset-top));
  min-height: 360px;
}
@media (min-width: 768px) {
  .panel-chat {
    height: calc(100vh - var(--header-h) - 2 * var(--gutter));
    height: calc(100dvh - var(--header-h) - 2 * var(--gutter) - env(safe-area-inset-top));
  }
}
.chat-layout { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; position: relative; }
.chat-main {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px;
}

.conv-list {
  display: none;
  flex-direction: column; gap: 4px;
  max-height: 45vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px;
}
.conv-list.open { display: flex; }
.conv-item {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item[aria-current="true"] { background: var(--primary-soft); }
.conv-title { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { display: flex; gap: 6px; align-items: center; font-size: 0.78rem; color: var(--muted); }

@media (min-width: 900px) {
  .chat-layout { flex-direction: row; }
  .conv-list { display: flex; width: 270px; flex: none; max-height: none; }
  .conv-toggle { display: none; }
}

.messages {
  /* position: relative keeps the absolutely positioned .sr-only labels inside the scroller;
     without it they stretch the page and the whole layout scrolls. */
  position: relative;
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 6px 2px;
  overscroll-behavior: contain;
}
.msg { position: relative; display: flex; flex-direction: column; max-width: min(85%, 720px); align-self: flex-start; }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-note { align-self: center; max-width: 92%; }
.bubble {
  padding: 10px 14px; border-radius: 18px;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  background: var(--bubble-bot); border: 1px solid var(--border);
}
.msg-assistant .bubble { border-bottom-left-radius: 6px; }
.msg-user .bubble {
  background: var(--bubble-user); color: var(--bubble-user-text); border-color: transparent;
  border-bottom-right-radius: 6px;
}
.msg-user .bubble a { color: inherit; }
.msg-note .bubble {
  background: var(--surface-2); border: 0; color: var(--muted);
  font-size: 0.85rem; border-radius: 12px; text-align: center;
}
.msg-time { font-size: 0.72rem; color: var(--muted); margin: 3px 6px 0; }
.msg-failed .bubble { opacity: 0.7; }
.msg-error { font-size: 0.8rem; color: var(--danger); margin: 4px 6px 0; }
.task-link { align-self: flex-start; }

.typing .bubble { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.4; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-empty { margin: auto; text-align: center; color: var(--muted); padding: 24px 12px; }
.chat-empty img { border-radius: 14px; margin-bottom: 8px; opacity: 0.9; }

.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-height: 46px; max-height: 180px; resize: none; border-radius: 22px; padding: 11px 16px; }
.send-btn { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; flex: none; }
.send-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- görevler ---------- */

.banner {
  border: 1px solid var(--warning); background: var(--warning-soft); color: var(--text);
  border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.banner-title { color: var(--warning); margin: 0; }
.confirm-item { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid rgba(0, 0, 0, 0.08); }
.confirm-item:first-of-type { border-top: 0; padding-top: 0; }
.confirm-item .actions { justify-content: flex-start; }
.confirm-question { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

.new-task summary { cursor: pointer; font-weight: 700; list-style-position: inside; }
.new-task[open] summary { margin-bottom: 12px; }
@media (min-width: 640px) { .row { flex-direction: row; } }

.filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-row .btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-contrast); border-color: transparent; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.task-card { display: flex; flex-direction: column; gap: 8px; }
.task-head { display: flex; align-items: flex-start; gap: 8px; }
.task-id { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.task-title { flex: 1; min-width: 0; margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.task-instruction {
  margin: 0; color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task-meta { font-size: 0.8rem; color: var(--muted); }
.task-card .actions { justify-content: flex-start; }

.task-detail { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.box { padding: 10px 12px; border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; }
.box-result { background: var(--success-soft); }
.box-error { background: var(--danger-soft); color: var(--danger); }
.box-question { background: var(--warning-soft); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.step { position: relative; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; min-width: 0; }
.step::before {
  content: ""; position: absolute; left: -21px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary);
}
.step-fail::before { border-color: var(--danger); background: var(--danger-soft); }
.step-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.step-idx { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.step-input, .step-output { color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.step-fail .step-output { color: var(--danger); }
.thumb-btn { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; max-width: 320px; width: 100%; }
.thumb { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }

/* ---------- hafıza ---------- */

.fact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fact { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.fact:last-child { border-bottom: 0; }
.fact-body { flex: 1; min-width: 0; }
.fact-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fact-meta { font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }

/* ---------- durum ---------- */

.status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.jobs { display: flex; flex-wrap: wrap; gap: 6px; }
.channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.channel-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- akış (ortak hafıza) ---------- */

.small-text { font-size: 0.8rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.notice-warning { background: var(--warning-soft); color: var(--warning); }
#briefing-card, #conn-card { scroll-margin-top: calc(var(--header-h) + 12px); }
#briefing-title:focus, #conn-title:focus { outline: none; }
#briefing-title:focus-visible, #conn-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* basit markdown görünümü */
.md { overflow-wrap: anywhere; font-size: 0.93rem; min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; white-space: pre-wrap; }
.md .md-h { margin: 14px 0 6px; font-size: 0.98rem; }
.md h4.md-h { font-size: 0.92rem; color: var(--muted); }
.md > .md-h:first-child { margin-top: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li.md-sub { margin-left: 16px; }
.md code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.86em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.md pre { margin: 0 0 8px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); overflow-x: auto; }
.md pre code { background: none; padding: 0; white-space: pre; }
.md blockquote { margin: 0 0 8px; padding: 4px 12px; border-left: 3px solid var(--border); color: var(--muted); white-space: pre-wrap; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

.briefing { border-color: var(--primary); }
.briefing .md { max-height: 70vh; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.briefing .actions { margin-top: 8px; }

.flow-source-row { margin: 10px 0 14px; }
.flow-list { margin-top: 4px; gap: 16px; }
.flow-list > .empty { list-style: none; margin-left: -14px; }
.flow-item { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.flow-item::before {
  content: ""; position: absolute; left: -21px; top: 5px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--muted);
}
.flow-item.kind-handoff::before { border-color: var(--primary); background: var(--primary-soft); }
.flow-item.kind-decision::before { border-color: var(--info); }
.flow-item.kind-todo::before { border-color: var(--warning); }
.flow-item.kind-session_summary::before { border-color: var(--success); }
.flow-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.flow-title { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.flow-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.78rem; color: var(--muted); }
.flow-body { color: var(--text); }
.flow-body.collapsed {
  max-height: 11em; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent);
  mask-image: linear-gradient(to bottom, #000 65%, transparent);
}
.flow-toggle { align-self: flex-start; }
.flow-more-row { justify-content: center; margin-top: 12px; }

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.todo { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.todo:last-child { border-bottom: 0; }
.todo input[type="checkbox"] { flex: none; width: 22px; height: 22px; margin: 1px 0 0; cursor: pointer; }
.todo input[type="checkbox"]:disabled { cursor: not-allowed; }
.todo-body { flex: 1; min-width: 0; }
.todo-text { display: block; font-weight: 600; font-size: 0.95rem; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.todo-detail { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.todo-done .todo-text, .todo-cancelled .todo-text { text-decoration: line-through; color: var(--muted); font-weight: 500; }

.lease-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lease { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.92rem; }
.lease-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lease-who { overflow-wrap: anywhere; }
.lease-expired { opacity: 0.7; }

.usage-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.usage-row:last-of-type { border-bottom: 0; }
.usage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.meter-row {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) 46px; align-items: center; gap: 4px 10px;
  font-size: 0.85rem;
}
.meter-label { color: var(--muted); }
.meter-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.meter-reset { grid-column: 2 / -1; color: var(--muted); font-size: 0.78rem; }
.bar { display: block; height: 8px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--success); }
.bar-warn { background: var(--warning); }
.bar-danger { background: var(--danger); }

.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface-2); }
.copy-row .btn { flex: none; }
.copy-buffer { position: fixed; top: 0; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.conn-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.conn-revoked .fact-text { color: var(--muted); }
.conn-note { list-style: none; padding-top: 8px; }
.setup-hints { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; font-size: 0.92rem; }
.setup-hints summary { cursor: pointer; font-weight: 700; }
.setup-hints ol { margin: 10px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- pencereler ---------- */

dialog { color: var(--text); }
.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 94vh; overflow: visible; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.8); }
.lightbox img { display: block; max-width: 96vw; max-height: 86vh; object-fit: contain; border-radius: 8px; background: #000; }
.lightbox-close { margin: 0 0 8px auto; display: flex; }

.modal {
  width: min(420px, calc(100vw - 2 * var(--gutter)));
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.5); }

/* ---------- bildirimler ---------- */

.toasts {
  position: fixed; z-index: 50;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 480px; width: fit-content;
  padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg);
  font-size: 0.9rem; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  pointer-events: auto; transition: opacity 0.3s, transform 0.3s;
  overflow-wrap: anywhere;
}
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }
@media (prefers-color-scheme: dark) {
  .toast-error, .toast-success { color: #0f1117; }
}
.toast.hide { opacity: 0; transform: translateY(8px); }
@media (min-width: 768px) {
  .toasts { bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
