/* Hermes — kişisel uygulama
   Dil: gece mavisi zemin, ultramarin vurgu, ince çizgiler, dar başlıklar, tek aralıklı etiketler. */

@font-face {
  font-family: "Display"; src: url("/static/fonts/BigShouldersDisplay.ttf") format("truetype");
  font-weight: 100 900; font-display: swap;
}
@font-face {
  font-family: "Mono"; src: url("/static/fonts/JetBrainsMono.ttf") format("truetype");
  font-weight: 100 800; font-display: swap;
}

:root {
  /* Gece (varsayılan) */
  --bg: #060a1c;
  --bg-2: #0a1029;
  --panel: #0b1232;
  --line: rgba(150, 165, 255, .16);
  --line-strong: rgba(150, 165, 255, .32);
  --text: #eceeff;
  --muted: #8a92c6;
  --accent: #2b33ff;
  --accent-text: #9aa0ff;
  --accent-ink: #ffffff;
  --me: #1d24e8;
  --me-ink: #ffffff;
  --code: rgba(150, 165, 255, .08);
  --danger: #ff7b72;
  --ok: #6ee7b7;
  --rays: .07;
  --font-display: "Display", "Arial Narrow", sans-serif;
  --font-mono: "Mono", ui-monospace, Menlo, monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
/* Mavi tema: Hermes sitesinin ultramarin zemini */
:root[data-theme="blue"] {
  --bg: #0000e6;
  --bg-2: #0000d2;
  --panel: #0000cc;
  --line: rgba(255, 255, 255, .22);
  --line-strong: rgba(255, 255, 255, .45);
  --text: #f4f4ff;
  --muted: #b9bcff;
  --accent: #ffffff;
  --accent-text: #ffffff;
  --accent-ink: #0000e6;
  --me: #ffffff;
  --me-ink: #0000c8;
  --code: rgba(255, 255, 255, .1);
  --danger: #ffd0cc;
  --rays: .16;
}
/* Mavi tema: Hermes yanıtları mavi zeminde beyaz yazı, kullanıcı mesajları beyaz blok (--me) */
:root[data-theme="blue"] .msg.error { background: #f6f6ff; color: #b3261e; border-color: #b3261e; }
:root[data-theme="blue"] .approval {
  --text: #0b0b5c; --muted: #4a4fa3; --line: rgba(0, 0, 160, .14); --bg: #ffffff; --accent-text: #0000e6;
  --accent: #0000e6; --accent-ink: #ffffff; --line-strong: rgba(0, 0, 160, .28); --code: rgba(0, 0, 200, .06);
  background: #f6f6ff; color: var(--text);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

.label {
  font: 500 11px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}

/* Düğmeler */
.btn {
  border: 1px solid var(--line-strong); background: transparent; border-radius: 4px;
  padding: 11px 14px; cursor: pointer; font: 500 12px/1 var(--font-mono);
  letter-spacing: .12em; text-transform: uppercase;
}
.btn:active { background: var(--code); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.subtle { border-color: transparent; color: var(--muted); }
.btn.wide { width: 100%; }
.icon-btn {
  border: 0; background: transparent; width: 44px; height: 44px; border-radius: 4px; flex: none;
  cursor: pointer; display: grid; place-items: center; color: var(--text);
}
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.icon-btn:active { background: var(--code); }
.icon-btn.recording { color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.link-btn {
  border: 0; background: none; color: var(--accent-text); cursor: pointer; padding: 4px 8px;
  font: 500 11px var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
}
.muted { color: var(--muted); }

/* Işınsal desen */
.rays {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.rays::before {
  content: ""; position: absolute; left: 50%; top: 42%; width: 900px; height: 900px; max-width: 220vw;
  transform: translate(-50%, -50%); background: url("/static/rays.svg") center / contain no-repeat;
  opacity: var(--rays);
}

/* Eşleştirme */
.login { position: relative; min-height: 100%; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; }
.login-card {
  position: relative; width: 100%; max-width: 360px; display: grid; gap: 18px; justify-items: center; text-align: center;
}
.wordmark {
  font: 200 76px/.85 var(--font-display); letter-spacing: .02em; text-transform: uppercase; margin: 0;
}
.login-card p { margin: 0; color: var(--muted); }
.pair-form { display: flex; gap: 8px; width: 100%; }
.pair-form input {
  flex: 1; min-width: 0; font: 400 22px var(--font-mono); letter-spacing: .4em; text-align: center; padding: 10px;
  border-radius: 4px; border: 1px solid var(--line-strong); background: transparent; color: var(--text);
}
.pair-form input::placeholder { letter-spacing: .1em; font-size: 13px; color: var(--muted); }

/* Yerleşim */
.app { height: 100%; display: flex; }
.main { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 4px; padding: 6px;
  padding-top: max(6px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg);
  position: relative; z-index: 2;
}
.title-wrap { flex: 1; min-width: 0; text-align: center; display: grid; gap: 2px; }
.title {
  font: 300 22px/1.05 var(--font-display); letter-spacing: .03em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.drawer {
  position: fixed; inset: 0 auto 0 0; width: min(86vw, 340px); background: var(--bg-2); z-index: 20;
  transform: translateX(-102%); transition: transform .2s ease; display: flex; flex-direction: column;
  padding: 14px 12px; padding-top: max(14px, env(safe-area-inset-top)); gap: 12px;
  border-right: 1px solid var(--line);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding-left: 4px; }
.drawer-head .wordmark-sm { font: 300 26px/1 var(--font-display); text-transform: uppercase; letter-spacing: .04em; }
.drawer-foot { display: grid; gap: 8px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); padding-top: 12px; }
.theme-row { display: flex; gap: 8px; }
.theme-row .btn { flex: 1; }
.theme-row .btn[aria-pressed="true"] { border-color: var(--accent-text); color: var(--accent-text); }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 10, .55); z-index: 15; }
.sessions { list-style: none; margin: 0 -12px; padding: 0; overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.sessions li {
  padding: 12px 14px 12px 16px; cursor: pointer; display: grid; gap: 4px; border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
}
.sessions li.active { border-left-color: var(--accent-text); background: var(--code); }
.sessions li:active { background: var(--code); }
.sessions .s-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.sessions .s-meta { display: flex; gap: 10px; }
.sessions .s-meta .live { color: var(--ok); }

@media (min-width: 900px) {
  .drawer { position: static; transform: none; height: 100dvh; }
  .scrim, #drawer-open, #drawer-close { display: none !important; }
}

/* Mesajlar */
.messages {
  position: relative; flex: 1; overflow-y: auto; padding: 18px 14px 10px; display: flex; flex-direction: column;
  gap: 18px; overscroll-behavior: contain; z-index: 1;
}
.empty { position: relative; margin: auto; text-align: center; display: grid; gap: 10px; }
.empty .wordmark { font-size: 56px; }
.empty p { margin: 0; color: var(--muted); max-width: 300px; }

.msg { position: relative; max-width: 100%; overflow-wrap: anywhere; display: grid; gap: 6px; }
.msg .who { display: flex; gap: 10px; align-items: baseline; }
.msg.user { align-self: flex-end; max-width: 86%; justify-items: end; }
.msg.user .body {
  background: var(--me); color: var(--me-ink); padding: 10px 13px; border-radius: 4px; white-space: pre-wrap;
}
.msg.assistant { align-self: stretch; padding-left: 12px; border-left: 1px solid var(--line-strong); }
.msg.assistant .body > :first-child { margin-top: 0; }
.msg.assistant .body > :last-child { margin-bottom: 0; }
.msg.assistant p { margin: .45em 0; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3 {
  font: 400 21px/1.15 var(--font-display); text-transform: uppercase; letter-spacing: .03em; margin: .8em 0 .3em;
}
.msg.assistant ul, .msg.assistant ol { padding-left: 1.3em; margin: .45em 0; }
.msg.assistant li::marker { color: var(--muted); }
.msg.assistant strong { font-weight: 650; }
.msg.assistant pre {
  background: var(--code); border: 1px solid var(--line); padding: 10px; border-radius: 4px; overflow-x: auto;
  font: 13px/1.5 var(--font-mono);
}
.msg.assistant code { font-family: var(--font-mono); font-size: .86em; background: var(--code); padding: 1px 5px; border-radius: 3px; }
.msg.assistant pre code { background: none; padding: 0; font-size: inherit; }
.msg.assistant table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; margin: .6em 0; }
.msg.assistant th { font: 500 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.msg.assistant th, .msg.assistant td { border-bottom: 1px solid var(--line); padding: 6px 10px 6px 0; text-align: left; }
.msg.assistant a { color: var(--accent-text); }
.msg.assistant blockquote { margin: .45em 0; padding-left: 10px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.msg.assistant hr { border: 0; border-top: 1px solid var(--line); }
.msg.error { align-self: stretch; color: var(--danger); font: 13px var(--font-mono); border: 1px dashed var(--danger); padding: 8px 10px; border-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 11px var(--font-mono); padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--muted); }
.copy { border: 0; background: none; cursor: pointer; padding: 0; }
.copy.label:active { color: var(--text); }

.tool-line {
  align-self: stretch; font: 12px/1.4 var(--font-mono); color: var(--muted); padding-left: 12px;
  border-left: 1px dashed var(--line-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-line b { color: var(--accent-text); font-weight: 500; }
.approval {
  align-self: stretch; border: 1px solid var(--accent-text); border-radius: 4px; padding: 12px; display: grid; gap: 10px;
  background: var(--code);
}
.approval pre { margin: 0; background: var(--bg); border: 1px solid var(--line); padding: 8px; border-radius: 3px; white-space: pre-wrap; font: 12px var(--font-mono); }
.approval .row { display: flex; gap: 8px; flex-wrap: wrap; }
.approval .row .btn { flex: 1 1 40%; }

.status {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 6px 16px;
  border-top: 1px solid var(--line); background: var(--bg);
}
.status .label { color: var(--text); }
.cursor { width: 8px; height: 14px; background: var(--accent-text); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.status .link-btn { margin-left: auto; }

/* Yazma alanı */
.composer {
  position: relative; z-index: 2; border-top: 1px solid var(--line); background: var(--bg);
  padding: 8px 6px 8px;
}
.composer-row { display: flex; align-items: flex-end; gap: 2px; }
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 40vh; border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 11px 12px; background: transparent; color: var(--text); font: inherit; line-height: 1.35;
}
.composer textarea:focus { outline: none; border-color: var(--accent-text); }
.composer textarea::placeholder { color: var(--muted); }
.send-btn {
  width: 44px; height: 44px; flex: none; border-radius: 4px; border: 0; background: var(--accent);
  color: var(--accent-ink); cursor: pointer; margin-left: 4px; display: grid; place-items: center;
}
.send-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.send-btn:disabled { opacity: .4; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 8px; }
.attachments:empty { display: none; }
.att {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 4px 6px 4px 4px; font: 12px var(--font-mono); max-width: 230px;
}
.att img { width: 34px; height: 34px; object-fit: cover; border-radius: 2px; }
.att .ext { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 2px; font-size: 10px; color: var(--muted); }
.att .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att button { border: 0; background: none; cursor: pointer; color: var(--muted); }
.att.uploading { opacity: .55; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; max-width: calc(100vw - 32px);
  background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 4px;
  font: 12px var(--font-mono); letter-spacing: .04em;
}

/* Arama */
.search {
  position: absolute; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column;
}
.search-bar {
  display: flex; align-items: center; gap: 4px; padding: 6px; padding-top: max(6px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.search-bar input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: transparent;
  color: var(--text); font: inherit; padding: 10px 12px;
}
.search-bar input:focus { outline: none; border-color: var(--accent-text); }
.search-results { flex: 1; overflow-y: auto; padding: 4px 0 24px; }
.search-results .group { padding: 14px 16px 6px; }
.search-results .hit {
  display: grid; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.search-results .hit:active { background: var(--code); }
.search-results .hit .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.search-results .hit .snip { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.search-results mark { background: var(--accent); color: var(--accent-ink); padding: 0 2px; border-radius: 2px; }
.search-results .none { padding: 32px 16px; text-align: center; }
.msg.flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 30% { outline: 2px solid var(--accent-text); outline-offset: 4px; } 100% { outline: 2px solid transparent; outline-offset: 4px; } }

/* Bölümler ve alt sekme çubuğu */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view.scroll { overflow-y: auto; padding-bottom: 24px; }
.tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--bg-2);
  padding-bottom: env(safe-area-inset-bottom); position: relative; z-index: 3;
}
.tab {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 8px 0 7px; display: grid; justify-items: center; gap: 3px;
  color: var(--muted); font: 500 10px var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
  border-top: 2px solid transparent; margin-top: -1px;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.tab[aria-current="page"] { color: var(--text); border-top-color: var(--accent-text); }

/* Görevler */
.rem-form { display: grid; gap: 8px; padding: 14px 14px 16px; border-bottom: 1px solid var(--line); }
.rem-form input {
  border: 1px solid var(--line-strong); border-radius: 4px; background: transparent; color: var(--text);
  font: inherit; padding: 10px 12px; min-width: 0;
}
.rem-form input:focus { outline: none; border-color: var(--accent-text); }
.rem-form input[type="datetime-local"] { font: 14px var(--font-mono); color-scheme: inherit; }
.rem-row { display: flex; gap: 8px; }
.rem-row input { flex: 1; }
.rem-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.rem-quick .btn { padding: 8px 10px; font-size: 11px; }
.section-head { padding: 18px 16px 8px; }
.tasks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tasks:empty::after { content: "Boş"; display: block; padding: 14px 16px; font: 11px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.task .check {
  flex: none; width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 3px; background: transparent;
  cursor: pointer; margin-top: 1px; display: grid; place-items: center; color: var(--accent-ink);
}
.task.is-done .check { background: var(--accent); border-color: var(--accent); }
.task.is-done .check::after { content: "✓"; font-size: 14px; }
.task .tbody { flex: 1; min-width: 0; display: grid; gap: 4px; cursor: pointer; }
.task .tname { overflow-wrap: anywhere; }
.task.is-done .tname { text-decoration: line-through; color: var(--muted); }
.task .tmeta { display: flex; gap: 10px; flex-wrap: wrap; }
.task .tmeta .due { color: var(--accent-text); }
.task .tmeta .late { color: var(--danger); }
.task .tmeta .bad { color: var(--danger); }
.task .tact { display: flex; gap: 2px; }
.task .tact .link-btn { padding: 6px; }
.done-wrap summary { padding: 14px 16px 10px; cursor: pointer; list-style: none; }
.done-wrap summary::-webkit-details-marker { display: none; }
.done-wrap summary::before { content: "▸ "; }
.done-wrap[open] summary::before { content: "▾ "; }

/* Dosyalar */
.filters { display: flex; gap: 6px; padding: 12px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.filters .btn { flex: none; padding: 8px 10px; font-size: 11px; }
.filters .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 2px; padding: 2px; }
.file-grid:empty { display: none; }
.file-grid button { border: 0; padding: 0; background: var(--code); aspect-ratio: 1; cursor: pointer; position: relative; }
.file-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.file-list .ext { flex: none; width: 44px; height: 52px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 2px; font: 500 10px var(--font-mono); letter-spacing: .08em; color: var(--accent-text); }
.file-list .fbody { flex: 1; min-width: 0; display: grid; gap: 4px; }
.file-list .fname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-list .fmeta { display: flex; gap: 10px; flex-wrap: wrap; }
.file-empty { padding: 40px 16px; text-align: center; }

/* Alt sayfa (iletişim kutusu) */
.sheet {
  border: 1px solid var(--line-strong); border-radius: 6px 6px 0 0; padding: 0; background: var(--bg-2); color: var(--text);
  width: 100%; max-width: 720px; max-height: 88dvh; margin: auto auto 0; display: none; flex-direction: column;
}
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgba(0, 0, 10, .6); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); }
.sheet-head .title { flex: 1; text-align: left; }
.sheet-body { overflow-y: auto; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.sheet-body img, .sheet-body video { max-width: 100%; border: 1px solid var(--line); }
.sheet-body .md p { margin: .4em 0; }
.sheet-body pre { white-space: pre-wrap; font: 12px var(--font-mono); background: var(--code); padding: 10px; border-radius: 4px; }
.sheet-body .row { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-body .row .btn { flex: 1 1 40%; text-align: center; text-decoration: none; color: inherit; }

.login-card .portrait { width: 168px; height: 168px; border-radius: 22%; border: 1px solid var(--line-strong); object-fit: cover; }
