/* Repeatta yönetim paneli — uygulamanın paleti (lib/core/theme/app_colors.dart) */
:root {
  --forest: #1F5A45;
  --forest-deep: #16402F;
  --lime: #C9E86B;
  --lime-soft: #E6F4B8;
  --coral: #E2512A;
  --peach: #FFA65A;
  --lavender: #8C84E8;
  --sky: #5AA7E6;

  --bg: #F7F4E9;
  --surface: #FFFDF7;
  --surface-2: #F1EEE2;
  --text: #1C2620;
  --muted: #5B665F;
  --border: #E2DECF;
  --accent: var(--forest);
  --accent-text: #FFFDF7;
  --focus: #9CC63B;

  --ok-bg: #E6F4B8;   --ok-fg: #2F5A14;
  --warn-bg: #FFEBD6; --warn-fg: #8A4B0B;
  --bad-bg: #FDE6E6;  --bad-fg: #A3341B;
  --info-bg: #E9E6FD; --info-fg: #4A42A8;
  --neutral-bg: #F1EEE2; --neutral-fg: #4B554F;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 38, 32, .06), 0 4px 16px rgba(28, 38, 32, .05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121D17; --surface: #1B2A22; --surface-2: #22342A; --text: #F2EFE3; --muted: #A9B3AC;
    --border: #2C3F34; --accent: #C9E86B; --accent-text: #16402F;
    --ok-bg: #2B3F1C; --ok-fg: #CDEB8A; --warn-bg: #43301B; --warn-fg: #FFC78F;
    --bad-bg: #4A2520; --bad-fg: #FFAE9A; --info-bg: #2D2B4A; --info-fg: #C9C4FF;
    --neutral-bg: #26362D; --neutral-fg: #C9D1CB;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121D17; --surface: #1B2A22; --surface-2: #22342A; --text: #F2EFE3; --muted: #A9B3AC;
  --border: #2C3F34; --accent: #C9E86B; --accent-text: #16402F;
  --ok-bg: #2B3F1C; --ok-fg: #CDEB8A; --warn-bg: #43301B; --warn-fg: #FFC78F;
  --bad-bg: #4A2520; --bad-fg: #FFAE9A; --info-bg: #2D2B4A; --info-fg: #C9C4FF;
  --neutral-bg: #26362D; --neutral-fg: #C9D1CB;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Düzen */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--forest-deep); color: #F2EFE3; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; padding: 4px 10px 18px; }
.brand-dot { width: 26px; height: 26px; border-radius: 8px; background: var(--forest); display: grid; place-items: center; }
.brand-dot::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--lime); }
.nav a {
  display: block; padding: 9px 12px; border-radius: 10px; text-decoration: none; font-weight: 700;
  color: #DCE5DF;
}
.nav a:hover { background: rgba(255, 255, 255, .07); }
.nav a[aria-current="page"] { background: var(--lime); color: var(--forest-deep); }
.sidebar-foot { margin-top: auto; font-size: 13px; color: #B8C4BC; padding: 0 10px; display: grid; gap: 8px; }
.sidebar-foot .who { word-break: break-all; }
.sidebar-foot button { background: transparent; border: 1px solid #3E5A4B; color: #F2EFE3; border-radius: 10px; padding: 7px 10px; cursor: pointer; }

main { padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
h1 { font-size: 26px; margin: 0; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 800; }
.source-line { font-size: 13px; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); min-width: 0;
}
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 700; }
.kpi .value { font-size: 30px; font-weight: 800; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi.na .value { font-size: 16px; color: var(--muted); font-weight: 700; }
section + section { margin-top: 22px; }

/* Bileşenler */
.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 14px;
  font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; padding: 11px 14px; }
.input, select.input {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; min-width: 0;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 260px; }
.field { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field .input { color: var(--text); font-weight: 400; font-size: 15px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok-fg); }
.b-warn { background: var(--warn-bg); color: var(--warn-fg); }
.b-bad { background: var(--bad-bg); color: var(--bad-fg); }
.b-info { background: var(--info-bg); color: var(--info-fg); }
.b-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 800; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
table.users { min-width: 980px; }
td.uid { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
td.nowrap { white-space: nowrap; }
.range-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.range-fields .input { padding: 6px 8px; font-size: 14px; }

dl.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; font-weight: 700; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.bar-row { display: grid; grid-template-columns: 110px 1fr 56px; gap: 10px; align-items: center; margin: 8px 0; }
.bar-track { background: var(--surface-2); border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { background: var(--forest); height: 100%; border-radius: 6px; }
:root[data-theme="dark"] .bar-fill { background: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar-fill { background: var(--lime); } }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

.note {
  background: var(--info-bg); color: var(--info-fg); border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.note.warn { background: var(--warn-bg); color: var(--warn-fg); }
.note p { margin: 0; }
.note p + p { margin-top: 6px; }

.state { text-align: center; padding: 40px 16px; color: var(--muted); }
.state .title { font-weight: 800; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.state .actions { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .spinner { animation: none !important; } }

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.spinner { width: 32px; height: 32px; border: 4px solid var(--border); border-top-color: var(--forest); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-card { width: 100%; max-width: 400px; }
.auth-card form { display: grid; gap: 12px; margin-top: 8px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.error-text { color: var(--bad-fg); font-size: 14px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.back { text-decoration: none; font-weight: 700; color: var(--muted); }

/* Mobil */
.topbar { display: none; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 6px; }
  .brand { padding: 0 8px 0 0; font-size: 16px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; display: flex; align-items: center; padding: 0; }
  .sidebar-foot .who, .sidebar-foot .tzline { display: none; }
  main { padding: 18px 16px 40px; }
  h1 { font-size: 22px; }
  .bar-row { grid-template-columns: 90px 1fr 44px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
  /* Kullanıcı tablosu mobilde kart görünümü */
  table.responsive { min-width: 0; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 10px 0; }
  table.responsive td.uid { max-width: none; }
  table.responsive td { display: flex; gap: 10px; justify-content: space-between; border: 0; padding: 3px 4px; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 800; flex: none; }
}
