/* MIKO Komuta Merkezi — bağımsız CSS (CDN yok, VPS offline çalışır) */

:root {
  --bg: #060609;
  --bg-soft: #08080c;
  --panel: rgba(16, 16, 23, 0.88);
  --panel-solid: #0f0f16;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #e7e9ee;
  --text-dim: #a1a1ab;
  --muted: #74748a;
  --gold: #e0b93c;
  --gold-soft: rgba(224, 185, 60, 0.13);
  --indigo: #7c7ff5;
  --emerald: #34d399;
  --rose: #fb7185;
  --amber: #fbbf24;
  --radius: 14px;
  --radius-lg: 20px;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  overflow: hidden;
}

::selection { background: rgba(224, 185, 60, 0.28); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a34; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a46; }

.mono { font-family: var(--mono); }

.glass {
  background: var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
}

.glow-gold { box-shadow: 0 0 34px -8px rgba(224, 185, 60, 0.35); }

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
}

.brand {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), #9a6bff 65%, var(--indigo));
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #10101a;
  font-size: 15px;
  box-shadow: 0 0 22px -6px rgba(224, 185, 60, 0.5);
}

.brand-name { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; }
.brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-group { padding: 14px 12px 6px; }
.nav-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 8px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: left;
  margin-bottom: 3px;
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }

.nav-btn.active {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: rgba(224, 185, 60, 0.32);
}

.nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--rose);
  color: #17070c;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.hidden { display: none; }

.history-list { padding: 4px 12px 12px; overflow-y: auto; max-height: 190px; }
.history-item {
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
.history-item:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.history-empty { padding: 7px 11px; font-size: 12px; color: var(--muted); }

.sidebar-foot {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.32);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.avatar {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: #1b1b24;
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: var(--gold);
}

.foot-name { font-size: 12px; font-weight: 600; color: #fff; }
.foot-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 7px;
  border-radius: 9px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.icon-btn svg { width: 15px; height: 15px; }

/* ── Main ────────────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-soft);
}

.topbar {
  height: 58px;
  flex-shrink: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 6px 11px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--muted); flex-shrink: 0; }
.dot.ok { background: var(--emerald); box-shadow: 0 0 9px rgba(52, 211, 153, 0.7); }
.dot.warn { background: var(--amber); box-shadow: 0 0 9px rgba(251, 191, 36, 0.7); }
.dot.bad { background: var(--rose); box-shadow: 0 0 9px rgba(251, 113, 133, 0.7); }
.dot.live { animation: pulse 1.9s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.grade {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 8px;
}
.grade-A { background: rgba(52, 211, 153, 0.16); color: var(--emerald); }
.grade-B { background: rgba(124, 127, 245, 0.16); color: var(--indigo); }
.grade-C { background: rgba(251, 191, 36, 0.16); color: var(--amber); }
.grade-D, .grade-F { background: rgba(251, 113, 133, 0.16); color: var(--rose); }
.grade-\? { background: rgba(255, 255, 255, 0.07); color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #c89b22);
  border-color: transparent;
  color: #14140c;
  font-weight: 700;
  box-shadow: 0 0 22px -8px rgba(224, 185, 60, 0.6);
}
.btn-gold:hover { background: linear-gradient(135deg, #eecb56, var(--gold)); }

.btn-ok { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.35); color: var(--emerald); }
.btn-ok:hover { background: rgba(52, 211, 153, 0.24); }
.btn-bad { background: rgba(251, 113, 133, 0.13); border-color: rgba(251, 113, 133, 0.32); color: var(--rose); }
.btn-bad:hover { background: rgba(251, 113, 133, 0.22); }
.btn-sm { font-size: 11px; padding: 5px 10px; border-radius: 9px; }

.content { flex: 1; overflow-y: auto; position: relative; }

.view { display: none; height: 100%; }
.view.active { display: flex; flex-direction: column; }

.page { max-width: 1080px; width: 100%; margin: 0 auto; padding: 24px 22px 28px; }

.page-head { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-title { font-size: 17px; font-weight: 700; color: #fff; }
.page-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

/* ── Kartlar ─────────────────────────────────────────────── */

.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 17px;
  backdrop-filter: blur(18px);
}

.card-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-value { font-size: 21px; font-weight: 700; color: #fff; margin-top: 6px; font-family: var(--mono); }
.card-value.sm { font-size: 15px; }
.card-note { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.bar { height: 6px; background: rgba(255, 255, 255, 0.07); border-radius: 99px; overflow: hidden; margin-top: 9px; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--amber)); transition: width 0.4s; }
.bar-fill.indigo { background: linear-gradient(90deg, var(--indigo), #a78bfa); }
.bar-fill.emerald { background: linear-gradient(90deg, var(--emerald), #6ee7b7); }
.bar-fill.rose { background: linear-gradient(90deg, var(--rose), #fda4af); }

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin: 22px 0 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.pill.ok { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.3); color: var(--emerald); }
.pill.bad { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.3); color: var(--rose); }
.pill.gold { background: var(--gold-soft); border-color: rgba(224, 185, 60, 0.3); color: var(--gold); }

.pill-row { display: flex; flex-wrap: wrap; gap: 7px; }

.empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* ── Probe listesi ───────────────────────────────────────── */

.probe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 12.5px;
}
.probe-name { font-family: var(--mono); font-size: 11.5px; color: var(--text); min-width: 128px; }
.probe-detail { color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Sohbet ──────────────────────────────────────────────── */

.chat-wrap { flex: 1; display: flex; flex-direction: column; max-width: 880px; width: 100%; margin: 0 auto; padding: 18px 20px 14px; min-height: 0; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-right: 6px; }

.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg-av {
  width: 32px; height: 32px; border-radius: 11px;
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 12px; font-weight: 700;
}
.msg-av.miko { background: var(--gold-soft); border: 1px solid rgba(224, 185, 60, 0.3); color: var(--gold); }
.msg-av.user { background: rgba(124, 127, 245, 0.14); border: 1px solid rgba(124, 127, 245, 0.3); color: var(--indigo); }

.bubble {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-top-left-radius: 6px;
  padding: 13px 16px;
  font-size: 13.5px;
  line-height: 1.62;
  max-width: 660px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.from-user .bubble { border-top-left-radius: var(--radius-lg); border-top-right-radius: 6px; background: rgba(124, 127, 245, 0.08); }
.msg.from-user { flex-direction: row-reverse; }
.bubble.error { border-color: rgba(251, 113, 133, 0.38); background: rgba(251, 113, 133, 0.07); color: #ffd7dd; }
.bubble-meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 8px; }

.typing span {
  display: inline-block; width: 6px; height: 6px; border-radius: 99px;
  background: var(--gold); margin-right: 4px; animation: blink 1.3s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.plan-drawer {
  background: var(--panel);
  border: 1px solid rgba(224, 185, 60, 0.32);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.plan-drawer.hidden { display: none; }

.composer {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 9px 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  box-shadow: 0 14px 40px -20px rgba(0, 0, 0, 0.9);
}

.composer textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  padding: 8px 4px;
}
.composer textarea::placeholder { color: var(--muted); }

.composer .icon-btn.on { color: var(--gold); background: var(--gold-soft); }
.composer .icon-btn.rec { color: var(--rose); background: rgba(251, 113, 133, 0.14); }

.hint { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 7px; }

/* ── Plan kartı (onay) ───────────────────────────────────── */
.plan-card {
  max-width: 660px;
  margin: 10px 0 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 168, 75, 0.35);
  background: rgba(212, 168, 75, 0.06);
}
.plan-card-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold, #d4a84b);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.plan-card-body { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.plan-steps { margin: 0 0 12px 1.1em; padding: 0; font-size: 12.5px; color: var(--text); }
.plan-steps li { margin-bottom: 6px; }
.plan-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plan-apr { font-size: 10px; color: var(--muted); }

/* ── Hedefler / trace ────────────────────────────────────── */

.goal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 10px;
}
.goal-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.goal-title { font-size: 13.5px; font-weight: 600; color: #fff; }
.goal-steps { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.step {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: var(--text-dim);
  padding: 5px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.02);
}
.step-dot { width: 7px; height: 7px; border-radius: 99px; margin-top: 6px; flex-shrink: 0; background: var(--muted); }
.step-dot.done { background: var(--emerald); }
.step-dot.failed { background: var(--rose); }
.step-dot.active { background: var(--gold); }
.step-result { color: var(--muted); font-family: var(--mono); font-size: 11px; }

.trace-log {
  font-family: var(--mono);
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trace-line { display: flex; gap: 9px; align-items: baseline; }
.trace-kind { min-width: 74px; text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; }
.k-perceive { color: #67e8f9; }
.k-orient { color: #a78bfa; }
.k-plan { color: var(--indigo); }
.k-authorize { color: var(--amber); }
.k-act { color: var(--gold); }
.k-observe { color: var(--emerald); }
.k-learn { color: #f0abfc; }
.k-error { color: var(--rose); }
.trace-msg { color: var(--text-dim); flex: 1; word-break: break-word; }

/* ── Onaylar ─────────────────────────────────────────────── */

.approval {
  background: var(--panel);
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.approval-body { flex: 1; min-width: 200px; }
.approval-tool { font-family: var(--mono); font-size: 13px; color: var(--amber); font-weight: 600; }
.approval-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; word-break: break-word; }
.approval-actions { display: flex; gap: 8px; }

/* ── Ses ─────────────────────────────────────────────────── */

.voice-panel {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  padding: 32px 26px;
  border-radius: 26px;
}
.voice-orb {
  width: 92px; height: 92px; border-radius: 99px;
  margin: 0 auto 22px;
  background: linear-gradient(140deg, var(--gold), #9a6bff, var(--indigo));
  display: grid; place-items: center;
  box-shadow: 0 0 44px -10px rgba(224, 185, 60, 0.6);
}
.voice-orb svg { width: 36px; height: 36px; color: #12121a; }
.voice-orb.live { animation: orb 2s ease-in-out infinite; }
@keyframes orb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.voice-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  padding: 6px 14px; border-radius: 99px;
  margin-top: 16px;
}
.voice-status.live { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.34); color: var(--emerald); }

.voice-actions { display: flex; gap: 11px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

.select {
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 8px 11px;
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  width: 100%;
}

/* ── Modal ───────────────────────────────────────────────── */

.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(9px);
  display: grid; place-items: center;
  padding: 18px;
}
.modal.hidden { display: none; }
.modal-box {
  width: 100%; max-width: 440px;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 22px;
  display: flex; flex-direction: column; gap: 18px;
  max-height: 86vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 700; color: #fff; }
.field-label {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-dim); display: block; margin-bottom: 7px;
}

/* ── Toast ───────────────────────────────────────────────── */

.toast-host { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  padding: 11px 15px;
  font-size: 12.5px;
  max-width: 330px;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.9);
  animation: slidein 0.22s ease-out;
}
.toast.ok { border-left-color: var(--emerald); }
.toast.bad { border-left-color: var(--rose); }
@keyframes slidein { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }

/* ── Ana ekrana ekle (PWA) ─────────────────────────────── */
.install-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(18, 18, 26, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px -12px #000;
}
.install-banner.hidden { display: none; }
.install-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted, #9a9aab);
}
.install-banner-text strong {
  color: var(--text, #f2f2f7);
  font-size: 13px;
}
@media (min-width: 721px) {
  .install-banner { bottom: 18px; max-width: 420px; left: auto; right: 18px; }
}

/* ── Mobil ───────────────────────────────────────────────── */

.mobile-bar { display: none; }
.mobile-dock { display: none; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body { flex-direction: column; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    width: 82vw; max-width: 300px;
    box-shadow: 24px 0 60px -20px #000;
    z-index: 30;
  }
  .sidebar.open { transform: none; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 13px;
    padding-top: max(9px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
    background: var(--panel);
  }
  .main {
    height: 100%;
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .page { padding: 16px 14px 22px; }
  .topbar { padding: 0 13px; height: 52px; }
  .topbar .desktop-only { display: none; }
  .bubble { max-width: 100%; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 15; }
  .scrim.hidden { display: none; }

  .mobile-dock {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 25;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(10, 10, 14, 0.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }
  .dock-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    padding: 6px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted, #8b8b9a);
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .dock-btn svg { width: 20px; height: 20px; }
  .dock-btn.active {
    color: var(--gold, #d4a84b);
    background: rgba(212, 168, 75, 0.1);
  }
  .chat-composer textarea,
  .chat-composer input,
  .select {
    font-size: 16px; /* iOS zoom engeli */
  }
  .modal-box {
    margin: 12px;
    max-height: calc(100vh - 24px - env(safe-area-inset-bottom, 0px));
    overflow: auto;
  }
}

@media (min-width: 721px) {
  .scrim { display: none; }
  .mobile-dock { display: none !important; }
}
