﻿    :root {
      --sidebar-w: 260px;
      --sidebar-bg: #0f1a2e;
      --sidebar-hover: rgba(255, 255, 255, 0.07);
      --primary: #2563eb;
      --primary-light: #3b82f6;
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ef4444;
      --surface: #ffffff;
      --surface-2: #f8fafc;
      --border: #e2e8f0;
      --text: #0f172a;
      --text-muted: #64748b;
      --radius: 12px;
      --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
      --shadow-lg: 0 8px 30px rgba(0, 0, 0, .12);
    }

    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0
    }

    body {
      font-family: 'Segoe UI', system-ui, sans-serif;
      background: var(--surface-2);
      color: var(--text);
      min-height: 100vh;
      overflow-x: hidden
    }

    /* ─── SIDEBAR ──────────────────────────────── */
    #sidebar {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: var(--sidebar-w);
      background: var(--sidebar-bg);
      z-index: 1000;
      display: flex;
      flex-direction: column;
      transition: transform .3s ease;
      overflow-y: auto;
    }

    .sidebar-brand {
      padding: 22px 20px 16px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.07);
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .brand-icon {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: linear-gradient(135deg, #2563eb, #06b6d4);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      color: #fff;
      font-weight: 700;
      flex-shrink: 0;
    }

    .brand-name {
      font-size: 1rem;
      font-weight: 700;
      color: #fff;
      letter-spacing: -.2px
    }

    .brand-version {
      font-size: .68rem;
      color: #64748b;
      margin-top: 1px
    }

    .sidebar-section {
      padding: 12px 12px 4px;
      font-size: .65rem;
      font-weight: 700;
      letter-spacing: .1em;
      text-transform: uppercase;
      color: #475569;
    }

    .sidebar-link {
      display: flex;
      align-items: center;
      gap: 11px;
      padding: 10px 16px;
      margin: 1px 8px;
      border-radius: 9px;
      cursor: pointer;
      color: #94a3b8;
      font-size: .875rem;
      font-weight: 500;
      text-decoration: none;
      transition: all .2s;
      border: none;
      background: none;
      width: calc(100% - 16px);
      text-align: left;
    }

    .sidebar-link:hover {
      background: var(--sidebar-hover);
      color: #e2e8f0
    }

    .sidebar-link.active {
      background: rgba(37, 99, 235, .25);
      color: #93c5fd
    }

    .sidebar-link .bi {
      font-size: 1rem;
      width: 18px;
      text-align: center
    }

    .sidebar-link .badge {
      margin-left: auto;
      font-size: .65rem
    }

    .sidebar-footer {
      margin-top: auto;
      padding: 16px;
      border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    .user-card {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.05);
      cursor: pointer;
      transition: background .2s;
    }

    .user-card:hover {
      background: rgba(255, 255, 255, 0.08)
    }

    .user-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: linear-gradient(135deg, #2563eb, #7c3aed);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: .8rem;
      font-weight: 700;
      flex-shrink: 0;
    }

    .user-name {
      font-size: .82rem;
      font-weight: 600;
      color: #e2e8f0
    }

    .user-role {
      font-size: .7rem;
      color: #64748b
    }

    /* ─── MAIN LAYOUT ──────────────────────────── */
    #main {
      margin-left: var(--sidebar-w);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      transition: margin .3s;
    }

    /* ─── TOPBAR ───────────────────────────────── */
    #topbar {
      height: 64px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      padding: 0 24px;
      gap: 16px;
      position: sticky;
      top: 0;
      z-index: 100;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }

    .topbar-toggle {
      display: none;
      background: none;
      border: none;
      font-size: 1.3rem;
      color: var(--text-muted);
      cursor: pointer;
      padding: 6px;
      border-radius: 8px;
    }

    .topbar-toggle:hover {
      background: var(--surface-2)
    }

    .breadcrumb-nav {
      flex: 1
    }

    .breadcrumb-nav .page-title {
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--text);
      margin: 0;
    }

    .breadcrumb-nav .page-sub {
      font-size: .78rem;
      color: var(--text-muted)
    }

    .topbar-actions {
      display: flex;
      align-items: center;
      gap: 12px
    }

    .topbar-btn {
      width: 38px;
      height: 38px;
      border-radius: 9px;
      background: none;
      border: 1.5px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: var(--text-muted);
      font-size: 1rem;
      transition: all .2s;
      position: relative;
    }

    .topbar-btn:hover {
      background: var(--surface-2);
      color: var(--text)
    }

    .notif-dot {
      position: absolute;
      top: 6px;
      right: 6px;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--danger);
      border: 1.5px solid white;
    }

    /* ─── CONTENT ──────────────────────────────── */
    #content {
      flex: 1;
      padding: 24px
    }

    /* ─── CARDS / STAT ─────────────────────────── */
    .stat-card {
      background: var(--surface);
      border-radius: var(--radius);
      padding: 22px;
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
      transition: transform .2s, box-shadow .2s;
    }

    .stat-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg)
    }

    .stat-icon {
      width: 48px;
      height: 48px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.3rem;
      margin-bottom: 14px;
    }

    .stat-val {
      font-size: 1.8rem;
      font-weight: 800;
      color: var(--text);
      line-height: 1
    }

    .stat-lbl {
      font-size: .8rem;
      color: var(--text-muted);
      margin-top: 4px
    }

    .stat-change {
      font-size: .75rem;
      font-weight: 600;
      margin-top: 8px;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .change-up {
      color: var(--success)
    }

    .change-down {
      color: var(--danger)
    }

    /* ─── GENERIC CARD ─────────────────────────── */
    .card {
      background: var(--surface);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      box-shadow: var(--shadow)
    }

    .card-header-bar {
      padding: 16px 20px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }

    .card-title {
      font-size: .95rem;
      font-weight: 700;
      color: var(--text);
      margin: 0
    }

    .card-body-pad {
      padding: 20px
    }

    /* ─── TABLE ────────────────────────────────── */
    .table-wrap {
      overflow-x: auto;
      border-radius: 0 0 var(--radius) var(--radius)
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: .875rem
    }

    thead tr {
      background: var(--surface-2)
    }

    th {
      padding: 11px 14px;
      text-align: left;
      font-size: .72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .05em;
      color: var(--text-muted);
      white-space: nowrap;
      border-bottom: 1px solid var(--border);
    }

    td {
      padding: 12px 14px;
      border-bottom: 1px solid var(--border);
      color: var(--text);
      vertical-align: middle;
    }

    tbody tr:hover {
      background: #f8fafc
    }

    tbody tr:last-child td {
      border-bottom: none
    }

    .td-code {
      font-family: monospace;
      font-size: .8rem;
      color: var(--primary);
      font-weight: 600
    }

    .td-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px
    }

    /* ─── BADGES ───────────────────────────────── */
    .badge-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 10px;
      border-radius: 20px;
      font-size: .72rem;
      font-weight: 600;
    }

    .badge-success {
      background: #dcfce7;
      color: #166534
    }

    .badge-danger {
      background: #fee2e2;
      color: #991b1b
    }

    .badge-warning {
      background: #fef3c7;
      color: #92400e
    }

    .badge-info {
      background: #dbeafe;
      color: #1e40af
    }

    .badge-secondary {
      background: #f1f5f9;
      color: #475569
    }

    /* ─── FORM CONTROLS ────────────────────────── */
    .form-ctrl {
      width: 100%;
      padding: 10px 14px;
      border: 1.5px solid var(--border);
      border-radius: 9px;
      background: var(--surface);
      color: var(--text);
      font-size: .9rem;
      font-family: inherit;
      transition: border-color .2s, box-shadow .2s;
      outline: none;
    }

    .form-ctrl:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1)
    }

    .form-label {
      font-size: .82rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 5px;
      display: block
    }

    .input-group-wrap {
      position: relative
    }

    .input-icon {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-muted);
      pointer-events: none
    }

    .input-group-wrap .form-ctrl {
      padding-left: 38px
    }

    /* ─── BUTTONS ──────────────────────────────── */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      padding: 9px 18px;
      border-radius: 9px;
      font-size: .875rem;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      border: none;
      transition: all .2s;
      text-decoration: none;
    }

    .btn-sm {
      padding: 6px 13px;
      font-size: .8rem
    }

    .btn-primary {
      background: var(--primary);
      color: #fff
    }

    .btn-primary:hover {
      background: #1d4ed8
    }

    .btn-success {
      background: var(--success);
      color: #fff
    }

    .btn-success:hover {
      background: #059669
    }

    .btn-danger {
      background: var(--danger);
      color: #fff
    }

    .btn-danger:hover {
      background: #dc2626
    }

    .btn-outline {
      background: none;
      border: 1.5px solid var(--border);
      color: var(--text)
    }

    .btn-outline:hover {
      background: var(--surface-2)
    }

    .btn-ghost {
      background: none;
      border: none;
      color: var(--text-muted);
      padding: 6px 10px
    }

    .btn-ghost:hover {
      background: var(--surface-2);
      color: var(--text)
    }

    .btn:disabled {
      opacity: .5;
      cursor: not-allowed
    }

    /* ─── SEARCH BAR ───────────────────────────── */
    .search-bar {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .search-wrap {
      position: relative;
      min-width: 240px
    }

    .search-wrap input {
      padding-left: 36px
    }

    .search-wrap .bi-search {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text-muted)
    }

    /* ─── STOCK BAR ────────────────────────────── */
    .stock-bar {
      width: 100%;
      height: 6px;
      background: var(--border);
      border-radius: 3px;
      overflow: hidden;
      margin-top: 4px;
    }

    .stock-fill {
      height: 100%;
      border-radius: 3px;
      transition: width .5s ease
    }

    .stock-ok {
      background: var(--success)
    }

    .stock-low {
      background: var(--warning)
    }

    .stock-critical {
      background: var(--danger)
    }

    /* ─── MODAL ────────────────────────────────── */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 2000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px;
      opacity: 0;
      pointer-events: none;
      transition: opacity .25s;
    }

    .modal-overlay.open {
      opacity: 1;
      pointer-events: all
    }

    .modal-box {
      background: var(--surface);
      border-radius: 16px;
      width: 100%;
      max-width: 560px;
      max-height: 90vh;
      overflow-y: auto;
      transform: translateY(20px) scale(.97);
      transition: transform .25s;
      box-shadow: var(--shadow-lg);
    }

    .modal-overlay.open .modal-box {
      transform: none
    }

    .modal-header {
      padding: 20px 22px 16px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .modal-title {
      font-size: 1rem;
      font-weight: 700;
      color: var(--text)
    }

    .modal-close {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      background: none;
      border: none;
      font-size: 1.1rem;
      cursor: pointer;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .modal-close:hover {
      background: var(--surface-2)
    }

    .modal-body {
      padding: 22px
    }

    .modal-footer {
      padding: 16px 22px;
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }

    /* ─── TOAST ────────────────────────────────── */
    #toast-container {
      position: fixed;
      bottom: 24px;
      right: 24px;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .toast {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 11px;
      padding: 14px 18px;
      display: flex;
      align-items: flex-start;
      gap: 12px;
      min-width: 300px;
      max-width: 380px;
      box-shadow: var(--shadow-lg);
      animation: slideInRight .3s ease;
    }

    .toast.removing {
      animation: slideOutRight .3s ease forwards
    }

    @keyframes slideInRight {
      from {
        transform: translateX(120%);
        opacity: 0
      }

      to {
        transform: none;
        opacity: 1
      }
    }

    @keyframes slideOutRight {
      to {
        transform: translateX(120%);
        opacity: 0
      }
    }

    .toast-icon {
      font-size: 1.1rem;
      margin-top: 1px;
      flex-shrink: 0
    }

    .toast-success .toast-icon {
      color: var(--success)
    }

    .toast-error .toast-icon {
      color: var(--danger)
    }

    .toast-warning .toast-icon {
      color: var(--warning)
    }

    .toast-info .toast-icon {
      color: var(--primary)
    }

    .toast-title {
      font-size: .87rem;
      font-weight: 700;
      color: var(--text)
    }

    .toast-msg {
      font-size: .8rem;
      color: var(--text-muted);
      margin-top: 2px
    }

    /* ─── LOGIN ────────────────────────────────── */
    #login-screen {
      position: fixed;
      inset: 0;
      background: var(--sidebar-bg);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 5000;
      padding: 20px;
    }

    .login-card {
      background: #fff;
      border-radius: 20px;
      padding: 44px 40px;
      width: 100%;
      max-width: 420px;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    }

    .login-logo {
      width: 260px;
      height: 90px;
      background-color: rgba(255, 255, 255, 0.959);
      border-radius: 10px;
      background-image: url('/images/logo.gif');
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      margin: 0 auto 25px auto;
      padding: 10px;
    }

    .login-title {
      font-size: 1.5rem;
      font-weight: 800;
      color: var(--text)
    }

    .login-sub {
      font-size: .875rem;
      color: var(--text-muted);
      margin-top: 4px;
      margin-bottom: 28px
    }

    /* ─── ALERT ────────────────────────────────── */
    .alert {
      padding: 12px 16px;
      border-radius: 9px;
      font-size: .875rem;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 16px;
    }

    .alert-danger {
      background: #fee2e2;
      color: #991b1b;
      border: 1px solid #fca5a5
    }

    .alert-warning {
      background: #fef3c7;
      color: #92400e;
      border: 1px solid #fcd34d
    }

    .alert-success {
      background: #d1fae5;
      color: #065f46;
      border: 1px solid #6ee7b7
    }

    /* ─── EMPTY STATE ──────────────────────────── */
    .empty-state {
      text-align: center;
      padding: 60px 20px;
      color: var(--text-muted);
    }

    .empty-icon {
      font-size: 3rem;
      margin-bottom: 12px;
      opacity: .4
    }

    .empty-title {
      font-size: 1rem;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 6px
    }

    .empty-desc {
      font-size: .875rem
    }

    /* ─── LOADING ──────────────────────────────── */
    .spinner {
      width: 18px;
      height: 18px;
      border: 2.5px solid rgba(255, 255, 255, .3);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin .7s linear infinite;
      display: inline-block;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg)
      }
    }

    .page-loading {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 300px;
      gap: 12px;
      color: var(--text-muted);
      font-size: .9rem;
    }

    .page-loading .spinner {
      border-color: rgba(37, 99, 235, .2);
      border-top-color: var(--primary)
    }

    /* ─── PAGINATION ───────────────────────────── */
    .pagination-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 20px;
      border-top: 1px solid var(--border);
      flex-wrap: wrap;
      gap: 10px;
    }

    .pag-info {
      font-size: .8rem;
      color: var(--text-muted)
    }

    .pag-btns {
      display: flex;
      gap: 4px
    }

    .pag-btn {
      padding: 6px 12px;
      border-radius: 8px;
      font-size: .8rem;
      background: none;
      border: 1.5px solid var(--border);
      cursor: pointer;
      color: var(--text-muted);
      font-weight: 500;
      transition: all .15s;
    }

    .pag-btn:hover:not(:disabled) {
      background: var(--surface-2);
      color: var(--text)
    }

    .pag-btn.active {
      background: var(--primary);
      color: #fff;
      border-color: var(--primary)
    }

    .pag-btn:disabled {
      opacity: .4;
      cursor: not-allowed
    }

    /* ─── RESPONSIVE ───────────────────────────── */
    @media(max-width:768px) {
      #sidebar {
        transform: translateX(-100%)
      }

      #sidebar.open {
        transform: translateX(0)
      }

      #main {
        margin-left: 0
      }

      .topbar-toggle {
        display: flex
      }

      #content {
        padding: 16px
      }

      .stat-card {
        padding: 16px
      }

      .modal-box {
        max-width: 100%
      }

      .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
      }

      .sidebar-overlay.show {
        display: block
      }
    }
