:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1b2430;
  --muted: #6b7684;
  --line: #e3e7ec;
  --brand: #1f5f8b;
  --brand-ink: #ffffff;
  --red: #c0392b;
  --red-bg: #fdecea;
  --orange: #b9650c;
  --orange-bg: #fff3e0;
  --yellow: #8a6d00;
  --yellow-bg: #fff9db;
  --green: #2e7d4f;
  --green-bg: #e8f5ec;
  --grey-bg: #eef1f4;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --panel: #1b2027;
    --ink: #e6e9ed;
    --muted: #97a1ad;
    --line: #2c333c;
    --brand: #5aa3d6;
    --brand-ink: #0d1116;
    --red: #ff8a80;
    --red-bg: #3a1f1d;
    --orange: #ffb766;
    --orange-bg: #3a2a17;
    --yellow: #f0d36b;
    --yellow-bg: #332d14;
    --green: #7fd1a0;
    --green-bg: #17301f;
    --grey-bg: #252b33;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1.2em; margin: 0; }
a { color: var(--brand); }

/* Giriş */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--panel); padding: 32px; border-radius: 12px; box-shadow: var(--shadow); width: 100%; max-width: 360px; display: grid; gap: 12px; border: 1px solid var(--line); }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0; }

/* Üst bar */
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: 0; padding: 8px 14px; border-radius: 6px; font: inherit; color: var(--muted); cursor: pointer; font-weight: 600; }
.tab.active { background: var(--grey-bg); color: var(--ink); }
.top-actions { margin-left: auto; }
.banner { background: var(--orange-bg); color: var(--orange); padding: 10px 20px; border-bottom: 1px solid var(--line); }

main { padding: 20px; max-width: 1600px; margin: 0 auto; }

/* Butonlar ve formlar */
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; cursor: pointer; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { min-width: 220px; flex: 0 1 300px; }
.grow { flex: 1; }

/* Özet kartları */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.red .n { color: var(--red); }
.stat.orange .n { color: var(--orange); }
.stat.yellow .n { color: var(--yellow); }

/* Tablolar */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 230px); }
table.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
.grid th { position: sticky; top: 0; background: var(--panel); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); z-index: 1; cursor: default; }
.grid th.sortable { cursor: pointer; }
.grid tbody tr:hover { background: var(--grey-bg); }
.grid tbody tr.clickable { cursor: pointer; }
.grid td.c, .grid th.c { text-align: center; }
.grid tr.done td { opacity: .5; }
.grid tr.done td:last-child { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--grey-bg); color: var(--muted); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.orange { background: var(--orange-bg); color: var(--orange); }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill.green { background: var(--green-bg); color: var(--green); }

.donebox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--green); }
.secret { display: inline-flex; align-items: center; gap: 4px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px 4px; font-size: 13px; border-radius: 4px; }
.icon-btn:hover { color: var(--ink); background: var(--grey-bg); }

/* İlerleme */
.progress { position: relative; height: 26px; background: var(--grey-bg); border-radius: 6px; margin-bottom: 12px; overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--brand) 35%, transparent); transition: width .2s; }
.progress span { position: relative; line-height: 26px; padding-left: 10px; font-size: 13px; }

/* Modal */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--panel); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 15, 20, .45); }
.m-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.m-head h2 { margin: 0; font-size: 19px; }
.m-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.m-head .close { margin-left: auto; }
.m-body { padding: 18px 22px; display: grid; gap: 22px; }
.m-foot { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
.m-body h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field .with-btn { display: flex; gap: 4px; }
.field .with-btn input { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.dl-list { display: grid; gap: 6px; }
.dl-item { display: grid; grid-template-columns: 24px 110px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.dl-item.done { opacity: .55; }
.dl-item .t { font-weight: 600; }
.dl-item .p { color: var(--muted); font-size: 12px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inline-form input[type=text] { flex: 1; min-width: 180px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

@media (max-width: 700px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .brand { display: none; }
  main { padding: 12px; }
  .toolbar input[type=search] { flex: 1 1 100%; min-width: 0; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dd { margin-bottom: 8px; }
  .dl-item { grid-template-columns: 24px 1fr; }
  .dl-item > :nth-child(n+3) { grid-column: 2; }
  .m-head, .m-body, .m-foot { padding-left: 14px; padding-right: 14px; }
  .table-wrap { max-height: none; }
}
