:root {
    --bg: #f1f5f9;
    --panel: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --brand: #4f46e5;
    --brand-dk: #4338ca;
    --sidebar: #0f172a;
    --sidebar-ink: #cbd5e1;
    --ok: #16a34a;
    --off: #94a3b8;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}
a { color: var(--brand); }
h2 { margin: 0 0 14px; font-size: 18px; }
h3 { margin: 0; font-size: 16px; }
h4 { margin: 0 0 8px; font-size: 15px; }
.muted { color: var(--muted); font-size: 14px; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ============ APP SHELL ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px; flex-shrink: 0; background: var(--sidebar); color: #fff;
    display: flex; flex-direction: column; padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 20px; font-weight: 700; padding: 4px 10px 20px; display: flex; gap: 8px; align-items: center; }
.brand span { color: #fff; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
    color: var(--sidebar-ink); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav-link .ic { width: 20px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; }
.sidebar-foot .who { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.avatar {
    width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; text-transform: uppercase; color: #fff;
}
.logout-btn {
    width: 100%; background: rgba(255,255,255,.1); color: #fff; border: 0;
    padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.logout-btn:hover { background: rgba(255,255,255,.2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 20px 28px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.appbar h1 { margin: 0; font-size: 22px; }
.appbar .sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.content { padding: 24px 28px 48px; max-width: 1100px; width: 100%; }
.content.two-col { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 20px; align-items: start; }

/* ============ PANELS / CARDS ============ */
.panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 20px; margin-bottom: 20px;
}
.two-col .panel { margin-bottom: 0; }
.back { display: inline-block; margin-bottom: 16px; color: var(--brand); text-decoration: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card {
    display: block; text-decoration: none; color: inherit;
    border: 1px solid var(--line); border-radius: 10px; padding: 16px;
    transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 6px 20px rgba(2,6,23,.08); transform: translateY(-1px); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-foot { display: flex; justify-content: space-between; font-size: 13px; margin-top: 10px; color: var(--muted); }

/* ============ STAT TILES ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
    display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px;
    transition: box-shadow .15s, transform .15s;
}
.stat:hover { box-shadow: 0 6px 20px rgba(2,6,23,.08); transform: translateY(-1px); }
.stat-ic { font-size: 26px; }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ============ TABLES ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

/* ============ BADGES / PILLS / TAGS ============ */
.badge, .pill, .tag {
    font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
    background: #eef2ff; color: var(--brand); display: inline-block;
}
.badge.ok, .pill.ok { background: #dcfce7; color: var(--ok); }
.badge.off, .pill.off { background: #e2e8f0; color: var(--off); }
.tag.STANDUP { background: #dbeafe; color: #1d4ed8; }
.tag.WEEKLY_STATUS { background: #ede9fe; color: #6d28d9; }
.tag.METRIC { background: #ccfbf1; color: #0f766e; }

/* ============ REPORT BLOCKS ============ */
.qa { display: block; margin-bottom: 4px; }
.qa strong { color: var(--muted); font-weight: 600; margin-right: 6px; }
.report { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.report:last-child { margin-bottom: 0; }
.report-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.report-head h4 { margin: 0; }
.qa-block { margin-bottom: 8px; }
.qa-block .q { color: var(--muted); font-size: 13px; }
.qa-block .a { white-space: pre-wrap; }
.metric-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.metric-chip {
    border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; text-align: center; min-width: 84px;
}
.metric-val { display: block; font-size: 20px; font-weight: 700; color: var(--ink); }
.metric-name { display: block; font-size: 12px; color: var(--muted); }

/* ============ FORMS ============ */
.report-form { display: flex; flex-direction: column; gap: 14px; }
.report-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.report-form select, .report-form textarea, .report-form input {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 15px; color: var(--ink); background: #fff; font-family: inherit;
}
.report-form textarea { resize: vertical; }
.report-form select:focus, .report-form textarea:focus, .report-form input:focus {
    outline: 2px solid var(--brand); border-color: var(--brand);
}
.report-form .btn-primary { align-self: flex-start; }
.btn-primary {
    padding: 11px 16px; border: 0; border-radius: 8px;
    background: var(--brand); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--brand-dk); }

/* ============ ALERTS ============ */
.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 0 0 16px; }
.alert.error { background: #fee2e2; color: #b91c1c; }
.alert.ok { background: #dcfce7; color: var(--ok); }

/* ============ LOGIN PAGE ============ */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-card { max-width: 380px; width: 100%; margin: 0; }
.login-title { margin: 0 0 4px; font-size: 22px; }
.login-sub { margin: 0 0 20px; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-form input {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 15px; color: var(--ink); background: #fff;
}
.login-form input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

/* ============ RESPONSIVE ============ */
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: column; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .content.two-col { grid-template-columns: 1fr; }
}

/* ============ PARTICIPANT PICKER ============ */
.btn-ghost {
    padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line, #e2e8f0);
    color: var(--brand); font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn-ghost:hover { background: #f8fafc; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row select {
    flex: 1 1 280px; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--line, #e2e8f0); font-size: 15px; background: #fff;
}

.picker { list-style: none; margin: 12px 0 18px; padding: 0; }
.picker li + li { border-top: 1px solid var(--line, #e2e8f0); }
.picker label {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 6px; cursor: pointer; border-radius: 8px;
}
.picker label:hover { background: #f8fafc; }
.picker input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand); }
.picker .name { font-weight: 600; }
/* Push the email away from the name and let the guest pill sit at the far right. */
.picker .muted { margin-left: auto; font-size: 13px; }
.avatar-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* ============ SIGN IN WITH SLACK ============ */
.slack-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 12px 16px; margin-bottom: 8px;
    border: 1px solid #611f69; border-radius: 8px;
    background: #fff; color: #611f69;
    font-size: 15px; font-weight: 600; text-decoration: none;
}
.slack-btn:hover { background: #f7f0f8; }
.slack-mark { font-size: 18px; line-height: 1; }
.login-hint { font-size: 13px; margin: 0 0 14px; text-align: center; }

/* "or" divider with a rule either side */
.or { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; color: var(--off, #94a3b8); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line, #e2e8f0); }
.or span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

/* ============ TEAM FORM ============ */
.panel.narrow { max-width: 560px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field > span em { font-weight: 400; font-style: normal; }
.field input[type="text"] {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--line, #e2e8f0); font-size: 15px;
}
.field input[type="text"]:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.field.checkbox { display: flex; align-items: center; gap: 10px; }
.field.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); }
.field.checkbox span { margin: 0; font-weight: 400; font-size: 14px; }

.panel.danger { border: 1px solid #fecaca; margin-top: 20px; }
.panel.danger h2 { color: #b91c1c; font-size: 16px; margin-top: 0; }
.btn-danger {
    padding: 10px 14px; border: 1px solid #fecaca; border-radius: 8px;
    background: #fff; color: #b91c1c; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: #fee2e2; }

/* ============ SCHEDULE PANEL ============ */
.field.small { flex: 0 0 150px; }
.field.grow  { flex: 1 1 220px; }
.row .field { margin-bottom: 0; }
.field input[type="time"] {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--line, #e2e8f0); font-size: 15px;
}
.days { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.days label {
    display: flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 7px 10px; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; font-size: 13px;
}
.days label:has(input:checked) { border-color: var(--brand); background: #eef2ff; color: var(--brand); }
.days input { accent-color: var(--brand); }

/* ============ STANDUP EDITOR ============ */
.question-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.question-row input[type="text"] {
    flex: 1; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--line, #e2e8f0); font-size: 15px;
}
.question-row select {
    padding: 10px 8px; border-radius: 8px; border: 1px solid var(--line, #e2e8f0);
    font-size: 14px; background: #fff;
}
.question-row .remove { padding: 8px 10px; color: #b91c1c; border-color: #fecaca; }

.field textarea {
    width: 100%; padding: 10px 12px; border-radius: 8px; font: inherit;
    border: 1px solid var(--line, #e2e8f0); resize: vertical;
}
.field input[type="number"] {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--line, #e2e8f0); font-size: 15px;
}

.card-actions { margin-top: 12px; }
.card-actions .btn-primary, .card-actions .btn-ghost { padding: 7px 12px; font-size: 13px; }

/* A first-run state should tell you what to do, not just that there is nothing here. */
.empty { text-align: center; padding: 28px 12px; }
.empty-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.empty .btn-primary { display: inline-block; margin-top: 14px; text-decoration: none; }

.report { padding: 12px 0; border-bottom: 1px solid var(--line, #e2e8f0); }
.report:last-child { border-bottom: 0; }
.report-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
