/**
 * Premium white theme — clean enterprise layout
 */

:root {
    --primary: #111111;
    --primary-dark: #000000;
    --primary-soft: #f4f4f5;
    --secondary: #475569;
    --success: #059669;
    --warning: #d97706;
    --danger: #e11d48;
    --bg: #f4f6f9;
    --bg-subtle: #fafbfc;
    --card: #ffffff;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
    --nav-height: 56px;
    --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Noto Sans Myanmar", sans-serif;
}

body {
    font-family: var(--font-sans);
    background: transparent;
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ——— App shell ——— */
.navbar {
    height: var(--nav-height);
    padding: 0 28px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    gap: 16px;
}

.nav-brand-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand-sub {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}

.brand-icon { display: none; }

.nav-links {
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.nav-links a {
    padding: 6px 11px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--bg-subtle);
    border-color: var(--border-light);
}

.nav-links a.active {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #bfdbfe;
    font-weight: 600;
}

.nav-user {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-subtle);
    max-width: 180px;
}

.site-context-bar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 10px 28px;
    top: var(--nav-height);
    box-shadow: var(--shadow-xs);
}

.site-context-inner label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.site-context-select {
    min-width: 200px;
    max-width: 320px;
    font-size: 0.875rem;
    border-color: var(--border);
}

.site-context-budget {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.container {
    max-width: 1280px;
    padding: 28px 28px 48px;
}

/* ——— Page structure ——— */
.page-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text);
    line-height: 1.3;
}

.page-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 6px;
    max-width: 640px;
}

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

.card > h2,
.card > h3,
.card-header h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.card-header {
    padding: 16px 24px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
}

.card form,
.card > .form-group,
.card > .table {
    padding: 0;
}

.card > h2,
.card > h3:not(.card-header h3) {
    padding: 20px 24px 0;
}

.card > p.page-desc {
    padding: 0 24px;
}

.card .table th,
.card .table td {
    padding: 12px 24px;
}

.card .form-row,
.card .filter-bar,
.convert-form {
    padding: 20px 24px;
}

/* ——— Dashboard ——— */
.dashboard-grid {
    gap: 10px;
    margin-bottom: 16px;
}

.dash-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 20px 18px;
    box-shadow: var(--shadow-xs);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--card);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.dash-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.dash-card-featured,
.dash-card-primary {
    background: var(--card);
    color: var(--text);
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.dash-card-featured:hover,
.dash-card-primary:hover {
    border-color: var(--primary);
}

.dash-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--primary);
    text-transform: uppercase;
}

.dash-card-featured .dash-icon-wrap,
.dash-card-primary .dash-icon-wrap {
    background: var(--primary-soft);
    border-color: #bfdbfe;
    color: var(--primary);
}

.dash-icon { display: none; }

.dash-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}

.dash-card p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    opacity: 1;
    line-height: 1.45;
}

/* ——— Stats ——— */
.stats-section h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.stats-grid {
    gap: 14px;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-xs);
    text-align: left;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ——— Summary blocks ——— */
.summary-cards {
    gap: 12px;
}

.summary-item {
    flex: 1;
    min-width: 120px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-subtle);
}

.summary-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.budget-meter-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
}

.budget-meter {
    height: 6px;
    background: var(--border-light);
}

.budget-meter-fill {
    background: var(--primary);
}

.budget-meter-fill.warn { background: var(--warning); }
.budget-meter-fill.danger { background: var(--danger); }

/* ——— Tables ——— */
.table th {
    background: var(--bg-subtle);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.table td {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: var(--bg-subtle);
}

.table-sm th,
.table-sm td {
    padding: 10px 16px;
}

/* ——— Buttons ——— */
.btn {
    font-weight: 500;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--card);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-subtle);
    color: var(--text);
    border-color: #cbd5e1;
}

.btn-warning {
    background: #fffbeb;
    color: var(--warning);
    border: 1px solid #fde68a;
}

.btn-danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.touch-btn { min-height: 40px; }

/* ——— Forms ——— */
.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.form-input,
.form-select,
textarea {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.filter-bar.card {
    padding: 16px 20px;
    margin-bottom: 20px;
}

/* ——— Modals ——— */
.modal {
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-width: 520px;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-wide { max-width: 720px; }

/* ——— POS ——— */
.pos-sidebar,
.pos-cart,
.materials-grid {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.material-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
}

.material-card:hover {
    border-color: #93c5fd;
    background: var(--bg-subtle);
    box-shadow: var(--shadow-xs);
}

.material-card.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 1px var(--primary);
}

.mat-name {
    font-size: 0.8125rem;
    font-weight: 600;
}

.mat-stock {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
    font-size: 0.75rem;
}

.mat-stock-empty {
    background: #fffbeb;
    color: var(--warning);
    border: 1px solid #fde68a;
}

.sel-name {
    font-size: 1.05rem;
    font-weight: 600;
}

.total-amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.toggle-btn {
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.toggle-btn.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #bfdbfe;
    font-weight: 600;
}

.area-calculator {
    background: var(--bg-subtle);
    border-radius: var(--radius);
}

/* ——— Badges & alerts ——— */
.badge,
.unit-type-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 4px;
}

.price-tag-current {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid #bfdbfe;
}

.price-tag-average {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.total-badge {
    background: var(--bg-subtle);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.budget-alert {
    border-radius: var(--radius);
    font-size: 0.8125rem;
    background: var(--primary-soft);
    border: 1px solid #bfdbfe;
    color: var(--text-secondary);
}

.budget-alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.budget-alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
}

.badge-success { background: #ecfdf5; color: var(--success); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-danger { background: #fef2f2; color: var(--danger); }

/* ——— Tabs & reports ——— */
.tab-btn {
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.tab-btn.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #bfdbfe;
    font-weight: 600;
}

.report-summary .stat-card,
.report-summary .summary-item {
    border: 1px solid var(--border);
}

/* ——— Workflow / dashboard page ——— */
.wf-step {
    border-radius: var(--radius);
    border-color: var(--border);
    background: var(--card);
}

.wf-step.active {
    border-color: #bfdbfe;
    background: var(--primary-soft);
}

.wf-step.done {
    border-color: #bbf7d0;
}

.dash-two-col {
    gap: 20px;
}

/* ——— Toast ——— */
.toast {
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    background: var(--text);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ——— Login ——— */
.login-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 400px;
    margin: 48px auto;
    padding: 32px 28px;
}

.login-card h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-card .page-desc {
    margin-bottom: 24px;
}

/* ——— Utilities ——— */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }

.price-cell { color: var(--text); font-variant-numeric: tabular-nums; }

.ledger-summary {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}

@media (max-width: 1024px) {
    .container { padding: 20px 16px 32px; }
    .navbar { padding: 8px 16px; }
    .site-context-bar { padding: 10px 16px; }
    .nav-links a { font-size: 0.875rem; padding: 10px 12px; }
}

@media (min-width: 1025px) {
    .nav-links::-webkit-scrollbar { height: 4px; }
    .nav-links::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }
}
