/* dombul */

:root {
  --bg: #e9e9e4;
  --surface: #fafaf7;
  --surface-2: #f0f0eb;
  --ink: #141413;
  --ink-2: #4f4e49;
  --ink-3: #85847d;
  --line: #cfcec7;
  --line-strong: #141413;
  --red: #c8231a;
  --red-ink: #ffffff;
  --yellow: #f2b705;
  --yellow-ink: #141413;
  --green: #1d7a45; /* yol tabelası yeşili: boşta, kaydedilebilir */
  --ok-ink: #141413;
  --focus: #1f5fd1;
  --bar: #141413;
  --bar-ink: #fafaf7;

  --f-cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-body: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;

  --gutter: 16px;
  --radius: 2px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1b1b19;
    --surface-2: #242421;
    --ink: #ecebe5;
    --ink-2: #b3b2aa;
    --ink-3: #7d7c75;
    --line: #31312d;
    --line-strong: #ecebe5;
    --red: #dd3e32;
    --ok-ink: #ecebe5;
    --green: #2f9c5d;
    --focus: #7aa7ff;
    --bar: #000000;
    --bar-ink: #ecebe5;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--f-body);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

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

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- üst bant ---------- */

.bar { background: var(--bar); color: var(--bar-ink); padding-top: env(safe-area-inset-top); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; height: 52px; gap: 12px; }

.mark {
  display: inline-flex; align-items: baseline; gap: 8px;
  font: 700 27px/1 var(--f-cond); letter-spacing: .01em; text-decoration: none;
}
.mark::before { content: ''; width: 11px; height: 11px; background: var(--red); flex: none; transform: translateY(-1px); }

.nav { display: flex; gap: 2px; }
.nav a {
  padding: 8px 10px; text-decoration: none;
  font: 500 15px/1 var(--f-body); color: var(--bar-ink); opacity: .7;
}
.nav a:hover { opacity: 1; }
.nav a[aria-current="page"] { opacity: 1; box-shadow: inset 0 -2px 0 var(--bar-ink); }

/* ---------- araç çubuğu: sayaçlar (filtre), arama, ekle ---------- */

.toolbar { padding: 14px 0 12px; display: grid; gap: 10px; }

.tally { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--surface); }
.tally button {
  background: none; border: 0; border-right: 1px solid var(--line); cursor: pointer;
  padding: 8px 10px 7px; text-align: left; display: flex; flex-direction: column; gap: 1px; position: relative;
}
.tally button:last-child { border-right: 0; }
.tally b { font: 600 28px/1 var(--f-cond); font-variant-numeric: tabular-nums; align-self: flex-start; }
.tally span { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.tally button[aria-pressed="true"] { background: var(--surface-2); }
.tally button[aria-pressed="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--ink); }
.tally .t-soon.has b { background: var(--yellow); color: var(--yellow-ink); padding: 0 4px; }
.tally .t-gone.has b { background: var(--red); color: var(--red-ink); padding: 0 4px; }

.finder { display: flex; gap: 8px; }
.finder .input { flex: 1 1 auto; min-width: 0; height: 40px; }
.finder .select { flex: 0 0 auto; width: auto; height: 40px; padding-right: 6px; }
.finder .btn { height: 40px; padding: 0 14px; }

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

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.input, .select {
  height: 44px; padding: 0 12px; width: 100%;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius);
}
.input.mono, .input[type="date"] { font-family: var(--f-mono); font-size: 15px; }
.input::placeholder { color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--radius); cursor: pointer;
  font: 600 15px/1 var(--f-body); white-space: nowrap; text-decoration: none;
  background: var(--ink); color: var(--bg); border: 1.5px solid var(--ink);
}
.btn:hover { filter: brightness(1.2); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.small { height: 36px; padding: 0 12px; font-size: 14px; }

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); justify-self: start;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; font-size: 14.5px;
}

.add textarea {
  width: 100%; resize: vertical; min-height: 120px;
  font: 500 15px/1.5 var(--f-mono); padding: 10px 12px;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius);
}
.add textarea::placeholder { color: var(--ink-3); }
.hint { margin: 6px 0 0; font-size: 13.5px; color: var(--ink-2); }
.acc-fields {
  padding: 14px; background: var(--surface-2); border: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
.acc-fields p { margin: 0; font-size: 13.5px; color: var(--ink-2); grid-column: 1 / -1; }

/* ---------- pano ---------- */

.board {
  display: grid; grid-template-columns: 1fr; gap: 4px;
  margin-bottom: 10px;
}

.tile {
  display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: stretch;
  min-height: 46px; padding: 0; cursor: pointer; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
}
.tile:hover { border-color: var(--ink-3); }
.tile:hover .t-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.days {
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--line); color: var(--ok-ink); margin: -1px 0 -1px -1px;
  border-radius: var(--radius) 0 0 var(--radius);
}
.days b { font: 600 25px/1 var(--f-cond); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.days.warn { background: var(--yellow); border-color: var(--yellow); color: var(--yellow-ink); }
.days.hot, .days.gone { background: var(--red); border-color: var(--red); color: var(--red-ink); }
.days.gone b { font-size: 17px; letter-spacing: .01em; }
.days.none { color: var(--ink-2); background: repeating-linear-gradient(-45deg, transparent 0 5px, var(--line) 5px 6px); }
.days.none b { font-size: 21px; }
.days.busy b { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.t-text { min-width: 0; padding: 5px 10px; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.t-name { font: 500 15px/1.2 var(--f-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-meta { font-size: 12.5px; line-height: 1.25; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-meta .bad { color: var(--red); }

.legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-3);
  padding: 6px 0 calc(28px + env(safe-area-inset-bottom));
}
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--ink-3); }
.legend .l-warn { background: var(--yellow); border-color: var(--yellow); }
.legend .l-hot { background: var(--red); border-color: var(--red); }

.nothing { padding: 26px 0; color: var(--ink-2); }

/* ---------- boş durum ---------- */

.empty-state { padding: 30px 0 40px; max-width: 560px; }
.empty-state h1 { font: 700 34px/1.05 var(--f-cond); margin: 0 0 8px; }
.empty-state > p { margin: 0 0 20px; color: var(--ink-2); }

/* ---------- pencere (ayrıntı ve ekleme) ---------- */

dialog.sheet {
  border: 0; padding: 0; color: var(--ink); background: var(--surface);
  width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 0;
  border-top: 3px solid var(--ink); overscroll-behavior: contain;
}
dialog.sheet::backdrop { background: rgba(10, 10, 9, .55); }
.sheet-head {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font: 500 19px/1.25 var(--f-mono); overflow-wrap: anywhere; }
.sheet-head h2.plain { font: 700 25px/1.1 var(--f-cond); }
.x { background: none; border: 1px solid var(--line); width: 36px; height: 36px; flex: none; cursor: pointer; border-radius: var(--radius); position: relative; }
.x::before, .x::after { content: ''; position: absolute; left: 9px; right: 9px; top: 50%; height: 1.5px; background: var(--ink); }
.x::before { transform: rotate(45deg); }
.x::after { transform: rotate(-45deg); }
.sheet-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.sheet-body form { display: grid; gap: 12px; }

.big-days { display: flex; align-items: center; gap: 14px; }
.big-days .days { width: 84px; height: 64px; border: 1.5px solid var(--line-strong); margin: 0; border-radius: var(--radius); flex: none; }
.big-days .days.warn, .big-days .days.hot, .big-days .days.gone { border-color: transparent; }
.big-days .days b { font-size: 38px; }
.big-days .days.gone b { font-size: 22px; }
.big-days p { margin: 0; font-size: 15px; }
.big-days p strong { font-weight: 600; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12.5px; color: var(--ink-3); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.facts dd.mono { font-family: var(--f-mono); font-size: 14px; }
.facts .wide { grid-column: 1 / -1; }

.notice { border-left: 4px solid var(--yellow); background: var(--surface-2); padding: 10px 12px; font-size: 14.5px; margin: 0; }
.notice.red { border-left-color: var(--red); }

.box-title { font: 600 19px/1.2 var(--f-cond); letter-spacing: .01em; margin: 6px 0 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.creds { border: 1px solid var(--line); }
.cred { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); min-height: 44px; }
.cred:last-child { border-bottom: 0; }
.cred > span { font-size: 13px; color: var(--ink-3); }
.cred > code { font: 500 14.5px/1.3 var(--f-mono); overflow-wrap: anywhere; }
.cred > code.empty { font-family: var(--f-body); color: var(--ink-3); font-weight: 400; }
.cred .acts { display: flex; gap: 4px; }
.mini {
  background: none; border: 1px solid var(--line); border-radius: var(--radius);
  height: 30px; padding: 0 9px; font-size: 13px; cursor: pointer; color: var(--ink);
}
.mini:hover { border-color: var(--ink); }

.edit-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.actions .spacer { flex: 1; }

/* ---------- giriş ---------- */

.auth { padding-top: 44px; padding-bottom: 40px; }
.auth > * { max-width: 420px; }
.auth h1 { font: 700 46px/1 var(--f-cond); margin: 0 0 8px; }
.auth .lede { color: var(--ink-2); margin: 0 0 28px; max-width: 34ch; }
.auth form { display: grid; gap: 14px; }
.auth .btn { width: 100%; height: 48px; margin-top: 6px; }
.auth .foot { margin-top: 22px; font-size: 14px; color: var(--ink-2); }

.err { color: var(--red); font-size: 14.5px; margin: 0; }
.err:empty { display: none; }

/* ---------- ayarlar ---------- */

.page { padding-top: 22px; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.page > * { max-width: 720px; }
.page h1 { font: 700 34px/1 var(--f-cond); margin: 0 0 18px; }
.section { background: var(--surface); border: 1px solid var(--line); padding: 16px; margin-bottom: 14px; }
.section h2 { font: 600 21px/1.2 var(--f-cond); margin: 0 0 4px; }
.section > p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.section form, .section .stack { display: grid; gap: 12px; }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline .field { flex: 1 1 160px; }
.inline .field.short { flex: 0 1 220px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 32px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }

.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 15px; }

.devices, .log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.devices li, .log li { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.devices li > div, .log li > div { min-width: 0; }
.devices small, .log small { color: var(--ink-3); display: block; font-size: 13px; overflow-wrap: anywhere; }
.log .bad { color: var(--red); }
.tag { font-size: 13px; padding: 2px 6px; border: 1px solid var(--line); border-radius: var(--radius); white-space: nowrap; }
.tag.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- kısa bildirim ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: var(--radius);
  font-size: 15px; max-width: calc(100% - 32px); width: max-content; z-index: 20;
}
.toast.bad { background: var(--red); color: #fff; }

/* ---------- geniş ekran ---------- */

@media (min-width: 640px) {
  .acc-fields, .edit-grid { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .board { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  dialog.sheet {
    margin: auto; width: min(600px, calc(100% - 48px)); max-height: min(86dvh, 820px);
    border: 1px solid var(--ink); border-top: 3px solid var(--ink); border-radius: var(--radius);
  }
}

@media (min-width: 980px) {
  :root { --gutter: 24px; }
  .wrap.wide { max-width: 1480px; }
  .toolbar { grid-template-columns: auto minmax(0, 1fr); align-items: stretch; gap: 16px; }
  .tally { display: flex; }
  .tally button { flex-direction: row; align-items: baseline; gap: 7px; padding: 7px 14px; }
  .tally b { font-size: 24px; }
  .tally span { font-size: 14px; }
  .finder { justify-content: flex-end; }
  .finder .input { max-width: 340px; }
}
.full { grid-column: 1 / -1; }

/* ---------- takip listesi ---------- */

.days.free { background: var(--green); border-color: var(--green); color: #fff; }
.days.free b { font-size: 19px; letter-spacing: .01em; }
.tally .t-expired.has b { background: var(--yellow); color: var(--yellow-ink); padding: 0 4px; }
.tally .t-pending_delete.has b { background: var(--red); color: var(--red-ink); padding: 0 4px; }
.tally .t-available.has b { background: var(--green); color: #fff; padding: 0 4px; }
.legend .l-free { background: var(--green); border-color: var(--green); }

.phases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.phases li { border-top: 4px solid var(--line); padding-top: 6px; font-size: 12.5px; line-height: 1.25; color: var(--ink-3); }
.phases li.done { border-top-color: var(--ink-3); color: var(--ink-2); }
.phases li.now { border-top-color: var(--ink); color: var(--ink); font-weight: 600; }

.catch-list ul { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.catch-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.catch-list li a { font-weight: 600; }
.catch-list .price { font: 500 14px var(--f-mono); }
.catch-list small { flex-basis: 100%; color: var(--ink-2); font-size: 13.5px; }
