/* ═══════════════════════════════════════════════════════════
   Vulcan Line Tools — Sag Chart Creator
   Design system matched to iOS Wave Timer app (Light Mode)
   ═══════════════════════════════════════════════════════════ */

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

:root {
    /* Brand */
    --vlt-teal: #21CE99;
    --vlt-teal-dark: #1ab586;
    --vlt-teal-fill: rgba(33, 206, 153, 0.15);
    --vlt-teal-stroke: rgba(33, 206, 153, 0.45);
    --vlt-teal-stroke-strong: rgba(33, 206, 153, 0.5);
    --vlt-purple: #7B61FF;

    /* Backgrounds (light mode) */
    --bg-page: #9A9AA0;
    --bg-card: #FFFFFF;
    --bg-sub: #F2F2F7;
    --bg-input: #F2F2F7;

    /* Text */
    --text-primary: #000000;
    --text-secondary: #3C3C43;
    --text-tertiary: #8E8E93;
    --text-quaternary: #A1A1A6;

    /* Borders */
    --border-card: rgba(0, 0, 0, 0.15);
    --border-separator: #C6C6C8;

    /* Status */
    --color-success: #34C759;
    --color-warning: #FF9500;
    --color-error: #FF3B30;
    --color-warning-bg: #FFF8E1;
    --color-error-bg: #FFF0EF;
    --color-warning-border: #FFD54F;
    --color-error-border: #FFCDD2;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-pill: 100px;

    /* Shadows */
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.08);
    --shadow-modal: 0 0 20px rgba(0, 0, 0, 0.3);

    --logo-invert: 0;

    /* Font */
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', sans-serif;
}

/* ── Dark Mode ──────────────────────────────────────────── */
body.dark {
    --bg-page: #000000;
    --bg-card: #1C1C1E;
    --bg-sub: #2C2C2E;
    --bg-input: #3A3A3C;
    --text-primary: #FFFFFF;
    --text-secondary: #EBEBF5;
    --text-tertiary: #8E8E93;
    --text-quaternary: #636366;
    --border-card: rgba(255, 255, 255, 0.18);
    --border-separator: #48484A;
    --color-warning-bg: rgba(255, 149, 0, 0.15);
    --color-error-bg: rgba(255, 59, 48, 0.15);
    --color-warning-border: rgba(255, 149, 0, 0.3);
    --color-error-border: rgba(255, 59, 48, 0.3);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-modal: 0 0 30px rgba(0, 0, 0, 0.6);
    --logo-invert: 1;
}

html { font-size: 17px; }

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}


/* ── Typography Tokens ──────────────────────────────────── */
.text-title    { font-size: 24px; font-weight: 700; }
.text-title2   { font-size: 20px; font-weight: 600; }
.text-title3   { font-size: 18px; font-weight: 600; }
.text-headline { font-size: 17px; font-weight: 600; }
.text-body     { font-size: 17px; font-weight: 400; }
.text-sub      { font-size: 16px; font-weight: 400; }
.text-caption  { font-size: 14px; font-weight: 400; }
.text-caption2 { font-size: 13px; font-weight: 400; }
.text-section  { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-tertiary); }


/* ── Header ─────────────────────────────────────────────── */
header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-separator);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
}

.header-inner { display: flex; align-items: center; max-width: 1200px; width: 100%; margin: 0 auto; }
.logo-link { display: flex; align-items: center; text-decoration: none; }
.logo { height: 32px; width: auto; filter: invert(var(--logo-invert)); }
.header-title { display: flex; align-items: center; margin-left: 16px; }
.header-divider { width: 1px; height: 24px; background: var(--border-separator); margin-right: 16px; }
.header-page-name { font-size: 17px; font-weight: 500; color: var(--text-tertiary); }


/* ── Step Indicator ─────────────────────────────────────── */
.steps-bar { background: var(--bg-card); border-bottom: 1px solid var(--border-separator); padding: 12px 32px; }
.steps-inner { display: flex; align-items: center; justify-content: center; max-width: 600px; margin: 0 auto; }
.step { display: flex; align-items: center; gap: 6px; opacity: 0.35; transition: opacity 0.3s ease-in-out; }
.step.active { opacity: 1; }
.step.completed { opacity: 0.7; }
.step-number { width: 28px; height: 28px; border-radius: 50%; background: var(--text-quaternary); color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.step.active .step-number, .step.completed .step-number { background: var(--vlt-teal); }
.step-label { font-size: 14px; font-weight: 500; color: var(--text-tertiary); white-space: nowrap; }
.step.active .step-label { color: var(--text-primary); font-weight: 600; }
.step-line { flex: 1; height: 1px; background: var(--border-separator); margin: 0 8px; min-width: 24px; max-width: 60px; }


/* ── Main ───────────────────────────────────────────────── */
main { flex: 1; display: flex; justify-content: center; padding: 24px 16px; }
.step-section { width: 100%; max-width: 580px; display: none; }
.step-section.active { display: block; }
.step-section .card.wide { max-width: 960px; }
.verify-create-layout { max-width: 1100px; width: 100%; padding-left: 56px; }

/* ── Verify Flag ───────────────────────────────────────── */
.verify-create-layout .create-rs-block { position: relative; }
.verify-flag { position: absolute; right: 100%; top: 12px; width: 56px; padding: 6px 4px; border-radius: var(--r-sm) 0 0 var(--r-sm); border: 2px solid #FF9500; border-right: none; background: #FF9500; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 9px; font-weight: 700; font-family: var(--font); text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.2s; z-index: 5; box-shadow: -2px 2px 6px rgba(255, 149, 0, 0.4); }
.verify-flag::before { content: "VERIFY"; }
.verify-flag .verify-box { width: 18px; height: 18px; border-radius: 4px; border: 2px solid rgba(255,255,255,0.6); background: transparent; display: flex; align-items: center; justify-content: center; }
.verify-flag .verify-box svg { width: 12px; height: 12px; stroke: #fff; opacity: 0; }
.verify-flag:hover { background: #E08600; border-color: #E08600; }
.verify-flag.checked { background: var(--vlt-teal); border-color: var(--vlt-teal); box-shadow: -2px 2px 6px rgba(33, 206, 153, 0.4); }
.verify-flag.checked::before { content: "DONE"; }
.verify-flag.checked .verify-box { border-color: #fff; background: rgba(255,255,255,0.25); }
.verify-flag.checked .verify-box svg { opacity: 1; }
#step-verify { max-width: 960px; }


/* ── Card ───────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 3px solid #2C2C2E;
    border-radius: var(--r-xl);
    padding: 32px;
    box-shadow: var(--shadow-card);
}

.card h2 { font-size: 24px; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.card-subtitle { font-size: 16px; color: var(--text-tertiary); margin-bottom: 20px; }
.card.center { text-align: center; }


/* ── Drop Zone ──────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border-separator);
    border-radius: var(--r-md);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, background 0.2s ease-in-out;
    margin-top: 8px;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--vlt-teal); background: var(--vlt-teal-fill); }
.upload-icon { width: 48px; height: 48px; color: var(--text-quaternary); margin-bottom: 12px; }
.drop-zone:hover .upload-icon, .drop-zone.dragover .upload-icon { color: var(--vlt-teal); }
.drop-text { font-size: 17px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.drop-subtext { color: var(--text-tertiary); font-size: 16px; margin-bottom: 12px; }
.file-types { font-size: 14px; color: var(--text-tertiary); margin-top: 16px; }


/* ── File Info / List ───────────────────────────────────── */
.file-info { display: flex; align-items: center; justify-content: space-between; background: var(--bg-sub); border: 1px solid var(--border-card); border-radius: var(--r-sm); padding: 12px 16px; margin-top: 12px; }
.file-info-left { display: flex; align-items: center; gap: 12px; }
.file-icon { width: 24px; height: 24px; color: var(--vlt-teal); flex-shrink: 0; }
.file-name { font-weight: 500; font-size: 16px; word-break: break-all; }
.file-size { font-size: 14px; color: var(--text-tertiary); }
.btn-icon { background: none; border: none; font-size: 22px; color: var(--text-tertiary); cursor: pointer; line-height: 1; padding: 4px; }
.btn-icon:hover { color: var(--color-error); }

.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.file-list-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-sub); border: 1px solid var(--border-card); border-radius: var(--r-sm); padding: 10px 12px; font-size: 16px; }
.file-list-item-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-list-item-left svg { width: 20px; height: 20px; color: var(--vlt-teal); flex-shrink: 0; }
.file-list-item-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-list-item-size { color: var(--text-tertiary); font-size: 14px; margin-left: 6px; flex-shrink: 0; }
.file-list-item .btn-icon { font-size: 18px; padding: 2px; }


/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 24px;
    font-size: 17px; font-weight: 600; font-family: var(--font);
    border: none; border-radius: var(--r-lg);
    cursor: pointer; text-decoration: none;
    transition: background 0.2s ease-in-out, border-color 0.2s ease-in-out, opacity 0.2s ease-in-out;
    min-height: 48px;
}
.btn-primary { background: var(--vlt-teal); color: #fff; }
.btn-primary:hover { background: var(--vlt-teal-dark); }
.btn-outline { background: var(--bg-card); color: var(--vlt-teal); border: 2px solid var(--vlt-teal-stroke-strong); border-radius: var(--r-md); }
.btn-outline:hover { background: var(--vlt-teal-fill); }
.btn-text { background: none; border: none; color: var(--vlt-teal); font-size: 16px; font-weight: 500; cursor: pointer; padding: 8px 16px; margin-top: 8px; }
.btn-text:hover { opacity: 0.7; }
.upload-top-bar { display: flex; justify-content: flex-start; align-items: center; margin-bottom: 20px; }
.btn-lg { padding: 14px 40px; font-size: 18px; }
.full-width { width: 100%; margin-top: 12px; }
.btn-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.btn-row.center { justify-content: center; margin-bottom: 8px; }
.btn-primary.btn-disabled { background: var(--text-quaternary); cursor: not-allowed; }
.btn-primary.btn-disabled:hover { background: var(--text-quaternary); }


/* ── Progress ───────────────────────────────────────────── */
.progress-section { margin-top: 16px; }
.progress-bar { width: 100%; height: 4px; background: var(--bg-sub); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--vlt-teal); border-radius: 2px; transition: width 0.1s linear; }
.progress-fill.indeterminate { width: 30%; animation: indeterminate 1.5s ease-in-out infinite; }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.progress-text { text-align: center; margin-top: 8px; font-size: 14px; color: var(--text-tertiary); }


/* ── Format Detection ───────────────────────────────────── */
.detect-result { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.detect-badge { padding: 4px 12px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.detect-badge.high { background: var(--vlt-teal-fill); color: var(--vlt-teal-dark); }
.detect-badge.low { background: var(--color-warning-bg); color: #B45309; }
.detect-format-name { font-size: 20px; font-weight: 600; }
.detect-note { font-size: 16px; color: var(--text-tertiary); margin-bottom: 16px; }
.format-selector { margin-bottom: 16px; }
.format-label { display: block; font-size: 16px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
.format-options { display: flex; flex-wrap: wrap; gap: 8px; }
.format-option { padding: 10px 16px; border: 1.5px solid var(--border-separator); border-radius: var(--r-sm); background: var(--bg-card); cursor: pointer; font-size: 16px; font-family: var(--font); transition: border-color 0.2s, background 0.2s; }
.format-option:hover { border-color: var(--vlt-teal-stroke); background: var(--bg-sub); }
.format-option.selected { border-color: var(--vlt-teal); background: var(--vlt-teal-fill); color: var(--vlt-teal-dark); font-weight: 600; }
.format-option input[type="radio"] { display: none; }

.detect-file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.detect-file-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-sub); border: 1px solid var(--border-card); border-radius: var(--r-sm); font-size: 16px; }
.detect-file-name { font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.detect-file-format { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap; flex-shrink: 0; margin-left: 12px; }
.detect-file-format.fmt-image { background: #EDE9FE; color: #6D28D9; }
.detect-file-format.fmt-sag10 { background: var(--vlt-teal-fill); color: var(--vlt-teal-dark); }
.detect-file-format.fmt-plscadd { background: #DBEAFE; color: #1D4ED8; }
.detect-file-format.fmt-unknown { background: var(--bg-sub); color: var(--text-tertiary); }


/* ── Metadata / Fields ──────────────────────────────────── */
.metadata-fields { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-separator); }
.metadata-fields h3 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.field-grid.units-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-grid.units-row .field { width: 150px; }
.field-grid.units-row .field select { width: 100%; }
.field label { display: block; font-size: 14px; font-weight: 500; color: var(--text-tertiary); margin-bottom: 4px; }
.field input, .field select {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border-separator); border-radius: var(--r-md);
    font-size: 17px; font-family: var(--font); color: var(--text-primary);
    background: var(--bg-input);
    transition: border-color 0.2s ease-in-out;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--vlt-teal); box-shadow: 0 0 0 3px var(--vlt-teal-fill); }
.field input::placeholder { color: var(--text-quaternary); }


/* ── Verification ───────────────────────────────────────── */
.verify-alerts { margin-bottom: 12px; }
.verify-status { padding: 10px 14px; border-radius: var(--r-sm); font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.verify-status.status-ok { background: rgba(52, 199, 89, 0.15); color: #1B7A34; }
.verify-status.status-warning { background: var(--color-warning-bg); color: #92400E; }
.verify-status.status-error { background: var(--color-error-bg); color: #991B1B; }
.alert { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 8px; font-size: 16px; }
.alert strong { display: block; margin-bottom: 4px; }
.alert ul { margin-left: 20px; }
.alert-warning { background: var(--color-warning-bg); border: 1px solid var(--color-warning-border); color: #92400E; }
.alert-error { background: var(--color-error-bg); border: 1px solid var(--color-error-border); color: #991B1B; }

/* ── Conductor List Panel ───────────────────────────────── */
.conductor-list-panel { display: flex; flex-direction: column; border: 2px solid var(--border-card); border-radius: var(--r-md); overflow: hidden; margin-bottom: 12px; }
.conductor-list-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border: none; border-bottom: 1px solid var(--border-separator); background: var(--bg-card); cursor: pointer; font-size: 17px; font-weight: 500; font-family: var(--font); color: var(--text-secondary); text-align: left; width: 100%; transition: background 0.2s; }
.conductor-list-item:last-child { border-bottom: none; }
.conductor-list-label { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.conductor-list-arrows { display: flex; gap: 4px; flex-shrink: 0; }
.conductor-arrow-btn { background: none; border: 1.5px solid var(--border-separator); border-radius: 4px; color: var(--text-tertiary); font-size: 10px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; font-family: var(--font); transition: all 0.2s; }
.conductor-arrow-btn:hover { background: var(--bg-sub); border-color: var(--text-tertiary); color: var(--text-primary); }
.conductor-list-item:hover { background: var(--bg-sub); }
.conductor-list-item.active { background: var(--vlt-teal-fill); color: var(--text-primary); font-weight: 600; border-left: 3px solid var(--vlt-teal); }
.conductor-list-item.approved { color: var(--vlt-teal-dark); }
.conductor-list-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--text-quaternary); flex-shrink: 0; }
.conductor-list-item.active .conductor-list-dot, .conductor-list-item.approved .conductor-list-dot { border-color: var(--vlt-teal); background: var(--vlt-teal); }
.conductor-list-check { width: 20px; height: 20px; color: var(--vlt-teal); flex-shrink: 0; display: none; }
.conductor-list-item.approved .conductor-list-check { display: block; }
.conductor-list-item.approved .conductor-list-dot { display: none; }

.verify-action-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.verify-action-right { display: flex; gap: 8px; }
.conductor-detail { margin-bottom: 12px; }

/* ── Conductor Cards (verify) ───────────────────────────── */
.conductor-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.conductor-card { border: 2px solid var(--border-card); border-radius: var(--r-lg); overflow: hidden; }
.conductor-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg-sub); cursor: pointer; user-select: none; min-height: 48px; gap: 8px; }
.conductor-header:hover { background: #E8E8ED; }
.conductor-header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conductor-number { background: var(--vlt-teal); color: #fff; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap; }
.conductor-name { font-weight: 600; font-size: 17px; color: var(--text-primary); word-break: break-word; min-width: 0; }
.conductor-toggle { font-size: 14px; color: var(--text-tertiary); transition: transform 0.2s; }
.conductor-card.open .conductor-toggle { transform: rotate(180deg); }
.conductor-body { display: none; padding: 16px; border-top: 1px solid var(--border-separator); }
.conductor-card.open .conductor-body { display: block; }
.conductor-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 24px; margin-bottom: 12px; font-size: 14px; }
.conductor-meta dt { color: var(--text-tertiary); font-weight: 400; }
.conductor-meta dd { color: var(--text-primary); font-weight: 500; margin-bottom: 6px; }

/* ── Data Tables ────────────────────────────────────────── */
.dp-table-wrapper { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.dp-table-wrapper::-webkit-scrollbar { display: none; }
.dp-table { width: 100%; border-collapse: collapse; font-size: 14px; font-family: var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dp-table th { padding: 8px 10px; background: var(--bg-sub); color: var(--text-tertiary); font-weight: 600; font-size: 13px; text-align: right; border: 1px solid #2C2C2E; }
.dp-table th:first-child { text-align: left; border-left: 2px solid #2C2C2E; }
.dp-table th:last-child { border-right: 2px solid #2C2C2E; }
.dp-table thead tr:not(.create-title-row) th { border-top: 2px solid #2C2C2E; }
.dp-table thead tr:not(.create-title-row) th.create-has-title-above { border-top: 1px solid #2C2C2E; }
.dp-table thead tr:last-child th { border-bottom: 1px solid #2C2C2E; }
.dp-table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid #2C2C2E; border-right: 1px solid #2C2C2E; color: var(--text-primary); }
.dp-table td:first-child { text-align: left; font-weight: 500; border-left: 2px solid #2C2C2E; }
.dp-table td:last-child { border-right: 2px solid #2C2C2E; }
.dp-table tbody tr:last-child td { border-bottom: 2px solid #2C2C2E; }
.dp-table tr:hover { background: var(--vlt-teal-fill); }

.span-title-input { width: 64px; padding: 4px 6px; border: 1px solid var(--border-separator); border-radius: 4px; font-size: 13px; font-family: var(--font); text-align: right; background: var(--bg-input); color: var(--text-primary); }
.span-title-input:focus { outline: none; border-color: var(--vlt-teal); box-shadow: 0 0 0 2px var(--vlt-teal-fill); }
.span-title-input::placeholder { color: var(--text-quaternary); }
.editable-cell { cursor: text; }
.editable-cell:focus { outline: 2px solid var(--vlt-teal); outline-offset: -2px; background: var(--vlt-teal-fill); }

.ruling-spans-list { display: flex; flex-direction: column; gap: 8px; }
.ruling-span-item { border: 1px solid var(--border-separator); border-radius: var(--r-sm); overflow: hidden; }
.ruling-span-summary { padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--text-secondary); background: var(--bg-sub); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.ruling-span-summary::-webkit-details-marker { display: none; }
.ruling-span-summary::before { content: "▸"; font-size: 12px; color: var(--text-tertiary); transition: transform 0.2s; }
.ruling-span-item[open] > .ruling-span-summary::before { transform: rotate(90deg); }
.ruling-span-summary:hover { background: #E8E8ED; }
.ruling-span-body { padding: 12px; border-top: 1px solid var(--border-separator); }

/* ── Image Verification ──────────────────────────────────── */
.image-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-bottom: 12px; }
.image-edit-field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.image-edit-field input { width: 100%; padding: 8px 10px; border: 1px solid var(--border-separator); border-radius: var(--r-md); font-size: 17px; font-family: var(--font); color: var(--text-primary); background: var(--bg-sub); transition: border-color 0.2s; }
.image-edit-field input:hover { border-color: var(--text-tertiary); background: var(--bg-input); }
.image-edit-field input:focus { outline: none; border-color: var(--vlt-teal); box-shadow: 0 0 0 3px var(--vlt-teal-fill); }
.edit-title-bar { margin-bottom: 20px; }
.edit-title-bar label { display: block; font-size: 13px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.edit-title-bar input { width: 100%; padding: 10px 14px; border: 1px solid var(--border-separator); border-radius: var(--r-md); font-size: 18px; font-weight: 500; font-family: var(--font); color: var(--text-primary); transition: border-color 0.2s; }
.edit-title-bar input:focus { outline: none; border-color: var(--vlt-teal); box-shadow: 0 0 0 3px var(--vlt-teal-fill); }
.image-sections { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.image-section-card { border: 2px solid var(--border-card); border-radius: var(--r-md); overflow: hidden; }
.image-section-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg-sub); border-bottom: 1px solid var(--border-separator); }
.image-section-title { font-weight: 600; font-size: 17px; color: var(--text-primary); }
.image-section-badge { font-size: 13px; color: var(--text-tertiary); background: var(--bg-card); border: 1px solid var(--border-card); padding: 3px 10px; border-radius: var(--r-pill); }
.image-section-body { padding: 16px; }

/* ── Download / Success ─────────────────────────────────── */
.success-icon { width: 56px; height: 56px; color: var(--vlt-teal); margin-bottom: 12px; }
.download-filename { font-size: 14px; color: var(--text-tertiary); font-family: 'SF Mono', 'Consolas', monospace; font-variant-numeric: tabular-nums; margin-bottom: 20px; }

/* ── Error State ────────────────────────────────────────── */
.error-icon-large { width: 56px; height: 56px; color: var(--color-error); margin-bottom: 12px; }
.error-detail { color: var(--text-secondary); margin-bottom: 12px; font-size: 17px; }
.error-details-list { text-align: left; background: var(--color-error-bg); border: 1px solid var(--color-error-border); border-radius: var(--r-sm); padding: 12px 16px 12px 32px; margin-bottom: 20px; font-size: 16px; color: #991B1B; }


/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-content { background: var(--bg-card); border-radius: var(--r-xl); padding: 24px; max-width: 520px; width: 100%; box-shadow: var(--shadow-modal); }
.modal-content h3 { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.modal-content p { font-size: 16px; color: var(--text-secondary); margin-bottom: 12px; }
.modal-content ul { margin: 0 0 20px 20px; font-size: 15px; color: var(--text-secondary); line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Example Modal ─────────────────────────────────────── */
.example-modal-content { max-width: 1100px; max-height: 90vh; overflow-y: auto; }
.example-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.example-modal-header h3 { margin-bottom: 0; font-size: 24px; }
.example-title-row { display: flex; align-items: center; gap: 12px; }
.example-toggle { display: flex; gap: 0; border: 2px solid var(--border-separator); border-radius: var(--r-pill); overflow: hidden; width: fit-content; }
.example-toggle-btn { padding: 8px 24px; font-size: 15px; font-weight: 600; font-family: var(--font); border: none; background: var(--bg-sub); color: var(--text-tertiary); cursor: pointer; transition: all 0.2s; }
.example-toggle-btn.active { background: var(--vlt-teal); color: #fff; }
.example-body { font-size: 15px; }
.example-section { margin-bottom: 16px; }
.example-section-title { font-size: 13px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.example-field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 12px; }
.example-field { font-size: 14px; }
.example-field .example-label { font-weight: 600; color: var(--text-tertiary); }
.example-field .example-value { color: var(--text-primary); font-weight: 500; }
.example-conductor { border: 2px solid var(--vlt-teal); border-radius: var(--r-md); margin-bottom: 12px; overflow: hidden; }
.example-conductor-header { background: #D9F5EC; padding: 10px 16px; font-weight: 700; color: var(--vlt-teal-dark); font-size: 15px; }
.example-conductor-body { padding: 12px 16px; }
.example-condition { border-top: 2px solid var(--vlt-purple); margin-top: 8px; padding-top: 8px; }
.example-condition-name { font-weight: 700; color: var(--text-primary); font-size: 14px; margin-bottom: 6px; }
.example-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 6px; }
.example-table th { padding: 6px 8px; background: var(--bg-sub); color: var(--text-tertiary); font-weight: 600; text-align: right; border: 1px solid #2C2C2E; }
.example-table th:first-child { text-align: left; }
.example-table td { padding: 4px 8px; text-align: right; border: 1px solid rgba(0,0,0,0.1); }
.example-table td:first-child { text-align: left; font-weight: 500; }


/* ── Menu Page ──────────────────────────────────────────── */
.menu-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 48px 16px 32px; }
.menu-container { background: var(--bg-card); border-radius: var(--r-xl); padding: 48px 40px; max-width: 900px; width: 100%; box-shadow: var(--shadow-card); }
.menu-hero { text-align: center; margin-bottom: 36px; display: flex; flex-direction: column; align-items: center; }
.menu-hero-logo { height: 100px; width: auto; margin-bottom: 16px; }
.menu-hero h1 { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.menu-hero p { font-size: 17px; color: var(--text-tertiary); }

.menu-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; width: 100%; }
.menu-card { display: flex; flex-direction: column; background: #EDEDF2; border: 2px solid var(--border-card); border-radius: var(--r-lg); padding: 24px; text-decoration: none; color: inherit; transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s; }
.menu-card:hover { border-color: var(--vlt-teal); box-shadow: 0 4px 16px rgba(33, 206, 153, 0.12); transform: translateY(-2px); }
.menu-card-icon { width: 48px; height: 48px; margin-bottom: 16px; color: var(--vlt-teal); }
.menu-card-icon svg { width: 100%; height: 100%; }
.menu-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.menu-card p { font-size: 16px; color: var(--text-tertiary); line-height: 1.5; flex: 1; margin-bottom: 16px; }
.menu-card-badge { display: inline-block; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--bg-sub); color: var(--text-tertiary); align-self: flex-start; }
.menu-card-badge.stable { background: var(--vlt-teal-fill); color: var(--vlt-teal-dark); }
.menu-card-badge.preview { background: #EDE9FE; color: #6D28D9; }

.menu-about-link { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 16px; padding: 14px 20px; font-size: 16px; font-weight: 500; color: var(--text-tertiary); text-decoration: none; background: #EDEDF2; border: 1.5px solid var(--border-separator); border-radius: var(--r-md); transition: border-color 0.2s, color 0.2s; }
.menu-about-link:hover { border-color: var(--vlt-teal-stroke); color: var(--vlt-teal-dark); }
.menu-about-icon { width: 22px; height: 22px; color: var(--vlt-teal); flex-shrink: 0; }


/* ── About Page ─────────────────────────────────────────── */
.about-main { flex: 1; display: flex; justify-content: center; padding: 24px 16px; }
.about-content { max-width: 1020px; width: 100%; }
.about-card { background: var(--bg-card); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow-card); }
.about-content h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.about-lead { font-size: 17px; color: var(--text-tertiary); margin-bottom: 28px; }
.about-section { margin-bottom: 28px; }
.about-section h2 { font-size: 20px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); padding-bottom: 8px; border-bottom: 1px solid var(--border-separator); }
.about-section p, .about-section li { font-size: 16px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 8px; }
.about-section ul, .about-section ol { margin-left: 20px; margin-bottom: 12px; }
.about-steps { counter-reset: step; list-style: none; margin-left: 0; }
.about-steps li { padding-left: 0; margin-bottom: 12px; }
.about-table { width: 100%; border-collapse: collapse; font-size: 16px; margin-bottom: 12px; }
.about-table th, .about-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-separator); }
.about-table th { background: var(--bg-sub); font-weight: 600; color: var(--text-secondary); }
.about-code { background: #1C1C1E; color: #E2E8F0; padding: 20px; border-radius: var(--r-md); font-size: 14px; font-family: 'SF Mono', 'Consolas', 'Monaco', monospace; overflow-x: auto; line-height: 1.5; white-space: pre; }
.about-dl dt { font-size: 17px; font-weight: 600; color: var(--text-primary); margin-top: 12px; }
.about-dl dt code { font-size: 14px; background: var(--vlt-teal-fill); color: var(--vlt-teal-dark); padding: 2px 8px; border-radius: 4px; font-family: 'SF Mono', 'Consolas', monospace; }
.about-dl dd { font-size: 16px; color: var(--text-secondary); margin: 4px 0 0 0; line-height: 1.5; }


/* ── Footer ─────────────────────────────────────────────── */
footer { text-align: center; padding: 16px; font-size: 14px; color: var(--text-tertiary); border-top: 1px solid var(--border-separator); }

.req { color: var(--color-error); font-weight: 400; }

.hidden { display: none !important; }


/* ── Create Summary ─────────────────────────────────────── */
.create-summary { margin-bottom: 12px; padding: 16px; background: var(--bg-card); border: 3px solid #2C2C2E; border-radius: var(--r-md); box-shadow: var(--shadow-card); overflow-x: auto; scrollbar-width: thin; }

.summary-header { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.summary-body { display: flex; flex-direction: column; gap: 8px; }
.summary-conductor { display: flex; flex-direction: column; gap: 6px; }
.summary-cond-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.summary-cond-spacer { visibility: hidden; }
.summary-cond-name, .summary-cond-spacer { min-width: fit-content; flex-shrink: 0; }
.summary-cond-name { font-weight: 700; font-size: 14px; color: var(--vlt-teal-dark); background: #D9F5EC; padding: 6px 12px; border-radius: var(--r-pill); line-height: 1; border: 1.5px solid var(--vlt-teal); }
.summary-condition { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); font-weight: 600; font-size: 14px; background: var(--bg-sub); padding: 6px 10px; border-radius: var(--r-pill); border: 1.5px solid var(--vlt-purple); line-height: 1; }
.summary-rs-row { padding-left: 24px; white-space: nowrap; }
.summary-rs { font-size: 14px; font-weight: 600; color: var(--text-primary); background: var(--bg-card); padding: 6px 10px; border-radius: var(--r-pill); border: 1.5px solid #2C2C2E; line-height: 1; }
.summary-clickable { cursor: pointer; transition: opacity 0.15s; }
.summary-clickable:hover { opacity: 0.7; }

/* ═══════════════════════════════════════════════════════════
   Create Page
   ═══════════════════════════════════════════════════════════ */
.create-main { flex: 1; display: flex; justify-content: center; padding: 24px 16px; }
.create-content { max-width: 1100px; width: 100%; }
.create-top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }

.create-conductor-card {
    background: var(--bg-card);
    border: 3px solid var(--vlt-teal);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: 0 0 0 1px #2C2C2E, var(--shadow-card);
}

.create-conductor-header { display: flex; justify-content: space-between; align-items: center; margin: -20px -20px 16px; padding: 14px 20px; background: #D9F5EC; border-bottom: 1px solid var(--vlt-teal-stroke); border-radius: var(--r-lg) var(--r-lg) 0 0; position: sticky; top: 0; z-index: 10; }
.create-conductor-number { font-size: 19px; font-weight: 700; color: var(--vlt-teal-dark); }
.create-remove-btn { width: 32px; height: 32px; border-radius: 50%; font-size: 20px; color: var(--text-tertiary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; }
.create-remove-btn:hover { background: var(--color-error-bg); color: var(--color-error); }

.create-condition-block { border: none; border-radius: 0; padding: 0; margin: 16px -20px 0; background: none; }
.create-condition-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; padding: 10px 20px; background: var(--bg-sub); border-top: 2px solid var(--vlt-purple); border-bottom: 2px solid var(--vlt-purple); position: sticky; top: 56px; z-index: 9; }
.create-condition-pill { display: flex; align-items: center; gap: 4px; }
.create-condition-label { font-size: 15px; font-weight: 600; color: var(--text-tertiary); white-space: nowrap; }
.create-condition-name-input { padding: 4px 6px; border: none; border-bottom: 1.5px solid var(--border-separator); border-radius: 0; font-size: 16px; font-family: var(--font); font-weight: 700; color: var(--text-primary); background: transparent; width: 130px; }
.create-condition-name-input:focus { outline: none; border-bottom-color: var(--vlt-teal); box-shadow: none; }

.create-rs-block { border: none; padding: 12px 20px 0; margin-bottom: 0; background: none; border-radius: 0; }

.create-rs-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.create-rs-topbar-left { display: flex; align-items: center; gap: 6px; }
.create-rs-inline-label { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.create-data-table .create-rs-inline-input { width: 75px; padding: 4px 6px; border: 1px solid var(--border-separator) !important; border-radius: var(--r-sm); font-size: 15px; font-weight: 600; font-family: var(--font); color: var(--text-primary); background: var(--bg-input) !important; font-variant-numeric: tabular-nums; text-align: left !important; }
.create-rs-inline-input:focus { outline: none; border-color: var(--vlt-teal); box-shadow: 0 0 0 3px var(--vlt-teal-fill); }
.create-rs-inline-input::placeholder { color: var(--text-quaternary); font-weight: 400; }


.create-col-header { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.create-data-table .create-col-input { width: 130px; padding: 4px 6px; border: 1px solid var(--border-separator) !important; border-radius: 4px; font-size: 14px; font-family: var(--font); color: var(--text-primary); background: #FFFFFF !important; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.create-col-input:focus { outline: none; border-color: var(--vlt-teal); box-shadow: 0 0 0 2px var(--vlt-teal-fill); }
.create-col-input::placeholder { color: var(--text-quaternary); font-weight: 400; }
/* Title row: span columns step up with thick border, temp/tension invisible */
.create-title-row th { padding: 0; border: none; background: transparent; }
.create-title-row th.create-title-rs {
    background: #FFFFFF;
    border: 2px solid #2C2C2E;
    border-bottom: 1px solid #2C2C2E;
    padding: 8px 16px;
    text-align: center;
}
.create-rs-in-header { display: inline-flex; align-items: center; gap: 6px; }
.create-del-rs-btn { width: 20px; height: 20px; border-radius: 50%; border: none; background: transparent; color: var(--text-quaternary); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; margin-left: auto; transition: all 0.2s; }
.create-del-rs-btn:hover { background: var(--color-error-bg); color: var(--color-error); }
.create-title-row th.create-title-span {
    background: var(--bg-sub) !important;
    border-top: 2px solid #2C2C2E !important;
    border-left: 2px solid #2C2C2E !important;
    border-right: 2px solid #2C2C2E !important;
    border-bottom: none !important;
    padding: 6px 4px 4px !important;
}
/* Interior span column dividers are thin */
.create-title-row th.create-title-span + th.create-title-span {
    border-left: 1px solid #2C2C2E !important;
}
.create-title-row th.create-title-spacer {
    border: none !important;
    background: transparent !important;
}

.create-action-th { background: var(--bg-sub) !important; }

.create-data-table .create-col-title { width: 140px; padding: 3px 6px; border: 1px solid var(--border-separator) !important; border-radius: 4px; font-size: 13px; font-family: var(--font); color: var(--text-secondary) !important; background: #FFFFFF !important; text-align: center; font-weight: 500 !important; }
.create-col-title:focus { outline: none; border-color: var(--vlt-teal); border-style: solid; box-shadow: 0 0 0 2px var(--vlt-teal-fill); }
.create-col-title::placeholder { color: var(--text-quaternary); }

.create-col-sag-label { font-size: 13px; font-weight: 600; color: var(--text-tertiary); margin-top: 2px; }

.create-col-length-row { display: flex; align-items: center; gap: 2px; justify-content: center; }
.create-col-title:focus { color: var(--text-primary); }
.create-col-title::placeholder { color: var(--text-quaternary); }

.create-table-help { font-size: 14px; color: var(--text-tertiary); line-height: 1.5; margin-bottom: 10px; }
.create-table-help p { margin-bottom: 4px; }
.create-table-help strong { color: var(--text-secondary); }

.create-col-length-row { display: flex; align-items: center; gap: 2px; justify-content: center; }

.create-del-col-btn { width: 18px; height: 18px; border-radius: 50%; border: none; background: transparent; color: var(--text-quaternary); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; padding: 0; line-height: 1; }
.create-del-col-btn:hover { background: var(--color-error-bg); color: var(--color-error); }

.create-add-col-btn { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--vlt-teal-stroke); background: transparent; color: var(--vlt-teal); font-size: 18px; font-weight: 600; font-family: var(--font); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.create-add-col-btn:hover { background: var(--vlt-teal-fill); }
.create-data-table input { width: 100%; min-width: 64px; padding: 6px 8px; border: 1px solid transparent; border-radius: 4px; font-size: 14px; font-family: var(--font); font-variant-numeric: tabular-nums; color: var(--text-primary); background: transparent; text-align: inherit; transition: all 0.2s; }
.create-data-table input:hover { border-color: var(--border-separator); background: var(--bg-input); }
.create-data-table input:focus { outline: none; border-color: var(--vlt-teal); background: var(--bg-input); box-shadow: 0 0 0 2px var(--vlt-teal-fill); }
.create-data-table td:last-child { width: 32px; text-align: center; }
.create-remove-row { width: 24px; height: 24px; border-radius: 50%; font-size: 14px; color: var(--text-quaternary); display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.create-remove-row:hover { background: var(--color-error-bg); color: var(--color-error); }
.create-add-row-btn { margin-top: 8px; font-size: 14px; padding: 6px 14px; min-height: auto; }
.create-add-cond-wrap { margin: 0 -20px -20px; padding: 20px 20px; border-radius: 0 0 var(--r-lg) var(--r-lg); text-align: center; }
.create-add-conductor-btn { background: var(--bg-card); border: 3px solid var(--vlt-teal); }

.create-rs-divider { margin: 24px 40px; border-top: 2px dotted var(--border-separator); }

.create-add-rs-wrap { margin: 0; padding: 20px 20px; text-align: center; }
.create-add-rs-last { border-bottom: 2px solid var(--vlt-purple); }
.create-add-rs-btn { font-size: 14px; padding: 6px 14px; min-height: auto; }
.create-hint { font-size: 16px; color: var(--text-tertiary); font-style: italic; padding: 12px 0; text-align: center; }


/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    header { padding: 0 16px; }
    .header-page-name, .header-divider { display: none; }
    main { padding: 16px 12px; }
    .card { padding: 16px; }
    .drop-zone { padding: 24px 16px; }
    .field-grid { grid-template-columns: 1fr; }
    .field-grid.units-row { flex-direction: column; }
    .btn-row { flex-direction: column-reverse; }
    .btn-row .btn { width: 100%; }
    .steps-inner { gap: 0; }
    .step-label { display: none; }
    .menu-hero h1 { font-size: 24px; }
    .create-top-bar { flex-direction: column; align-items: stretch; }
    .create-top-bar > div { justify-content: stretch; }
    .create-top-bar .btn { flex: 1; font-size: 14px; padding: 10px 12px; min-height: 40px; }
    .menu-container { padding: 24px 16px; }
    .btn { font-size: 15px; padding: 10px 16px; min-height: 44px; }
}
