:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e3e6eb; --text: #1b2130; --muted: #6b7385; --accent: #2458e6;
  --tam: #0f9d58; --guclu: #2458e6; --warn: #c77700; --err: #d93a4a; --soft: #eef1f6; --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1116; --panel: #161b23; --line: #262d39; --text: #e6e9ef; --muted: #8b93a5; --soft: #1e2530;
    --accent: #5b8cff; --guclu: #5b8cff; --tam: #2ecc71; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h2 { margin: 0 0 6px; font-size: 18px; } h3 { margin: 0 0 8px; font-size: 15px; } h4 { margin: 16px 0 6px; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .center { text-align: center; }
.ok { color: var(--tam); } .error { color: var(--err); }
.stack { display: flex; flex-direction: column; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; margin: 4px 0; }
input, select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; }
.btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; display: inline-block; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; } .btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.on { background: var(--soft); border-color: var(--accent); color: var(--accent); }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 380px; }
.brand { font-size: 18px; font-weight: 600; } .brand b { color: var(--accent); } .brand.big { font-size: 26px; text-align: center; }

header { display: flex; align-items: center; gap: 20px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; }
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav button { font: inherit; font-weight: 500; background: none; border: 0; color: var(--muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
nav button.on { background: var(--soft); color: var(--text); }
.count { background: var(--err); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
section > * + * { margin-top: 16px; }

.alert { background: color-mix(in srgb, var(--warn) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  padding: 10px 14px; border-radius: var(--r); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat b { display: block; font-size: 24px; } .stat span { color: var(--muted); font-size: 12px; }
.stat.tam b { color: var(--tam); } .stat.warn b { color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 180px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 12.5px; background: none; border: 0; padding: 5px 10px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--soft); color: var(--text); font-weight: 600; }

.cards { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.card.tam { border-left-color: var(--tam); } .card.guclu { border-left-color: var(--guclu); }
.card.unread { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.card h3 { margin: 8px 0 4px; font-size: 16px; } .card h3 a { color: var(--text); }
.card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .spacer { flex: 1; }
.badge { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.badge.tam { background: color-mix(in srgb, var(--tam) 15%, transparent); color: var(--tam); }
.badge.guclu { background: color-mix(in srgb, var(--guclu) 15%, transparent); color: var(--guclu); }
.badge.soft { font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.deadline { font-weight: 600; } .deadline.soon { color: var(--warn); } .deadline.urgent { color: var(--err); } .deadline.past { color: var(--muted); text-decoration: line-through; }
.snippet { color: var(--muted); font-size: 13px; margin: 8px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.note { background: var(--soft); padding: 8px 10px; border-radius: 8px; font-size: 13px; margin: 8px 0 0; white-space: pre-wrap; }
.empty { text-align: center; padding: 40px 16px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.dim { opacity: .5; }
.row-actions { white-space: nowrap; } .links a { display: inline-block; margin-right: 10px; }
.log { max-height: 260px; overflow-y: auto; font-size: 12.5px; } .log div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.log .error { color: var(--err); }
.cal li { margin-bottom: 6px; } ol, ul { padding-left: 20px; } li { margin-bottom: 4px; }
details summary { cursor: pointer; color: var(--muted); margin-bottom: 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; z-index: 50; font-size: 13px; }
@media (max-width: 800px) {
  .grid2 { grid-template-columns: 1fr; }
  header { flex-wrap: wrap; gap: 8px; padding: 10px 16px; } nav { order: 3; flex-basis: 100%; }
}
.badge.expired { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.card.is-expired { opacity: .6; border-left-color: var(--line); }
