:root {
    --ink: #111820;
    --ink-soft: #516070;
    --paper: #f7f9f8;
    --panel: #ffffff;
    --line: #d9e1df;
    --teal: #10a99a;
    --teal-dark: #087a72;
    --amber: #d88a1d;
    --blue: #2368b4;
    --danger: #b42333;
    --charcoal: #0a1118;
    --sidebar: #111a22;
    --radius: 8px;
    --shadow: 0 16px 48px rgba(17, 24, 32, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button,
input,
textarea,
select {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--teal), var(--blue));
}

.button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 750;
    white-space: nowrap;
}

.button {
    color: #fff;
    background: var(--teal-dark);
    box-shadow: 0 8px 24px rgba(8, 122, 114, 0.25);
}

.button:hover {
    background: #076b64;
}

.button-secondary,
.ghost-button {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
    box-shadow: none;
}

.button-small {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.92rem;
}

.danger-button {
    color: #fff;
    background: var(--danger);
}

.text-link {
    color: var(--teal-dark);
    font-weight: 750;
}

.eyebrow {
    margin-bottom: 10px;
    color: var(--teal-dark);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
}

.marketing-shell {
    background: #fff;
}

.marketing-nav {
    position: absolute;
    z-index: 10;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 72px;
    padding: 16px clamp(20px, 5vw, 72px);
    color: #fff;
}

.marketing-links {
    display: flex;
    align-items: center;
    gap: 18px;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 700;
}

.marketing-links a {
    padding: 8px 0;
}

.marketing-links .is-active,
.marketing-links a:hover {
    color: #fff;
}

.marketing-hero {
    display: flex;
    align-items: center;
    min-height: 84vh;
    padding: 128px clamp(20px, 5vw, 72px) 72px;
    color: #fff;
    background-position: center;
    background-size: cover;
}

.hero-copy {
    width: min(650px, 100%);
}

.hero-copy h1,
.page-hero h1 {
    margin-bottom: 18px;
    font-size: clamp(3rem, 7vw, 6.2rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.hero-lede,
.page-hero p {
    max-width: 650px;
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(1.05rem, 2.2vw, 1.32rem);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.section {
    padding: 72px clamp(20px, 5vw, 72px);
}

.band-light {
    background: #f4f8f6;
}

.section-heading {
    max-width: 780px;
    margin-bottom: 28px;
}

.section-heading h2,
.split-band h2,
.page-hero h1 {
    font-size: clamp(2rem, 4vw, 3.8rem);
    line-height: 1.04;
    letter-spacing: 0;
}

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

.feature-card,
.contact-panel,
.data-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 24px;
}

.feature-card h2,
.feature-card h3,
.data-row h2,
.contact-panel h2 {
    margin-bottom: 10px;
    font-size: 1.14rem;
}

.feature-card p,
.data-row p,
.contact-panel p {
    color: var(--ink-soft);
}

.split-band {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
    gap: 32px;
    align-items: center;
    background: var(--charcoal);
    color: #fff;
}

.split-band .eyebrow {
    color: #74d8cd;
}

.metric-row {
    display: grid;
    gap: 14px;
}

.metric-row div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.metric-row strong {
    color: #fff;
    font-size: 1.25rem;
}

.metric-row span {
    color: rgba(255, 255, 255, 0.72);
    text-align: right;
}

.page-hero {
    padding: 132px clamp(20px, 5vw, 72px) 64px;
    color: #fff;
    background: linear-gradient(135deg, #101922, #12302d 48%, #3b2a15);
}

.compact-hero {
    min-height: 440px;
}

.data-list {
    display: grid;
    gap: 12px;
}

.data-row {
    display: grid;
    grid-template-columns: minmax(180px, 0.32fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.pricing-grid {
    background: #fff;
}

.contact-panel {
    max-width: 760px;
}

.marketing-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 24px clamp(20px, 5vw, 72px);
    color: var(--ink-soft);
    border-top: 1px solid var(--line);
}

.login-section {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 112px 20px 48px;
    background: linear-gradient(135deg, #101922, #173531 55%, #443018);
}

.auth-panel {
    width: min(440px, 100%);
    padding: 28px;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.auth-panel h1 {
    font-size: 2rem;
}

.auth-panel label,
.form-panel label,
.filter-grid label {
    display: grid;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 0.88rem;
    font-weight: 750;
}

input,
textarea,
select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
}

input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin-right: 8px;
}

textarea {
    resize: vertical;
}

.auth-panel .button {
    width: 100%;
    margin-top: 14px;
}

.flash {
    position: relative;
    z-index: 20;
    width: min(920px, calc(100% - 40px));
    margin: 14px auto;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 10px 30px rgba(17, 24, 32, 0.08);
}

.flash-success {
    border-color: rgba(16, 169, 154, 0.35);
}

.flash-error {
    border-color: rgba(180, 35, 51, 0.35);
}

.app-shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
    background: #edf3f1;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    color: #fff;
    background: var(--sidebar);
}

.sidebar-brand {
    min-height: 44px;
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-nav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 750;
}

.side-nav a:hover,
.side-nav .is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-logout {
    margin-top: auto;
}

.sidebar .ghost-button {
    width: 100%;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
}

.workspace {
    min-width: 0;
    padding: 24px clamp(18px, 3vw, 36px) 48px;
}

.workspace-topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.workspace-topbar h1 {
    margin-bottom: 0;
    font-size: clamp(1.55rem, 3vw, 2.3rem);
    line-height: 1.1;
}

.user-pill {
    min-width: 190px;
    display: grid;
    justify-items: end;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.user-pill span {
    font-weight: 800;
}

.user-pill small {
    color: var(--ink-soft);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 10px 30px rgba(17, 24, 32, 0.06);
}

.stat-card {
    min-height: 118px;
    padding: 18px;
}

.stat-card span {
    color: var(--ink-soft);
    font-weight: 750;
}

.stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    line-height: 1;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
    gap: 18px;
    margin-bottom: 18px;
}

.panel {
    padding: 18px;
}

.panel-heading,
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-heading h2 {
    margin-bottom: 0;
    font-size: 1.15rem;
}

.compact-list,
.activity-list,
.module-list {
    display: grid;
    gap: 10px;
}

.compact-item,
.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.compact-item:last-child,
.activity-item:last-child {
    border-bottom: 0;
}

.compact-item span {
    min-width: 0;
}

.compact-item small,
.activity-item small,
.data-table small {
    display: block;
    color: var(--ink-soft);
}

.module-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-list span {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 8px;
    background: #edf8f6;
    color: var(--teal-dark);
    font-weight: 750;
}

.toolbar {
    align-items: end;
}

.filter-grid {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.4fr) minmax(150px, 0.35fr) auto auto;
    gap: 12px;
    align-items: end;
}

.table-panel {
    padding: 0;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table th {
    color: var(--ink-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #f8fbfa;
}

.data-table th a {
    color: var(--ink-soft);
}

.table-title {
    display: inline-block;
    color: var(--teal-dark);
    font-weight: 850;
}

.badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    border-radius: 8px;
    padding: 0 10px;
    color: #055c55;
    background: #dff6f2;
    font-size: 0.84rem;
    font-weight: 800;
}

.badge-muted {
    color: #59636d;
    background: #edf0f2;
}

.score-line {
    width: 120px;
    height: 8px;
    overflow: hidden;
    border-radius: 8px;
    background: #e6ecea;
}

.score-line span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--amber), var(--teal));
}

.form-panel {
    display: grid;
    gap: 18px;
}

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

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.project-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: start;
    margin-bottom: 18px;
}

.project-header h2 {
    margin-bottom: 8px;
    font-size: 1.8rem;
}

.project-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.prose-panel h2,
.prose-panel h3 {
    margin-bottom: 8px;
}

.prose-panel h3 {
    margin-top: 18px;
    color: var(--ink-soft);
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.prose-panel p {
    color: var(--ink-soft);
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 18px;
}

.chat-panel {
    display: grid;
    gap: 14px;
}

.chat-feed {
    display: grid;
    gap: 12px;
    max-height: 560px;
    overflow: auto;
    padding-right: 4px;
}

.chat-message {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fbfa;
}

.chat-assistant {
    background: #edf8f6;
    border-color: rgba(16, 169, 154, 0.28);
}

.chat-user {
    background: #fff;
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--ink-soft);
    text-transform: capitalize;
}

.chat-message p {
    margin-bottom: 0;
}

.chat-form {
    display: grid;
    gap: 12px;
}

.mic-status {
    align-self: center;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.prompt-chip {
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--teal-dark);
    background: #edf8f6;
    cursor: pointer;
    font-weight: 750;
    text-align: left;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .side-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sidebar-logout {
        margin-top: 0;
    }

    .stat-grid,
    .feature-grid,
    .pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two-column,
    .chat-layout,
    .split-band,
    .data-row {
        grid-template-columns: 1fr;
    }

    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .marketing-nav {
        position: static;
        color: var(--ink);
        background: #fff;
        border-bottom: 1px solid var(--line);
    }

    .marketing-links {
        display: none;
    }

    .marketing-hero {
        min-height: 78vh;
        padding-top: 72px;
        background-position: center right;
    }

    .hero-copy h1,
    .page-hero h1 {
        font-size: 3rem;
    }

    .feature-grid,
    .pricing-grid,
    .stat-grid,
    .form-grid,
    .filter-grid,
    .module-list,
    .side-nav {
        grid-template-columns: 1fr;
    }

    .workspace-topbar,
    .toolbar,
    .project-header,
    .marketing-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .user-pill {
        min-width: 0;
        justify-items: start;
    }

    .project-actions,
    .form-actions,
    .hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .button,
    .ghost-button,
    .danger-button {
        width: 100%;
    }
}
