/**
 * USTech AI Interview System — App Shell (Figma revamp)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Merriweather:wght@400;500;600;700&display=swap');

:root {
    --shell-bg: #f4f6f9;
    --shell-sidebar-bg: #ffffff;
    --shell-border: #e5e7eb;
    --shell-text: #111827;
    --shell-text-muted: #6b7280;
    --shell-text-light: #9ca3af;
    --shell-primary: #2563eb;
    --shell-primary-hover: #1d4ed8;
    --shell-primary-soft: #eff6ff;
    --shell-success: #16a34a;
    --shell-success-soft: #dcfce7;
    --shell-warning: #d97706;
    --shell-danger: #dc2626;
    --shell-card: #ffffff;
    --shell-radius: 12px;
    --shell-radius-lg: 16px;
    --shell-sidebar-width: 248px;
    --shell-topbar-height: 64px;
    --shell-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shell-serif: 'Merriweather', Georgia, 'Times New Roman', Times, serif;
    --shell-heading-color: #002347;
    --shell-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shell-shadow-md: 0 4px 16px rgba(16, 24, 40, 0.06);
}

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

body.app-shell-body {
    margin: 0;
    font-family: var(--shell-font);
    background: var(--shell-bg);
    color: var(--shell-text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.app-sidebar {
    width: var(--shell-sidebar-width);
    background: var(--shell-sidebar-bg);
    border-right: 1px solid var(--shell-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.app-layout.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
}

.app-layout.sidebar-collapsed .app-main {
    margin-left: 0;
}

.app-sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--shell-border);
}

.app-sidebar-brand img {
    height: 40px;
    width: auto;
    display: block;
}

.app-sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.app-nav-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--shell-text-light);
    padding: 8px 12px 6px;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--shell-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}

.app-nav-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.app-nav-link:hover {
    background: #f3f4f6;
    color: var(--shell-text);
}

.app-nav-link.active {
    background: var(--shell-primary-soft);
    color: var(--shell-primary);
}

.app-nav-link.active svg {
    opacity: 1;
    stroke: var(--shell-primary);
}

.app-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--shell-border);
    font-size: 12px;
    color: var(--shell-text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-sidebar-footer svg {
    color: var(--shell-success);
}

/* ── Main area ── */
.app-main {
    flex: 1;
    margin-left: var(--shell-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.22s ease;
}

.app-topbar {
    height: var(--shell-topbar-height);
    background: var(--shell-card);
    border-bottom: 1px solid var(--shell-border);
    display: flex;
    align-items: center;
    padding: 0 24px 0 20px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-sidebar-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid var(--shell-border);
    border-radius: 10px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--shell-text-muted);
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 51;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.app-sidebar-toggle:hover {
    background: var(--shell-primary-soft);
    border-color: #bfdbfe;
    color: var(--shell-primary);
}

.app-sidebar-toggle:focus-visible {
    outline: 2px solid var(--shell-primary);
    outline-offset: 2px;
}

.app-sidebar-toggle .toggle-icon {
    display: block;
}

.app-sidebar-toggle .toggle-icon--closed {
    display: none;
}

.app-layout.sidebar-collapsed .app-sidebar-toggle .toggle-icon--open {
    display: none;
}

.app-layout.sidebar-collapsed .app-sidebar-toggle .toggle-icon--closed {
    display: block;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    z-index: 90;
    border: none;
    padding: 0;
    cursor: pointer;
}

@media (max-width: 900px) {
    .sidebar-backdrop {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    .app-layout:not(.sidebar-collapsed) .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

.app-topbar-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
}

.app-topbar-text h1 {
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--shell-text);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.app-topbar-text p {
    margin: 2px 0 0;
    padding: 0;
    font-size: 12px;
    color: var(--shell-text-muted);
    line-height: 1.35;
}

.app-content {
    flex: 1;
    padding: 28px 32px 40px;
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
}

.app-content--wide {
    max-width: 1280px;
}

/* ── Page header ── */
.page-header-block {
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
    padding: 20px 36px 22px;
    margin-bottom: 24px;
    box-shadow: var(--shell-shadow-sm);
}

.page-header-block .page-eyebrow {
    margin-bottom: 8px;
}

.page-header-block .page-title-serif {
    margin-bottom: 10px;
}

.page-header-block .page-desc {
    margin-bottom: 0;
    max-width: none;
    line-height: 1.55;
}

.page-header-block .flow-stepper {
    margin-top: 20px;
    margin-bottom: 0;
}

.page-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--shell-primary);
    margin-bottom: 8px;
}

.page-title-serif {
    font-family: var(--shell-serif);
    font-size: clamp(28px, 3vw, 34px);
    font-weight: 500;
    color: var(--shell-heading-color);
    margin: 0 0 10px;
    line-height: 1.25;
    letter-spacing: normal;
    max-width: none;
}

.page-desc {
    font-size: 14px;
    color: var(--shell-text-muted);
    margin: 0 0 24px;
    max-width: 640px;
    line-height: 1.6;
}

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

.page-header-row .page-header-main {
    flex: 1;
    min-width: 0;
}

.back-link-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--shell-text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    transition: color 0.15s;
}

.back-link-left:hover {
    color: var(--shell-primary);
}

/* ── Stepper ── */
.flow-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 28px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.flow-step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid var(--shell-border);
    background: #fff;
    color: var(--shell-text-light);
}

.flow-step.done .flow-step-circle {
    background: var(--shell-success-soft);
    border-color: var(--shell-success);
    color: var(--shell-success);
}

.flow-step.active .flow-step-circle {
    background: var(--shell-primary);
    border-color: var(--shell-primary);
    color: #fff;
}

.flow-step-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--shell-text-light);
}

.flow-step.done .flow-step-label,
.flow-step.active .flow-step-label {
    color: var(--shell-text);
}

.flow-step-connector {
    width: 48px;
    height: 2px;
    background: var(--shell-border);
    margin: 0 12px;
    flex-shrink: 0;
}

.flow-step-connector.done {
    background: var(--shell-success);
}

.flow-stepper--compact .flow-step-connector {
    width: 28px;
    margin: 0 8px;
}

.flow-stepper--compact .flow-step-label {
    font-size: 11px;
}

/* ── Cards ── */
.shell-card {
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
    box-shadow: var(--shell-shadow-sm);
}

.shell-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--shell-border);
}

.shell-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--shell-text);
}

.shell-card-title svg {
    color: var(--shell-primary);
}

.status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--shell-text-muted);
}

.status-pill.ready {
    background: var(--shell-success-soft);
    color: var(--shell-success);
}

.status-pill.pending {
    background: #fef3c7;
    color: #b45309;
}

.shell-card-body {
    padding: 20px;
}

/* ── Input tabs ── */
.shell-tabs {
    display: inline-flex;
    border: 1px solid var(--shell-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.shell-tab {
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: #f9fafb;
    color: var(--shell-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.shell-tab + .shell-tab {
    border-left: 1px solid var(--shell-border);
}

.shell-tab.active {
    background: #fff;
    color: var(--shell-text);
    box-shadow: var(--shell-shadow-sm);
}

.shell-tab:hover:not(.active) {
    background: #f3f4f6;
}

/* ── Upload zone ── */
.shell-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: 32px 20px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--shell-radius);
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
}

.shell-upload-zone:hover {
    border-color: var(--shell-primary);
    background: var(--shell-primary-soft);
}

.shell-upload-zone svg {
    color: var(--shell-primary);
    margin-bottom: 12px;
}

.shell-upload-zone .zone-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--shell-text);
    margin-bottom: 4px;
}

.shell-upload-zone .zone-hint {
    font-size: 12px;
    color: var(--shell-text-muted);
}

.shell-upload-zone input[type="file"] {
    display: none;
}

/* ── Form fields ── */
.shell-field {
    margin-bottom: 14px;
}

.shell-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--shell-text);
    margin-bottom: 6px;
}

.shell-field label .req {
    color: var(--shell-danger);
}

.shell-input,
.shell-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--shell-border);
    border-radius: 8px;
    font-family: var(--shell-font);
    font-size: 14px;
    color: var(--shell-text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.shell-input:focus,
.shell-textarea:focus {
    outline: none;
    border-color: var(--shell-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.shell-textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}

.metadata-grid .field-full {
    grid-column: 1 / -1;
}

.upload-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── Action footer ── */
.shell-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 24px;
    padding: 20px 24px;
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
}

.shell-action-bar h3 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
}

.shell-action-bar p {
    margin: 0;
    font-size: 13px;
    color: var(--shell-text-muted);
}

.btn-shell-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--shell-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--shell-font);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn-shell-primary:hover:not(:disabled) {
    background: var(--shell-primary-hover);
}

.btn-shell-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-shell-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #fff;
    color: var(--shell-text);
    border: 1px solid var(--shell-border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--shell-font);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.btn-shell-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* ── Rubrics (step 2) ── */
.rubric-panel {
    padding: 0;
    overflow: hidden;
}

.rubric-panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f9fafb;
    border-bottom: 1px solid var(--shell-border);
}

.rubric-panel-top .position-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--shell-text-light);
}

.rubric-panel-top .position-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--shell-text);
}

.rubric-count {
    font-size: 13px;
    color: var(--shell-text-muted);
}

.rubric-list {
    display: flex;
    flex-direction: column;
}

.rubric-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--shell-border);
    background: #fff;
    transition: background 0.15s ease;
}

.rubric-row:last-child {
    border-bottom: none;
}

.rubric-row.accepted {
    background: #f0fdf4;
}

.rubric-row-info {
    flex: 1;
    min-width: 0;
}

.rubric-row-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--shell-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.rubric-weight {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--shell-text-muted);
}

.rubric-row-desc {
    font-size: 12px;
    color: var(--shell-text-muted);
    margin-top: 2px;
}

.rubric-row-actions {
    display: flex;
    gap: 6px;
}

.rubric-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--shell-border);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}

.rubric-icon-btn.accept.active {
    background: var(--shell-success-soft);
    border-color: var(--shell-success);
    color: var(--shell-success);
}

.rubric-icon-btn.delete:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--shell-danger);
}

.rubric-add-row {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--shell-border);
}

.rubric-add-row input {
    flex: 1;
}

/* ── Format cards (step 3) ── */
.duration-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
    margin-bottom: 20px;
}

.duration-bar-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--shell-text-light);
}

.duration-bar-hint {
    font-size: 12px;
    color: var(--shell-text-muted);
    margin-top: 2px;
}

.duration-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--shell-border);
    border-radius: 10px;
    overflow: hidden;
}

.duration-toggle button {
    padding: 10px 18px;
    border: none;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--shell-font);
    color: var(--shell-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.duration-toggle button + button {
    border-left: 1px solid var(--shell-border);
}

.duration-toggle button.active {
    background: var(--shell-primary-soft);
    color: var(--shell-primary);
}

.format-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.format-card {
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.format-card:hover {
    border-color: var(--shell-primary);
    box-shadow: var(--shell-shadow-md);
}

.format-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--shell-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--shell-primary);
    margin-bottom: 16px;
}

.format-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.format-card > p {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--shell-text-muted);
    line-height: 1.5;
}

.format-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    flex: 1;
}

.format-features li {
    font-size: 13px;
    color: var(--shell-text-muted);
    padding: 5px 0 5px 22px;
    position: relative;
}

.format-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--shell-success);
    font-weight: 700;
    font-size: 12px;
}

.format-card .btn-shell-primary {
    width: 100%;
}

/* ── Session ready (step 4) ── */
#setupPhase {
    text-align: left;
}

#setupPhase .page-desc--left {
    max-width: none;
    text-align: left;
}

#setupPhase .flow-stepper {
    justify-content: flex-start;
}

.session-card {
    padding: 24px;
    max-width: none;
    margin: 0;
}

.session-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.session-meta-item {
    background: #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: left;
}

.session-meta-item .meta-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #374151;
    margin-bottom: 6px;
}

.session-meta-item .meta-value {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin-top: 0;
}

.share-link-box {
    background: #f8fafc;
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius);
    padding: 16px;
    margin-bottom: 20px;
}

.share-link-box label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--shell-text);
    margin-bottom: 10px;
}

.share-link-hint {
    font-size: 12px;
    color: var(--shell-text-muted);
    margin: 10px 0 0;
    text-align: left;
}

.share-link-row {
    display: flex;
    gap: 8px;
}

.share-link-row input {
    flex: 1;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    padding: 10px 12px;
    border: 1px solid var(--shell-border);
    border-radius: 8px;
    background: #fff;
    color: var(--shell-text-muted);
}

/* ── Analysis library ── */
.library-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 16px;
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
    margin-bottom: 24px;
}

.library-filters .search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--shell-border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 12px center;
}

.library-filters select {
    padding: 10px 32px 10px 12px;
    border: 1px solid var(--shell-border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.interview-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.interview-card-v2 {
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
    padding: 20px;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.interview-card-v2.clickable {
    cursor: pointer;
}

.interview-card-v2.clickable:hover {
    border-color: var(--shell-primary);
    box-shadow: var(--shell-shadow-md);
}

.interview-card-v2 .card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--shell-text-muted);
    margin-bottom: 12px;
}

.interview-card-v2 .card-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
}

.interview-card-v2 .card-date {
    font-size: 12px;
    color: var(--shell-text-light);
    margin: 0 0 12px;
}

.interview-card-v2 .card-role {
    font-size: 13px;
    color: var(--shell-text-muted);
    margin: 0 0 16px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.interview-card-v2 .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.score-badge {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--shell-text);
}

.match-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}

.match-badge.possible {
    background: #dbeafe;
    color: #1d4ed8;
}

.match-badge.no-match {
    background: #fee2e2;
    color: #b91c1c;
}

.match-badge.processing {
    background: #f3f4f6;
    color: var(--shell-text-muted);
}

.view-analysis-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--shell-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ── Utilities ── */
.hidden { display: none !important; }
.error-banner {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 14px;
}

.loader-inline {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: shell-spin 0.7s linear infinite;
}

@keyframes shell-spin {
    to { transform: rotate(360deg); }
}

.spinner-shell {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--shell-primary);
    border-radius: 50%;
    animation: shell-spin 0.8s linear infinite;
}

.session-preparing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 48px 24px;
    gap: 20px;
}

.session-preparing-spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

.session-preparing .preparing-text {
    font-size: 16px;
    color: var(--shell-text-muted);
    margin: 0;
}

.loading-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: var(--shell-text-muted);
    font-size: 14px;
}

/* ── Live interview session ── */
.live-session-card {
    padding: 0;
    overflow: hidden;
}

.live-stage-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--shell-border);
}

.live-stage-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--shell-primary);
    margin-bottom: 4px;
}

.live-stage-desc {
    margin: 0;
    font-size: 13px;
    color: var(--shell-text-muted);
}

.live-stage-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.live-recording-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
}

.live-recording-badge .rec-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #dc2626;
    animation: rec-blink 1s infinite;
}

@keyframes rec-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.live-timer {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--shell-text);
}

.live-video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px 24px 0;
}

.live-video-panel {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #111827;
    aspect-ratio: 16 / 10;
}

.live-video-panel img,
.live-video-panel video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.live-video-panel.candidate-panel {
    background: #e5e7eb;
}

.live-video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #9ca3af;
    pointer-events: none;
}

.live-video-placeholder svg {
    opacity: 0.5;
}

.live-video-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
}

.live-video-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.live-speaking-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    backdrop-filter: blur(4px);
}

.live-video-badge {
    margin: 0 auto;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(17,24,39,0.75);
    color: #fff;
}

.live-progress-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 24px 0;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1px solid var(--shell-border);
    border-radius: 10px;
}

.live-progress-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.live-progress-left svg {
    flex-shrink: 0;
    color: var(--shell-primary);
}

.live-progress-left strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--shell-text);
}

.live-progress-left span {
    display: block;
    font-size: 12px;
    color: var(--shell-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-audio-viz {
    flex-shrink: 0;
}

.live-audio-viz .wave-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 28px;
}

.live-audio-viz .wave-bar {
    width: 4px;
    background: var(--shell-primary);
    border-radius: 2px;
    animation: live-wave 1.2s ease-in-out infinite;
}

.live-audio-viz .wave-bar:nth-child(1) { animation-delay: 0s; height: 10px; }
.live-audio-viz .wave-bar:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.live-audio-viz .wave-bar:nth-child(3) { animation-delay: 0.2s; height: 22px; }
.live-audio-viz .wave-bar:nth-child(4) { animation-delay: 0.3s; height: 16px; }
.live-audio-viz .wave-bar:nth-child(5) { animation-delay: 0.4s; height: 10px; }

@keyframes live-wave {
    0%, 100% { transform: scaleY(0.45); }
    50% { transform: scaleY(1); }
}

.live-transcript-v2 {
    margin: 16px 24px 0;
    padding-top: 16px;
    border-top: 1px solid var(--shell-border);
}

.live-transcript-v2 h4 {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--shell-primary);
}

.live-transcript-v2 #transcriptContent {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.live-transcript-v2 .transcript-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.live-transcript-v2 .transcript-message.emma {
    align-self: flex-start;
    background: #f3f4f6;
    margin: 0;
}

.live-transcript-v2 .transcript-message.candidate {
    align-self: flex-end;
    background: #dbeafe;
    margin: 0;
}

.live-transcript-v2 .message-role {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--shell-text-light);
    margin-bottom: 4px;
}

.live-transcript-v2 .message-content {
    margin: 0;
    color: var(--shell-text);
}

.live-session-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 24px 24px;
}

.btn-end-interview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid var(--shell-border);
    border-radius: 10px;
    background: #fff;
    color: var(--shell-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-end-interview:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.live-incomplete-warning {
    margin: 12px 24px 0;
    padding: 12px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
}

.live-incomplete-warning strong {
    display: block;
    margin-bottom: 4px;
}

.interview-card-v2 .card-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.interview-card-v2 .card-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}

.interview-card-v2:hover .card-delete-btn {
    opacity: 1;
}

.interview-card-v2 .card-delete-btn:hover {
    background: #fee2e2;
}

.interview-card-v2 .card-delete-btn svg {
    stroke: #dc2626;
}

.interview-card-v2 .card-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.btn-view-analysis {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--shell-border);
    border-radius: 8px;
    background: #fff;
    color: var(--shell-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.interview-card-v2.clickable:hover .btn-view-analysis {
    border-color: var(--shell-primary);
    color: var(--shell-primary);
}

/* ── Post-interview overlay ── */
.post-interview-overlay {
    position: fixed;
    inset: 0;
    background: var(--shell-bg);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10000;
    overflow-y: auto;
    padding: 48px 20px 40px;
    animation: postOverlayIn 0.25s ease;
}

@keyframes postOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.post-interview-card {
    background: var(--shell-card);
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-lg);
    box-shadow: var(--shell-shadow-md);
    width: 100%;
    max-width: 560px;
    padding: 32px 32px 28px;
    text-align: left;
    animation: postCardIn 0.35s ease;
}

@keyframes postCardIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.post-interview-card .page-eyebrow {
    margin-bottom: 10px;
}

.post-interview-card .page-title-serif {
    margin-bottom: 10px;
}

.post-interview-card .page-desc {
    margin-bottom: 24px;
    max-width: none;
    text-align: left;
}

.post-interview-wait-notice {
    color: #b91c1c !important;
    font-weight: 600;
    margin-top: -8px;
    margin-bottom: 20px !important;
}

.post-interview-card--complete .post-interview-wait-notice {
    display: none;
}

.post-interview-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.post-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--shell-border);
    background: #f9fafb;
    transition: background 0.2s, border-color 0.2s;
}

.post-step--pending {
    background: #f9fafb;
    border-color: #eef0f3;
}

.post-step--active {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.post-step--done-green {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.post-step--done-teal {
    background: #ecfeff;
    border-color: #a5f3fc;
}

.post-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.post-step--pending .post-step-icon {
    background: #e5e7eb;
    color: #9ca3af;
}

.post-step--active .post-step-icon {
    background: var(--shell-primary);
    color: #fff;
}

.post-step--done-green .post-step-icon {
    background: #16a34a;
    color: #fff;
}

.post-step--done-teal .post-step-icon {
    background: #0891b2;
    color: #fff;
}

.post-step-icon .step-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: shell-spin 0.7s linear infinite;
}

.post-step-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--shell-text);
    margin-bottom: 2px;
}

.post-step-subtitle {
    font-size: 12px;
    color: var(--shell-text-muted);
}

.post-interview-progress-footer {
    padding-top: 4px;
}

.post-interview-progress-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--shell-text);
}

.post-interview-progress-labels span:last-child {
    color: var(--shell-primary);
}

.post-interview-progress-track {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.post-interview-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--shell-primary);
    border-radius: 999px;
    transition: width 0.45s ease;
}

.post-interview-card--complete {
    text-align: center;
}

.post-interview-card--complete .page-eyebrow,
.post-interview-card--complete .page-title-serif,
.post-interview-card--complete .page-desc {
    text-align: center;
}

.post-interview-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.post-interview-redirect-note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--shell-text-muted);
}

@media (max-width: 900px) {
    .app-main { margin-left: 0; }
    .app-layout:not(.sidebar-collapsed) .app-sidebar {
        box-shadow: 4px 0 24px rgba(16, 24, 40, 0.12);
    }
    .app-layout.sidebar-collapsed .app-sidebar {
        transform: translateX(-100%);
    }
    .app-layout:not(.sidebar-collapsed) .app-sidebar {
        transform: translateX(0);
    }
    .upload-grid-2,
    .format-grid,
    .metadata-grid { grid-template-columns: 1fr; }
    .session-meta-grid { grid-template-columns: 1fr; }
    .shell-action-bar { flex-direction: column; align-items: stretch; }
    .live-video-grid { grid-template-columns: 1fr; }
    .live-stage-header { flex-direction: column; }
}

/* Bridge legacy style.css tokens when loaded with app shell */
.app-shell-body {
    --accent-color: var(--shell-primary);
    --primary-color: var(--shell-heading-color);
    --secondary-color: var(--shell-text-muted);
    --border-radius: var(--shell-radius-lg);
    --shadow: var(--shell-shadow-sm);
    --transition: 0.15s ease;
}

.app-shell-body .analysis-card {
    border-radius: var(--shell-radius-lg);
    border: 1px solid var(--shell-border);
    box-shadow: var(--shell-shadow-sm);
}

.app-shell-body .submit-btn {
    background: var(--shell-primary);
    border-radius: 10px;
}

.app-shell-body .submit-btn:hover {
    background: var(--shell-primary-hover);
}

.thank-you-countdown {
    font-size: 48px;
    font-weight: 700;
    color: var(--shell-primary);
    margin: 12px 0;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    min-width: 2.5ch;
    text-align: center;
}
