:root {
    --blue: #1269c7;
    --blue-2: #e8f2ff;
    --ink: #102a43;
    --muted: #62748e;
    --line: #dbe7f7;
    --bg: #f6f9fd;
    --success: #0f8a5f;
    --danger: #c0392b;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
.app-shell {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    position: sticky;
    top: 0;
    width: 260px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 16px;
    background: #fff;
    border-right: 1px solid var(--line);
}
.public-topbar {
    padding: 16px clamp(16px, 4vw, 42px);
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}
.brand.compact span:last-child { font-size: 19px; }
.logo-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font-weight: 950;
}
.side-nav {
    display: grid;
    gap: 7px;
}
.side-nav a, .button, button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 13px;
    background: #fff;
    color: var(--ink);
    font-weight: 750;
    cursor: pointer;
}
.side-nav a.active, .settings-tabs a.active, .primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.nav-group {
    display: grid;
    gap: 7px;
}
.side-nav a.sub {
    margin-left: 18px;
    min-height: 34px;
    padding: 7px 12px;
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
}
.side-nav a.sub.active {
    background: var(--blue-2);
    color: var(--blue);
}
.sidebar-user {
    margin-top: auto;
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
}
.sidebar-user span { font-weight: 850; }
.sidebar-user a { margin-top: 8px; font-weight: 850; }
.container {
    width: min(1180px, calc(100% - 28px));
    margin: 28px auto 56px;
}
.app-shell .container {
    flex: 1;
    min-width: 0;
}
.auth-card {
    width: min(460px, 100%);
    margin: 48px auto;
    padding: 28px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(18, 55, 105, .08);
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.05; }
h2 { font-size: 20px; }
.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-weight: 850;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .08em;
}
.hero-row, .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}
.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.metrics div, .panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}
.metrics span, .detail span, small, .muted { color: var(--muted); }
.metrics strong { display: block; margin-top: 8px; font-size: 30px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); align-items: start; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--ink); font-weight: 750; }
input, select, textarea {
    width: 100%;
    border: 1px solid #c9d8ea;
    border-radius: 8px;
    padding: 11px 12px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 3px solid var(--blue-2);
    border-color: var(--blue);
}
.password-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}
.password-row button {
    justify-content: center;
    min-width: 72px;
}
.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--blue-2);
}
.toggle-row input {
    width: 18px;
    height: 18px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td small { display: block; margin-top: 3px; }
.pill {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--blue-2);
    color: var(--blue);
    font-weight: 800;
    font-size: 12px;
}
.due { color: var(--danger); font-weight: 850; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; }
.actions a {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 9px;
    background: #fff;
    font-weight: 800;
    white-space: nowrap;
}
.actions.big a { padding: 10px 14px; }
.inline {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}
.detail {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}
.note-box, .copy-box {
    padding: 13px;
    border-radius: 8px;
    background: var(--blue-2);
    overflow-wrap: anywhere;
}
.timeline {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.timeline time { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.alert, .success {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
}
.alert { background: #fff0ee; color: var(--danger); border: 1px solid #ffd2cc; }
.success { background: #ecfff8; color: var(--success); border: 1px solid #bcebd9; }
.empty { color: var(--muted); margin: 0; }
.settings-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.settings-tabs {
    position: sticky;
    top: 22px;
    display: grid;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.settings-tabs a {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 9px 11px;
    border-radius: 8px;
    color: var(--ink);
    font-weight: 800;
}
.team-row {
    grid-template-columns: 1fr 160px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.team-row small {
    display: block;
    margin-top: 3px;
}

@media (max-width: 820px) {
    .app-shell { display: block; }
    .sidebar {
        position: static;
        width: auto;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .side-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .nav-group { grid-column: 1 / -1; }
    .hero-row, .panel-head { align-items: flex-start; flex-direction: column; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .grid.two { grid-template-columns: 1fr; }
    .inline { grid-template-columns: 1fr; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .metrics { grid-template-columns: 1fr; }
    .side-nav { grid-template-columns: 1fr; }
    .settings-tabs { grid-template-columns: 1fr; }
    .password-row, .team-row { grid-template-columns: 1fr; }
    .detail { display: grid; gap: 5px; }
}
