/* Tahkim Kalemi — design system.
   Palette: flag red + one ink scale (unchanged). Spacing on a 4px scale, one vertical rhythm per container,
   no inline margins in pages. Type scale: 24 / 15 / 13 / 14 body / 12.5 small / 11.5 table heads. */
:root {
  --red: #c8102e; --red-dark: #a30d25; --red-soft: #fbe9ec; --red-line: #f1c5cc;
  --ink: #151b23; --ink-2: #3a4553; --muted: #6b7684;
  --line: #e4e8ed; --line-strong: #cdd4db;
  --bg: #f4f6f8; --panel: #ffffff; --panel-head: #f7f8fa; --hover: #f2f4f7;
  --ok: #1e6b3a; --ok-soft: #e6f4ea; --warn: #8a5a00; --warn-soft: #fff4e0; --danger: #a3281d;
  --log-bg: #151b23; --log-fg: #d8dee6;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(21, 27, 35, .05), 0 2px 6px rgba(21, 27, 35, .04);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --panel-x: 22px; --panel-y: 20px;
  --control-h: 36px;
}
* { box-sizing: border-box; }
html, body { margin: 0; font-family: -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; overflow-wrap: anywhere; }
main { flex: 1; width: 100%; }

/* ---- Type ---- */
h1 { font-size: 24px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 15px; line-height: 1.3; margin: 0; font-weight: 650; letter-spacing: -.005em; }
.sub { font-size: 13px; font-weight: 650; margin: 0; color: var(--ink); }
p { margin: 0; max-width: 92ch; }
p.lead { color: var(--muted); }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { color: var(--red-dark); text-decoration-color: currentColor; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--panel-head); padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; }
strong { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---- Page rhythm: every block on a page is 20px apart; a section title sits 32px above its block ---- */
.content > * + * { margin-top: var(--s5); }
.content > h1 + * { margin-top: var(--s4); }
.content > h1 + p.lead + * { margin-top: var(--s5); }
.content > h2, .content > .list-head { margin-top: var(--s8); }
.content > h2 + *, .content > .list-head + * { margin-top: var(--s3); }
.content > .subnav + * { margin-top: 0; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.list-head .badge { margin-left: var(--s2); vertical-align: middle; }

/* ---- Panels: 20/22 padding, header strip, 16px rhythm inside ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--panel-y) var(--panel-x); }
.panel > * + * { margin-top: var(--s4); }
.panel > h2:first-child { margin: calc(-1 * var(--panel-y)) calc(-1 * var(--panel-x)) 0; padding: 14px var(--panel-x); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.panel > h2:first-child + * { margin-top: var(--s5); }
.panel > .sub { margin-top: var(--s6); }
.panel > .sub + * { margin-top: var(--s3); }
.panel > .list-head { margin-top: var(--s6); }
.panel > .list-head + * { margin-top: var(--s3); }
.panel > p { color: var(--muted); font-size: 13px; }
.panel[id] { scroll-margin-top: 120px; }

/* ---- Stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: var(--s4); display: block; text-decoration: none; color: inherit; }
a.stat:hover { border-color: #b8c1ca; background: var(--hover); }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .n.fail { color: var(--danger); }
.stat .n.ok { color: var(--ok); }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: var(--s1); }

/* ---- Forms: fixed-track grid, labels one line, hints below ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4); align-items: start; max-width: 1060px; }
.form-grid .field { min-width: 0; }
.form-grid .field.wide { grid-column: span 2; }
.form-grid .field.path { grid-column: span 3; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-grid .field.date { max-width: 220px; }
.field { display: flex; flex-direction: column; gap: var(--s1) 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 18px; min-height: 18px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field > strong { font-size: 15px; line-height: var(--control-h); }
.field .hint { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: var(--s1); }
.field.action { flex-direction: row; align-items: center; flex-wrap: wrap; gap: var(--s2); padding-top: 20px; } /* 18px label + 2px, so controls line up with inputs */
.field.action > label.chip { margin: 0; }
.input-group { display: flex; }
.input-group > input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.input-group > button { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; flex: none; }
.actions { display: flex; gap: var(--s2) var(--s3); flex-wrap: wrap; align-items: center; }

/* ---- Controls ---- */
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  font: inherit; height: var(--control-h); padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink); width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: #b8c1ca; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
textarea { height: auto; min-height: 84px; padding: 9px 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }
input[type=checkbox] { accent-color: var(--red); width: 16px; height: 16px; margin: 0; flex: none; }
input::placeholder { color: #a3acb6; }

button { font: inherit; font-weight: 500; height: var(--control-h); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #fff; cursor: pointer; color: var(--ink); white-space: nowrap; transition: background .12s, border-color .12s; }
button:hover:not(:disabled) { background: var(--hover); border-color: #b8c1ca; }
button.primary { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
button.danger { color: var(--danger); border-color: var(--red-line); }
button.danger:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red-line); }
button.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
button:disabled { opacity: .45; cursor: default; }
button.more { background: none; border: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; height: auto; padding: 0; font-size: 13px; }
button.more:hover:not(:disabled) { background: none; color: var(--red-dark); }
a:has(> button) { text-decoration: none; }
.btn-file { position: relative; overflow: hidden; display: inline-flex; align-items: center; height: var(--control-h); padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 500; }
.btn-file:hover { background: var(--hover); border-color: #b8c1ca; }
.btn-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; height: var(--control-h); }
.segmented button { border: 0; border-radius: 0; height: 100%; border-right: 1px solid var(--line-strong); }
.segmented button:last-child { border-right: 0; }
.segmented button.on, .segmented button.on:hover { background: var(--ink); color: #fff; }

/* ---- Chips (checkbox groups) ---- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
label.chip { display: inline-flex; align-items: center; gap: var(--s2); height: 32px; padding: 0 12px 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; cursor: pointer; font-size: 13px; user-select: none; margin: 0; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
label.chip:hover { border-color: #b8c1ca; background: var(--hover); }
label.chip:has(input:checked) { background: var(--red-soft); border-color: var(--red-line); color: var(--red-dark); font-weight: 600; }
label.chip.sm { height: 28px; font-size: 12.5px; padding: 0 10px 0 8px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
.table-wrap > table { min-width: 900px; }
.table-wrap.narrow > table { min-width: 720px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: var(--panel-head); white-space: nowrap; }
tbody th { font-size: 13px; color: var(--ink-2); font-weight: 600; background: var(--panel-head); }
table.kv tbody th { width: 260px; white-space: nowrap; }
tbody tr:hover > td { background: var(--hover); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
table.compact th, table.compact td { padding: 8px 12px; }
td input[type=text], td select, td input[type=number], td input[type=password], td input[type=date] { height: 30px; padding: 0 8px; font-size: 13px; }
td input[type=text], td input[type=password] { min-width: 90px; }
td .line2 { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
td .line2.trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td .cell-row { display: flex; gap: var(--s2); align-items: center; flex-wrap: nowrap; }
td .cell-stack { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
/* tables inside panels run edge to edge; a trailing table closes the panel */
.panel > table, .panel > .table-wrap { margin-left: calc(-1 * var(--panel-x)); margin-right: calc(-1 * var(--panel-x)); width: calc(100% + 2 * var(--panel-x)); border: 0; border-radius: 0; }
.panel > .table-wrap > table { border: 0; border-radius: 0; }
.panel > table:last-child, .panel > .table-wrap:last-child { margin-bottom: calc(-1 * var(--panel-y)); border-radius: 0 0 var(--radius) var(--radius); }
.panel > table:first-child, .panel > .table-wrap:first-child { margin-top: calc(-1 * var(--panel-y)); border-radius: var(--radius) var(--radius) 0 0; }
.panel > table:first-child:last-child, .panel > .table-wrap:first-child:last-child { border-radius: var(--radius); }
.panel > .table-wrap:not(:last-child) + * { margin-top: var(--s4); }
.panel > table:not(:last-child), .panel > .table-wrap:not(:last-child) { border-bottom: 1px solid var(--line); }
.panel > table th:first-child, .panel > table td:first-child, .panel > .table-wrap > table th:first-child, .panel > .table-wrap > table td:first-child { padding-left: var(--panel-x); }
.panel > table th:last-child, .panel > table td:last-child, .panel > .table-wrap > table th:last-child, .panel > .table-wrap > table td:last-child { padding-right: var(--panel-x); }
.panel > h2:first-child + table, .panel > h2:first-child + .table-wrap { margin-top: 0; border-top: 0; }

/* ---- Badges, flashes, notes, empty states ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1; vertical-align: middle; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.fail { background: var(--red-soft); color: var(--danger); }
.badge.skip { background: var(--hover); color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.flash { display: flex; gap: var(--s2); align-items: flex-start; padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--red-soft); color: var(--danger); }
.note { background: var(--red-soft); border: 1px solid var(--red-line); color: var(--ink); padding: 12px 14px; border-radius: 10px; }
.note::before { content: "Uyarı · "; font-weight: 700; color: var(--red-dark); }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); margin-bottom: var(--s1); }
.status-ok { color: var(--ok); } .status-fail { color: var(--danger); } .status-skip { color: var(--muted); }

/* ---- Collapsible, sub-navigation, save bar ---- */
details.collapse { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
details.collapse > summary { list-style: none; cursor: pointer; padding: 10px 14px; font-weight: 600; display: flex; align-items: center; gap: var(--s2); }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary::before { content: "›"; display: inline-block; transition: transform .12s; color: var(--muted); font-size: 16px; }
details.collapse[open] > summary::before { transform: rotate(90deg); }
details.collapse[open] > summary { border-bottom: 1px solid var(--line); }
details.collapse > .body { padding: 14px; }
details.collapse > .body > * + * { margin-top: var(--s3); }
.subnav { position: sticky; top: 60px; z-index: 5; display: flex; gap: 6px; flex-wrap: wrap; padding: var(--s2) 0 var(--s3); background: linear-gradient(var(--bg) 78%, rgba(244, 246, 248, 0)); }
.subnav a { font-size: 13px; text-decoration: none; height: 30px; display: inline-flex; align-items: center; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.subnav a:hover { border-color: #b8c1ca; color: var(--ink); }
.savebar { position: sticky; bottom: 0; z-index: 5; margin: var(--s5) -32px 0; padding: var(--s3) 32px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; backdrop-filter: blur(6px); }
.savebar .spacer { flex: 1; }

/* ---- Log ---- */
.log { background: var(--log-bg); color: var(--log-fg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; padding: 14px 16px; border-radius: var(--radius); max-height: 480px; overflow: auto; line-height: 1.6; box-shadow: var(--shadow); }
.log .t { color: #8d9aa8; margin-right: 10px; }
.log .warn { color: #f0c96a; }
.log .err { color: #ff8f80; }
pre.log { white-space: pre-wrap; margin: 0; }

/* ---- Footer ---- */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 18px 28px 22px; text-align: center; }

/* ---- Demo sign-in ---- */
.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 420px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; margin-bottom: 18px; }
.login-brand svg { width: 34px; height: 34px; padding: 7px; color: #fff; background: var(--red); border-radius: 9px; }
.login-card h1 { font-size: 20px; }
.login-card > * + * { margin-top: var(--s3); }
.login-card .form-grid { margin-top: var(--s4); }
.login-card button { width: 100%; }
.demo-tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--red-soft); color: var(--red-dark); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.demo-tag a { color: inherit; }

/* ---- Responsive ---- */
@media (max-width: 1100px) { td .line2.trunc { max-width: 200px; } }
@media (max-width: 760px) {
  h1 { font-size: 21px; }
  table.kv tbody th { width: 120px; white-space: normal; }
  td .line2.trunc { max-width: 160px; }
  .form-grid .field.path { grid-column: span 2; }
  :root { --panel-x: 16px; --panel-y: 16px; }
  .panel > h2:first-child { padding: 12px var(--panel-x); }
  .savebar { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .subnav { top: 56px; }
}
@media (max-width: 520px) { .form-grid .field.wide, .form-grid .field.path { grid-column: auto; } }
