:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d232c;
  --line: #262d38;
  --text: #e6e9ee;
  --muted: #8b95a5;
  --accent: #2dd4bf;
  --accent-ink: #04221f;
  --up: #3b4a5e;
  --danger: #f87171;
  --radius: 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f8; --surface: #ffffff; --surface-2: #eef1f4; --line: #dde2e8;
    --text: #18202b; --muted: #627083; --accent: #0d9488; --accent-ink: #ffffff; --up: #c9d3df; --danger: #dc2626;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
input, select {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); }

.btn { border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; background: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--line); color: var(--muted); font-weight: 500; }
.btn.ghost:hover { color: var(--text); border-color: var(--muted); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 28px; height: 28px; }

/* 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: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card .brand { justify-content: center; margin-bottom: 6px; font-size: 18px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
label input { color: var(--text); font-size: 14px; }
.error { color: var(--danger); margin: 0; font-size: 13px; }

/* Üst çubuk */
.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--surface-2); color: var(--text); }
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.me span { margin-right: 6px; color: var(--text); }

.page { max-width: 1180px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }

/* Filtreler */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.quick { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.quick button { background: none; border: 0; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; }
.quick button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.range { display: flex; align-items: center; gap: 6px; color: var(--muted); }
#f-user { min-width: 180px; }
.hint { color: var(--muted); font-size: 12.5px; margin: -8px 0 0; }
.panel .hint { margin: 10px 0 0; }

/* Kartlar */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card:first-child .value { color: var(--accent); }
.card .sub { color: var(--muted); font-size: 12.5px; }

/* Paneller ve tablolar */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.inactive td { opacity: .55; }
.strong { font-weight: 600; }
.accent { color: var(--accent); font-weight: 600; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.title-cell { max-width: 640px; overflow: hidden; text-overflow: ellipsis; }
.share-col { width: 28%; min-width: 160px; }
.share { display: inline-block; vertical-align: middle; width: calc(100% - 48px); height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.share-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.pct { display: inline-block; width: 42px; text-align: right; font-size: 12.5px; }
.tag { margin-left: 8px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Günler */
.days { display: flex; flex-direction: column; gap: 8px; }
.day { display: grid; grid-template-columns: 110px 1fr 220px; gap: 12px; align-items: center; }
.day-label { color: var(--muted); font-size: 13px; }
.day-bars { position: relative; height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.bar.up { background: var(--up); }
.day-value { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--accent); }
.legend i.up { background: var(--up); }

/* Kullanıcılar */
.user-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 130px auto; gap: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }

/* Pencere */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h3 { margin: 0 0 14px; font-size: 16px; }
#dialog-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-text { margin: 0; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#dialog-error { margin-top: 10px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 20; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--danger); color: #fff; }

@media (max-width: 860px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .user-form { grid-template-columns: 1fr 1fr; }
  .day { grid-template-columns: 90px 1fr; }
  .day-value { grid-column: 2; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .me { margin-left: 0; width: 100%; }
  .page { padding: 16px; }
  .user-form { grid-template-columns: 1fr; }
  .card .value { font-size: 21px; }

  /* Tablolar → kartlar */
  .table-wrap { overflow-x: visible; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tr { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
  .table-wrap tr:last-child { margin-bottom: 0; }
  .table-wrap td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border-bottom: 0; white-space: normal; text-align: right; }
  .table-wrap td::before { content: attr(data-label); flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
  .table-wrap td[data-label=""]::before { display: none; }
  .table-wrap td:first-child { justify-content: flex-start; text-align: left; font-size: 15px; padding: 0 0 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  .table-wrap td:first-child::before { display: none; }
  .table-wrap td.empty { justify-content: center; border-bottom: 0; padding: 18px 0; margin: 0; }
  .table-wrap .title-cell { max-width: none; word-break: break-word; }
  .table-wrap .share-col { width: auto; min-width: 0; }
  .table-wrap .share-col .share { flex: 1; width: auto; }
  .table-wrap .actions { flex-wrap: wrap; justify-content: flex-start; padding-top: 8px; }
}
a { color: var(--accent); }
