:root {
    --bg: #eef2f1;
    --panel: #ffffff;
    --panel-soft: #f6f8f7;
    --text: #18302b;
    --muted: #58706b;
    --line: #d5dfdc;
    --accent: #0f766e;
    --accent-strong: #0a5b55;
    --accent-soft: #d7efea;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --success: #0f766e;
    --success-soft: #e7f7f3;
    --shadow: 0 18px 40px rgba(19, 44, 41, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.08), transparent 30%),
        linear-gradient(180deg, #f4f7f6 0%, #e8eeec 100%);
    color: var(--text);
}

body {
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

code {
    background: #edf3f1;
    padding: 0.12rem 0.32rem;
    border-radius: 0.35rem;
}

.layout-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.layout-simple {
    display: block;
}

.candidate-body {
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.08), transparent 28%),
        linear-gradient(180deg, #f5f8f7 0%, #edf3f1 100%);
}

.candidate-header {
    border-bottom: 1px solid rgba(213, 223, 220, 0.9);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.candidate-header-inner {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.brand-inline {
    margin-bottom: 0;
}

.candidate-main {
    margin: 0 auto;
}

.candidate-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.candidate-user {
    color: var(--muted);
    font-weight: 600;
}

.sidebar {
    min-height: 100vh;
    padding: 2rem 1.4rem;
    background: linear-gradient(180deg, #163631 0%, #0f2a26 100%);
    color: #f4fbf8;
    position: sticky;
    top: 0;
}

.brand {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 2rem;
}

.brand-mark {
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 700;
    letter-spacing: 0.08em;
}

.brand-title {
    font-size: 1rem;
    font-weight: 700;
}

.brand-subtitle {
    font-size: 0.88rem;
    color: rgba(244, 251, 248, 0.74);
}

.nav {
    display: grid;
    gap: 0.45rem;
}

.nav-link {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 0.8rem;
    color: #eef8f5;
    background: rgba(255, 255, 255, 0.03);
}

.nav-link:hover {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.09);
}

.nav-link-muted {
    margin-top: 1rem;
}

.sidebar-meta {
    margin-top: 2rem;
    font-size: 0.92rem;
    color: rgba(244, 251, 248, 0.78);
}

.main {
    padding: 2.25rem;
    width: min(1200px, 100%);
}

.page-header {
    margin-bottom: 1.4rem;
}

.page-header h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.8rem, 2.5vw, 2.4rem);
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(213, 223, 220, 0.9);
    border-radius: 1.2rem;
    padding: 1.4rem;
    box-shadow: var(--shadow);
}

.panel-subtle {
    background: var(--panel-soft);
    box-shadow: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
}

.narrow {
    max-width: 760px;
}

.grid-cards,
.grid-two,
.grid-three,
.session-grid,
.score-grid {
    display: grid;
    gap: 1rem;
}

.grid-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.grid-two,
.session-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1rem;
}

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

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

.score-grid > div,
.meta-list > div,
.result-card,
.stat-card,
.timer-box {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: #fbfcfc;
}

.score-grid > div,
.result-card,
.stat-card {
    padding: 1rem;
}

.stat-label {
    display: block;
    color: var(--muted);
    margin-bottom: 0.45rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.field,
.checkbox {
    display: grid;
    gap: 0.45rem;
}

.field span {
    font-weight: 600;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c5d3cf;
    border-radius: 0.85rem;
    padding: 0.82rem 0.9rem;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 3rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.7);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox input {
    width: 1rem;
    height: 1rem;
}

.button-row,
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.82rem 1.1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.button-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #15807a 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
}

.button-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}

.button-block {
    width: 100%;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    background: #ecf4f2;
    color: var(--accent-strong);
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-soft {
    background: var(--accent-soft);
}

.alert {
    padding: 0.95rem 1.1rem;
    border-radius: 0.95rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    transition: opacity 0.4s ease;
}

.alert-success {
    background: var(--success-soft);
    border-color: #b9e5d9;
    color: var(--success);
}

.alert-error {
    background: var(--danger-soft);
    border-color: #f4c7c3;
    color: var(--danger);
}

.alert-fade {
    opacity: 0.6;
}

.plain-list {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.55rem;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    text-align: left;
    padding: 0.95rem 0.75rem;
    border-bottom: 1px solid #e1e8e6;
    vertical-align: top;
}

.table-actions {
    white-space: nowrap;
}

.empty-state {
    padding: 1.1rem;
    border-radius: 1rem;
    background: #f8fbfa;
    border: 1px dashed #c8d4d1;
    color: var(--muted);
}

.auth-card {
    max-width: 520px;
    margin: 6rem auto;
}

.meta-list {
    margin: 0;
    display: grid;
    gap: 0.8rem;
}

.meta-list > div {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
}

.meta-list dt {
    font-weight: 700;
}

.meta-list dd {
    margin: 0;
}

.conversation-list {
    display: grid;
    gap: 0.85rem;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.turn {
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid var(--line);
    background: #fcfdfd;
}

.turn header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.55rem;
    color: var(--muted);
}

.turn-user {
    background: #eff6f5;
}

.turn-patient {
    background: #fff;
}

.turn-hidden-self {
    opacity: 0.85;
}

.turn p {
    margin: 0;
    line-height: 1.55;
}

.turn audio {
    margin-top: 0.75rem;
    width: 100%;
}

.recorder-card {
    padding: 1rem;
    border-radius: 1rem;
    background: #f8faf9;
    border: 1px dashed #c7d5d2;
    margin-bottom: 1rem;
}

.timer-panel {
    display: grid;
    align-content: start;
}

.timer-box {
    padding: 1.1rem;
    margin-bottom: 1rem;
}

.timer-label {
    display: block;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

#timer-display {
    font-size: 2.5rem;
    letter-spacing: 0.04em;
}

.status-message,
.status-inline,
.muted,
.field-error {
    color: var(--muted);
}

.status-error,
.field-error {
    color: var(--danger);
}

.score-card {
    text-align: center;
}

.score-circle {
    width: 10rem;
    height: 10rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: radial-gradient(circle at top, #ffffff 0%, #f0fbf8 60%, #d7efea 100%);
    border: 1px solid #c3ddd7;
    display: grid;
    place-items: center;
    align-content: center;
}

.score-circle strong {
    font-size: 2.6rem;
    line-height: 1;
}

.result-card {
    display: grid;
    gap: 0.9rem;
}

.result-card p {
    margin: 0.3rem 0 0;
}

.stack-lg,
.stack-md,
.stack-xl {
    display: grid;
}

.stack-md {
    gap: 0.85rem;
}

.stack-lg {
    gap: 1rem;
}

.stack-xl {
    gap: 1.35rem;
}

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

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

    .main {
        width: 100%;
    }

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

@media (max-width: 760px) {
    .main {
        padding: 1rem;
    }

    .candidate-header-inner {
        width: calc(100% - 1rem);
        padding: 0.75rem 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .grid-cards,
    .grid-two,
    .grid-three,
    .session-grid,
    .score-grid {
        grid-template-columns: 1fr;
    }

    .meta-list > div {
        grid-template-columns: 1fr;
    }

    .button-row,
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        width: 100%;
    }
}
