:root {
    --bg: #f7f4ec;
    --bg-soft: #fff8e5;
    --surface: #ffffff;
    --surface-2: #fbfaf7;
    --ink: #151b2d;
    --muted: #6b7280;
    --line: #e9e2d6;
    --brand: #ffb21a;
    --brand-2: #ff7a1a;
    --navy: #18243b;
    --cyan: #12b8b0;
    --gold: #ffb21a;
    --danger: #c24132;
    --success: #15835b;
    --warning: #b76a00;
    --shadow: 0 20px 50px rgba(24, 36, 59, .11);
    --shadow-soft: 0 10px 28px rgba(24, 36, 59, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, #fbfaf7 0, #f7f4ec 100%);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a { color: #0c766f; text-decoration: none; font-weight: 800; }
a:hover { color: var(--brand-2); }

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    background: #111827;
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.app-main { min-width: 0; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 8;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 30px;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid rgba(233, 226, 214, .92);
    backdrop-filter: blur(14px);
}

.app-header strong {
    display: block;
    color: var(--navy);
    font-size: 18px;
}

.section-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
}

.brand-symbol {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: #111827;
    background: linear-gradient(135deg, var(--brand), #ffd36c);
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(255, 178, 26, .28);
}

.brand-text span { display: block; color: rgba(255, 255, 255, .62); font-size: 12px; font-weight: 700; }
.brand-text strong { font-size: 16px; }

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

.side-nav a {
    color: rgba(255, 255, 255, .74);
    padding: 12px 13px;
    border-radius: 7px;
    font-weight: 800;
}

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

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 6px;
    padding: 8px 11px;
    background: #f3f7f7;
    border: 1px solid #dbe8e7;
    border-radius: 999px;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.container { width: min(1280px, calc(100% - 48px)); margin: 26px auto; }

.hero {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 26px;
    margin-bottom: 22px;
    padding: 34px;
    border: 1px solid rgba(233, 226, 214, .9);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 178, 26, .18), transparent 45%),
        linear-gradient(120deg, #ffffff 0, #ffffff 62%, #f3fbfa 100%);
    box-shadow: var(--shadow);
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 18px;
}

.page-head h1 { margin-bottom: 8px; font-size: 30px; }
.page-head p:not(.eyebrow) { max-width: 780px; margin: 0; color: var(--muted); }

.hero::after {
    content: "";
    position: absolute;
    right: 34px;
    top: 28px;
    width: 220px;
    height: 126px;
    border-radius: 8px;
    border: 1px solid rgba(18, 184, 176, .22);
    background:
        linear-gradient(#f9fafb 0 0) padding-box,
        linear-gradient(135deg, rgba(18, 184, 176, .36), rgba(255, 178, 26, .55)) border-box;
    box-shadow: 0 18px 38px rgba(24, 36, 59, .08);
    opacity: .55;
}

.hero > * { position: relative; z-index: 1; }
.hero p:not(.eyebrow) { max-width: 710px; margin-bottom: 0; color: #4b5563; font-size: 16px; }

.eyebrow {
    margin: 0 0 9px;
    color: #c66a00;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
    font-weight: 900;
}

h1, h2, h3 { margin: 0 0 12px; letter-spacing: 0; }
h1 { max-width: 780px; font-size: 36px; line-height: 1.12; color: var(--navy); }
h2 { font-size: 19px; color: var(--navy); }
p { line-height: 1.58; }

.muted, small { color: var(--muted); }

.card {
    background: rgba(255, 255, 255, .97);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.compact { width: min(430px, calc(100% - 24px)); }

.metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 136px;
    border-top: 4px solid var(--brand);
}

.metric-card:nth-child(2) { border-top-color: var(--cyan); }
.metric-card:nth-child(3) { border-top-color: var(--brand-2); }
.metric-card:nth-child(4) { border-top-color: #7c3aed; }
.metric-card:nth-child(5) { border-top-color: #475569; }

.metric-card::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 52px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 178, 26, .45), rgba(18, 184, 176, .45));
}

.metric-label { display: block; color: #526071; font-weight: 800; }
.metric-value { display: block; margin-top: 12px; font-size: 36px; line-height: 1; font-weight: 900; color: var(--navy); }
.metric-note { display: block; margin-top: 10px; max-width: 190px; color: var(--muted); font-size: 12px; }

.grid.two { display: grid; grid-template-columns: 1.08fr .92fr; gap: 20px; align-items: start; }
.grid.equal { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
    color: #667085;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: #fff8e5;
}
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fffdf7; }

.stack { display: grid; gap: 15px; }
label { display: grid; gap: 8px; font-weight: 800; color: #263246; }
input, textarea, select {
    width: 100%;
    border: 1px solid #ded8cd;
    border-radius: 7px;
    padding: 12px 13px;
    font: inherit;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border-color .16s, box-shadow .16s, background .16s;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(255, 178, 26, .18);
    background: #fffefb;
}

.check { display: flex; align-items: center; gap: 9px; font-weight: 750; }
.check input { width: auto; accent-color: var(--brand-2); }

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 44px;
    border: 0;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #111827;
    padding: 12px 18px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(255, 122, 26, .23);
}
button:hover, .button:hover { color: #111827; filter: brightness(.99); transform: translateY(-1px); }
button.danger { background: #fff1ef; color: var(--danger); border: 1px solid #ffd0ca; box-shadow: none; }

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #fff3cf;
    color: #9a5a00;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 900;
}
.pill.pending { background: #fff3df; color: var(--warning); }
.pill.responded { background: #e8f7f4; color: var(--success); }

.auth, .survey-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth {
    background:
        linear-gradient(135deg, rgba(255, 178, 26, .24), transparent 44%),
        linear-gradient(225deg, rgba(18, 184, 176, .14), transparent 40%),
        #fffaf0;
}

.public {
    background:
        linear-gradient(180deg, #fff8e7 0, #f9f5ec 48%, #f7f4ec 100%);
}
.survey-shell { align-items: center; }
.survey-card {
    width: min(820px, 100%);
    padding: 34px;
    border-top: 5px solid var(--brand);
}
.survey-card h1 { font-size: 32px; }

.ticket { padding: 14px 15px; background: #fffaf0; border: 1px solid var(--line); border-radius: 7px; }
.ticket-summary summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 900;
    color: var(--navy);
}
.ticket-summary summary::marker { color: var(--brand-2); }
.ticket-details {
    display: grid;
    gap: 10px;
    margin: 14px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.ticket-details div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.ticket-details dt { color: var(--muted); font-weight: 900; }
.ticket-details dd { margin: 0; }

.timeline-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.timeline-item:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline-item strong { display: block; color: var(--navy); }
.timeline-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 800; }
.timeline-item p { margin-bottom: 0; }

.alert { background: #fff4d6; border: 1px solid #ffd982; border-radius: 7px; padding: 12px 14px; color: #7a4a00; font-weight: 750; }

.question {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 19px;
    margin: 0;
    background: #fff;
    box-shadow: 0 8px 20px rgba(24, 36, 59, .04);
}
.question legend { padding: 0 8px; font-weight: 900; color: var(--navy); }
.stars { display: flex; flex-direction: row; justify-content: flex-start; gap: 8px; }
.stars input { position: absolute; opacity: 0; width: 0; }
.stars span { font-size: 44px; color: #d9d5ca; cursor: pointer; line-height: 1; transition: color .14s, transform .14s; }
.stars label.active span {
    color: var(--gold);
}
.stars label:hover span { transform: translateY(-1px); }

.empty {
    padding: 24px;
    border: 1px dashed #d8d0c3;
    border-radius: 8px;
    color: var(--muted);
    background: #fffaf0;
}

code {
    font-family: Consolas, "Courier New", monospace;
    color: #283747;
    background: #f6f1e8;
    border: 1px solid #eadfce;
    border-radius: 6px;
    padding: 2px 5px;
}

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-actions button {
    min-height: 36px;
    padding: 8px 11px;
}

.filter-card { margin-bottom: 20px; }
.filter-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(190px, 1fr)) minmax(132px, auto) minmax(104px, auto);
    gap: 14px;
    align-items: end;
}
.filter-form button,
.filter-form .button {
    width: 100%;
    white-space: nowrap;
}
.button.secondary {
    background: #fff8e5;
    color: var(--navy);
    border: 1px solid var(--line);
    box-shadow: none;
}
.bi-overview {
    display: grid;
    grid-template-columns: 1.35fr repeat(4, minmax(150px, 1fr));
    gap: 16px;
    align-items: stretch;
    margin-bottom: 18px;
}
.bi-hero-card {
    position: relative;
    overflow: hidden;
    min-height: 178px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .13), transparent 42%),
        #111827;
    border-color: rgba(255, 255, 255, .08);
}
.bi-hero-card.good { background-color: #0f5f46; }
.bi-hero-card.mid { background-color: #63460b; }
.bi-hero-card.bad { background-color: #6f1d1b; }
.bi-hero-card::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 170px;
    height: 170px;
    border: 26px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
}
.bi-hero-card .metric-label { color: rgba(255, 255, 255, .72); }
.bi-hero-card strong {
    display: block;
    margin-top: 14px;
    font-size: 58px;
    line-height: .95;
    font-weight: 950;
}
.bi-hero-card p {
    position: relative;
    z-index: 1;
    margin: 12px 0 18px;
    color: rgba(255, 255, 255, .78);
    font-weight: 750;
}
.nps-scale {
    position: relative;
    height: 9px;
    overflow: visible;
    border-radius: 999px;
    background: linear-gradient(90deg, #ef4444, #ffb21a, #22c55e);
}
.nps-scale span {
    position: absolute;
    top: 50%;
    width: 17px;
    height: 17px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #111827;
    transform: translate(-50%, -50%);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .24);
}
.bi-mini-card {
    min-height: 178px;
    display: grid;
    align-content: space-between;
    height: 100%;
}
.bi-mini-card span {
    color: var(--muted);
    font-weight: 900;
}
.bi-mini-card strong {
    display: block;
    color: var(--navy);
    font-size: 36px;
    line-height: 1;
    font-weight: 950;
}
.bi-mini-card small { font-weight: 800; }
.bi-board {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
    margin-bottom: 22px;
}
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 24px 0 12px;
}
.section-title h2 { margin: 0; font-size: 24px; }
.detail-grid { margin-bottom: 18px; }
.table-card {
    overflow: hidden;
    height: 100%;
}
.chart-card {
    min-height: 346px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-content: stretch;
}
.chart-card.chart-large { min-height: 384px; }
.chart-card.chart-medium { min-height: 342px; }
.chart-card.chart-large canvas { min-height: 286px; }
.chart-card.chart-medium canvas { min-height: 250px; }
.chart-card canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    margin-top: 4px;
    border: 1px solid rgba(233, 226, 214, .72);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 250, 240, .72), rgba(255, 255, 255, .96));
}
.compact-split { margin-top: 8px; }
.bar {
    display: block;
    min-width: 110px;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #f0eadf;
}
.bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--cyan));
}
.bi-split {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.insight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.insight-grid.vertical {
    grid-template-columns: 1fr;
    height: 100%;
}
.insight-grid.vertical div {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.grid.equal > .card {
    height: 100%;
}

.card table {
    table-layout: fixed;
}

.card td,
.card th {
    overflow-wrap: anywhere;
}
.insight-grid.vertical strong {
    margin-top: 0;
    font-size: 28px;
}
.insight-grid div {
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #fffaf0, #ffffff);
}
.insight-grid span {
    display: block;
    color: var(--muted);
    font-weight: 800;
}
.insight-grid strong {
    display: block;
    margin-top: 12px;
    color: var(--navy);
    font-size: 34px;
    line-height: 1;
    font-weight: 900;
}

@media (max-width: 1050px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
    }
    .side-nav {
        display: flex;
        flex-wrap: wrap;
        margin-top: 16px;
    }
    .app-header { position: static; padding: 16px; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bi-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bi-hero-card { grid-column: 1 / -1; }
    .bi-board { grid-template-columns: 1fr; }
    .span-4, .span-6, .span-8 { grid-column: auto; }
    .grid.two, .grid.equal { grid-template-columns: 1fr; }
    .hero::after { display: none; }
}

@media (max-width: 760px) {
    .container { width: min(100% - 24px, 1220px); margin: 16px auto; }
    .hero { align-items: stretch; flex-direction: column; padding: 22px; }
    .page-head { align-items: stretch; flex-direction: column; }
    .metrics { grid-template-columns: 1fr; }
    .bi-overview { grid-template-columns: 1fr; }
    .app-header { align-items: flex-start; flex-direction: column; }
    .header-actions { flex-wrap: wrap; }
    h1 { font-size: 28px; }
    .survey-card h1 { font-size: 27px; }
    th, td { padding: 10px; }
    .stars span { font-size: 38px; }
    .ticket-summary summary { align-items: flex-start; flex-direction: column; }
    .ticket-details div { grid-template-columns: 1fr; gap: 4px; }
    .filter-form { grid-template-columns: 1fr; }
    .insight-grid { grid-template-columns: 1fr; }
}
