:root {
    --brand-950: #071528;
    --brand-900: #0b1d35;
    --brand-850: #102743;
    --brand-800: #153250;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-active: #1e40af;
    --primary-soft: #eff6ff;
    --primary-border: #bfdbfe;
    --accent: #0ea5e9;
    --text: #1e293b;
    --text-strong: #0f172a;
    --muted: #64748b;
    --muted-2: #8795a8;
    --border: #d9e2ec;
    --border-strong: #c7d2e0;
    --page: #f4f7fb;
    --card: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #eef3f8;
    --success: #15803d;
    --success-soft: #ecfdf3;
    --warning: #b76e00;
    --warning-soft: #fff8e6;
    --danger: #c92a2a;
    --danger-soft: #fff1f2;
    --info: #0f6fbd;
    --info-soft: #eaf5fd;
    --shadow-xs: 0 1px 2px rgba(15, 31, 53, .04);
    --shadow-sm: 0 4px 14px rgba(15, 31, 53, .055);
    --shadow: 0 10px 30px rgba(15, 31, 53, .07);
    --shadow-lg: 0 22px 55px rgba(7, 21, 40, .16);
    --radius-xs: 6px;
    --radius-sm: 9px;
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar: 280px;
    --sidebar-collapsed: 82px;
    --content-max: 1240px;
    --topbar-height: 76px;
    --transition: 180ms cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
    margin: 0;
    min-width: 320px;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 92% -8%, rgba(37, 99, 235, .07), transparent 28rem),
        var(--page);
    color: var(--text);
    font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    font-variant-numeric: tabular-nums;
}
body.sidebar-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
::selection { background: rgba(15, 111, 189, .18); }

.app-main {
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar);
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

/* Enterprise navigation */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,.035), transparent 18%),
        linear-gradient(180deg, var(--brand-900) 0%, var(--brand-950) 100%);
    color: #c8d4e2;
    z-index: 60;
    border-right: 1px solid rgba(255,255,255,.055);
    box-shadow: 14px 0 38px rgba(5, 16, 31, .11);
    transition: width var(--transition), transform var(--transition);
}
.sidebar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, #1d9ee5, #48b4e9 48%, transparent);
}
.sidebar-brand {
    min-height: 86px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 18px 18px 16px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.065);
}
.brand-logo {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .22);
}
.brand-logo img { width: 39px; height: 39px; object-fit: contain; }
.brand-text { min-width: 0; line-height: 1.25; white-space: nowrap; overflow: hidden; }
.brand-text strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.brand-text small { display: block; margin-top: 4px; color: #91a7bf; font-size: 10.5px; font-weight: 500; letter-spacing: .035em; text-transform: uppercase; }
.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
    padding: 16px 12px 12px;
}
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label {
    height: 22px;
    padding: 0 12px;
    color: #6f88a2;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .105em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 43px;
    margin: 2px 0;
    padding: 8px 11px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #bfccda;
    font-size: 13.5px;
    font-weight: 500;
    transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}
.nav-item:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.035); color: #fff; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(22,150,210,.22), rgba(15,111,189,.14));
    border-color: rgba(102,192,235,.2);
    color: #fff;
    box-shadow: inset 3px 0 0 #43b0e5, 0 6px 16px rgba(0,0,0,.08);
}
.nav-item:active { transform: translateY(1px); }
.nav-icon {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    font-size: 15px;
    color: #8fb0ca;
    transition: color var(--transition), background var(--transition);
}
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: #9edcff; background: rgba(255,255,255,.045); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer {
    flex: 0 0 auto;
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.065);
    background: rgba(3, 13, 25, .18);
}
.workspace-status {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 8px 10px 11px;
    color: #c7d4df;
}
.workspace-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: #35c56a; box-shadow: 0 0 0 4px rgba(53,197,106,.11); }
.workspace-status span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; }
.workspace-status strong, .workspace-status small { display: block; overflow: hidden; text-overflow: ellipsis; }
.workspace-status strong { font-size: 11.5px; font-weight: 600; color: #dce7f1; }
.workspace-status small { margin-top: 2px; color: #708aa3; font-size: 10px; }
.sidebar-collapse-btn {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    background: rgba(255,255,255,.035);
    color: #9eb2c5;
    font-size: 12px;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-collapse-btn i { flex: 0 0 22px; text-align: center; font-size: 14px; }
.sidebar-backdrop { display: none; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 14px; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .workspace-status span:last-child,
body.sidebar-collapsed .sidebar-collapse-btn span { display: none; }
body.sidebar-collapsed .sidebar-nav { padding-inline: 10px; }
body.sidebar-collapsed .nav-group + .nav-group { margin-top: 9px; }
body.sidebar-collapsed .nav-group-label { height: 8px; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 8px; }
body.sidebar-collapsed .nav-icon { flex-basis: 30px; width: 30px; height: 30px; }
body.sidebar-collapsed .workspace-status { justify-content: center; }
body.sidebar-collapsed .sidebar-collapse-btn { justify-content: center; }
body.sidebar-collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }

/* Top workspace bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: var(--topbar-height);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(18px) saturate(1.2);
    border-bottom: 1px solid rgba(202, 213, 225, .82);
    box-shadow: 0 2px 9px rgba(15,31,53,.025);
}
.topbar-inner {
    width: min(100%, var(--content-max));
    min-height: var(--topbar-height);
    margin: 0 auto;
    padding: 0 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.topbar-leading { min-width: 0; display: flex; align-items: center; gap: 13px; }
.topbar-heading { min-width: 0; }
.topbar-context {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
    color: var(--muted-2);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .025em;
}
.topbar-context i { font-size: 8px; }
.topbar-title {
    margin: 0;
    max-width: 720px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-strong);
    font-size: 20px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.025em;
}
.topbar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.phase-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid var(--primary-border);
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-active);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.icon-btn, .notification-btn, .user-trigger {
    min-height: 42px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.icon-btn:hover, .notification-btn:hover, .user-trigger:hover { border-color: var(--border-strong); background: var(--surface-soft); box-shadow: var(--shadow-sm); }
.icon-btn { display: none; width: 42px; padding: 0; font-size: 20px; }
.notification-btn { position: relative; width: 42px; padding: 0; font-size: 15px; }
.notification-btn span {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
}
.avatar {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(145deg, #e5f4fe, #d3ebfa);
    color: var(--primary-active);
    font-size: 12px;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(15,111,189,.1);
}
.avatar.large { flex-basis: 38px; width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
.user-trigger { min-width: 168px; justify-content: flex-start; padding: 5px 10px 5px 7px; }
.user-identity { min-width: 0; flex: 1; text-align: left; line-height: 1.25; }
.user-identity strong, .user-identity small { display: block; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-identity strong { font-size: 12.5px; font-weight: 650; color: var(--text-strong); }
.user-identity small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.user-menu { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 9px);
    min-width: 255px;
    max-width: min(300px, calc(100vw - 24px));
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    transform-origin: top right;
}
.user-menu.open .dropdown-menu { display: block; animation: dropdown-in 140ms ease-out; }
@keyframes dropdown-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown-profile { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); }
.dropdown-profile span:last-child { min-width: 0; }
.dropdown-profile strong, .dropdown-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-profile strong { font-size: 12.5px; }
.dropdown-profile small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.dropdown-meta { display: flex; align-items: center; gap: 8px; padding: 9px 10px; color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.logout-form { margin: 0; }
.dropdown-action {
    width: 100%;
    min-height: 39px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 600;
}
.dropdown-action:hover { background: var(--danger-soft); }

/* Page structure */
.content-wrap {
    width: min(100%, var(--content-max));
    min-width: 0;
    margin: 0 auto;
    padding: 26px;
    flex: 1 0 auto;
}
.auth-shell .app-main { margin-left: 0; }
.auth-shell .content-wrap { width: 100%; max-width: none; padding: 0; }
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}
.page-head > * { min-width: 0; }
.page-head h1, .content-wrap > h1 {
    margin: 0 0 16px;
    color: var(--text-strong);
    font-size: 23px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.025em;
}
.page-head > h1, .page-head > div > h1 { margin-bottom: 0; }
.page-head p { margin: 5px 0 0; max-width: 760px; }
.page-actions, .actions, .report-actions, .notification-toolbar, .form-actions, .row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.grid { display: grid; gap: 16px; min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid > .full { grid-column: 1 / -1; }
.card, .card-form {
    position: relative;
    min-width: 0;
    margin-bottom: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.card::before, .card-form::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: rgba(255,255,255,.95);
}
.card h2, .card-form h2 { margin: 0 0 15px; color: var(--text-strong); font-size: 16px; line-height: 1.35; font-weight: 700; letter-spacing: -.012em; }
.card h3 { margin: 0 0 8px; color: var(--text-strong); font-size: 14.5px; line-height: 1.4; }
.stat { color: var(--text-strong); font-size: clamp(26px, 3vw, 34px); font-weight: 700; line-height: 1.08; letter-spacing: -.04em; }
.muted, .small-note { color: var(--muted); font-size: 12.5px; }

/* Data tables */
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.table {
    width: 100%;
    min-width: 640px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}
.table th {
    background: #f5f8fb;
    color: #506176;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .065em;
}
.table th, .table td {
    padding: 12px 13px;
    border-bottom: 1px solid #e8edf3;
    vertical-align: middle;
    overflow-wrap: anywhere;
}
.table th:first-child, .table td:first-child { padding-left: 15px; }
.table th:last-child, .table td:last-child { padding-right: 15px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover td { background: #f9fbfd; }
.table td { color: #27364a; font-size: 13px; }
.table td .btn + .btn { margin-left: 5px; }
.actions-column { text-align: right; white-space: nowrap; }
.remarks-cell, .audit-json { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }

/* Forms */
label { display: block; margin: 12px 0 6px; color: #34445a; font-size: 12.5px; font-weight: 650; }
.form-row { min-width: 0; }
.form-row > label:first-child { margin-top: 0; }
.input, select, textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="tel"], input[type="url"] {
    width: 100%;
    max-width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    box-shadow: inset 0 1px 1px rgba(15,31,53,.02);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
select { padding-right: 34px; }
textarea { min-height: 100px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9ba7b5; }
.input:hover, select:hover, textarea:hover, input:hover { border-color: #b7c5d4; }
.input:focus, select:focus, textarea:focus, input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
input:disabled, select:disabled, textarea:disabled { background: #f4f6f8; color: #8795a8; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--primary); }
.checkbox-label, .checkbox-group label { display: flex; align-items: flex-start; gap: 8px; color: #334155; font-weight: 500; }
.field-hint { display: block; margin-top: 5px; color: var(--muted); font-size: 11.5px; }

/* Buttons */
.btn {
    min-height: 40px;
    border: 1px solid var(--primary);
    border-radius: 9px;
    background: linear-gradient(180deg, #2f70ef, var(--primary));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
    box-shadow: 0 7px 18px rgba(37, 99, 235, .16);
    transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:hover { background: linear-gradient(180deg, #116db5, var(--primary-hover)); border-color: var(--primary-hover); box-shadow: 0 7px 16px rgba(15,111,189,.18); transform: translateY(-1px); }
.btn:active { background: var(--primary-active); transform: translateY(0); }
.btn.secondary { border-color: var(--border-strong); background: #fff; color: #29384a; box-shadow: var(--shadow-xs); }
.btn.secondary:hover { background: var(--surface-soft); border-color: #aebdcc; box-shadow: var(--shadow-sm); }
.btn.danger { background: linear-gradient(180deg, #d43a3a, var(--danger)); border-color: var(--danger); box-shadow: 0 4px 10px rgba(201,42,42,.12); }
.btn.danger:hover { background: #b92323; border-color: #b92323; }
.btn.warning { background: linear-gradient(180deg, #c88612, var(--warning)); border-color: var(--warning); }
.btn.small { min-height: 33px; padding: 6px 9px; border-radius: 8px; font-size: 11.5px; }
.btn:disabled, button:disabled { opacity: .52; cursor: not-allowed; box-shadow: none; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, .notification-btn:focus-visible, .user-trigger:focus-visible,
.sidebar-collapse-btn:focus-visible, .dropdown-action:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .22);
    outline-offset: 2px;
}
.form-actions { margin-top: 17px; }
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 15;
    margin: 19px -20px -20px;
    padding: 13px 20px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
}

/* Feedback and status */
.alert {
    position: relative;
    margin-bottom: 17px;
    padding: 12px 42px 12px 14px;
    border: 1px solid;
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    overflow-wrap: anywhere;
    box-shadow: var(--shadow-xs);
}
.alert > i { margin-top: 1px; }
.alert.success { border-color: #bce9cb; background: var(--success-soft); color: #116632; }
.alert.error { border-color: #f2c7cc; background: var(--danger-soft); color: #9d202b; }
.alert button { position: absolute; top: 6px; right: 9px; border: 0; background: transparent; color: inherit; font-size: 21px; }
.badge, .status-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid transparent;
    background: #e9eef4;
    color: #405166;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .015em;
    white-space: normal;
}
.badge.draft { background: #f1f4f7; border-color: #dce3ea; }
.badge.submitted, .badge.in_approval { background: #e8f3fc; border-color: #c9e2f6; color: #0b5f9f; }
.badge.hold { background: #fff4e8; border-color: #f4d3ad; color: #a45500; }
.badge.approved, .badge.closed, .badge.issued { background: #eaf8ef; border-color: #c7e9d2; color: #146b37; }
.badge.purchase_required, .badge.current, .badge.po_created, .badge.grn_done { background: #edf0ff; border-color: #d3d9fa; color: #4452a8; }
.badge.rejected { background: #fff0f1; border-color: #f2cbd0; color: #aa2530; }
.badge.pending, .badge.skipped, .badge.cancelled { background: #f2f5f8; border-color: #dde4eb; color: #56677b; }
.badge.partial { background: #fff7df; border-color: #f0dda0; color: #8a6200; }
.badge.stock_issue { background: #e8f8fb; border-color: #c2e8ef; color: #0b6f80; }
.danger-badge { background: #fff0f1 !important; border-color: #f2cbd0 !important; color: #aa2530 !important; }
.low-stock { color: var(--danger); font-weight: 700; }

/* Common enterprise modules */
.empty-state { padding: 34px 24px; text-align: center; color: var(--muted); }
.empty-state i { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 12px; background: var(--surface-strong); color: var(--primary); font-size: 20px; }
.empty-state p { max-width: 540px; margin: 0 auto; }
.empty-state.compact { padding: 15px; }
.empty-state.compact i { display: none; }
.dashboard-row { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); gap: 16px; }
.status-list { display: grid; gap: 8px; }
.status-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.status-item:hover { border-color: var(--primary-border); background: var(--primary-soft); transform: translateX(2px); }
.status-item > * { min-width: 0; }
.quick-actions, .module-list { display: flex; gap: 9px; flex-wrap: wrap; }
.quick-actions a, .module-link {
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 9px 12px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #304157;
    font-size: 12.5px;
    font-weight: 600;
    transition: border-color var(--transition), background var(--transition), color var(--transition), transform var(--transition);
}
.quick-actions a:hover, .module-link:hover { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary-active); transform: translateY(-1px); }
.filter-form, .filter-bar, .report-toolbar {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}
.filter-form > *, .filter-bar > *, .report-toolbar > * { min-width: 150px; flex: 1; }
.filter-form button, .filter-bar button, .filter-form .btn, .filter-bar .btn,
.report-toolbar button, .report-toolbar .btn { flex: 0 0 auto; min-width: auto; }
.inline-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 8px; align-items: center; }
.inline-action-form, .danger-inline-form, .danger-block-form { margin: 0; }
.danger-zone {
    border-color: #edc7cc;
    background: linear-gradient(180deg, #fff, #fffafb);
}
.danger-zone h2, .danger-zone h3 { color: #9f2630; }
.app-footer {
    width: min(100%, var(--content-max));
    margin: auto auto 0;
    padding: 9px 26px 24px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted-2);
    font-size: 10.5px;
}
.footer-product { display: inline-flex; align-items: center; gap: 6px; }

/* Fatal error surface */
.fatal-error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--page); }
.fatal-error-card { width: min(100%, 560px); padding: 28px; border: 1px solid var(--border); border-radius: 15px; background: #fff; box-shadow: var(--shadow); }
.fatal-error-card h1 { margin: 0 0 8px; font-size: 22px; }
.fatal-error-card p { margin: 0; color: var(--muted); }

@media (max-width: 1120px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    :root { --topbar-height: 66px; }
    body.sidebar-collapsed .app-main, .app-main { margin-left: 0; }
    .sidebar, body.sidebar-collapsed .sidebar {
        width: min(86vw, 300px);
        transform: translateX(-105%);
        box-shadow: 20px 0 55px rgba(7,21,40,.3);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .nav-group-label,
    body.sidebar-collapsed .nav-label,
    body.sidebar-collapsed .workspace-status span:last-child,
    body.sidebar-collapsed .sidebar-collapse-btn span { display: block; }
    body.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding-inline: 18px; }
    body.sidebar-collapsed .sidebar-nav { padding-inline: 12px; }
    body.sidebar-collapsed .nav-group + .nav-group { margin-top: 18px; }
    body.sidebar-collapsed .nav-group-label { height: 22px; }
    body.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 8px 11px; }
    body.sidebar-collapsed .nav-icon { flex-basis: 24px; width: 24px; height: 24px; }
    body.sidebar-collapsed .workspace-status { justify-content: flex-start; }
    body.sidebar-collapsed .sidebar-collapse-btn { justify-content: flex-start; }
    body.sidebar-collapsed .sidebar-collapse-btn i { transform: none; }
    .sidebar-collapse-btn { display: none; }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: block;
        visibility: hidden;
        opacity: 0;
        background: rgba(5, 16, 31, .58);
        backdrop-filter: blur(2px);
        transition: opacity var(--transition), visibility var(--transition);
    }
    body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
    .icon-btn { display: inline-flex; }
    .topbar-inner { padding: 0 16px; }
    .topbar-context { display: none; }
    .content-wrap { padding: 20px 16px; }
    .app-footer { padding-inline: 16px; }
    .page-head { align-items: flex-start; }
}

@media (max-width: 700px) {
    .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
    .form-grid > .full { grid-column: auto; }
    .page-head { flex-direction: column; align-items: stretch; }
    .page-head .page-actions { width: 100%; }
    .filter-form, .filter-bar, .report-toolbar { display: grid; grid-template-columns: 1fr; width: 100%; }
    .filter-form > *, .filter-bar > *, .report-toolbar > * { min-width: 0; width: 100%; }
    .filter-form .btn, .filter-bar .btn, .report-toolbar .btn { width: 100%; }
    .inline-form { grid-template-columns: 1fr; }
    .sticky-actions { position: static; margin-bottom: -20px; }
    .actions-column { text-align: left; }
    .notification-toolbar { width: 100%; justify-content: space-between; }

    .table.mobile-card-table { min-width: 0; display: block; background: transparent; }
    .table.mobile-card-table thead { display: none; }
    .table.mobile-card-table tbody { display: grid; gap: 10px; }
    .table.mobile-card-table tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 11px;
        background: #fff;
        box-shadow: var(--shadow-xs);
        overflow: hidden;
    }
    .table.mobile-card-table td {
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: minmax(105px, 35%) minmax(0, 1fr);
        gap: 10px;
        padding: 9px 11px;
        border-bottom: 1px solid #edf1f5;
        background: #fff !important;
        white-space: normal;
        text-align: left;
    }
    .table.mobile-card-table td:last-child { border-bottom: 0; }
    .table.mobile-card-table td::before {
        content: attr(data-label);
        color: #68788b;
        font-size: 9.5px;
        font-weight: 700;
        letter-spacing: .055em;
        text-transform: uppercase;
    }
    .table.mobile-card-table td[data-label=""]::before { display: none; }
    .table.mobile-card-table .mobile-empty-row td { display: block; }
    .table.mobile-card-table .mobile-empty-row td::before { display: none; }
    .table.mobile-card-table td .btn + .btn { margin: 6px 0 0; }
    .table.mobile-card-table td.actions-column .btn { width: 100%; }
    .table-wrap.mobile-card-wrap { overflow: visible; border: 0; background: transparent; }
}

@media (max-width: 560px) {
    .topbar-inner { padding: 0 12px; gap: 8px; }
    .topbar-leading { gap: 8px; }
    .topbar-title { max-width: calc(100vw - 168px); font-size: 17px; }
    .topbar-actions { gap: 7px; }
    .phase-chip { display: none; }
    .user-identity { display: none; }
    .user-trigger { min-width: 42px; width: 42px; padding: 0; }
    .user-trigger > i { display: none; }
    .content-wrap { padding: 16px 12px 20px; }
    .card, .card-form { padding: 15px; border-radius: 11px; }
    .page-head h1, .content-wrap > h1 { font-size: 21px; }
    .page-head .btn, .page-head .page-actions, .page-head .page-actions .btn { width: 100%; }
    .form-actions, .actions, .report-actions { width: 100%; }
    .form-actions .btn, .sticky-actions .btn { flex: 1 1 100%; width: 100%; }
    .actions .btn, .report-actions .btn { flex: 1 1 calc(50% - 4px); }
    .status-item { flex-direction: column; }
    .quick-actions, .module-list { display: grid; grid-template-columns: 1fr; }
    .quick-actions a, .module-link { width: 100%; }
    .app-footer { flex-direction: column; align-items: flex-start; padding: 8px 12px 18px; }
    .sticky-actions { margin-inline: -15px; margin-bottom: -15px; padding-inline: 15px; }
}

@media (max-width: 390px) {
    .table.mobile-card-table td { grid-template-columns: 1fr; gap: 3px; }
    .actions .btn, .report-actions .btn { flex-basis: 100%; width: 100%; }
    .notification-btn { display: none; }
    .topbar-title { max-width: calc(100vw - 106px); }
}

@media print {
    body { background: #fff; }
    .sidebar, .topbar, .sidebar-backdrop, .app-footer, .no-print { display: none !important; }
    .app-main, body.sidebar-collapsed .app-main { margin-left: 0; }
    .content-wrap { width: 100%; max-width: none; padding: 0; }
    .card, .card-form { box-shadow: none; }
    .table.mobile-card-table { display: table; min-width: 0; }
    .table.mobile-card-table thead { display: table-header-group; }
    .table.mobile-card-table tbody { display: table-row-group; }
    .table.mobile-card-table tr { display: table-row; border: 0; box-shadow: none; }
    .table.mobile-card-table td { display: table-cell; width: auto; padding: 8px; border-bottom: 1px solid var(--border); }
    .table.mobile-card-table td::before { display: none; }
}


/* Enterprise UI v2 — shared refinement layer */
.content-wrap {
    padding: 30px 28px 34px;
}
.topbar {
    border-bottom-color: #dbe4ef;
    background: rgba(255,255,255,.93);
    box-shadow: 0 1px 0 rgba(15,23,42,.02);
}
.topbar-inner { width: min(100%, var(--content-max)); margin-inline: auto; }
.topbar-title { font-size: 18px; font-weight: 750; letter-spacing: -.025em; }
.topbar-context { color: #8492a6; }
.phase-chip { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.sidebar {
    background:
        radial-gradient(circle at 20% 0%, rgba(56,189,248,.11), transparent 17rem),
        linear-gradient(180deg, #0b172a 0%, #07111f 100%);
}
.sidebar::before { height: 2px; background: linear-gradient(90deg, #38bdf8, #2563eb 55%, transparent); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(37,99,235,.22), rgba(37,99,235,.08));
    color: #fff;
    box-shadow: inset 3px 0 0 #60a5fa;
}
.nav-item.active .nav-icon { color: #bfdbfe; background: rgba(96,165,250,.1); }
.page-head { margin-bottom: 20px; }
.page-kicker, .section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.page-head h1, .content-wrap > h1 { font-size: 25px; font-weight: 750; letter-spacing: -.035em; }
.card, .card-form {
    border-color: #dce5ef;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15,23,42,.055), 0 1px 2px rgba(15,23,42,.03);
}
.card::before, .card-form::before { display: none; }
.table-wrap { border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.025); }
.table th { background: #f7f9fc; color: #64748b; font-size: 10px; }
.table tbody tr:hover td { background: #f8fbff; }
label { color: #334155; font-size: 12px; font-weight: 680; }
.input, select, textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="tel"], input[type="url"] {
    min-height: 44px;
    border-color: #cbd7e5;
    border-radius: 10px;
    color: #172033;
    box-shadow: 0 1px 2px rgba(15,23,42,.02);
}
.input:hover, select:hover, textarea:hover, input:hover { border-color: #aebed0; }
.btn {
    min-height: 42px;
    border-radius: 10px;
    padding-inline: 15px;
    font-weight: 700;
    letter-spacing: -.005em;
}
.btn.primary-strong { box-shadow: 0 9px 22px rgba(37,99,235,.2); }
.btn.secondary { color: #334155; }
.btn.ghost-danger {
    border-color: transparent;
    background: transparent;
    color: #b4232f;
    box-shadow: none;
}
.btn.ghost-danger:hover { border-color: #fecdd3; background: #fff1f2; color: #9f1d29; box-shadow: none; }
.filter-form, .filter-bar, .report-toolbar { padding: 14px; border: 1px solid #dce5ef; border-radius: 12px; background: #fff; box-shadow: 0 4px 16px rgba(15,23,42,.035); }
.admin-tile, .report-card, .purchase-card, .notification-card, .metric-card {
    border-color: #dce5ef;
    border-radius: 14px;
}
.admin-tile:hover, .report-card:hover, .purchase-card:hover, .notification-card:hover, .metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(15,23,42,.08);
}
.required-mark { color: var(--danger); }
.control-wrap { position: relative; }
.control-with-icon > i { position: absolute; left: 13px; top: 50%; z-index: 2; transform: translateY(-50%); color: #8190a4; pointer-events: none; }
.control-with-icon > .input { padding-left: 38px; }
.page-head-status {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 230px;
    padding: 10px 12px;
    border: 1px solid #dbe5ef;
    border-radius: 12px;
    background: rgba(255,255,255,.78);
    box-shadow: 0 4px 14px rgba(15,23,42,.035);
}
.page-head-status .status-dot { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }
.page-head-status strong, .page-head-status small { display: block; }
.page-head-status strong { color: #273449; font-size: 11.5px; }
.page-head-status small { margin-top: 2px; color: #7b8899; font-size: 10px; }
.section-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 72px;
    padding: 16px 18px;
    border-bottom: 1px solid #e4eaf1;
    background: linear-gradient(180deg, #fff, #fbfcfe);
}
.section-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 18px;
    box-shadow: inset 0 0 0 1px #dbeafe;
}
.section-icon.accent { background: #ecfeff; color: #0e7490; box-shadow: inset 0 0 0 1px #cffafe; }
.section-heading-copy { flex: 1 1 auto; min-width: 0; }
.section-heading-copy strong, .section-heading-copy small { display: block; }
.section-heading-copy strong { margin-top: 2px; color: #0f172a; font-size: 15px; font-weight: 750; letter-spacing: -.015em; }
.section-heading-copy small { margin-top: 3px; color: #718096; font-size: 11px; }
.section-step {
    flex: 0 0 auto;
    color: #cbd5e1;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.04em;
}
.section-content { padding: 20px; }
.form-section-card { padding: 0; overflow: hidden; }
.checkbox-panel { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border: 1px solid #d8e1ec; border-radius: 10px; background: #f8fafc; }
.checkbox-panel label { margin: 0; padding: 7px 9px; border-radius: 8px; background: #fff; border: 1px solid #e2e8f0; }
@media (max-width: 900px) {
    .content-wrap { padding: 22px 18px 28px; }
    .topbar-inner { width: 100%; }
}
@media (max-width: 640px) {
    .content-wrap { padding: 17px 12px 22px; }
    .page-head-status { width: 100%; min-width: 0; }
    .section-heading { align-items: flex-start; padding: 14px; }
    .section-heading-copy small { line-height: 1.45; }
    .section-content { padding: 15px; }
    .section-step { display: none; }
}
@media print {
    .content-wrap { width: 100%; max-width: none; padding: 0; }
    .card, .card-form { border-color: #d7dde5; box-shadow: none; }
    .page-head-status, .form-command-bar { display: none !important; }
}
