/* Velmor Lisans — yönetim paneli
 *
 * Tek dosya, derleme adımı yok: bu araç iç ağda birkaç kişi tarafından
 * kullanılıyor; sunucuya ikinci bir konteyner ve derleme zinciri koymak
 * taşıdığı değerden pahalı olurdu.
 */

:root {
  color-scheme: light;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e2e5ea;
  --line-strong: #cbd1d9;

  --text: #16181d;
  --text-muted: #646b78;

  --accent: #1f6f6b;        /* derin teal — tek vurgu */
  --accent-soft: #e6f1f0;
  --accent-text: #ffffff;

  --ok: #1d7a4c;
  --ok-soft: #e4f3ea;
  --warn: #8a5a08;
  --warn-soft: #fbf0dc;
  --bad: #a3282d;
  --bad-soft: #fbe6e7;

  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 18 23 / 6%), 0 8px 24px rgb(16 18 23 / 6%);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101216;
    --surface: #171a20;
    --surface-2: #1c2028;
    --line: #262b34;
    --line-strong: #353b47;
    --text: #e8eaee;
    --text-muted: #949cab;
    --accent: #4fb3ad;
    --accent-soft: #15302f;
    --accent-text: #06201f;
    --ok: #5bc48a;
    --ok-soft: #14301f;
    --warn: #d9a441;
    --warn-soft: #30260f;
    --bad: #e2787d;
    --bad-soft: #341a1c;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101216;
  --surface: #171a20;
  --surface-2: #1c2028;
  --line: #262b34;
  --line-strong: #353b47;
  --text: #e8eaee;
  --text-muted: #949cab;
  --accent: #4fb3ad;
  --accent-soft: #15302f;
  --accent-text: #06201f;
  --ok: #5bc48a;
  --ok-soft: #14301f;
  --warn: #d9a441;
  --warn-soft: #30260f;
  --bad: #e2787d;
  --bad-soft: #341a1c;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
}

* { box-sizing: border-box; }

/* `hidden` özniteliği, kendi `display` kuralı olan öğelerde İŞLEMEZ:
 * tarayıcının `[hidden]{display:none}` kuralı, `#app{display:grid}` gibi
 * bir kuralla eziliyor. Kapı ekranı da uygulama da display taşıdığı için
 * ikisi birden görünüyordu. */
[hidden] { display: none !important; }

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

h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }

a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* --- Anahtar kapısı --------------------------------------------------- */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-error {
  margin: 0;
  color: var(--bad);
  background: var(--bad-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13.5px;
}

/* --- Çatı ------------------------------------------------------------- */

#app { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 700;
}

.rail nav { display: flex; flex-direction: column; gap: 2px; }

.nav {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.nav:hover { background: var(--surface-2); color: var(--text); }
.nav[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav:focus-visible, .btn:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rail-foot { margin-top: auto; }

main { padding: 28px 32px 64px; min-width: 0; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* --- Kartlar ---------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card + .card { margin-top: 18px; }

.card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-body { padding: 16px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.tile .n {
  font-size: 26px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.tile .k { color: var(--text-muted); font-size: 13px; }

/* --- Tablo ------------------------------------------------------------ */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 12px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }

td.num { font-variant-numeric: tabular-nums; }

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

/* --- Rozet ------------------------------------------------------------ */

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.mute { background: var(--surface-2); color: var(--text-muted); }

/* --- Düğme ------------------------------------------------------------ */

.btn {
  appearance: none;
  font: inherit;
  font-weight: 560;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { border-color: var(--text-muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* --- Form ------------------------------------------------------------- */

label.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
label.field > span { font-size: 13px; font-weight: 560; }
label.field > .hint { font-size: 12.5px; color: var(--text-muted); font-weight: 400; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

textarea { resize: vertical; min-height: 64px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* --- Kopyalanacak değerler -------------------------------------------- */

.kv {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.kv > .k { color: var(--text-muted); font-size: 13px; }

.kv > .v {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  overflow-x: auto;
  white-space: nowrap;
}

/* --- Kip penceresi ---------------------------------------------------- */

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgb(8 10 14 / 55%); }
dialog form { padding: 22px; }
dialog h2 { margin-bottom: 16px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* --- Bildirim --------------------------------------------------------- */

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  max-width: 360px;
  font-size: 14px;
}

.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

/* --- Dar ekran -------------------------------------------------------- */

@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }

  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    gap: 12px;
  }

  .rail nav { flex-direction: row; }
  .rail-foot { margin-top: 0; }
  main { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
}

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