:root {
    --bg: #0f1115;
    --panel: #161922;
    --panel-2: #1c1f2a;
    --border: #262b38;
    --text: #e6e8ee;
    --text-dim: #8b92a5;
    --accent: #f7931e;
    --accent-dim: #4a3016;
    --accent-text: #1a0f00;
    --success: #6ee7b7;
    --success-dim: #2f6b52;
    --danger: #f2777a;
    --danger-bg: #3a1f22;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    font-size: 14px;
}

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px 6px; }
.brand-logo { height: 28px; width: auto; display: block; }
.brand-logo-login { height: 40px; }

nav { display: flex; flex-direction: column; gap: 2px; flex: 1; margin-top: 8px; }
.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 16.5px;
    transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-sublink { padding-left: 26px; font-size: 15.5px; }
.nav-section-label {
    margin: 16px 12px 4px 12px;
    font-size: 13.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 10px; }
.user-chip { padding: 0 12px 8px 12px; }
.user-email { font-size: 15.5px; color: var(--text); }
.user-role { font-size: 14px; color: var(--text-dim); }
.logout-link {
    display: block; padding: 8px 12px; color: var(--danger);
    text-decoration: none; font-size: 16px; border-radius: 7px;
}
.logout-link:hover { background: var(--danger-bg); }

.content { flex: 1; padding: 32px 40px; max-width: 1100px; }
.page-wide .content { max-width: 1540px; }

.flag-stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.flag-stack .badge { min-width: 150px; text-align: center; }

.data-table a { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-dim); }
.data-table a:hover { color: var(--text); text-decoration-color: var(--text); }

.page-header {
    margin-bottom: 24px;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: nowrap;
}
.page-header h1 { margin: 0 0 4px 0; font-size: 22px; }
.page-header .header-line { line-height: 1.5; margin-top: 6px; }
.page-header > div:first-child { min-width: 0; }
.page-header > a { flex-shrink: 0; white-space: nowrap; text-decoration: none; display: inline-block; }
.subtle { color: var(--text-dim); font-size: 16px; margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.module-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.12s, transform 0.12s;
}
.module-card:hover { border-color: var(--accent-dim); transform: translateY(-1px); }
.module-card-title { font-weight: 600; margin-bottom: 6px; font-size: 17px; }
.module-card-sub { color: var(--accent); font-size: 15.5px; }

.empty-state {
    color: var(--text-dim);
    background: var(--panel);
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 24px;
    font-size: 16.5px;
}

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card h3 { margin: 0; font-size: 18px; }

.section-title { font-size: 18px; margin: 28px 0 12px 0; }

.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 16px; }
.data-table th { color: var(--text-dim); font-weight: 500; font-size: 14.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .group-divider { border-left: 1px solid var(--border); }
.nowrap { white-space: nowrap; }

.perm-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.perm-table th, .perm-table td { text-align: left; padding: 6px 10px; font-size: 16px; }
.perm-table th { color: var(--text-dim); font-weight: 500; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 14px; font-weight: 600; }
.badge-ok { background: var(--success-dim); color: var(--success); }
.badge-off { background: var(--danger-bg); color: var(--danger); }

.form-block { display: flex; flex-direction: column; gap: 6px; max-width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.form-block label { font-size: 15px; color: var(--text-dim); margin-top: 8px; }
.inline-form { display: inline; }

input[type=email], input[type=password], input[type=text], select {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 11px;
    border-radius: 7px;
    font-size: 16.5px;
    width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent-dim); border-color: var(--accent); }

button, .btn-sm {
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: 12px;
}
button:hover, .btn-sm:hover { filter: brightness(1.08); }
.btn-sm { padding: 8px 14px; margin-top: 0; font-size: 13.5px; }

.dash-confirm-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    align-items: center; justify-content: center;
}
.dash-confirm-overlay.open { display: flex; }
.dash-confirm-box {
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 22px 24px; max-width: 420px; width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.dash-confirm-box p { margin: 0 0 18px 0; color: var(--text); font-size: 14.5px; line-height: 1.5; }
.dash-confirm-actions { display: flex; justify-content: center; gap: 10px; }

.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px;
    width: 320px;
    display: flex;
    flex-direction: column;
}
.login-card label { font-size: 12px; color: var(--text-dim); margin-top: 12px; margin-bottom: 4px; }
.login-card button { margin-top: 20px; }

.alert { padding: 10px 12px; border-radius: 7px; font-size: 16px; margin-bottom: 4px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }

.divider { display: flex; align-items: center; text-align: center; color: var(--text-dim); font-size: 11.5px; margin: 18px 0 4px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-bottom: 1px solid var(--border); }
.divider span { padding: 0 10px; }

.google-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #fff; color: #1f1f1f;
    border-radius: 7px; padding: 9px 16px;
    font-size: 13.5px; font-weight: 600;
    text-decoration: none; margin-top: 12px;
}
.google-btn:hover { filter: brightness(0.96); }

@media (max-width: 720px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; overflow-x: auto; align-items: center; }
    nav { flex-direction: row; }
    .sidebar-footer { display: none; }
    .content { padding: 20px; }
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.modal-close {
    background: transparent;
    color: var(--text-dim);
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    margin: 0;
}
.modal-close:hover { color: var(--text); filter: none; }

/* ── Top bar: switches between the parts of the project. Shown on pages that belong to a part; the side menu below it then lists only that part's own pages. ── */
.topbar {
    position: sticky; top: 0; z-index: 50;
    height: 60px;
    display: flex; align-items: center; gap: 22px;
    padding: 0 22px;
    background: #0a0b0f;
    box-shadow: 0 6px 22px rgba(255, 122, 0, 0.13);
}
/* the orange line that sets the bar apart from the page */
.topbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
    background: linear-gradient(90deg, #ff9f1a 0%, #ff6a00 100%);
}
.topbar-logo { flex-shrink: 0; display: block; }
.part-tabs {
    flex: 1; min-width: 0; margin: 0;
    flex-direction: row; align-items: center; gap: 4px;
    overflow-x: auto; scrollbar-width: none;
}
.part-tab {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    padding: 8px 13px;
    border-radius: 8px;
    color: var(--text);
    font-size: 15px; font-weight: 500;
    text-decoration: none; white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}
.part-tab svg { width: 17px; height: 17px; flex-shrink: 0; }
a.part-tab:hover { background: var(--accent-dim); color: var(--accent); }
a.part-tab.active:hover { background: var(--accent); color: var(--accent-text); }
.part-tab.active { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.part-tab-soon { opacity: 0.45; cursor: default; }
.topbar-user { flex-shrink: 0; display: flex; align-items: center; gap: 16px; font-size: 14.5px; }
.topbar-name { color: var(--text-dim); }
.topbar-user a { color: var(--text); text-decoration: none; }
.topbar-user a:hover { color: var(--accent); }
.topbar-user a.active { color: var(--accent); font-weight: 600; }
.topbar-user a.topbar-logout { color: var(--danger); }

.shell-part { min-height: calc(100vh - 60px); }
.shell-part .sidebar { position: sticky; top: 60px; align-self: flex-start; height: calc(100vh - 60px); overflow-y: auto; }
.sidebar-title {
    padding: 2px 12px 10px 12px;
    font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-dim);
}
@media (max-width: 1180px) { .topbar-name { display: none; } }
@media (max-width: 720px) {
    .topbar { gap: 12px; padding: 0 12px; }
    .topbar-user a:not(.topbar-logout) { display: none; }
    .shell-part .sidebar { position: static; height: auto; }
    .sidebar-title { display: none; }
}

/* Slack Bots overview: summary numbers, one card per check, alert feed */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat small { display: block; min-height: 2.6em; line-height: 1.3; color: var(--text-dim); font-size: 13.5px;
    text-transform: uppercase; letter-spacing: .05em; }
.stat b { display: block; font-size: 26px; margin-top: 4px; }
.text-warn { color: #f5c451; }
.text-bad { color: var(--danger); }
.badge-warn { background: #4a3a12; color: #f5c451; text-decoration: none; }
.badge-dim { background: var(--panel-2); color: var(--text-dim); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot-ok { background: var(--success); }
.dot-warn { background: #f5c451; }
.dot-bad { background: var(--danger); }
.dot-dim { background: var(--text-dim); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.check-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px;
    display: flex; flex-direction: column; gap: 8px; }
.check-card.off { opacity: .6; }
.check-card.placeholder { border-style: dashed; opacity: .6; }
.overview-group { margin-top: 8px; }
.section-split { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--border); }
.check-card h3 { margin: 0; font-size: 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.check-card h3 a { color: var(--text); text-decoration: none; }
.check-card h3 a:hover { color: var(--accent); }
.check-card .meta { color: var(--text-dim); font-size: 14.5px; }
.check-card .summary { font-size: 15px; overflow-wrap: anywhere; }
.check-card .foot { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.chips + .chips { margin-top: -12px; }
.chip { padding: 6px 12px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--border);
    font-size: 14px; color: var(--text-dim); text-decoration: none; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }
.chip-gap { width: 10px; }
.chip-divider { width: 1px; height: 24px; background: var(--border); margin: 0 8px; }
.plain-list { margin: 0; padding-left: 18px; color: var(--text-dim); font-size: 15.5px; line-height: 1.5; }
.plain-list li + li { margin-top: 8px; }
.plain-list b { color: var(--text); }
.faq-bot h3 { margin-bottom: 10px; }
.faq-bot h3 a { color: var(--text); text-decoration: none; }
.faq-bot h3 a:hover { color: var(--accent); }
.faq-bot .subtle-cell { font-weight: normal; font-size: 15px; }
.feed-intro { margin-bottom: 20px; line-height: 1.5; }
.add-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.add-row input[type=text] { max-width: 360px; margin: 0; }
.add-row select { width: 160px; margin: 0; }
.add-row button { margin-top: 0; }
.add-row { flex-wrap: wrap; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.pager a { text-decoration: none; }
.add-row input.add-id { max-width: 150px; }
.day-line { position: relative; height: 96px; margin: 8px 12px 34px 12px; border-bottom: 2px solid var(--border); }
.day-hour { position: absolute; bottom: -22px; transform: translateX(-50%); font-size: 12px; color: var(--text-dim); }
.day-hour::before { content: ""; position: absolute; left: 50%; bottom: 20px; width: 1px; height: 8px; background: var(--border); }
.day-mark { position: absolute; bottom: 0; width: 2px; height: 34px; background: var(--accent); }
.day-mark.low { height: 64px; }
.day-mark.clash { background: #f5c451; }
.day-mark span { position: absolute; bottom: 100%; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: 12.5px;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; }
.day-mark.clash span { border-color: #f5c451; color: #f5c451; }
.schedule-warn { margin-top: 30px; padding: 10px 12px; border-radius: 7px; border: 1px solid #f5c451; color: #f5c451; font-size: 15px; }
.schedule-warn div + div { margin-top: 4px; }
.settings-table input.num { width: 72px; margin: 0 0 0 6px; }
.settings-table input[type=checkbox] { margin: 0; }
.settings-table .row-off td { opacity: .6; }
.people-table { width: auto; }
.people-table th, .people-table td { padding: 10px 8px; }
.people-table input[type=text], .people-table select { margin: 0; min-width: 0; padding: 7px 9px; font-size: 15.5px; }
.people-table .w-name { width: 100px; }
.people-table .w-slack { width: 150px; }
.people-table input.num { width: 70px; }
.people-table .w-login { width: 205px; }
.people-table .w-role { width: 160px; }
.people-table .row-off td { opacity: .6; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; margin: 0 14px 0 0; font-size: 15px; }
.subtle-cell { color: var(--text-dim); }
.row-actions { display: flex; gap: 8px; margin-top: 8px; }
.row-actions button { margin-top: 0; }
.feed-item { background: var(--panel); border: 1px solid var(--border); border-left: 4px solid #f5c451;
    border-radius: 10px; padding: 14px 18px; margin-bottom: 10px; }
.feed-item.done { border-left-color: var(--success-dim); opacity: .85; }
.feed-item .top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.feed-item .top b { font-size: 16px; overflow-wrap: anywhere; }
.feed-item p { margin: 6px 0 0 0; color: var(--text-dim); font-size: 15px; line-height: 1.45; }
.feed-item p.pre { white-space: pre-line; }
.feed-item .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.feed-item .foot form { margin: 0; }
.small { font-size: 14px; color: var(--text-dim); }
.note { font-size: 14px; color: var(--text-dim); margin-top: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-dim); font-size: 15.5px; text-decoration: none; white-space: nowrap;
    border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin: 6px 0 14px 0; }
.settings-row label { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: normal; margin: 0; }
.settings-row input.num { width: 80px; margin: 0; }
.table-scroll { overflow-x: auto; }
.settings-wide { display: block; max-width: 520px; font-size: 15px; margin-bottom: 10px; }
.stat-link { display: block; text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--danger); }
.failed-list { margin-top: 18px; scroll-margin-top: 80px; }
.failed-list summary { cursor: pointer; font-size: 17px; font-weight: 600; padding: 6px 0; }
#alerts { scroll-margin-top: 80px; }
.btn-ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.inline-form button { margin-top: 0; }
.btn-same { min-width: 10.5em; text-align: center; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14.5px; }
#domains, #settings { scroll-margin-top: 80px; }
