:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --future: #94a3b8;
  --danger: #b91c1c;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a21;
    --text: #e6e8ec;
    --muted: #8b93a1;
    --line: #262b35;
    --accent: #2dd4bf;
    --accent-soft: #123b37;
    --future: #64748b;
    --danger: #f87171;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); min-height: 1.2em; }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
h1 { margin: 0 0 4px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 15px; }
h3 { font-size: 14px; margin: 20px 0 8px; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 7px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
@media (prefers-color-scheme: dark) { button, .btn { color: #052e2b; } }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.link { background: none; color: var(--muted); padding: 0 0 0 10px; font-weight: 400; }
button.link:hover { color: var(--text); }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  min-width: 0;
}

/* giriş */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }

/* üst bar */
.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 16px; }
nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav button { background: none; color: var(--muted); font-weight: 500; padding: 6px 12px; }
nav button.active { background: var(--accent-soft); color: var(--text); }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; display: block; }
main > section > .card, main > section > .grid2 { margin-bottom: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; word-break: break-word; }
.kpi .small-value { font-size: 16px; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.accent { border-color: var(--accent); }
.kpi.accent .value { color: var(--accent); }

/* saatler */
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.progress div { height: 100%; background: var(--accent); width: 0; transition: width .4s; }
.hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.hour { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.hour .h { color: var(--muted); }
.hour .a { font-weight: 600; }
.hour.done { background: var(--accent-soft); border-color: transparent; }
.hour.now { border-color: var(--accent); border-style: dashed; }

/* grafik */
.chart { width: 100%; height: 260px; }
.chart svg { width: 100%; height: 100%; display: block; }
.legend { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-left: 8px; }
.sw.past { background: var(--accent); }
.sw.future { background: repeating-linear-gradient(90deg, var(--future) 0 4px, transparent 4px 7px); }

/* tablolar */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--card); }
td.num, th.num { text-align: right; }
tr.today td { background: var(--accent-soft); }
tr.off td { color: var(--muted); }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); }
.pill.closed { color: var(--text); }
.pill.live { background: var(--accent); color: #fff; border-color: transparent; }
.pill.projected { color: var(--muted); border-style: dashed; }
table.compact td, table.compact th { padding: 5px 8px; }

/* yönetim */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.row-form { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.row-form input { flex: 1 1 120px; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.settings label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.settings label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.settings .wide { grid-column: 1 / -1; }
.days-pick { border: 1px solid var(--line); border-radius: 7px; display: flex; gap: 10px; flex-wrap: wrap; padding: 6px 10px; }
.days-pick legend { color: var(--muted); font-size: 12px; }
.days-pick label { flex-direction: row; align-items: center; gap: 4px; color: var(--text); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.keybox { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; margin-bottom: 10px; word-break: break-all; }

/* api */
.doc pre { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 12px; overflow: auto; max-height: 420px; }
.doc td { white-space: normal; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 20;
}

@media (max-width: 640px) {
  .top { padding: 10px 16px; gap: 8px; }
  .brand { flex: 1; }
  nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav button { white-space: nowrap; }
  .clock { font-size: 12px; }
  main { padding: 16px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* hızlı ayar */
.quick { margin-bottom: 16px; border-color: var(--accent); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.quick-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.quick-grid input { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 11.5px; min-height: 1.3em; }
.quick-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.preview { color: var(--muted); font-size: 13px; }
.preview b { color: var(--text); font-variant-numeric: tabular-nums; }
.row-form select { flex: 0 0 auto; }

.settings .reshuffle { display: flex; align-items: flex-end; }

/* dönem seçici (günlük / haftalık / aylık) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { background: none; color: var(--muted); font-weight: 500; padding: 5px 12px; border-radius: 6px; }
.seg button.active { background: var(--accent-soft); color: var(--text); }
.table-wrap.short { max-height: 300px; }
