/* ============================================
   Tra Thép Hình Online — Styles
   Modern dark glassmorphism design
   ============================================ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #1e2440;
    --bg-hover: #1e2440;
    --bg-input: #151a2e;
    --border: #2a3050;
    --border-focus: #4f6bff;
    --text-primary: #e8ecf4;
    --text-secondary: #8892b0;
    --text-muted: #5a6580;
    --accent-blue: #4f6bff;
    --th-bg-1: #1c2240;
    --th-bg-2: #161d35;
    --accent-blue-light: #6b83ff;
    --accent-cyan: #22d3ee;
    --accent-purple: #a78bfa;
    --accent-green: #34d399;
    --accent-orange: #fb923c;
    --accent-red: #f87171;
    --gradient-1: linear-gradient(135deg, #4f6bff 0%, #a78bfa 100%);
    --gradient-2: linear-gradient(135deg, #22d3ee 0%, #4f6bff 100%);

    /* CAD COLORS (DARK MODE) */
    --cad-shape: #00e5ff;
    --cad-hatch: #00bcd4;
    --cad-dim: #00e5ff;
    --cad-dim-text: #ffeb3b;   /* Yellow */
    --cad-axis: #ff9800;
    --cad-axis-text: #ff4081;  /* Magenta */
    --cad-centroid: #ff9800;
    --cad-code: #69f0ae;       /* Green */
    --cad-grid: rgba(255,255,255,0.04);
    --cad-hover: rgba(255,235,59,0.08);
}

[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-hover: #f8fafc;
    --bg-input: #f8fafc;
    --border: #cbd5e1;
    --border-focus: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent-blue: #2563eb;
    --accent-blue-light: #3b82f6;
    --accent-cyan: #0284c7;
    --th-bg-1: #f1f5f9;
    --th-bg-2: #e2e8f0;

    /* Light Mode CAD colors (High Contrast for Printing) */
    --cad-shape: #000000;
    --cad-hatch: rgba(0,0,0,0.4);
    --cad-dim: #475569;
    --cad-dim-text: #0ea5e9;   /* High contrast dark cyan/blue */
    --cad-axis: #ea580c;       /* Dark orange */
    --cad-axis-text: #be123c;  /* Dark magenta */
    --cad-centroid: #ea580c;
    --cad-code: #000000;
    --cad-grid: rgba(0,0,0,0.05);
    --cad-hover: rgba(2,132,199,0.08);
}

:root {
    --glass: rgba(26, 31, 53, 0.85);
    --glass-border: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(79,107,255,0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ========== HEADER ========== */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 24px;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.app-title .version {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

.app-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

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

.badge-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.badge-count {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(79,107,255,0.12);
    color: var(--accent-blue-light);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(79,107,255,0.2);
}

/* ========== TAB NAVIGATION ========== */
.tab-container {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-scroll {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 8px 0;
}

.tab-scroll::-webkit-scrollbar { display: none; }

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(125, 125, 125, 0.1);
}

.tab-btn.active {
    color: #ffffff;
    background: var(--accent-blue);
    opacity: 1;
}

.tab-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.tab-btn.active .tab-icon {
    opacity: 1;
    color: var(--accent-cyan);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    min-height: calc(100vh - 180px);
}

/* ========== CONTROL CARD ========== */
.control-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.control-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.select-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: 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='%238892b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

.select-input:hover { border-color: var(--border-focus); }
.select-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79,107,255,0.15);
}

.select-input option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.standard-note {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.6;
    display: none;
}

.standard-note.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

.warning-banner {
    max-width: 1600px;
    margin: 0 auto 16px;
    padding: 12px 16px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.08);
    color: #fecaca;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .warning-banner {
    background: rgba(220, 38, 38, 0.06);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.18);
}

/* ========== DATA CARD ========== */
.data-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.data-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}

.data-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.record-count {
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(34,211,238,0.1);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.data-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(79,107,255,0.1);
    border: 1px solid rgba(79,107,255,0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-blue-light);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    background: rgba(79,107,255,0.2);
    border-color: rgba(79,107,255,0.4);
    transform: translateY(-1px);
}

.btn-action:active { transform: translateY(0); }

.search-input {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.78rem;
    width: 180px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79,107,255,0.15);
    width: 220px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ========== TABLE ========== */
.table-container {
    width: 100%;
}

.table-scroll {
    max-height: 500px;
    overflow: auto;
}

.table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    border: 1px solid rgba(120, 150, 190, 0.18);
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    z-index: 5;
    border-right: 1px solid rgba(120, 150, 190, 0.14);
}

/* First header row (column names) sticks at top */
.data-table thead tr:first-child th {
    top: 0;
    background: var(--th-bg-1);
}

/* Second header row (units) sticks below first row */
.data-table thead tr:nth-child(2) th {
    top: 36px;
    background: var(--th-bg-2);
    border-bottom: 2px solid var(--accent-blue);
}

.data-table td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(120, 150, 190, 0.14);
    border-right: 1px solid rgba(120, 150, 190, 0.12);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
}

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

.data-table .col-name {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--accent-blue-light);
}

.data-table .col-unit {
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.data-table tbody tr {
    transition: background 0.15s ease;
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: rgba(79,107,255,0.06);
}

.data-table tbody tr.selected {
    background: rgba(79,107,255,0.12);
    box-shadow: inset 3px 0 0 var(--accent-blue);
}

/* Properties view (vertical layout) */
.props-table {
    width: 100%;
}

.props-table .prop-row {
    display: grid;
    grid-template-columns: 1fr 80px 120px 80px;
    padding: 4px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    align-items: center;
    transition: background 0.15s ease;
}

.props-table .prop-row > * {
    padding: 6px 12px;
}

.props-table .prop-row > *:not(:last-child) {
    border-right: 1px solid rgba(120, 150, 190, 0.14);
}

[data-theme="light"] .props-table .prop-row {
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .props-table .prop-row > *:not(:last-child) {
    border-right: 1px solid rgba(133, 151, 179, 0.22);
}

.props-table .prop-row:hover {
    background: rgba(79,107,255,0.06);
}

.props-table .prop-name {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.props-table .prop-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--accent-purple);
    font-weight: 500;
}

.props-table .prop-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent-cyan);
    text-align: right;
}

.props-table .prop-unit {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: right;
}

.props-table .prop-header {
    background: rgba(255,255,255,0.03);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 8px 20px;
    border-bottom: 1px solid var(--border);
}

/* ========== EMPTY STATE ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.empty-icon {
    margin-bottom: 16px;
}

/* ========== REBAR & CONCRETE MODULE ========== */
.rebar-tabs {
    margin-bottom: 16px;
}

.rebar-header {
    margin-bottom: 20px;
}

.rebar-content-area {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.rebar-tabs .btn-action {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.rebar-tabs .btn-action:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.rebar-tabs .active-subtab {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    font-weight: 600;
}
[data-theme="light"] .rebar-tabs .active-subtab {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.rebar-grid th, .rebar-grid td {
    padding: 10px 6px;
    border: 1px solid rgba(120, 150, 190, 0.18);
}

.rebar-grid thead th {
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.rebar-grid.data-table tbody tr:hover td {
    background: transparent;
}

.cross-highlight {
    background: rgba(79, 107, 255, 0.25) !important;
}

[data-theme="light"] .cross-highlight {
    background: rgba(43, 85, 237, 0.15) !important;
}

[data-theme="light"] .data-table {
    border-color: rgba(133, 151, 179, 0.32);
}

[data-theme="light"] .data-table th {
    border-right-color: rgba(133, 151, 179, 0.24);
}

[data-theme="light"] .data-table td {
    border-bottom-color: rgba(133, 151, 179, 0.22);
    border-right-color: rgba(133, 151, 179, 0.18);
}

[data-theme="light"] .bolt-data-table td,
[data-theme="light"] .bolt-data-table th {
    border-color: rgba(133, 151, 179, 0.22);
}

/* ========== IMAGE CARD ========== */
.panel-right {
    position: sticky;
    top: 130px;
    align-self: start;
}

.image-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.image-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.image-container {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    background: var(--bg-primary);
}

.section-image {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: 4px;
    filter: none;
    transition: transform 0.3s ease;
}

[data-theme="light"] .section-image {
    filter: invert(1) hue-rotate(180deg) contrast(1.2);
}

.section-image:hover {
    transform: scale(1.05);
}

/* ========== INTERACTIVE SVG DRAWING (CAD Style) ========== */
.section-svg {
    width: 100%;
    min-width: 100%;
    height: auto;
    min-height: 300px;
    max-height: 480px;
    display: block;
}

.drawing-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px 0;
}

.drawing-toolbar .btn-action {
    padding: 7px 10px;
    font-size: 0.8rem;
}

.drawing-edit-mode .dim-group {
    cursor: move;
}

.drawing-edit-mode .dim-group:hover .dim-line,
.drawing-edit-mode .dim-group:hover .ext-line {
    stroke-width: 2;
    opacity: 1;
}

.drawing-edit-mode .dim-group.dragging {
    opacity: 0.9;
}

.drawing-edit-mode .dim-group.dragging text {
    filter: brightness(1.2);
}

.edit-handle {
    fill: #ff9800;
    stroke: #fff3c4;
    stroke-width: 1.4;
    cursor: nwse-resize;
    opacity: 0.95;
}

.drawing-edit-mode .edit-handle:hover {
    fill: #ffd54f;
    transform-box: fill-box;
}

.edit-foot-handle {
    fill: #4dd0e1;
    stroke: #e0fbff;
}

.edit-text-target {
    cursor: move;
}

.drawing-edit-mode .edit-text-target:hover {
    filter: brightness(1.25);
}

/* Dimension lines - cyan like CAD */
.dim-line {
    stroke: var(--cad-dim);
    stroke-width: 1.2;
    opacity: 0.8;
}

/* Extension lines - thin dashed */
.ext-line {
    stroke: var(--cad-dim);
    stroke-width: 0.6;
    stroke-dasharray: 4 2;
    opacity: 0.4;
}

/* Axis lines - orange dashed */
.axis-line {
    stroke: var(--cad-axis);
    stroke-width: 1.2;
    stroke-dasharray: 12 5;
    opacity: 0.7;
}

/* Dimension highlight animation */
.dim-group {
    transition: opacity 0.15s ease;
    cursor: pointer;
}

.dim-group.highlight text {
    animation: dimFlash 0.5s ease infinite;
}

.dim-group.highlight .dim-line {
    stroke: var(--cad-dim-text);
    stroke-width: 2.5;
    opacity: 1;
}

.dim-group.highlight .ext-line {
    stroke: var(--cad-dim-text);
    opacity: 0.7;
}

@keyframes dimFlash {
    0% { opacity: 1; transform: scale(1); filter: brightness(1); }
    50% { opacity: 0.6; transform: scale(1.1); filter: brightness(1.5); }
    100% { opacity: 1; transform: scale(1); filter: brightness(1); }
}

/* Property row hover highlight */
.props-table .prop-row.dim-hover {
    background: var(--cad-hover) !important;
    box-shadow: inset 3px 0 0 var(--cad-dim-text);
}

.props-table .prop-row.dim-hover .prop-value {
    animation: valFlash 0.5s ease infinite;
}

@keyframes valFlash {
    0%, 100% { color: var(--cad-dim-text); }
    50% { color: var(--accent-cyan); }
}

/* Material Dropdown & Highlight Rows */
#matSelect {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 4px;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    outline: none;
    cursor: pointer;
}

#matSelect:focus {
    border-color: var(--border-focus);
}

.highlight-bg {
    background: rgba(255, 255, 255, 0.05);
}
[data-theme="light"] .highlight-bg {
    background: rgba(0, 0, 0, 0.03);
}

/* ========== BOLT + OTHER MODULES ========== */
#boltModule,
#otherModule {
    grid-column: 1 / -1;
}

.bolt-layout,
.other-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
}

.bolt-left,
.other-main,
.other-side {
    min-width: 0;
}

.bolt-card,
.other-card {
    margin-bottom: 16px;
}

.bolt-control-card,
.other-card .control-card {
    margin-bottom: 0;
}

.bolt-control-row,
.other-control-row {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(110px, 0.8fr));
}

.control-group-small {
    min-width: 0;
}

.bolt-figure-card {
    position: sticky;
    top: 20px;
}

.bolt-figure-wrap {
    min-height: 420px;
    background:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
        var(--bg-primary);
    background-size: 18px 18px, 18px 18px, auto;
}

[data-theme="light"] .bolt-figure-wrap {
    background:
        linear-gradient(rgba(15,23,42,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15,23,42,0.04) 1px, transparent 1px),
        #f8fafc;
}

.bolt-figure,
.other-shape-svg {
    width: 100%;
    height: auto;
    display: block;
}

.bolt-figure-image {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    display: block;
}

.other-figure-image {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    display: block;
}

.bolt-data-table td,
.bolt-data-table th {
    padding: 8px 10px;
}

.other-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.95fr);
}

.other-main,
.other-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.other-card-body {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
}

.other-card-body.compact {
    grid-template-columns: minmax(0, 1fr) 120px;
    align-items: center;
}

.other-round-card .other-card-body {
    grid-template-columns: 240px minmax(0, 1fr);
}

.other-figure-wrap,
.other-mini-figure {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.other-figure-wrap {
    min-height: 168px;
}

.other-mini-figure {
    min-height: 120px;
}

.other-fields {
    min-width: 0;
}

.composite-card {
    background: linear-gradient(180deg, rgba(79,107,255,0.08), rgba(34,211,238,0.03));
}

.composite-header {
    margin-bottom: 14px;
}

.composite-title {
    font-size: 0.98rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.composite-note {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
}

.composite-status {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    line-height: 1.45;
    border: 1px solid rgba(96, 165, 250, 0.24);
    background: rgba(96, 165, 250, 0.08);
    color: #bfdbfe;
}

.composite-status.is-match {
    border-color: rgba(74, 222, 128, 0.28);
    background: rgba(74, 222, 128, 0.08);
    color: #bbf7d0;
}

.composite-status.is-manual {
    border-color: rgba(96, 165, 250, 0.24);
    background: rgba(96, 165, 250, 0.08);
    color: #bfdbfe;
}

.composite-status.is-locked {
    border-color: rgba(250, 204, 21, 0.28);
    background: rgba(250, 204, 21, 0.08);
    color: #fde68a;
}

[data-theme="light"] .composite-status {
    border-color: rgba(59, 130, 246, 0.28);
    background: rgba(59, 130, 246, 0.08);
    color: #1e3a8a;
}

[data-theme="light"] .composite-status.is-match {
    border-color: rgba(34, 197, 94, 0.28);
    background: rgba(34, 197, 94, 0.10);
    color: #166534;
}

[data-theme="light"] .composite-status.is-manual {
    border-color: rgba(59, 130, 246, 0.28);
    background: rgba(59, 130, 246, 0.08);
    color: #1e3a8a;
}

[data-theme="light"] .composite-status.is-locked {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.10);
    color: #92400e;
}

.composite-type-row {
    grid-template-columns: minmax(260px, 1fr);
    margin-bottom: 14px;
}

.composite-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 14px;
}

.composite-input {
    appearance: textfield;
    background-image: none;
    padding-right: 14px;
}

.composite-error {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.24);
    color: #fda4af;
    font-size: 0.82rem;
}

.shape-line {
    stroke: var(--accent-cyan);
    stroke-width: 2;
    fill: none;
}

.shape-fill {
    fill: rgba(34, 211, 238, 0.08);
    stroke: var(--accent-cyan);
    stroke-width: 2;
}

.shape-hatch {
    stroke: rgba(34, 211, 238, 0.45);
    stroke-width: 1;
}

.shape-accent {
    stroke: #facc15;
    stroke-width: 1.6;
    fill: none;
}

.shape-axis {
    stroke: #ec4899;
    stroke-width: 1.2;
}

.shape-text {
    fill: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
}

.shape-dim {
    fill: #22d3ee;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
}

.bolt-shape {
    stroke: #f8fafc;
    stroke-width: 2;
    fill: none;
}

.bolt-fill {
    fill: rgba(255,255,255,0.05);
    stroke: #f8fafc;
    stroke-width: 2;
}

.bolt-dim {
    stroke: #00ffff;
    stroke-width: 1.3;
    fill: none;
}

.bolt-text {
    fill: #00ffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
}

.bolt-axis {
    stroke: #ff00ff;
    stroke-width: 1.1;
}

.bolt-hatch-line {
    stroke: rgba(255,255,255,0.24);
    stroke-width: 1;
}

[data-theme="light"] .bolt-shape,
[data-theme="light"] .bolt-fill {
    stroke: #0f172a;
}

[data-theme="light"] .bolt-fill {
    fill: rgba(15,23,42,0.03);
}

[data-theme="light"] .bolt-hatch-line {
    stroke: rgba(15,23,42,0.16);
}

@media (max-width: 1180px) {
    .bolt-layout,
    .other-layout {
        grid-template-columns: 1fr;
    }

    .bolt-figure-card {
        position: static;
    }
}

@media (max-width: 860px) {
    .bolt-control-row {
        grid-template-columns: 1fr 1fr;
    }

    .composite-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .footer-right {
        text-align: left;
    }

    .other-card-body,
    .other-round-card .other-card-body,
    .other-card-body.compact {
        grid-template-columns: 1fr;
    }
}

.highlight-red {
    background: rgba(248, 113, 113, 0.15) !important;
}
[data-theme="light"] .highlight-red {
    background: rgba(248, 113, 113, 0.25) !important;
}

.highlight-pink {
    background: rgba(236, 72, 153, 0.15) !important;
}
[data-theme="light"] .highlight-pink {
    background: rgba(236, 72, 153, 0.2) !important;
}

/* ========== QUICK INFO CARD ========== */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: slideUp 0.3s ease;
}

.info-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-blue-light);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(79,107,255,0.05);
}

.info-grid {
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
}

.info-item-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.info-item-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

/* ========== FOOTER ========== */
.app-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 40px;
    background: var(--bg-card);
}

.footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
    gap: 28px;
    align-items: start;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.footer-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-brand {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--accent-blue-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-link {
    text-decoration: none;
}

.badge-link:hover {
    text-decoration: underline;
}

.footer-title {
    color: var(--text-primary);
    font-size: 0.94rem;
    font-weight: 600;
}

.footer-desc,
.footer-note,
.footer-org {
    line-height: 1.6;
}

.footer-org a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.28);
}

.footer-org a:hover {
    border-bottom-color: currentColor;
}

.footer-author {
    color: var(--text-primary);
}

.footer-copy {
    margin-top: 6px;
}

/* ========== TOAST ========== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(52,211,153,0.2);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .panel-right {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .control-row {
        grid-template-columns: 1fr;
    }
    
    .header-badge { display: none; }
}

@media (max-width: 600px) {
    .main-content { padding: 12px; }
    
    .panel-right {
        grid-template-columns: 1fr;
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .data-actions { flex-wrap: wrap; }
    
    .search-input { width: 120px; }
    .search-input:focus { width: 160px; }
    
    .props-table .prop-row {
        grid-template-columns: 1fr 60px 90px 60px;
        padding: 8px 14px;
    }
}
