:root {
  --bg: #0f1419;
  --surface: #161d27;
  --surface-2: #1d2632;
  --border: #2a3340;
  --text: #e6ecf1;
  --muted: #8a98a8;
  --accent: #2faa6b;
  --accent-hover: #36c47b;
  --warn: #d68f2b;
  --danger: #d6612b;
  --link: #4ea8e6;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% 0%, #1a2330 0%, #0f1419 60%) no-repeat,
              #0f1419;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 760; letter-spacing: -0.2px; }
h2 { font-size: 18px; font-weight: 740; }
h3 { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
p  { color: var(--muted); font-size: 14px; line-height: 1.5; }
code { font-family: "Cascadia Mono", "JetBrains Mono", Consolas, monospace; color: #b9c8d6; font-size: 12px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 640;
  transition: background 0.12s ease;
}
button:hover { background: var(--accent-hover); }
button:disabled { background: #3a4452; cursor: not-allowed; opacity: 0.6; }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.ghost:hover { background: var(--surface-2); }

input[type=email] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  transition: border 0.12s ease;
}
input[type=email]:focus { border-color: var(--accent); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.login-card h1 { margin-bottom: 6px; }
.login-card p  { margin-bottom: 22px; }
.login-card form { display: grid; gap: 12px; }
.login-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  font-size: 13px;
  color: #c4d2dd;
}
.login-result.error { border-left-color: var(--danger); }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #1c7c4f);
  display: grid; place-items: center;
  font-weight: 760; color: #fff;
}

/* ---------- Dashboard ---------- */
.dash {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.dash-header .who {
  display: flex; align-items: center; gap: 12px;
}
.who-email { color: var(--muted); font-size: 13px; }

.chain-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 640;
}
.chain-badge.ok   { background: rgba(47, 170, 107, 0.15); color: #6fdba0; }
.chain-badge.fail { background: rgba(214, 97, 43, 0.15); color: #ff9874; }
.chain-badge::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.metric-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.metric-value { font-size: 24px; font-weight: 740; margin-top: 4px; }

.session-list {
  display: grid;
  gap: 10px;
}
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.session-card:hover { border-color: #3a4754; transform: translateY(-1px); }
.session-id {
  font-size: 24px;
  font-weight: 740;
  color: var(--accent);
  min-width: 50px;
}
.session-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.session-title { font-weight: 640; }
.session-meta { font-size: 12px; color: var(--muted); }
.session-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.count-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #c4d2dd;
  font-weight: 600;
}
.count-pill.ok   { background: rgba(47, 170, 107, 0.18); color: #6fdba0; }
.count-pill.dup  { background: rgba(214, 143, 43, 0.18); color: #f0c179; }
.count-pill.unk  { background: rgba(214, 97, 43, 0.18); color: #ff9874; }
.count-pill.pre  { background: rgba(78, 168, 230, 0.18); color: #7fc3f0; }
.count-pill.man  { background: rgba(166, 121, 230, 0.18); color: #c1a5f5; }

.session-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.session-actions button {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Drawer (detay) ---------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 50;
  animation: fadein 0.16s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(760px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 51;
  animation: slidein 0.2s ease-out;
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.drawer-body { padding: 18px 22px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 640; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
tbody tr:hover { background: var(--surface-2); }
.status-cell {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 640;
}
.status-cell.ok   { background: rgba(47, 170, 107, 0.18); color: #6fdba0; }
.status-cell.dup  { background: rgba(214, 143, 43, 0.18); color: #f0c179; }
.status-cell.unk  { background: rgba(214, 97, 43, 0.18); color: #ff9874; }
.status-cell.pre  { background: rgba(78, 168, 230, 0.18); color: #7fc3f0; }
.status-cell.man  { background: rgba(166, 121, 230, 0.18); color: #c1a5f5; }
.status-cell.dup::before, .status-cell.unk::before { content: ""; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
}

.loading {
  display: grid;
  place-items: center;
  min-height: 200px;
  color: var(--muted);
}
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chain-issues {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(214, 97, 43, 0.10);
  border-left: 3px solid var(--danger);
}
.chain-issues h3 { color: #ff9874; }
.chain-issues ul { margin: 8px 0 0 0; padding-left: 20px; font-size: 13px; }

footer.pf {
  margin-top: 40px;
  padding: 20px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
footer.pf code { font-size: 11px; }
