:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --surface-alt: #f1f0eb;
    --border: #e5e3dc;
    --border-strong: #d8d4cb;

    --text: #171717;
    --text-soft: #5f5b53;
    --text-faint: #8a857c;

    --accent: #0f766e;
    --accent-hover: #115e59;
    --accent-soft: #e7f4f2;

    --danger-bg: #fef2f2;
    --danger-border: #f3c7c7;
    --danger-text: #8f1d1d;

    --info-bg: #eff6ff;
    --info-border: #cddff8;
    --info-text: #1f4f8a;

    --shadow-sm: 0 1px 2px rgba(20, 20, 20, 0.04);
    --shadow-md: 0 10px 30px rgba(20, 20, 20, 0.04);

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    --container: 1180px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

a:hover {
    color: var(--accent);
    text-decoration: none;
}

.container {
    width: min(var(--container), calc(100% - 32px));
    margin: 0 auto;
}

.page-shell {
    padding: 0 0 56px;
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(246, 245, 242, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(229, 227, 220, 0.9);
    margin-bottom: 28px;
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 86px;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.site-title {
    margin: 0;
    font-size: clamp(1.25rem, 1.7vw, 1.65rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title a:hover {
    color: inherit;
    text-decoration: none;
}

.site-subtitle {
    margin: 0;
    max-width: 520px;
    font-size: 0.96rem;
    color: var(--text-soft);
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 28px;
    flex: 0 0 auto;
    min-width: 0;
}

.top-nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    white-space: nowrap;
}

.nav-primary {
    padding-right: 6px;
}

.top-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-soft);
    text-decoration: none;
}

.top-nav a:hover {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.top-nav a[aria-current="page"] {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.header-account {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: 0;
}

.nav-text-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 2px;
    color: var(--text-soft);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
}

.nav-text-link:hover {
    color: var(--text);
    text-decoration: none;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-soft);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

.user-badge-label {
    font-size: 0.92rem;
    color: var(--text-soft);
}

.user-badge-name {
    font-size: 0.98rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.user-badge-role {
    font-size: 0.92rem;
    color: var(--text-faint);
}

@media (max-width: 1100px) {
    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 0;
    }

    .brand-block {
        width: 100%;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
        gap: 16px;
    }
}

@media (max-width: 820px) {
    .header-right {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-nav,
    .header-account {
        width: 100%;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .site-subtitle {
        max-width: none;
    }
}

@media (max-width: 640px) {
    .site-header {
        position: static;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .site-subtitle {
        font-size: 0.92rem;
    }

    .user-badge {
        min-height: 42px;
        padding: 0 14px;
        gap: 10px;
    }

    .user-badge-label,
    .user-badge-role,
    .user-badge-name {
        font-size: 0.9rem;
    }
}

/* Hero / page intro */

.page-intro,
.hero-panel {
    background: #ecebe7;
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: clamp(24px, 4vw, 48px);
    margin-bottom: 24px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.page-intro h1,
.hero-panel h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
    font-weight: 700;
}

.page-intro p,
.hero-panel p {
    margin: 0;
    max-width: 760px;
    font-size: 1.02rem;
    color: var(--text-soft);
}

.page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    margin-bottom: 16px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(216, 212, 203, 0.9);
    color: var(--text-soft);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Sections */

.section-stack {
    display: grid;
    gap: 20px;
}

.section-title {
    margin: 0 0 6px;
    font-size: 1.45rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.section-copy {
    margin: 0;
    color: var(--text-soft);
    max-width: 760px;
}

/* Cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card h2,
.card h3,
.card h4 {
    margin-top: 0;
    margin-bottom: 10px;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.card p:last-child,
.card ul:last-child,
.card ol:last-child {
    margin-bottom: 0;
}

.card-muted {
    background: #f9f8f5;
}

.card-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.card-grid > .card {
    margin-bottom: 0;
}

.report-card-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.report-card-title {
    margin: 4px 0 0;
    font-size: 1.4rem;
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.report-card-title a {
    color: var(--text);
}

.report-card-title a:hover {
    color: var(--accent);
}

.report-card-copy {
    margin: 0;
    color: var(--text-soft);
}

.report-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: var(--text-soft);
    font-size: 0.94rem;
}

@media (max-width: 960px) {
    .report-card-grid {
        grid-template-columns: 1fr;
    }
}

.span-12 { grid-column: span 12; }
.span-8  { grid-column: span 8; }
.span-6  { grid-column: span 6; }
.span-4  { grid-column: span 4; }
.span-3  { grid-column: span 3; }


/* Session Summaries */
.session-summary-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.session-summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.session-summary-title {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.session-summary-copy {
    margin: 0;
    color: var(--text-soft);
}

.session-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: var(--text-soft);
    font-size: 0.94rem;
}

@media (max-width: 960px) {
    .session-summary-grid {
        grid-template-columns: 1fr;
    }
}

.session-summary-id {
    margin: 0;
    color: var(--text-faint);
    font-size: 0.9rem;
}

/* Pills / meta / filters */

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pill,
.meta-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.9rem;
    font-weight: 500;
}

.meta-pill.is-accent {
    background: var(--accent-soft);
    border-color: rgba(15, 118, 110, 0.15);
    color: var(--accent);
}

/* KPI cards */

.kpi-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    margin: 0 0 8px;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    font-weight: 700;
}

.kpi-value {
    margin: 0;
    font-size: clamp(1.8rem, 2.7vw, 2.5rem);
    line-height: 1;
    letter-spacing: -0.04em;
    font-weight: 700;
    color: var(--text);
}

.kpi-note {
    margin: 10px 0 0;
    color: var(--text-soft);
    font-size: 0.94rem;
}

/* Actions / buttons */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0 0;
}

.button-link,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.08s ease;
}

.button-link:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--accent-hover);
    color: #ffffff;
    text-decoration: none;
}

.button-link:active,
button:active,
input[type="submit"]:active {
    transform: translateY(1px);
}

.button-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.button-secondary:hover {
    background: #f7f6f2;
    color: var(--text);
    border-color: var(--border-strong);
}

.button-ghost {
    background: transparent;
    color: var(--text-soft);
    border-color: var(--border);
}

.button-ghost:hover {
    background: var(--surface);
    color: var(--text);
}



/* Forms */

.form-card {
    width: 100%;
    max-width: 620px;
    padding: 22px;
    margin: 0 auto;
}

.login-intro {
    margin-bottom: 14px;
}

.login-title {
    margin: 0 0 4px;
    font-size: 2rem;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.login-subtitle {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.98rem;
    line-height: 1.45;
}

.form-row {
    margin-bottom: 14px;
}

.form-row:last-child {
    margin-bottom: 0;
}

label {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: #fcfcfa;
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    border-color: rgba(15, 118, 110, 0.45);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.08);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Notices */

.notice-error,
.notice-info,
.notice-success {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid;
    font-size: 0.95rem;
}

.notice-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.notice-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
}

.notice-success {
    background: #eefbf5;
    border-color: #ccebdc;
    color: #15603f;
}

/* Tables */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    min-width: 700px;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    vertical-align: top;
    text-align: left;
    font-size: 0.94rem;
}

th {
    background: #f6f5f1;
    color: var(--text-soft);
    font-weight: 700;
    white-space: nowrap;
}

tbody tr:hover {
    background: #faf9f6;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Lists / metadata */

ul.report-meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

ul.report-meta li {
    color: var(--text-soft);
}

.inline-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: #f2f1ed;
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.92em;
}

.muted {
    color: var(--text-soft);
}

.small {
    font-size: 0.92rem;
    color: var(--text-soft);
}

/* Charts */

.chart-shell {
    background: #fbfbf8;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 18px;
    width: 100% !important;
    height: auto !important;
}

canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

/* Utility blocks */

.split-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.stack-xs { display: grid; gap: 8px; }
.stack-sm { display: grid; gap: 12px; }
.stack-md { display: grid; gap: 16px; }
.stack-lg { display: grid; gap: 24px; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.noscript-banner {
    margin: 0 auto 20px;
    width: min(var(--container), calc(100% - 32px));
    padding: 14px 16px;
    border: 1px solid #ead9b0;
    border-radius: 16px;
    background: #fff9eb;
    color: #7b5b17;
    font-size: 0.95rem;
}

/* Footer */

.site-footer {
    padding: 12px 0 36px;
    color: var(--text-faint);
    font-size: 0.92rem;
}

/* Responsive */

@media (max-width: 960px) {
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 0;
    }

    .top-nav {
        justify-content: flex-start;
    }

    .span-8,
    .span-6,
    .span-4,
    .span-3 {
        grid-column: span 12;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .page-intro,
    .hero-panel {
        border-radius: 24px;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(var(--container), calc(100% - 20px));
    }

    .card {
        padding: 18px;
        border-radius: 20px;
    }

    .page-intro,
    .hero-panel {
        padding: 22px;
        margin-bottom: 18px;
    }

    .page-intro h1,
    .hero-panel h1 {
        font-size: 2rem;
    }

    th,
    td {
        padding: 12px 12px;
    }

    .button-link,
    button,
    input[type="submit"] {
        width: 100%;
    }

    .actions {
        display: grid;
    }
}