/* ============================================================
   Vinina ERP — Clean Light Theme
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Backgrounds */
    --bg-base: #ffffff;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f5f5f5;
    --bg-input: #f7fbf7;

    /* Borders */
    --border: #d5e8d5;
    --border-light: #e2ede2;
    --border-focus: #4ab040;

    /* Accent — Vinina Green */
    --accent: #3da832;
    --accent-hover: #2f8e26;
    --accent-light: #eaf6e9;
    --accent2: #d41414;
    --accent2-light: #fef2f2;

    /* Status */
    --success: #3da832;
    --success-light: #eaf6e9;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;

    /* Text */
    --text: #0f2d0f;
    --text-muted: #4a6b4a;
    --text-subtle: #7a9b7a;
    --text-white: #ffffff;

    /* Sidebar — Vinina Dark Green */
    --sidebar-bg: #163b1e;
    --sidebar-border: #214f2a;
    --sidebar-text: #a8c4aa;
    --sidebar-active-bg: rgba(74, 176, 64, .18);
    --sidebar-active: #6ccc60;
    --sidebar-hover: rgba(255, 255, 255, .07);

    /* Misc */
    --sidebar-w: 240px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .05);
    --shadow: 0 4px 16px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .05);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, .14);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ══════════════════════════════════════════════════
   LAYOUT — ERPNext style
══════════════════════════════════════════════════ */
:root {
  --topbar-h: 50px;
  --ws-sidebar-w: 230px;
  --text-main: #1a1a1a;
  --bg-page: #f3f4f6;
}

.erpnext-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── TOPBAR ─────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 200;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.topbar-logo {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 6px;
    transition: background .15s;
}
.topbar-logo:hover { background: #f3f4f6; }

.topbar-icon-btn {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.topbar-icon-btn:hover { background: #f3f4f6; color: #111; }

/* Breadcrumb */
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    flex-shrink: 0;
}
.bc-home { cursor: pointer; font-size: 15px; opacity:.7; }
.bc-home:hover { opacity:1; }
.bc-sep { color: #d1d5db; }
.bc-item { color: #6b7280; }
.bc-clickable { cursor: pointer; }
.bc-clickable:hover { color: #111; text-decoration: underline; }
.bc-item:last-child { color: #111; font-weight: 600; }

/* Center search */
.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 16px;
}
.topbar-search-wrap {
    position: relative;
    width: 100%;
    max-width: 460px;
}
.topbar-search-icon {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}
#topbar-search {
    width: 100%;
    height: 34px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0 12px 0 34px;
    font-size: 13px;
    font-family: inherit;
    background: #f9fafb;
    color: #111;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
#topbar-search:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(61,168,50,.1);
}
#topbar-search::placeholder { color: #9ca3af; }

/* Search results dropdown */
.topbar-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    display: none;
    z-index: 500;
    overflow: hidden;
}
.tsr-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .12s;
}
.tsr-item:hover { background: #f3f4f6; }
.tsr-empty { padding: 16px; text-align: center; color: #9ca3af; font-size: 13px; }

/* Right area */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.topbar-status {
    display: flex; align-items: center; gap: 5px;
    cursor: default;
}

/* User menu */
.topbar-user-menu {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    position: relative;
}
.topbar-user-menu:hover { background: #f3f4f6; }
.topbar-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}
.topbar-username { font-size: 13px; font-weight: 600; color: #374151; }

/* User dropdown */
.topbar-dropdown {
    position: absolute;
    top: calc(var(--topbar-h) + 4px);
    right: 12px;
    width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    z-index: 500;
    display: none;
    overflow: hidden;
}
.topbar-dropdown.open { display: block; }
.td-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px;
    background: #f9fafb;
}
.td-divider { height: 1px; background: #f3f4f6; }
.td-item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    border: none; background: none;
    font-size: 13px; font-family: inherit;
    color: #374151; cursor: pointer;
    transition: background .12s;
    text-align: left;
}
.td-item:hover { background: #f3f4f6; }
.td-item.danger { color: #dc2626; }

/* ── TOPBAR ─────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 200;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.topbar-logo {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 6px;
    transition: background .15s;
}
.topbar-logo:hover { background: #f3f4f6; }

.topbar-icon-btn {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.topbar-icon-btn:hover { background: #f3f4f6; color: #111; }

/* Breadcrumb */
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    flex-shrink: 0;
}
.bc-home { cursor: pointer; font-size: 15px; opacity:.7; }
.bc-home:hover { opacity:1; }
.bc-sep { color: #d1d5db; }
.bc-item { color: #6b7280; }
.bc-clickable { cursor: pointer; }
.bc-clickable:hover { color: #111; text-decoration: underline; }
.bc-item:last-child { color: #111; font-weight: 600; }

/* Center search */
.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 16px;
}
.topbar-search-wrap {
    position: relative;
    width: 100%;
    max-width: 460px;
}
.topbar-search-icon {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}
#topbar-search {
    width: 100%;
    height: 34px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0 12px 0 34px;
    font-size: 13px;
    font-family: inherit;
    background: #f9fafb;
    color: #111;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
#topbar-search:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(61,168,50,.1);
}
#topbar-search::placeholder { color: #9ca3af; }

/* Search results dropdown */
.topbar-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    display: none;
    z-index: 500;
    overflow: hidden;
}
.tsr-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .12s;
}
.tsr-item:hover { background: #f3f4f6; }
.tsr-empty { padding: 16px; text-align: center; color: #9ca3af; font-size: 13px; }

/* Right area */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.topbar-status {
    display: flex; align-items: center; gap: 5px;
    cursor: default;
}

/* User menu */
.topbar-user-menu {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    position: relative;
}
.topbar-user-menu:hover { background: #f3f4f6; }
.topbar-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}
.topbar-username { font-size: 13px; font-weight: 600; color: #374151; }

/* User dropdown */
.topbar-dropdown {
    position: absolute;
    top: calc(var(--topbar-h) + 4px);
    right: 12px;
    width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    z-index: 500;
    display: none;
    overflow: hidden;
}
.topbar-dropdown.open { display: block; }
.td-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px;
    background: #f9fafb;
}
.td-divider { height: 1px; background: #f3f4f6; }
.td-item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    border: none; background: none;
    font-size: 13px; font-family: inherit;
    color: #374151; cursor: pointer;
    transition: background .12s;
    text-align: left;
}
.td-item:hover { background: #f3f4f6; }
.td-item.danger { color: #dc2626; }
.td-item.danger:hover { background: #fef2f2; }

/* ══════════════════════════════════════════════════
   APP BODY = ws-sidebar + main
══════════════════════════════════════════════════ */
.app-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: transparent;
}

/* ── WORKSPACE SIDEBAR ────────────────────────── */
.workspace-sidebar {
    width: var(--ws-sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    transform: translateX(calc(-1 * var(--ws-sidebar-w)));
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    position: absolute;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
}
.workspace-sidebar.ws-visible {
    transform: translateX(0);
    position: relative;
}

.ws-module-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px;
    background: linear-gradient(135deg,#16a34a,#15803d);
    flex-shrink: 0;
}
.ws-module-icon { font-size: 22px; }
.ws-module-name { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
.ws-module-sub { font-size: 10px; color: rgba(255,255,255,.65); font-weight: 500; letter-spacing: .5px; }

.ws-nav { flex: 1; padding: 8px 0; }
.ws-nav-group {
    padding: 12px 14px 4px;
    font-size: 10px;
    font-weight: 600;
    color: #4a9e5a;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.ws-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 400;
    color: var(--sidebar-text);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: all .13s;
    border-left: 3px solid transparent;
}
.ws-nav-item:hover {
    background: var(--sidebar-hover);
    color: #c8e6c9;
}
.ws-nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
    border-left-color: var(--sidebar-active);
}
.ws-nav-icon { font-size: 14px; flex-shrink: 0; }

/* Child (indented) nav items */
.ws-nav-item--child {
    padding-left: 30px;
    font-size: 12px;
    color: rgba(168, 196, 170, .75);
    border-left: none;
}
.ws-nav-item--child::before {
    content: '›';
    margin-right: 2px;
    opacity: .5;
}
.ws-nav-item--child:hover {
    color: #c8e6c9;
    background: rgba(255,255,255,.04);
}
.ws-nav-item--child.active {
    color: var(--sidebar-active);
    background: var(--sidebar-active-bg);
    font-weight: 600;
    border-left: 3px solid var(--sidebar-active);
    padding-left: 27px;
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
    .topbar-username, .topbar-status { display: none; }
    .workspace-sidebar.ws-visible {
        position: fixed;
        top: var(--topbar-h); bottom: 0; left: 0;
        z-index: 300;
        box-shadow: 4px 0 24px rgba(0,0,0,.3);
    }
    .app-body.has-ws::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 299;
    }
}


/* ══════════════════════════════════════════════════
   SIDEBAR — stays dark for contrast
══════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3da832, #d41414);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(61, 168, 50, .4);
}

.logo-title {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -.3px;
}

.logo-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

nav {
    padding: 8px 0;
    flex: 1;
}

.nav-group {
    padding: 14px 16px 5px;
    font-size: 10px;
    font-weight: 600;
    color: #5ab85a;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    border-radius: 0;
    font-family: inherit;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #b8d4b9;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
    border-right: 3px solid var(--sidebar-active);
}

.nav-item svg {
    opacity: .55;
    flex-shrink: 0;
}

.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--sidebar-border);
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #475569;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(16, 185, 129, .5);
}

.status-dot.err {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, .5);
}

/* ── USER BAR (Sidebar) ── */
.user-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 8px 10px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
    flex-shrink: 0;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3da832, #2f8e26);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    color: #5ab85a;
    font-weight: 500;
    margin-top: 1px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.user-logout {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all .15s;
    flex-shrink: 0;
}

.user-logout:hover {
    background: rgba(239, 68, 68, .15);
    color: #f87171;
}

/* ══════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════ */
.main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: transparent;
}

/* ── PAGE ── */
.page {
    padding: 28px 32px;
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.5px;
}

.page-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

.badge-schema {
    background: var(--accent2-light);
    color: var(--accent2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    border: 1px solid rgba(8, 145, 178, .15);
}

/* ── DASHBOARD CARDS ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform .2s, box-shadow .2s;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .7px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
}

.stat-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

/* ── TOOLBAR ── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 220px;
    max-width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 168, 50, .12);
}

.search-input::placeholder {
    color: var(--text-subtle);
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(61, 168, 50, .28);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(61, 168, 50, .38);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(5, 150, 105, .25);
}

.btn-success:hover {
    background: #047857;
}

.btn-ghost {
    background: var(--bg-surface);
    color: var(--text-muted);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: #cbd5e1;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: transparent;
}

.btn-danger:hover {
    background: var(--danger-light);
    border-color: rgba(220, 38, 38, .2);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* ── TABLE ── */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-card[style*="padding"] {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

th {
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    white-space: nowrap;
}

td {
    padding: 11px 14px;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f8fafc;
}

.empty-row td {
    text-align: center;
    color: var(--text-subtle);
    padding: 48px;
    font-style: italic;
}

/* ── STATUS CHIPS ── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.chip-open {
    background: #eaf6e9;
    color: #2f8e26;
    border: 1px solid #b2ddb0;
}

.chip-progress {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.chip-done {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.chip-cancelled {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.chip-draft {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.chip-posted {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn .22s ease;
}

.modal-lg {
    max-width: 800px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-14px) scale(.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.3px;
}

.modal-close {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: rgba(220, 38, 38, .2);
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 14px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── FORM ELEMENTS ── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 168, 50, .12);
    background: var(--bg-surface);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.required {
    color: var(--danger);
    margin-left: 2px;
}

/* ── CONFIRM DIALOG ── */
.confirm-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: modalIn .22s ease;
}

/* ── TOAST ── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: toastIn .25s ease;
    pointer-events: auto;
    max-width: 340px;
    border: 1px solid transparent;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.toast-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.toast-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.toast-info {
    background: #eff6ff;
    color: #1e3a8a;
    border-color: #bfdbfe;
}

/* ── ACTIVE CHIP ── */
.chip-active {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.chip-inactive {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* ── BREADCRUMB ── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-subtle);
    margin-bottom: 6px;
}

.breadcrumb strong {
    color: var(--text);
}

/* ── ROLE TABS ── */
.role-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.role-tab {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.role-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.role-tab.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.role-tab.system-role::after {
    content: '🔒';
    margin-left: 6px;
    font-size: 11px;
    opacity: .6;
}

/* ── PERMISSION MATRIX ── */
.perm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    border-radius: var(--radius) var(--radius) 0 0;
}

.perm-role-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.perm-check {
    text-align: center;
    vertical-align: middle;
}

.perm-toggle {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
    cursor: pointer;
    border-radius: 4px;
}

.perm-toggle:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* ── CODE TAG ── */
code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: #f1f5f9;
    color: #0891b2;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #e2e8f0;
}

/* ── NAV HIDDEN ── */
.nav-hidden {
    display: none !important;
}

/* ── USER CHIPS ── */
.chip-admin {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.chip-manager {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.chip-warehouse {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.chip-sales {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.chip-viewer {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* sidebar scrollbar */
.sidebar::-webkit-scrollbar-thumb {
    background: #334155;
}

/* ═══════════════════════════════════════════════════
   MATERIAL MASTER — TABS
═══════════════════════════════════════════════════ */
.mat-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.mat-tab {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    font-family: inherit;
    transition: all .15s;
    white-space: nowrap;
}

.mat-tab:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.mat-tab.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.mat-tab-content {
    display: none;
}

.mat-tab-content.active {
    display: block;
}

/* ── Color swatch ── */
.color-swatch {
    width: 28px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, .12);
    display: inline-block;
    vertical-align: middle;
}

/* ── Type badge ── */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin: 1px;
}

.type-profile {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.type-panel {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.type-acc {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ══════════════════════════════════════════════════
   WAREHOUSE MASTER-DETAIL LAYOUT
══════════════════════════════════════════════════ */
#page-warehouse {
    display: none;
    flex-direction: column;
    height: calc(100vh - 0px);
    overflow: hidden;
}

#page-warehouse.active {
    display: flex;
}

#page-warehouse .page-header {
    flex-shrink: 0;
    margin-bottom: 16px;
}

.wh-layout {
    display: grid;
    grid-template-columns: 282px 1fr;
    gap: 16px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* LEFT PANEL */
.wh-master {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 0;
}

.wh-master-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--fe-bg-surface, #f8fafc);
    flex-shrink: 0;
}

.wh-list {
    overflow-y: auto;
    flex: 1;
}

.wh-card {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all .14s;
    display: flex;
    align-items: center;
    gap: 11px;
    position: relative;
}

.wh-card:hover {
    background: var(--bg-hover);
}

.wh-card.active {
    background: var(--accent-light);
    border-right: 3px solid var(--accent);
}

.wh-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.wh-card.active .wh-card-icon {
    background: rgba(37, 99, 235, .12);
}

.wh-card-info {
    flex: 1;
    min-width: 0;
}

.wh-card-code {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    font-family: monospace;
}

.wh-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.wh-card.active .wh-card-name {
    color: var(--accent);
}

.wh-card-meta {
    font-size: 11px;
    color: var(--text-subtle);
    margin-top: 2px;
}

.wh-card-actions {
    display: none;
    gap: 4px;
    flex-shrink: 0;
}

.wh-card:hover .wh-card-actions {
    display: flex;
}

.wh-card-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all .12s;
    white-space: nowrap;
}

.wh-card-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.wh-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-subtle);
    font-style: italic;
    font-size: 13px;
}

/* RIGHT PANEL */
.wh-detail {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 0;
}

.wh-detail-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

#wh-rack-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.rack-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--fe-bg-surface, #f8fafc);
    border-radius: var(--radius) var(--radius) 0 0;
}

.rack-wh-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.rack-wh-addr {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.rack-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-surface);
}

#wh-rack-panel .table-card {
    border-radius: 0;
    border: none;
    box-shadow: none;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#wh-rack-panel .table-wrapper {
    flex: 1;
    overflow-y: auto;
}
/* ══════════════════════════════════════════════════════════
   SEARCHABLE SELECT COMPONENT (pn-ss)
══════════════════════════════════════════════════════════ */
.pn-ss {
    position: relative;
    display: inline-block;
    width: 100%;
    font-size: 12px;
}
.pn-ss-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
    min-height: 28px;
    padding: 3px 6px;
    background: var(--bg-input, #f7fbf7);
    border: 1px solid var(--border, #d5e8d5);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text, #0f2d0f);
    box-sizing: border-box;
    user-select: none;
    transition: border-color .15s;
}
.pn-ss-trigger:hover { border-color: var(--accent, #3da832); }
.pn-ss-trigger.open   { border-color: var(--accent, #3da832); box-shadow: 0 0 0 2px rgba(61,168,50,.18); }
.pn-ss-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn-ss-arrow { font-size: 9px; color: var(--text-muted, #4a6b4a); flex-shrink: 0; transition: transform .15s; }
.pn-ss-trigger.open .pn-ss-arrow { transform: rotate(180deg); }

.pn-ss-dropdown {
    position: fixed;
    min-width: 160px;
    width: max-content;
    max-width: 300px;
    z-index: 99999;
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--accent, #3da832);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    overflow: hidden;
    display: none;
    flex-direction: column;
    max-height: 260px;
    height: auto;
}
.pn-ss-dropdown.open { display: flex; }

.pn-ss-search-wrap {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border, #d5e8d5);
    flex-shrink: 0;
    background: var(--bg-card, #ffffff);
}
.pn-ss-search {
    width: 100%;
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg-input, #f7fbf7);
    border: 1px solid var(--border, #d5e8d5);
    border-radius: 5px;
    color: var(--text, #0f2d0f);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}
.pn-ss-search:focus { border-color: var(--accent, #3da832); }

.pn-ss-list {
    overflow-y: auto;
    flex: 0 1 auto;
    max-height: 210px;
}
.pn-ss-opt {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text, #0f2d0f);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .1s;
}
.pn-ss-opt:hover   { background: var(--accent-light, #eaf6e9); }
.pn-ss-opt.selected { background: var(--accent-light, #eaf6e9); color: var(--accent, #3da832); font-weight: 600; }
.pn-ss-opt.placeholder { color: var(--text-muted, #4a6b4a); font-style: italic; }
.pn-ss-opt.hidden { display: none; }
.pn-ss-empty {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, #64748b);
    display: none;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE / RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

/* ── Hamburger Menu Button (hidden on desktop) ── */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: var(--sidebar-bg);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    transition: transform .2s, background .2s;
}
.mobile-menu-btn:active { transform: scale(.92); }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .25s ease;
}
.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* ══════════════════════════════════════════════════
   TABLET — ≤ 1024px
   ══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    :root { --sidebar-w: 220px; }

    .page { padding: 20px 20px; }
    .page-title { font-size: 19px; }

    .stat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .stat-value { font-size: 26px; }

    .wh-layout { grid-template-columns: 240px 1fr; }

    .form-grid { gap: 12px; }

    .modal { max-width: 90vw; }
}

/* ══════════════════════════════════════════════════
   MOBILE — ≤ 768px
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Hamburger visible ── */
    .mobile-menu-btn { display: flex; }

    /* ── Sidebar: off-canvas ── */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 270px;
        z-index: 1000;
        transition: left .3s cubic-bezier(.4,0,.2,1);
        box-shadow: none;
    }
    .sidebar.open {
        left: 0;
        box-shadow: 8px 0 30px rgba(0,0,0,.25);
    }

    /* ── Main content full width ── */
    .app { flex-direction: column; }
    .main {
        width: 100%;
        padding-top: 56px; /* space for hamburger */
    }

    /* ── Page layout ── */
    .page { padding: 16px 14px; }
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .page-header .btn { align-self: flex-end; }
    .page-title { font-size: 18px; }
    .page-sub { font-size: 12px; }

    /* ── Stats ── */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 10px; }

    /* ── Toolbar ── */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .search-input { max-width: 100%; min-width: auto; }

    /* ── Form grid → single column ── */
    .form-grid { grid-template-columns: 1fr !important; }

    /* ── Tables ── */
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; }
    th { padding: 9px 10px; font-size: 10px; }
    td { padding: 9px 10px; font-size: 12px; }

    /* ── Modals fullscreen ── */
    .modal-overlay { padding: 8px; }
    .modal {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 95vh;
        border-radius: 12px;
    }
    .modal-header { padding: 14px 16px 0; }
    .modal-title { font-size: 16px; }
    .modal-body { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px 14px; flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; min-width: 100px; justify-content: center; }

    /* ── Buttons touch-friendly ── */
    .btn { padding: 10px 16px; font-size: 13px; min-height: 40px; }
    .btn-sm { padding: 8px 12px; min-height: 34px; }

    /* ── Warehouse layout stack ── */
    .wh-layout { grid-template-columns: 1fr; }
    .wh-master { max-height: 200px; }

    /* ── Toast ── */
    #toast-container { left: 12px; right: 12px; bottom: 16px; }
    .toast { max-width: 100%; }

    /* ── User bar ── */
    .user-bar { margin: 6px 8px; padding: 8px 10px; }
    .user-name { font-size: 12px; }

    /* ── Nav items touch targets ── */
    .nav-item { padding: 11px 16px; font-size: 14px; }
    .nav-group { padding: 12px 16px 5px; }

    /* ── Role tabs wrap ── */
    .role-tabs { gap: 6px; }
    .role-tab { padding: 7px 12px; font-size: 12px; }

    /* ── Material tabs ── */
    .mat-tabs { gap: 2px; padding: 4px; }
    .mat-tab { padding: 7px 12px; font-size: 12px; }

    /* ── Breadcrumb ── */
    .breadcrumb { font-size: 12px; flex-wrap: wrap; }

    /* ── On-page stat cards (quotation, SO etc.) ── */
    div[style*="grid-template-columns:repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ══════════════════════════════════════════════════
   SMALL MOBILE — ≤ 480px
   ══════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .page { padding: 12px 10px; }
    .page-title { font-size: 16px; }

    .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 20px; }

    .modal { border-radius: 10px; }
    .modal-footer { gap: 6px; }
    .modal-footer .btn { font-size: 12px; padding: 8px 10px; }

    .nav-item { padding: 12px 14px; }

    .search-input { font-size: 14px; padding: 10px 14px; }

    table { min-width: 500px; }
    th, td { padding: 7px 8px; }
    td { font-size: 11px; }

    /* Quotation/SO stat cards */
    div[style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
}

/* ── Print: hide sidebar & mobile elements ── */
@media print {
    .sidebar, .mobile-menu-btn, .sidebar-overlay,
    #toast-container { display: none !important; }
    .main { width: 100%; padding: 0; }
    .page { padding: 10px; }
}

/* ── TÍNH GIÁ BỘ CỬA ── */
.pr-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
  gap: 12px;
}
.pr-sum-row span:first-child { color: var(--text-muted); }
.pr-sum-row span:last-child  { font-weight: 600; white-space: nowrap; }

/* ── PHÂN TRANG TỒN KHO PROFILE ── */
#sbp-pagination {
  border-top: 1px solid var(--border-light);
  background: var(--bg-hover);
}

.sbp-pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.sbp-page-info {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.sbp-page-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sbp-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sbp-page-btn:hover:not(:disabled):not(.active) {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.sbp-page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(61,168,50,.28);
}

.sbp-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sbp-page-ellipsis {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 32px;
}

/* ══════════════════════════════════════════
   KANBAN BOARD — Module Công trình
 */

/* View toggle buttons */
.view-toggle-group {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
}
.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.view-toggle-btn:hover { background: var(--bg-hover); color: var(--text); }
.view-toggle-btn.active { background: var(--accent); color: #fff; }
.view-toggle-btn + .view-toggle-btn { border-left: 1.5px solid var(--border); }

/* Kanban board container */
.kanban-board {
  display: flex;
  gap: 16px;
  padding: 4px 0 16px;
  overflow-x: auto;
  align-items: flex-start;
  min-height: calc(100vh - 220px);
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: transparent; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Kanban column */
.kanban-col {
  flex: 0 0 280px;
  min-width: 280px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
  transition: box-shadow .2s;
}
.kanban-col:hover { box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.kanban-col[data-dragover="true"] {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--bg-hover);
}

/* Column header */
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px 10px 0 0;
  border-bottom: 1.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.kanban-col-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.kanban-col-count {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border-radius: 20px;
  padding: 2px 8px;
  min-width: 20px;
  text-align: center;
}

/* Cards container (scrollable) */
.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-cards::-webkit-scrollbar { width: 4px; }
.kanban-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Empty state */
.kanban-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 24px 8px;
  border: 2px dashed var(--border);
  border-radius: 8px;
}

/* Add button */
.kanban-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 20px);
  margin: 8px 10px;
  padding: 8px 12px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  justify-content: center;
}
.kanban-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(61,168,50,.06);
}

/* Card */
.kanban-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: grab;
  transition: all .2s;
  position: relative;
}
.kanban-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-1px);
  border-color: rgba(61,168,50,.4);
}
.kanban-card:active { cursor: grabbing; }

.kanban-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.kanban-card-code {
  font-size: 11px;
  font-weight: 700;
  background: transparent;
  border: none;
  padding: 0;
}
.kanban-card-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .2s;
}
.kanban-card:hover .kanban-card-actions { opacity: 1; }
.kcard-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 13px;
  transition: background .15s;
}
.kcard-btn:hover { background: var(--bg-hover); }

.kanban-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}
.kanban-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.kcard-date {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 7px;
  border-radius: 20px;
}
.kcard-date-overdue {
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
}

/* Quick move buttons */
.kanban-card-move {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all .25s ease;
}
.kanban-card:hover .kanban-card-move {
  opacity: 1;
  max-height: 60px;
}
.kcard-move-btn {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
}
.kcard-move-btn:hover {
  opacity: .8;
  transform: translateX(2px);
}


/* ═══════════════════════════════════════════
   PROJECT SIDE PANEL
 */
.proj-panel {
  position: fixed;
  top: 0; right: 0;
  width: 480px; max-width: 95vw;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1.5px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.12);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.proj-panel.open { transform: translateX(0); }

.proj-panel-inner { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.proj-panel-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}
.proj-panel-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-panel-sub {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; font-size: 12px; color: var(--text-muted);
}
.proj-panel-close {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 4px; border-radius: 6px; flex-shrink: 0;
  transition: all .15s;
}
.proj-panel-close:hover { background: var(--bg-hover); color: var(--text); }

/* Panel tabs */
.proj-panel-tabs {
  display: flex; gap: 0; overflow-x: auto; flex-shrink: 0;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
  padding: 0 12px;
}
.proj-panel-tabs::-webkit-scrollbar { height: 3px; }
.ppanel-tab {
  border: none; background: transparent; cursor: pointer;
  padding: 10px 12px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1.5px;
  transition: all .2s;
}
.ppanel-tab:hover { color: var(--text); }
.ppanel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Panel body */
.proj-panel-body { flex: 1; overflow-y: auto; padding: 0; }
.proj-panel-body::-webkit-scrollbar { width: 4px; }
.proj-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.proj-panel-content { padding: 16px; display: flex; flex-direction: column; gap: 14px; height: 100%; box-sizing: border-box; }

/* Phụ trách assign */
.ppanel-assign {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 10px;
}
.ppanel-assign-label { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.ppanel-assign select {
  flex: 1; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; background: var(--bg-card);
  color: var(--text); outline: none;
}

/* Detail grid */
.ppanel-detail-grid { display: flex; flex-direction: column; gap: 6px; }
.ppanel-detail-row {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 13px; padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.ppanel-detail-row span { color: var(--text-muted); min-width: 90px; flex-shrink: 0; }
.ppanel-detail-row strong { color: var(--text); }
.ppanel-detail-row.full { flex-direction: column; gap: 3px; }

/* Section title */
.ppanel-section-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  padding: 4px 0 2px; border-bottom: 1.5px solid var(--accent);
  margin-bottom: 2px;
}

/* Chat box */
.ppanel-chat {
  flex: 1; overflow-y: auto; min-height: 180px; max-height: 340px;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
  background: var(--bg);
}
.ppanel-chat::-webkit-scrollbar { width: 4px; }
.ppanel-chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.ppanel-chat-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 32px 0; }

.ppanel-msg { display: flex; gap: 6px; align-items: flex-end; }
.ppanel-msg-mine { flex-direction: row-reverse; align-self: flex-end; }
.ppanel-msg-bubble {
  max-width: 78%; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 12px 12px 12px 4px;
  padding: 8px 12px;
}
.ppanel-msg-mine .ppanel-msg-bubble {
  background: var(--accent); color: #fff;
  border-color: var(--accent); border-radius: 12px 12px 4px 12px;
}
.ppanel-msg-name { font-size: 10px; font-weight: 700; color: var(--accent); margin-bottom: 3px; }
.ppanel-msg-mine .ppanel-msg-name { display: none; }
.ppanel-msg-text { font-size: 13px; line-height: 1.5; word-break: break-word; }
.ppanel-msg-mine .ppanel-msg-text { color: #fff; }
.ppanel-msg-time { font-size: 10px; opacity: .6; margin-top: 3px; text-align: right; }
.ppanel-msg-recall {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: 14px; line-height: 1; padding: 2px 4px;
  border-radius: 4px; opacity: 0; transition: opacity .2s;
}
.ppanel-msg:hover .ppanel-msg-recall { opacity: 1; }
.ppanel-msg-recall:hover { background: var(--bg-hover); color: #ef4444; }

/* Chat input */
.ppanel-chat-input-row {
  display: flex; gap: 8px; align-items: center;
  padding: 10px; border-top: 1.5px solid var(--border);
  background: var(--bg-card); border-radius: 0 0 10px 10px;
  flex-shrink: 0;
  margin: 0 -16px -16px;
}
.ppanel-chat-attach {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--bg);
  cursor: pointer; font-size: 18px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.ppanel-chat-attach:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }
.ppanel-chat-input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 20px;
  padding: 8px 16px; font-size: 13px; background: var(--bg);
  color: var(--text); outline: none; transition: border .2s;
}
.ppanel-chat-input:focus { border-color: var(--accent); }
.ppanel-chat-send {
  background: var(--accent); color: #fff; border: none;
  border-radius: 20px; padding: 8px 16px; font-size: 13px;
  font-weight: 600; cursor: pointer; flex-shrink: 0;
  transition: all .15s;
}
.ppanel-chat-send:hover { background: var(--accent-dark, #1a6b3a); }

/* Kanban card updates for new style */
.kanban-card-cust {
  font-size: 10px; color: var(--text-muted);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kanban-card-value {
  font-size: 11px; font-weight: 700; color: #10b981;
  padding: 2px 0;
}
.kanban-card-actions-row {
  display: flex; justify-content: flex-end; gap: 2px;
  opacity: 0; transition: opacity .2s;
  margin-top: 4px;
}
.kanban-card:hover .kanban-card-actions-row { opacity: 1; }


/* ═════════════════════════════════════════════
   VININA ERP — LIQUID GLASS UI UPGRADE
   Phiên bản: 2.0 — Premium Liquid Glass Design System
   Áp dụng lên các class hiện có mà KHÔNG phá vỡ workflow
 */   ════════════════════════

/* ── CSS Variables Nâng cấp */ ──────────────────────────
:root {
  /* Brand Gradient */
  --brand-from: #5DA92F;
  --brand-to:   #4A8F25;
  --brand-glow: #8BDB5B;
  --brand-light: #9BD46A;

  /* Glass Colors */
  --glass-bg:         rgba(255, 255, 255, 0.72);
  --glass-border:     rgba(255, 255, 255, 0.55);
  --glass-shadow:     0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --glass-shadow-lg:  0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);

  /* Sidebar */
  --sidebar-grad-from: #163B1E;
  --sidebar-grad-to:   #1B4626;
  --sidebar-active-bg: rgba(93, 169, 47, 0.22);
  --sidebar-active-border: #6CC844;
  --sidebar-glow: rgba(139, 219, 91, 0.28);

  /* Surfaces */
  --surface-page:   #F4F7F3;
  --surface-card:   #FFFFFF;
  --surface-hover:  rgba(93, 169, 47, 0.04);

  /* Radius */
  --r-card:   20px;
  --r-btn:    14px;
  --r-input:  12px;
  --r-badge:  999px;

  /* Transitions */
  --t-fast:   0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --t-normal: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow:   0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Background handled by liquid-glass.css */
body, html {
  background: #0a0c14;
}
.app-body, .main {
  background: transparent;
}

/* ═════════
   TOPBAR — Liquid Glass Frosted
 */   ════════
.topbar {
  background: rgba(255, 255, 255, 0.80) !important;
  backdrop-filter: blur(20px) saturate(1.8) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.8) !important;
  border-bottom: 1px solid rgba(93, 169, 47, 0.13) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6), 0 4px 20px rgba(0,0,0,0.06) !important;
  height: 54px !important;
}

/* Logo text trong topbar */
.topbar-logo {
  border-radius: 10px !important;
}
.topbar-logo:hover {
  background: rgba(93, 169, 47, 0.08) !important;
}

/* Search bar */
#topbar-search {
  border-radius: 999px !important;
  border: 1.5px solid rgba(93, 169, 47, 0.15) !important;
  background: rgba(248, 250, 247, 0.9) !important;
  height: 36px !important;
  padding: 0 16px 0 38px !important;
  font-size: 13px !important;
  transition: all var(--t-normal) !important;
}
#topbar-search:focus {
  border-color: var(--brand-from) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3.5px rgba(93, 169, 47, 0.12) !important;
  outline: none !important;
}

/* Icon buttons topbar */
.topbar-icon-btn {
  border-radius: 10px !important;
  transition: all var(--t-fast) !important;
}
.topbar-icon-btn:hover {
  background: rgba(93, 169, 47, 0.08) !important;
  color: var(--brand-from) !important;
}

/* Avatar */
.topbar-avatar {
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to)) !important;
  border-radius: 10px !important;
  width: 32px !important; height: 32px !important;
  font-size: 13px !important;
  box-shadow: 0 2px 8px rgba(93, 169, 47, 0.3) !important;
}

/* User menu */
.topbar-user-menu {
  border-radius: 12px !important;
  padding: 5px 10px !important;
  transition: all var(--t-fast) !important;
}
.topbar-user-menu:hover {
  background: rgba(93, 169, 47, 0.07) !important;
}
.topbar-username { 
  color: #1a2e1a !important; 
  font-weight: 600 !important; 
}

/* Dropdown */
.topbar-dropdown {
  border-radius: 16px !important;
  border: 1px solid rgba(93, 169, 47, 0.12) !important;
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.14) !important;
}
.td-item:hover { background: rgba(93, 169, 47, 0.06) !important; }
.td-item.danger:hover { background: #fef2f2 !important; }

/* ════════════════
   WORKSPACE SIDEBAR — Dark Green Gradient
 */   ═════
.workspace-sidebar {
  background: linear-gradient(180deg, var(--sidebar-grad-from) 0%, var(--sidebar-grad-to) 100%) !important;
  border-right: none !important;
  box-shadow: 3px 0 20px rgba(22, 59, 30, 0.18) !important;
}

/* Module header trong sidebar */
.ws-module-header {
  background: rgba(255, 255, 255, 0.06) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 18px 16px !important;
}

/* Active nav item — Liquid Glass glow */
.ws-nav-item.active {
  background: var(--sidebar-active-bg) !important;
  border-left-color: var(--sidebar-active-border) !important;
  border-left-width: 3px !important;
  color: var(--brand-glow) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 12px var(--sidebar-glow) !important;
  border-radius: 0 10px 10px 0 !important;
  font-weight: 600 !important;
}
.ws-nav-item:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  color: rgba(200, 230, 200, 0.95) !important;
  border-radius: 0 10px 10px 0 !important;
}

/* Child items */
.ws-nav-item--child {
  color: rgba(168, 196, 170, 0.72) !important;
}
.ws-nav-item--child:hover {
  color: #c8e6c9 !important;
  background: rgba(255,255,255,0.05) !important;
  border-radius: 0 8px 8px 0 !important;
}
.ws-nav-item--child.active {
  background: rgba(93, 169, 47, 0.18) !important;
  color: var(--brand-glow) !important;
  box-shadow: 0 0 10px rgba(139, 219, 91, 0.2) !important;
  border-radius: 0 8px 8px 0 !important;
}

/* Group labels */
.ws-nav-group {
  color: rgba(93, 169, 47, 0.6) !important;
  font-size: 10px !important;
  letter-spacing: 1.2px !important;
}

/* Footer sidebar */
.ws-footer {
  border-top: 1px solid rgba(255,255,255,0.08) !important;
  background: rgba(0,0,0,0.1) !important;
}

/* ═══════════════════
   CARDS — Liquid Glass Premium
 */   ═══════════════════
.table-card,
.stat-card,
.modal {
  border-radius: var(--r-card) !important;
  border: 1px solid rgba(255,255,255,0.8) !important;
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,1) !important;
  transition: box-shadow var(--t-normal), transform var(--t-normal) !important;
}

.stat-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* Table headers */
thead {
  background: rgba(242, 245, 241, 0.9) !important;
  border-bottom: 1.5px solid rgba(93, 169, 47, 0.12) !important;
}
th {
  color: #3a5c3a !important;
  font-size: 11px !important;
  letter-spacing: 0.7px !important;
  font-weight: 700 !important;
}
td {
  border-bottom: 1px solid rgba(0,0,0,0.04) !important;
}
tr:hover td {
  background: rgba(93, 169, 47, 0.035) !important;
}

/* ══════════════════════════════════
   BUTTONS — Premium
 */   ═════════════════════════════════════════════
.btn {
  border-radius: var(--r-btn) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0.1px !important;
  transition: all var(--t-fast) !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to)) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(93, 169, 47, 0.35) !important;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #68c235, var(--brand-from)) !important;
  box-shadow: 0 6px 20px rgba(93, 169, 47, 0.45) !important;
  transform: translateY(-1.5px) !important;
}
.btn-primary:active { transform: translateY(0) !important; }

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}
.btn-success:hover {
  background: linear-gradient(135deg, #34d399, #10b981) !important;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
  transform: translateY(-1.5px) !important;
}

.btn-ghost {
  background: rgba(255,255,255,0.85) !important;
  border: 1.5px solid rgba(93, 169, 47, 0.2) !important;
  color: #2d5c1e !important;
  backdrop-filter: blur(4px) !important;
}
.btn-ghost:hover {
  background: rgba(93, 169, 47, 0.06) !important;
  border-color: var(--brand-from) !important;
  color: var(--brand-from) !important;
  transform: translateY(-1px) !important;
}

.btn-danger {
  color: #dc2626 !important;
  background: transparent !important;
  border: 1.5px solid rgba(220,38,38,0.15) !important;
  border-radius: var(--r-btn) !important;
}
.btn-danger:hover {
  background: rgba(220,38,38,0.06) !important;
  border-color: rgba(220,38,38,0.3) !important;
}

/* Small buttons */
.btn-sm {
  padding: 5px 12px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
}

/* ═══════════════════════════════════
   INPUTS — Premium Glass
 */   ═════════════════════════════════════════
.search-input {
  border-radius: var(--r-input) !important;
  border: 1.5px solid rgba(93, 169, 47, 0.18) !important;
  background: rgba(255,255,255,0.9) !important;
  transition: all var(--t-fast) !important;
}
.search-input:focus {
  border-color: var(--brand-from) !important;
  box-shadow: 0 0 0 3.5px rgba(93, 169, 47, 0.12) !important;
  background: #fff !important;
}

.form-group input,
.form-group select,
.form-group textarea {
  border-radius: var(--r-input) !important;
  border: 1.5px solid rgba(0,0,0,0.09) !important;
  background: rgba(248,250,248,0.95) !important;
  transition: all var(--t-fast) !important;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand-from) !important;
  box-shadow: 0 0 0 3.5px rgba(93, 169, 47, 0.1) !important;
  background: #fff !important;
}

/* Toolbar selects */
.toolbar select,
.toolbar input[type="text"],
.toolbar input[type="search"] {
  border-radius: var(--r-input) !important;
  border: 1.5px solid rgba(93, 169, 47, 0.15) !important;
  background: rgba(255,255,255,0.9) !important;
  padding: 7px 12px !important;
  font-size: 13px !important;
  transition: all var(--t-fast) !important;
}
.toolbar select:focus,
.toolbar input:focus {
  border-color: var(--brand-from) !important;
  box-shadow: 0 0 0 3px rgba(93, 169, 47, 0.1) !important;
  outline: none !important;
}

/* ═══════════════════════════════
   CHIPS STATUS Semantic Badges (Liquid style) 
 */   ══════════════
.chip {
  border-radius: var(--r-badge) !important;
  padding: 3px 11px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.2px !important;
  border: none !important;
}
.chip-open {
  background: rgba(93, 169, 47, 0.12) !important;
  color: #2d6c00 !important;
  box-shadow: 0 0 0 1px rgba(93,169,47,0.25) !important;
}
.chip-progress {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #b45309 !important;
  box-shadow: 0 0 0 1px rgba(245,158,11,0.3) !important;
}
.chip-done {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #065f46 !important;
  box-shadow: 0 0 0 1px rgba(16,185,129,0.28) !important;
}
.chip-cancelled {
  background: rgba(220, 38, 38, 0.10) !important;
  color: #991b1b !important;
  box-shadow: 0 0 0 1px rgba(220,38,38,0.22) !important;
}
.chip-draft {
  background: rgba(100, 116, 139, 0.10) !important;
  color: #475569 !important;
  box-shadow: 0 0 0 1px rgba(100,116,139,0.2) !important;
}
.chip-posted {
  background: rgba(37, 99, 235, 0.10) !important;
  color: #1e3a8a !important;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.22) !important;
}
.chip-active {
  background: rgba(93, 169, 47, 0.12) !important;
  color: #2d6c00 !important;
  box-shadow: 0 0 0 1px rgba(93,169,47,0.25) !important;
}
.chip-inactive {
  background: rgba(220, 38, 38, 0.10) !important;
  color: #991b1b !important;
  box-shadow: 0 0 0 1px rgba(220,38,38,0.22) !important;
}

/* 
   MODALS — Premium Liquid Glass
 */   ═════════════════════════════════════════════════
.modal-overlay {
  background: rgba(10, 20, 10, 0.45) !important;
  backdrop-filter: blur(8px) saturate(1.5) !important;
  -webkit-backdrop-filter: blur(8px) saturate(1.5) !important;
}

.modal, .confirm-dialog {
  background: rgba(255,255,255,0.96) !important;
  border-radius: var(--r-card) !important;
  border: 1px solid rgba(255,255,255,0.9) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: 0 32px 80px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,1) !important;
}

.modal-header {
  padding: 22px 26px 16px !important;
  border-bottom: 1px solid rgba(93, 169, 47, 0.1) !important;
}
.modal-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #1a2e1a !important;
}
.modal-close {
  border-radius: 10px !important;
  border: 1.5px solid rgba(0,0,0,0.07) !important;
  width: 30px !important; height: 30px !important;
  background: rgba(248,250,248,0.8) !important;
}
.modal-close:hover {
  background: rgba(220,38,38,0.07) !important;
  border-color: rgba(220,38,38,0.2) !important;
  color: #dc2626 !important;
}
.modal-body { padding: 20px 26px !important; }
.modal-footer {
  padding: 14px 26px 22px !important;
  border-top: 1px solid rgba(93, 169, 47, 0.08) !important;
  background: rgba(248,250,247,0.7) !important;
  border-radius: 0 0 var(--r-card) var(--r-card) !important;
}

/* ══════════════════════════════════════
   TOAST — Liquid Glass Notifications
 */   ════════════════════════════════
.toast {
  border-radius: 14px !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid transparent !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), inset 0 1px 0 rgba(255,255,255,0.6) !important;
  font-weight: 500 !important;
}
.toast.success, .toast-success {
  background: rgba(236,253,245,0.95) !important;
  color: #065f46 !important;
  border-color: rgba(167, 243, 208, 0.6) !important;
}
.toast.error, .toast-error {
  background: rgba(254,242,242,0.95) !important;
  color: #991b1b !important;
  border-color: rgba(254,202,202,0.6) !important;
}
.toast.info, .toast-info {
  background: rgba(239,246,255,0.95) !important;
  color: #1e3a8a !important;
  border-color: rgba(191,219,254,0.6) !important;
}

/* ═════════════════════════
   HOME PAGE — Hero Banner + Module Cards
 */   ═══════════════
/* Hero banner — đã có trong home view, thêm gradient overlay */
.hero-banner,
[class*="hero"] {
  border-radius: 28px !important;
  overflow: hidden !important;
}

/* Stat cards ở dash */
.stat-card {
  padding: 22px !important;
}
.stat-label {
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.7px !important;
  color: #4a7a4a !important;
  font-weight: 600 !important;
}
.stat-value {
  font-size: 30px !important;
  font-weight: 800 !important;
  letter-spacing: -1.5px !important;
  /* Dùng màu đặc thay vì gradient-clip để tránh text vô hình */
  color: var(--lg-stat-val, #1a4a1a) !important;
  -webkit-text-fill-color: unset !important;
  background-image: none !important;
  background-clip: unset !important;
  -webkit-background-clip: unset !important;
}

/* Module cards trên home */
.module-card, .ws-module-card {
  border-radius: var(--r-card) !important;
  background: rgba(255,255,255,0.92) !important;
  border: 1px solid rgba(255,255,255,0.8) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07), inset 0 1px 0 rgba(255,255,255,1) !important;
  backdrop-filter: blur(8px) !important;
  transition: all var(--t-normal) !important;
}
.module-card:hover, .ws-module-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* ══════════════════════════════════════════
   PAGE HEADER — Typography nâng cấp
 */   ═════════════════════════════════════
.page-title {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #0f2010 !important;
  letter-spacing: -0.5px !important;
}
.page-sub {
  font-size: 13px !important;
  color: #4a6b4a !important;
  margin-top: 3px !important;
}
.breadcrumb {
  font-size: 12.5px !important;
  color: #7a9b7a !important;
}
.breadcrumb strong {
  color: #1a3a1a !important;
  font-weight: 600 !important;
}

/* ═════════
   SCROLLBAR — Xanh lá tối nhẹ
 */   ══════════
::-webkit-scrollbar-thumb {
  background: rgba(93, 169, 47, 0.25) !important;
  border-radius: 4px !important;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(93, 169, 47, 0.45) !important;
}
.workspace-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15) !important;
}

/* ══════════════════════════════════════════
   KANBAN CARDS — Glass style
 */   ════════════════════════════════════════════
.kanban-card {
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,0.85) !important;
  background: rgba(255,255,255,0.93) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07), inset 0 1px 0 rgba(255,255,255,1) !important;
  transition: all var(--t-fast) !important;
}
.kanban-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,1) !important;
}
.kanban-col {
  background: rgba(242,245,241,0.6) !important;
  border-radius: 16px !important;
  border: 1px solid rgba(93,169,47,0.08) !important;
}
.kanban-col-hdr {
  border-radius: 14px 14px 0 0 !important;
  font-weight: 700 !important;
}

/* ═══════════════════════════════════
   FORM LABELS nâng cấp
 */   ═══════════════════════════════════════════
.form-group label {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  color: #3a5c3a !important;
}

/* Material tabs */
.mat-tab {
  border-radius: 10px !important;
  font-weight: 500 !important;
  transition: all var(--t-fast) !important;
}
.mat-tab.active {
  background: linear-gradient(135deg, rgba(93,169,47,0.12), rgba(93,169,47,0.08)) !important;
  color: var(--brand-from) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 0 1.5px rgba(93,169,47,0.3) !important;
}

/* Role tabs */
.role-tab {
  border-radius: 12px !important;
}
.role-tab.active {
  background: rgba(93,169,47,0.10) !important;
  border-color: var(--brand-from) !important;
  color: var(--brand-from) !important;
  box-shadow: 0 0 0 3px rgba(93,169,47,0.1) !important;
}

/* ══════════════════════
   WH CARDS (Warehouse)
 */   ══════════════════════════════
.wh-card.active {
  background: rgba(93,169,47,0.08) !important;
  border-right: 3px solid var(--brand-from) !important;
}
/* Warehouse panels — use theme variables, not hardcoded glass */
.wh-detail, .wh-master {
  border-radius: 16px !important;
  border: 1px solid var(--fe-border, rgba(255,255,255,0.12)) !important;
  background: var(--fe-bg-card, #ffffff) !important;
  box-shadow: var(--fe-shadow-sm, var(--glass-shadow)) !important;
}

/* ═════════════════════════
   ANIMATIONS — Smooth micro-interactions
*/
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

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

.page.active {
  animation: fadeSlideUp 0.2s ease !important;
}

/* ════════════════════════════════════════════
   LOGIN PAGE — nâng cấp theo chủ đề nếu có
 */   ════════════════════════════════
.login-card, .auth-card {
  border-radius: var(--r-card) !important;
  background: rgba(255,255,255,0.90) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255,255,255,0.85) !important;
  box-shadow: 0 32px 80px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* ═══
   PURCHASE ORDER & TABLE SPECIFIC
 */   
/* Tăng padding cell cho bảng dữ liệu */
td { padding: 11px 14px !important; }
th { padding: 12px 14px !important; }

/* Empty state */
.empty-row td {
  background: transparent !important;
  color: #7a9b7a !important;
  font-style: italic !important;
}

/* ════════════════════════
   ACCOUNTING CSS OVERRIDE (nếu có)
 */   ════════════════════
.report-card {
  border-radius: var(--r-card) !important;
  background: rgba(255,255,255,0.92) !important;
  border: 1px solid rgba(255,255,255,0.8) !important;
  box-shadow: var(--glass-shadow) !important;
  transition: all var(--t-normal) !important;
}
.report-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--glass-shadow-lg) !important;
}

/* ═════════════════════════════
   GLASS UTILITY CLASSES — dùng trong HTML view mới
 */   ═════════
.glass {
  background: rgba(255,255,255,0.75) !important;
  backdrop-filter: blur(16px) saturate(1.6) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.6) !important;
  border: 1px solid rgba(255,255,255,0.6) !important;
}
.glass-dark {
  background: rgba(22, 59, 30, 0.85) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
}
.glass-card {
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255,255,255,0.8) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07), inset 0 1px 0 rgba(255,255,255,1) !important;
  border-radius: var(--r-card) !important;
}
.brand-gradient {
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to)) !important;
}
.brand-text {
  background: linear-gradient(135deg, var(--brand-from), #2a5c10);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ═══════════════════════════════════════
   PAGE WRAPPER — Premium padded layout
 */
.page.active {
  padding: 0 !important;
  background: var(--surface-page, #F4F7F3) !important;
  min-height: 100vh !important;
}
/* For pages that don't have their own wrapper, auto-add padding */
.page.active > .page-header:first-child,
.page.active > div > .page-header:first-child {
  padding-top: 28px !important;
}

/* Page header layout */
.page-header {
  padding: 28px 36px 0 !important;
  margin-bottom: 20px !important;
}

/* Standard toolbar (filter row) gets glass card treatment on all pages */
.page.active > .toolbar,
.page.active > div > .toolbar {
  margin: 0 36px 16px !important;
  border-radius: 16px !important;
  padding: 14px 18px !important;
}

/* Table card gets margin on all pages */
.page.active > .table-card,
.page.active > div > .table-card {
  margin: 0 36px 36px !important;
}

/* Unified top card — same horizontal margin as table-card below */
.page.active > .module-top-card,
.page.active > div > .module-top-card,
.page.active > section > .module-top-card {
  margin: 28px 36px 16px !important;
  width: auto !important;
  box-sizing: border-box !important;
}

/* ═══════════════════════════════════════
   STAT CARDS — Consistent for all pages
 */
.stat-card {
  cursor: pointer !important;
}
.stat-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* ═══════════════════
   STATUS CHIP ALIASES (Đã duyệt, Chờ duyệt, etc.)
 */
.chip-confirmed, .chip-posted, .chip-active {
  background: rgba(93, 169, 47, 0.12) !important;
  color: #2d6c00 !important;
  box-shadow: 0 0 0 1px rgba(93,169,47,0.25) !important;
  border-radius: var(--r-badge) !important;
  padding: 3px 11px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}
.chip-pending {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #b45309 !important;
  box-shadow: 0 0 0 1px rgba(245,158,11,0.3) !important;
  border-radius: var(--r-badge) !important;
  padding: 3px 11px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

/* END LIQUID GLASS UPGRADE */

/* ══════════════════════════════════════════════════════════
   QUOTATION PRODUCT SEARCH PORTAL (qt-prod-portal)
   Matches pn-ss style from phiếu nhập kho
══════════════════════════════════════════════════════════ */

/* Portal-based input in each row — simpler than before */
.qt-prod-search-inp {
  width: 100%;
  padding: 4px 26px 4px 8px;
  font-size: 12px;
  background: var(--bg-input, #f7fbf7);
  border: 1px solid var(--border, #d5e8d5);
  border-radius: 6px;
  color: var(--text, #0f2d0f);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s;
}
.qt-prod-search-inp:focus { border-color: var(--accent, #3da832); box-shadow: 0 0 0 2px rgba(61,168,50,.18); }

/* ── Portal search bar at top of dropdown ── */
.qt-drop-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #d5e8d5);
  flex-shrink: 0;
  background: var(--bg-card, #fff);
}
.qt-drop-search-input {
  width: 100%;
  padding: 5px 10px;
  font-size: 12px;
  background: var(--bg-input, #f7fbf7);
  border: 1px solid var(--border, #d5e8d5);
  border-radius: 6px;
  color: var(--text, #0f2d0f);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}
.qt-drop-search-input:focus { border-color: var(--accent, #3da832); }

/* ── Left category sidebar ── */
.qt-drop-cats {
  width: 140px;
  flex-shrink: 0;
  border-right: 1px solid var(--border, #d5e8d5);
  padding: 6px 5px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-secondary, #f8f9fa);
}
.qt-cat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text, #0f2d0f);
  font-weight: 400;
  transition: background .12s;
  user-select: none;
}
.qt-cat-item:hover { background: var(--accent-light, #eaf6e9); }
.qt-cat-item.active {
  background: var(--accent-light, #eaf6e9);
  color: var(--accent, #3da832);
  font-weight: 700;
}
.qt-cat-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qt-cat-count {
  font-size: 10px;
  background: var(--border, #d5e8d5);
  border-radius: 8px;
  padding: 1px 6px;
  color: var(--text-muted, #64748b);
  flex-shrink: 0;
}

/* ── Right product list ── */
.qt-drop-prods {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
}
.qt-prod-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
}
.qt-prod-item:hover, .qt-prod-item.hover { background: var(--accent-light, #eaf6e9); }
.qt-prod-item-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.qt-prod-item-name mark {
  display: inline;
  background: #fef3c7;
  border-radius: 2px;
  padding: 0 2px;
  color: inherit;
  font-weight: 600;
}

.qt-prod-item-cat {
  font-size: 10px;
  color: var(--text-muted, #64748b);
}
.qt-prod-item-price {
  font-size: 11px;
  color: var(--accent, #3da832);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.qt-prod-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted, #64748b);
}


