/* G:\app\ADM2\web\css\style.css */
/* ADM Web v3 — Dark Glassmorphism Theme (TCCS 38:2022) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-dark: #2563eb;
    --success: #34d399;
    --success-hover: #6ee7b7;
    --danger: #f87171;
    --danger-hover: #fca5a5;

    --bg-app: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(15, 23, 42, 0.6);
    --bg-header: rgba(30, 41, 59, 0.85);
    --bg-sidebar: rgba(15, 23, 42, 0.6);
    --bg-selected: rgba(96, 165, 250, 0.15);

    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-bright: #f8fafc;
    --border: rgba(255, 255, 255, 0.08);
    --border-input: rgba(255, 255, 255, 0.12);
    --border-focus: rgba(96, 165, 250, 0.5);
    --accent: #60a5fa;

    --glass-blur: blur(12px);
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --glow: 0 0 12px rgba(96, 165, 250, 0.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #0f172a 100%);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.5;
}

/* Subtle grid pattern overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(96, 165, 250, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(52, 211, 153, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* ====== PRO HEADER ====== */
.app-header-pro {
    background: #0f172a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    border-bottom: 1px solid #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.header-right {
    justify-content: flex-end;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 2;
    justify-content: center;
}

.header-logo-box {
    width: 36px;
    height: 36px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #60a5fa;
    position: relative;
}

.status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #34d399;
    border: 2px solid #0f172a;
    border-radius: 50%;
}

.header-title-group h1 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 2px 0;
    line-height: 1.2;
    color: white;
}

.header-title-group p {
    font-size: 11px;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.header-btn-ghost,
.header-btn,
.header-btn-text,
.header-btn-solid,
.header-btn-outline {
    background: transparent;
    border: none;
    color: #e2e8f0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.header-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-btn-text {
    padding: 6px 12px;
    gap: 6px;
}

.header-btn-text:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-btn-solid {
    background: #2563eb;
    color: white;
    padding: 6px 16px;
    gap: 6px;
    font-weight: 600;
}

.header-btn-solid:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-btn-outline {
    background: transparent;
    color: #e2e8f0;
    border: 1px solid #2563eb;
    padding: 6px 14px;
    gap: 6px;
    font-weight: 500;
}

.header-btn-outline:hover {
    background: rgba(37, 99, 235, 0.1);
    color: white;
}

.header-btn-ghost {
    padding: 6px 12px;
    gap: 6px;
    opacity: 0.9;
}

.header-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: #1e293b;
    margin: 0 4px;
}

/* ====== PRO FOOTER ====== */
.app-footer {
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    height: auto;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    flex-shrink: 0;
}

.footer-left {
    flex: 0 0 160px;
    display: flex;
    align-items: center;
}

.footer-logo-large {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 4px;
    width: 120px;
    height: 40px;
}

.footer-logo-large i {
    font-size: 14px;
    color: #60a5fa;
    margin-bottom: 2px;
}

.logo-text {
    font-size: 9px;
    font-weight: 700;
    color: #e2e8f0;
    text-align: center;
    line-height: 1.1;
}

.footer-center {
    flex: 1;
    padding: 0 24px;
    border-left: 1px solid #1e293b;
    border-right: 1px solid #1e293b;
}

.footer-center h3 {
    margin: 0 0 2px 0;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
}

.footer-center p {
    margin: 2px 0 0 0;
    font-size: 11px;
    color: #94a3b8;
}

.footer-mobile-author {
    display: none;
    color: #cbd5e1;
    font-weight: 600;
}

.footer-right {
    flex: 0 0 400px;
    padding-left: 24px;
    text-align: right;
}

.author-credits p {
    margin: 2px 0;
    font-size: 11px;
    color: #94a3b8;
}

.author-credits .author-link {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
}

.author-credits .author-link:hover {
    text-decoration: underline;
}

.author-credits .copyright {
    color: #64748b;
    margin-top: 2px;
}

/* ====== OVERVIEW CLASSES ====== */
.res-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}

.res-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

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

.result-overview-item {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-left: 4px solid #475569;
    border-radius: 10px;
    padding: 14px 16px;
}

.result-overview-item.pass {
    border-left-color: var(--success);
}

.result-overview-item.fail {
    border-left-color: var(--danger);
}

.result-overview-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 10px;
}

.result-overview-status {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 6px;
}

.result-overview-item.pass .result-overview-status {
    color: var(--success);
}

.result-overview-item.fail .result-overview-status {
    color: var(--danger);
}

.result-overview-note {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.calc-mono {
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1.7;
    font-size: 13px;
    color: #cbd5e1;
}

.calc-mono .calc-symbol {
    color: #93c5fd;
    font-weight: 700;
}

.calc-mono .calc-symbol-secondary {
    color: #67e8f9;
    font-weight: 600;
}

.calc-mono .calc-important {
    color: #f8fafc;
    font-weight: 700;
}

.audit-table-wrapper {
    margin: 12px 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.28);
}

.audit-table-title {
    padding: 10px 12px;
    background: rgba(96, 165, 250, 0.1);
    border-bottom: 1px solid rgba(96, 165, 250, 0.2);
    color: var(--text-bright);
    font-weight: 700;
    font-size: 12.5px;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    font-size: 12px;
}

.audit-table th,
.audit-table td {
    padding: 8px 10px;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: middle;
    text-align: center;
    white-space: nowrap;
}

.audit-table th:last-child,
.audit-table td:last-child {
    border-right: none;
}

.audit-table tr:last-child td {
    border-bottom: none;
}

.audit-table th {
    background: rgba(30, 41, 59, 0.88);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.audit-table td {
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.16);
}

.audit-table td:first-child,
.audit-table th:first-child {
    text-align: left;
    white-space: normal;
    min-width: 210px;
}


/* ====== MAIN LAYOUT ====== */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ====== SIDEBAR ====== */
.sidebar {
    width: 280px;
    /* Tăng độ rộng để text không bị rớt dòng */
    background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    padding: 12px 0;
    overflow-y: auto;
}

.tree-nav {
    list-style: none;
}

.nav-item {
    padding: 8px 16px 8px 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    user-select: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.nav-item i {
    width: 16px;
    text-align: center;
    color: var(--primary);
    font-size: 13px;
    opacity: 0.7;
}

.nav-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-bright);
}

.nav-item.active {
    color: var(--text-bright);
    background: var(--bg-selected);
    font-weight: 600;
    border-left-color: var(--primary);
}

.nav-item.active i {
    opacity: 1;
}

.nav-header {
    padding: 7px 16px;
    color: var(--text-bright);
    font-weight: 600;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.nav-header .toggle-icon {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
}

.nav-item.has-children {
    display: block;
    padding: 0;
    border-left: none;
}

.nav-item.has-children:hover {
    background: transparent;
}

.nav-item.has-children>.nav-header:hover {
    background: var(--bg-glass-hover);
}

.sub-nav {
    list-style: none;
    display: none;
    padding-left: 0;
    margin: 0;
}

.sub-nav .nav-item {
    padding: 8px 16px 8px 36px;
    /* Cách lề trái để tạo cấp độ, không bị thụt quá lố */
}

.expanded .sub-nav {
    display: block;
}

.add-variant-btn {
    width: calc(100% - 32px);
    margin: 8px 16px;
    padding: 5px;
    background: var(--bg-glass);
    border: 1px dashed var(--border-input);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.add-variant-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--primary);
    color: var(--primary);
}

/* ====== WORKSPACE ====== */
.workspace {
    flex: 1;
    background: transparent;
    padding: 16px;
    overflow-y: auto;
}

/* Custom scrollbar */
.workspace::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.workspace::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.workspace::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.workspace::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.view-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* ====== GLASS PANELS (Form Sections) ====== */
.form-section {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    letter-spacing: 0.3px;
}

.section-title i {
    margin-right: 6px;
    opacity: 0.8;
}

/* ====== FORMS ====== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-bright);
    padding: 5px 10px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    height: 32px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: var(--glow);
}

.form-control:disabled,
.form-control[readonly] {
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-muted);
    border-color: rgba(255, 255, 255, 0.05);
}

.project-layout {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.project-panel {
    padding: 25px;
    border-radius: 12px;
}

.project-panel-main {
    flex: 2;
    min-width: 400px;
    position: relative;
    overflow: hidden;
}

.project-panel-side {
    flex: 1;
    min-width: 300px;
    background: linear-gradient(145deg, rgba(30,41,59,0.7), rgba(15,23,42,0.9));
    border: 1px solid var(--border);
}

.project-panel-ghost-icon {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 150px;
    color: rgba(255,255,255,0.02);
    pointer-events: none;
}

.section-title-topless {
    margin-top: 0;
}

.label-caps {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
}

.form-icon-wrap {
    position: relative;
}

.form-icon-wrap i {
    position: absolute;
    left: 15px;
    top: 12px;
    color: var(--accent);
}

.input-with-icon {
    padding-left: 40px;
}

.input-emphasis {
    font-size: 16px;
    font-weight: 500;
    height: 42px;
}

.project-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.helper-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.45;
}

.helper-note-sm {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.helper-note-accent {
    color: #a16207;
}

.value-box-label {
    font-size: 13px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 10px;
    display: block;
}

.value-box {
    grid-column: 1/-1;
    margin-top: 10px;
    background: var(--bg-selected);
    padding: 15px;
    border: 1px solid var(--accent);
}

.input-strong {
    font-weight: 700;
}

.input-accent {
    color: var(--primary);
}

.project-info-section .glass-panel .form-group > label {
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    letter-spacing: 1px !important;
}

.project-info-section .glass-panel input[data-project-field="name"] {
    padding-left: 40px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    height: 40px !important;
}

.project-info-section .glass-panel input[data-project-field="location"],
.project-info-section .glass-panel input[data-project-field="designer"] {
    padding-left: 40px !important;
}

.project-info-section .glass-panel select[data-project-field="designObject"],
.project-info-section .glass-panel select[data-project-action="design-type"] {
    font-weight: 500 !important;
}

.project-info-section .glass-panel select[data-project-action="design-type"] {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

select.form-control {
    cursor: pointer;
}

input[type="checkbox"] {
    margin-right: 6px;
    accent-color: var(--primary);
}

.checkbox-group {
    display: flex;
    align-items: center;
    font-size: 12.5px;
    margin-top: 5px;
    color: var(--text-muted);
}

/* ====== TABLES ====== */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th,
.data-table td {
    border: 1px solid var(--border);
    padding: 5px 8px;
    text-align: center;
    vertical-align: middle;
}

.data-table th {
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table td {
    background: rgba(30, 41, 59, 0.4);
    color: var(--text-main);
}

.data-table input,
.data-table select {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-family: inherit;
    font-size: 12px;
    padding: 2px;
    outline: none;
    color: var(--text-bright);
}

.data-table select {
    text-align: left;
    color: var(--text-bright);
}

.data-table select option,
.data-table select optgroup {
    background: #1e293b;
    color: var(--text-bright);
}

.data-table input:focus {
    background: var(--bg-selected);
    border-radius: 2px;
}

.data-table tbody tr:hover td {
    background: var(--bg-glass-hover);
}

.data-table tbody tr.selected td {
    background: var(--bg-selected);
}

.structure-overview {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 280px;
    gap: 14px;
    margin-bottom: 14px;
}

.structure-stack-pane,
.structure-summary-card {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.structure-overview-head,
.structure-table-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.structure-overview-head strong,
.structure-table-head strong {
    color: var(--text-bright);
    font-size: 14px;
}

.structure-overview-head span,
.structure-table-head span {
    color: var(--text-muted);
    font-size: 12px;
}

.structure-stack-pane {
    padding: 14px;
}

.pavement-diagram {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pavement-diagram-scale {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.pavement-diagram-stack {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.3);
}

.pavement-layer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-bottom: 2px solid rgba(15, 23, 42, 0.7);
    overflow: hidden;
}

.pavement-layer:last-child {
    border-bottom: none;
}

.pavement-layer.invalid {
    box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.45);
}

.pattern-wear {
    background:
        repeating-linear-gradient(135deg, rgba(255,255,255,0.22) 0 2px, transparent 2px 12px),
        rgba(96, 165, 250, 0.14);
}

.pattern-surface {
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 1px, transparent 1px 10px),
        rgba(59, 130, 246, 0.12);
}

.pattern-treated {
    background:
        radial-gradient(circle at 12px 12px, rgba(255,255,255,0.15) 0 2px, transparent 2px 18px),
        rgba(52, 211, 153, 0.12);
}

.pattern-granular {
    background:
        radial-gradient(circle at 10px 10px, rgba(255,255,255,0.12) 0 1.8px, transparent 1.8px 16px),
        radial-gradient(circle at 28px 24px, rgba(255,255,255,0.09) 0 1.5px, transparent 1.5px 18px),
        rgba(148, 163, 184, 0.12);
}

.pavement-layer-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    width: 100%;
    max-width: 100%;
    padding: 0 6px;
}

.pavement-layer-name {
    color: var(--text-bright);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

.pavement-layer-meta {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

.subgrade-card {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px dashed rgba(96, 165, 250, 0.35);
    background: rgba(96, 165, 250, 0.06);
}

.subgrade-card-title {
    font-weight: 700;
    color: var(--primary-hover);
    margin-bottom: 6px;
}

.subgrade-card-body {
    color: var(--text-main);
    line-height: 1.5;
}

.structure-summary-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.structure-summary-card {
    padding: 14px;
}

.structure-summary-title {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.structure-summary-value {
    color: var(--text-bright);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.structure-summary-value span {
    font-size: 14px;
    color: var(--text-muted);
}

.structure-summary-note {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.layer-empty {
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    text-align: center;
}

/* ====== BUTTONS ====== */
.btn {
    padding: 5px 14px;
    border: 1px solid var(--border-input);
    background: var(--bg-glass);
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    height: 30px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--primary);
    color: var(--text-bright);
}

.btn-primary {
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary);
    border-color: rgba(96, 165, 250, 0.3);
}

.btn-primary:hover {
    background: rgba(37, 99, 235, 0.35);
    color: var(--primary-hover);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.2);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: var(--danger);
}

.btn-small {
    padding: 2px 8px;
    height: 24px;
    font-size: 11px;
}

/* ====== MODALS ====== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: rgba(15, 23, 42, 0.5);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-bright);
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
}

.modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: right;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 0 0 var(--radius) var(--radius);
}

.guide-modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.guide-section {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.28);
}

.guide-section h4 {
    color: var(--text-bright);
    margin-bottom: 6px;
    font-size: 14px;
}

.guide-section p {
    color: var(--text-main);
    line-height: 1.6;
    font-size: 13px;
}

#material-modal .modal-content.material-picker-modal {
    width: min(94vw, 1080px);
    max-width: min(94vw, 1080px);
}

.material-picker-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

#material-picker-table {
    min-width: 760px;
    table-layout: fixed;
}

#material-picker-table th:first-child,
#material-picker-table td:first-child {
    width: 320px;
    min-width: 320px;
    text-align: left;
}

#material-picker-table th:nth-child(2),
#material-picker-table td:nth-child(2),
#material-picker-table th:nth-child(3),
#material-picker-table td:nth-child(3),
#material-picker-table th:nth-child(4),
#material-picker-table td:nth-child(4) {
    width: 88px;
}

#material-picker-table th:nth-child(5),
#material-picker-table td:nth-child(5),
#material-picker-table th:nth-child(6),
#material-picker-table td:nth-child(6),
#material-picker-table th:nth-child(7),
#material-picker-table td:nth-child(7) {
    width: 72px;
}

#material-picker-table .material-picker-group-row td {
    background: rgba(96, 165, 250, 0.12);
    border-top: 1px solid rgba(96, 165, 250, 0.28);
    border-bottom: 1px solid rgba(96, 165, 250, 0.18);
    padding: 10px 12px;
}

.material-picker-group-title {
    color: var(--primary-hover);
    font-weight: 700;
}

.material-picker-group-count {
    margin-left: 10px;
    color: var(--text-muted);
    font-size: 12px;
}

.material-picker-name {
    color: var(--primary-hover);
    font-weight: 600;
    line-height: 1.35;
}

.material-picker-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.structure-preset-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: rgba(96, 165, 250, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 8px;
}

.structure-preset-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.structure-preset-copy strong {
    color: var(--text-bright);
}

.structure-preset-copy span {
    color: var(--text-muted);
    font-size: 12px;
}

#modal-materials .modal-content.material-db-modal {
    width: min(96vw, 1420px);
    max-width: min(96vw, 1420px);
    height: min(88vh, 920px);
    resize: both;
    overflow: auto;
    min-width: 1100px;
    min-height: 720px;
}

.material-db-body {
    display: flex;
    gap: 20px;
    height: calc(100% - 130px);
    padding: 20px;
    overflow: hidden;
}

.material-db-list-pane {
    flex: 2.45;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.material-db-list-head {
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

.material-db-table-wrap {
    flex: 1;
    overflow: auto;
}

.material-db-form-pane {
    flex: 1;
    min-width: 300px;
    background: var(--bg-panel);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow-y: auto;
}

.material-db-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}

#mat-db-table {
    table-layout: fixed;
    min-width: 920px;
}

#mat-db-table th,
#mat-db-table td {
    padding: 8px 10px;
}

#mat-db-table th:first-child,
#mat-db-table td:first-child {
    width: 300px;
    min-width: 300px;
    text-align: left;
}

#mat-db-table td:first-child {
    font-weight: 600;
    color: var(--primary-hover);
    white-space: normal;
    word-break: break-word;
}

#mat-db-table th:nth-child(2),
#mat-db-table td:nth-child(2),
#mat-db-table th:nth-child(3),
#mat-db-table td:nth-child(3),
#mat-db-table th:nth-child(4),
#mat-db-table td:nth-child(4) {
    width: 78px;
}

#mat-db-table th:nth-child(5),
#mat-db-table td:nth-child(5),
#mat-db-table th:nth-child(6),
#mat-db-table td:nth-child(6),
#mat-db-table th:nth-child(7),
#mat-db-table td:nth-child(7) {
    width: 50px;
}

#mat-db-table th:nth-child(8),
#mat-db-table td:nth-child(8) {
    width: 80px;
}

#mat-db-table th:nth-child(9),
#mat-db-table td:nth-child(9) {
    width: 72px;
}

#mat-db-table .material-group-row td {
    background: rgba(96, 165, 250, 0.12);
    color: var(--text-bright);
    font-weight: 700;
    text-align: left;
    padding: 9px 12px;
    border-top: 1px solid rgba(96, 165, 250, 0.3);
    border-bottom: 1px solid rgba(96, 165, 250, 0.18);
}

#mat-db-table .material-group-title {
    color: var(--primary-hover);
}

#mat-db-table .material-group-count {
    margin-left: 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.close-modal {
    cursor: pointer;
    color: var(--danger);
    font-size: 16px;
    font-weight: bold;
    transition: color 0.15s;
}

.close-modal:hover {
    color: var(--danger-hover);
}

/* ====== UTILITIES ====== */
.hidden {
    display: none !important;
}

.flex-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-toast-container {
    position: fixed;
    top: 72px;
    right: 16px;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.app-toast {
    min-width: 260px;
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: var(--shadow);
    color: var(--text-main);
    pointer-events: auto;
}

.app-toast-success {
    border-color: rgba(52, 211, 153, 0.35);
}

.app-toast-error {
    border-color: rgba(248, 113, 113, 0.35);
}

.app-toast-info {
    border-color: rgba(96, 165, 250, 0.35);
}

.app-toast-title {
    font-weight: 700;
    margin-bottom: 3px;
    color: var(--text-bright);
}

.app-toast-message {
    font-size: 12px;
    color: var(--text-muted);
}

.app-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(4px);
}

.app-confirm-dialog {
    width: min(92vw, 420px);
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: var(--shadow);
}

.app-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 8px;
}

.app-confirm-message {
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 16px;
}

.app-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 1024px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    .app-container {
        min-height: 100vh;
        height: auto;
    }

    .app-header-pro {
        height: auto;
        min-height: 56px;
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-start;
    }

    .header-left,
    .header-center,
    .header-right {
        flex: 1 1 100%;
        min-width: 0;
    }

    .header-left {
        order: 1;
    }

    .header-center {
        order: 2;
        justify-content: flex-start;
    }

    .header-right {
        order: 3;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-title-group h1 {
        font-size: 14px;
    }

    .header-title-group p {
        font-size: 10px;
    }

    .header-btn-text,
    .header-btn-solid,
    .header-btn-outline,
    .header-btn-ghost {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .header-divider {
        display: none;
    }

    .main-content {
        flex-direction: column;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        max-height: 42vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 8px;
        overflow-y: auto;
    }

    .workspace {
        width: 100%;
        min-width: 0;
        padding: 12px;
        overflow: visible;
    }

    .view-container {
        max-width: 100%;
    }

    .app-footer {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 12px;
        padding: 10px 12px;
        min-height: 0;
    }

    .footer-left {
        flex: 0 0 auto;
    }

    .footer-center {
        flex: 1 1 320px;
        padding: 0 0 0 12px;
        border-left: 1px solid #1e293b;
        border-right: none;
    }

    .footer-right {
        flex: 1 1 100%;
        padding-left: 0;
        text-align: left;
    }

    .footer-logo-large {
        width: 104px;
        height: 38px;
    }

    .footer-center h3 {
        font-size: 12px;
    }

    .footer-center p,
    .author-credits p {
        font-size: 10px;
    }

    .footer-mobile-author {
        display: block;
        margin-top: 4px;
    }

    .modal-content {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        margin: 8px;
    }

    #modal-materials .modal-content.material-db-modal {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        min-width: 0;
        min-height: 0;
        height: calc(100vh - 16px);
        resize: none;
    }

    .material-db-body {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .material-db-list-pane,
    .material-db-form-pane {
        min-width: 0;
    }

    .material-db-list-pane {
        flex: 1 1 auto;
        min-height: 42vh;
    }

    .material-db-form-pane {
        flex: 0 0 auto;
    }

    .app-toast-container {
        top: auto;
        right: 10px;
        left: 10px;
        bottom: 12px;
    }

    .app-toast {
        min-width: 0;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .result-overview-grid {
        grid-template-columns: 1fr;
    }

    .header-left {
        display: none;
    }

    .header-center {
        gap: 8px;
    }

    .header-logo-box {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .header-title-group p {
        display: none;
    }

    .header-title-group h1 {
        font-size: 13px;
        line-height: 1.15;
    }

    .sidebar {
        max-height: 36vh;
    }

    .nav-item,
    .sub-nav .nav-item {
        white-space: normal;
        line-height: 1.35;
    }

    .sub-nav .nav-item {
        padding-left: 28px;
    }

    .form-section {
        padding: 14px;
        margin-bottom: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .flex-row {
        flex-wrap: wrap;
    }

    .btn,
    .btn-small {
        min-height: 32px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 880px;
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 6px;
        white-space: nowrap;
    }

    .data-table input,
    .data-table select {
        min-width: 64px;
        font-size: 12px;
        padding: 4px 2px;
    }

    #material-modal .modal-content.material-picker-modal {
        width: min(96vw, 96vw);
        max-width: min(96vw, 96vw);
        max-height: 92vh;
    }

    .material-picker-toolbar {
        grid-template-columns: 1fr;
    }

    #material-picker-table {
        min-width: 620px;
    }

    #material-picker-table th:first-child,
    #material-picker-table td:first-child {
        width: 240px;
        min-width: 240px;
    }

    #material-picker-table .material-col-optional {
        display: none;
    }

    .structure-preset-bar {
        grid-template-columns: 1fr;
    }

    #mat-db-table {
        min-width: 860px;
    }

    #mat-db-table th:first-child,
    #mat-db-table td:first-child {
        width: 260px;
        min-width: 260px;
    }

    .variant-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .variant-tabs .tab-btn {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .structure-overview {
        grid-template-columns: 1fr;
    }

    .structure-summary-pane {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}

@media (max-width: 480px) {
    .app-header-pro {
        padding: 8px;
    }

    .header-center {
        display: flex;
        flex: 1 1 100%;
        order: 1;
        align-items: center;
        gap: 8px;
        padding-bottom: 2px;
    }

    .header-left {
        display: none;
    }

    .header-right {
        order: 2;
        flex: 1 1 100%;
        gap: 4px;
    }

    .header-logo-box {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .header-title-group h1 {
        font-size: 12px;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 64px);
    }

    .header-btn,
    .header-btn-text,
    .header-btn-solid,
    .header-btn-outline,
    .header-btn-ghost {
        font-size: 11px;
        padding: 6px 8px;
    }

    .header-btn-text i,
    .header-btn-solid i,
    .header-btn-outline i,
    .header-btn-ghost i {
        margin-right: 4px;
    }

    .app-footer {
        padding: 8px 10px;
        gap: 6px;
    }

    .footer-left {
        display: none;
    }

    .footer-center {
        flex: 1 1 100%;
        padding-left: 0;
        border-left: none;
    }

    .footer-right {
        display: none;
    }

    .footer-center h3 {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .footer-center p {
        font-size: 9px;
        line-height: 1.35;
    }

    .footer-mobile-author {
        display: block;
        font-size: 9px;
        margin-top: 4px;
    }

    .sidebar {
        max-height: 34vh;
    }

    .workspace {
        padding: 10px;
    }

    .section-title {
        font-size: 13px;
    }

    .form-control {
        height: 36px;
        font-size: 14px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 12px;
        padding-right: 12px;
    }

    #material-modal .modal-body {
        padding: 12px;
    }

    #material-picker-table {
        min-width: 560px;
        font-size: 11px;
    }

    #material-picker-table th:first-child,
    #material-picker-table td:first-child {
        width: 220px;
        min-width: 220px;
    }

    .material-picker-name {
        font-size: 12px;
    }

    .material-picker-meta {
        font-size: 10px;
    }

    .structure-overview-head,
    .structure-table-head,
    .layer-stack-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .structure-summary-pane {
        grid-template-columns: 1fr;
    }

    .pavement-layer {
        height: auto !important;
        justify-content: flex-start;
    }

    .pavement-layer-name,
    .pavement-layer-meta {
        text-align: left;
    }

    .pavement-layer-content {
        padding: 0;
    }
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

/* ====== VERIFICATION RESULT CARDS (inline styles override) ====== */
/* Success/Danger indicators for verification results */
[style*="background: #e8f5e9"],
[style*="background:#e8f5e9"] {
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: rgba(52, 211, 153, 0.25) !important;
    color: var(--text-main) !important;
}

[style*="background: #ffebee"],
[style*="background:#ffebee"] {
    background: rgba(248, 113, 113, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.25) !important;
    color: var(--text-main) !important;
}

[style*="background: #f0f0f0"],
[style*="background:#f0f0f0"] {
    background: rgba(15, 23, 42, 0.5) !important;
    color: var(--text-bright) !important;
}

[style*="background: #fff"],
[style*="background:#fff"] {
    background: var(--bg-glass) !important;
}

[style*="background: #fff8e1"],
[style*="background:#fff8e1"] {
    background: rgba(251, 191, 36, 0.1) !important;
    border-color: rgba(251, 191, 36, 0.25) !important;
    color: #fbbf24 !important;
}

[style*="color: #555"] {
    color: var(--text-muted) !important;
}

[style*="color: #333"] {
    color: var(--text-main) !important;
}

[style*="color: #888"] {
    color: var(--text-muted) !important;
}

[style*="color: #666"] {
    color: var(--text-muted) !important;
}

[style*="border-bottom: 1px dashed #eee"] {
    border-bottom-color: var(--border) !important;
}

[style*="border: 1px solid #ccc"] {
    border-color: var(--border) !important;
}

[style*="border-bottom: 1px solid #ccc"] {
    border-bottom-color: var(--border) !important;
}

/* Fix inline monospace log colors */
[style*="font-family: monospace"],
[style*="font-family: 'Consolas'"] {
    color: var(--text-muted) !important;
}

/* ====== NOMOGRAPH TABS ====== */
.nomo-tab {
    padding: 12px 15px;
    margin: 4px 8px;
    border-radius: 8px;
    background-color: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    font-size: 14px;
}

.nomo-tab i {
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nomo-tab:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.nomo-tab:hover i {
    opacity: 1;
}

.nomo-tab.active {
    background-color: #1e293b;
    color: #38bdf8;
    border-color: #334155;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.nomo-tab.active i {
    color: #38bdf8;
    opacity: 1;
}


.app-debug-panel {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 420px;
    max-width: calc(100vw - 24px);
    max-height: 240px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(30, 41, 59, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 700;
}

.app-debug-clear {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
    padding: 4px 8px;
}

.app-debug-list {
    overflow: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 1.45;
}

.app-debug-entry {
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    word-break: break-word;
}

.app-debug-entry strong {
    color: #93c5fd;
}

.app-debug-entry .time {
    color: #34d399;
    margin-right: 6px;
}

@media (max-width: 768px) {
    .app-debug-panel {
        left: 8px;
        right: 8px;
        width: auto;
        bottom: 8px;
        max-height: 180px;
    }
}
