
    :root {
      --bg: #f3f7f7;
      --ink: #122127;
      --muted: #5d6b70;
      --brand: #0e8f83;
      --brand-strong: #096b62;
      --accent: #ee7f3b;
      --line: rgba(18, 33, 39, 0.1);
      --shadow: 0 20px 45px rgba(9, 41, 49, 0.12);
      --card: #ffffff;
      --danger: #c0392b;
    }

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

    body {
      font-family: 'Manrope', sans-serif;
      color: var(--ink);
      background:
        radial-gradient(circle at 8% 5%, rgba(14, 143, 131, 0.15), transparent 28%),
        radial-gradient(circle at 95% 10%, rgba(238, 127, 59, 0.12), transparent 24%),
        linear-gradient(180deg, #f8fbfb 0%, var(--bg) 75%);
      min-height: 100vh;
      overflow-x: hidden;
    }

    .shell { width: min(1200px, 96%); margin: 0 auto; }

    /* ===== HEADER ===== */
    header {
      position: sticky;
      top: 0;
      z-index: 50;
      backdrop-filter: blur(10px);
      background: rgba(248, 251, 251, 0.85);
      border-bottom: 1px solid var(--line);
    }

    .topbar {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      padding: 14px 0;
      gap: 16px;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      justify-self: start;
      text-decoration: none;
      color: var(--ink);
      font-family: 'Sora', sans-serif;
      font-weight: 700;
    }

    .brand-badge {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      display: grid;
      place-items: center;
      background: linear-gradient(145deg, var(--brand), #0fb8a9);
      color: #fff;
      font-weight: 800;
      font-size: 0.88rem;
    }

    nav {
      display: flex;
      align-items: center;
      justify-self: center;
      justify-content: center;
      flex-wrap: nowrap;
      gap: 6px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }

    nav a {
      text-decoration: none;
      color: var(--muted);
      padding: 8px 13px;
      border-radius: 999px;
      font-size: 0.9rem;
      font-weight: 600;
      white-space: nowrap;
      transition: background 0.2s, color 0.2s;
    }
    nav a:hover,
    nav a.active {
      background: rgba(14, 143, 131, 0.13);
      color: var(--brand-strong);
    }
    .user-area {
      display: flex;
      justify-self: end;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
      position: relative;
    }
    .user-chip {
      display: flex;
      align-items: center;
      gap: 8px;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 7px 13px 7px 9px;
      background: var(--card);
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--ink);
      max-width: 280px;
      display: inline-flex;
      align-items: baseline;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .user-chip span strong {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      min-width: 0;
    }
    .user-chip span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .user-menu-trigger {
      border: 1px solid var(--line);
      cursor: pointer;
      font-family: 'Manrope', sans-serif;
      text-align: left;
    }
    .user-menu-panel {
      position: absolute;
      top: calc(100% + 10px);
      right: 48px;
      width: min(420px, calc(100vw - 26px));
      border: 1px solid var(--line);
      border-radius: 14px;
      background: #ffffff;
      padding: 14px;
      box-shadow: 0 20px 48px rgba(8, 37, 44, 0.18);
      z-index: 70;
      display: none;
    }
    .user-menu-panel.open {
      display: block;
    }
    .subscription-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }
    .subscription-label {
      font-size: 0.75rem;
      text-transform: uppercase;
      color: var(--muted);
      font-weight: 800;
      letter-spacing: 0.4px;
    }
    .subscription-top h2 {
      font-family: 'Sora', sans-serif;
      font-size: 1.05rem;
    }
    .subscription-status {
      background: rgba(238, 127, 59, 0.16);
      color: #8b3a18;
      font-size: 0.76rem;
      font-weight: 800;
      border-radius: 999px;
      padding: 5px 10px;
    }
    .subscription-status.is-active {
      background: rgba(14, 143, 131, 0.16);
      color: #0a6a5f;
    }
    .subscription-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }
    .sub-item {
      background: rgba(14, 143, 131, 0.06);
      border: 1px solid rgba(14, 143, 131, 0.16);
      border-radius: 10px;
      padding: 10px;
      display: grid;
      gap: 4px;
    }
    .sub-item span {
      color: var(--muted);
      font-size: 0.76rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.35px;
    }
    .sub-item strong {
      color: #173a42;
      font-size: 0.93rem;
    }
    .sub-item-name-wrapper {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .btn-edit-name {
      background: none;
      border: none;
      padding: 2px 4px;
      cursor: pointer;
      font-size: 0.9rem;
      opacity: 0;
      transition: opacity 0.2s;
      min-width: auto;
      min-height: auto;
    }
    .sub-item:hover .btn-edit-name {
      opacity: 1;
    }
    .btn-edit-name:hover {
      filter: brightness(1.2);
    }
    .subscription-actions {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
      margin-top: 12px;
    }
    .subscription-actions select,
    .subscription-actions input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 10px 12px;
      font-size: 0.9rem;
      font-family: 'Manrope', sans-serif;
      outline: none;
      background: #fafcfc;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .subscription-actions select:focus,
    .subscription-actions input:focus {
      border-color: rgba(14, 143, 131, 0.55);
      box-shadow: 0 0 0 4px rgba(14, 143, 131, 0.12);
    }
    .avatar {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: linear-gradient(145deg, var(--brand), #0fb8a9);
      display: grid;
      place-items: center;
      color: #fff;
      font-size: 0.75rem;
      font-weight: 800;
    }
    .btn-logout {
      border: 1px solid rgba(192, 57, 43, 0.55);
      background: rgba(192, 57, 43, 0.13);
      color: var(--danger);
      border-radius: 999px;
      padding: 7px 13px;
      font-size: 0.82rem;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.2s, border-color 0.2s;
    }
    .btn-logout:hover { background: rgba(192, 57, 43, 0.22); border-color: rgba(192, 57, 43, 0.8); }

    /* Toolbar padrão fornecedores */
    .toolbar {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
      flex-wrap: wrap;
    }
    .toolbar .toolbar-btn {
      min-height: 42px;
      min-width: 148px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .toolbar .btn-new.toolbar-btn { padding: 0 16px; }

    @media (max-width: 1100px) {
      .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
      .brand { min-width: 0; }
      nav { justify-self: stretch; justify-content: flex-start; }
      .user-area { gap: 6px; }
      .user-chip { max-width: 155px; padding: 6px 10px 6px 8px; }
      .btn-logout { padding: 6px 10px; }
      .toolbar .toolbar-btn { min-width: 126px; }
    }
    @media (max-width: 920px) {
      .topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
      .brand { order: 1; }
      .user-area { order: 2; margin-left: auto; }
      nav { order: 3; width: 100%; padding-bottom: 2px; }
      .toolbar .toolbar-btn { flex: 1 1 calc(50% - 8px); min-width: 0; }
    }
    @media (max-width: 1200px) {
      .chip-greeting { display: none; }
      .user-chip { max-width: 180px; }
    }
    @media (max-width: 768px) {
      .topbar { display: flex; align-items: flex-start; flex-direction: column; }
      .brand { width: 100%; }
      nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
      nav a { white-space: nowrap; flex: 0 0 auto; }
      .user-area { width: 100%; justify-content: space-between; margin-left: 0; }
      .user-chip { max-width: 65vw; }
      .toolbar { flex-direction: column; align-items: stretch; }
      .toolbar > div { width: 100%; }
      .toolbar .btn, .toolbar .btn-new { width: 100%; }
      .user-menu-panel { right: 0; }
    }
    @media (max-width: 560px) {
      .user-chip span { display: none; }
      .toolbar .btn, .toolbar .btn-new, .modal-actions button { min-height: 44px; }
      .modal-actions { flex-direction: column-reverse; gap: 8px; }
      .table-actions { flex-wrap: wrap; }
      .btn-edit, .btn-delete { flex: 1 1 120px; }
    }

    /* ===== MAIN ===== */
    main { padding: 36px 0 64px; }

    /* ===== PAGE HEADER ===== */
    .page-head {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 22px;
      flex-wrap: wrap;
    }

    .page-head h1 {
      font-family: 'Sora', sans-serif;
      font-size: clamp(1.55rem, 3vw, 2rem);
      margin-bottom: 4px;
    }

    .page-head p {
      color: var(--muted);
      font-size: 0.95rem;
    }

    .subscription-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }

    .subscription-label {
      font-size: 0.75rem;
      text-transform: uppercase;
      color: var(--muted);
      font-weight: 800;
      letter-spacing: 0.4px;
    }

    .subscription-top h2 {
      font-family: 'Sora', sans-serif;
      font-size: 1.05rem;
    }

    .subscription-status {
      background: rgba(238, 127, 59, 0.16);
      color: #8b3a18;
      font-size: 0.76rem;
      font-weight: 800;
      border-radius: 999px;
      padding: 5px 10px;
    }

    .subscription-status.is-active {
      background: rgba(14, 143, 131, 0.16);
      color: #0a6a5f;
    }

    .subscription-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin-bottom: 12px;
    }

    .sub-item {
      background: rgba(14, 143, 131, 0.06);
      border: 1px solid rgba(14, 143, 131, 0.16);
      border-radius: 10px;
      padding: 10px;
      display: grid;
      gap: 4px;
    }

    .sub-item span {
      color: var(--muted);
      font-size: 0.76rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.35px;
    }

    .sub-item strong {
      color: #173a42;
      font-size: 0.93rem;
    }

    .sub-item-name-wrapper {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
    }

    .sub-item-name-wrapper strong {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .btn-edit-name {
      background: none;
      border: none;
      padding: 2px 4px;
      cursor: pointer;
      font-size: 0.9rem;
      opacity: 0.7;
      transition: opacity 0.2s;
      min-width: auto;
      min-height: auto;
      flex-shrink: 0;
    }

    .sub-item:hover .btn-edit-name {
      opacity: 1;
    }

    .btn-edit-name:hover {
      filter: brightness(1.2);
    }

    .subscription-actions {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    .subscription-actions select,
    .subscription-actions input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 10px 12px;
      font-size: 0.9rem;
      font-family: 'Manrope', sans-serif;
      outline: none;
      background: #fafcfc;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .subscription-actions select:focus,
    .subscription-actions input:focus {
      border-color: rgba(14, 143, 131, 0.55);
      box-shadow: 0 0 0 4px rgba(14, 143, 131, 0.12);
    }

    /* ===== KPIs ===== */
    .kpi-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 24px;
    }

    .kpi {
      border: 1px solid var(--line);
      border-radius: 16px;
      background: var(--card);
      padding: 16px;
      box-shadow: 0 4px 14px rgba(8, 37, 44, 0.06);
      position: relative;
      overflow: hidden;
    }

    .kpi::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 3px;
      background: linear-gradient(90deg, var(--brand), #0fb8a9);
    }

    .kpi.alert-kpi::before {
      background: linear-gradient(90deg, var(--accent), #f6a060);
    }

    .kpi-label {
      font-size: 0.8rem;
      color: var(--muted);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.4px;
      margin-bottom: 8px;
    }

    .kpi-value {
      font-family: 'Sora', sans-serif;
      font-size: 1.9rem;
      font-weight: 800;
      color: var(--ink);
      line-height: 1;
      margin-bottom: 4px;
    }

    .kpi-sub {
      font-size: 0.8rem;
      color: var(--muted);
      font-weight: 600;
    }

    .kpi-sub.danger { color: #c0392b; }
    .kpi-sub.ok { color: #0a6a5f; }

    /* ===== TOOLBAR ===== */
    .toolbar {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }

    .search-wrap {
      flex: 1;
      min-width: 200px;
      position: relative;
    }

    .search-wrap svg {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--muted);
      pointer-events: none;
    }

    .search-wrap input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 10px 12px 10px 38px;
      font-size: 0.92rem;
      font-family: 'Manrope', sans-serif;
      background: var(--card);
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .search-wrap input:focus {
      border-color: rgba(14, 143, 131, 0.55);
      box-shadow: 0 0 0 4px rgba(14, 143, 131, 0.12);
    }

    .category-filters {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .filter-chip {
      border: 1px solid var(--line);
      background: var(--card);
      color: var(--muted);
      border-radius: 999px;
      padding: 7px 12px;
      font-size: 0.82rem;
      font-weight: 700;
      cursor: pointer;
      transition: background 0.2s, color 0.2s, border-color 0.2s;
    }

    .filter-chip:hover {
      border-color: rgba(14, 143, 131, 0.4);
      color: var(--brand-strong);
    }

    .filter-chip.active {
      background: rgba(14, 143, 131, 0.12);
      border-color: rgba(14, 143, 131, 0.38);
      color: var(--brand-strong);
    }

    .btn {
      border: 0;
      padding: 10px 18px;
      border-radius: 10px;
      font-weight: 800;
      font-size: 0.9rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 7px;
      transition: transform 0.2s, box-shadow 0.2s;
      text-decoration: none;
      white-space: nowrap;
    }

    .btn:hover { transform: translateY(-1px); }

    .btn-main {
      background: linear-gradient(135deg, var(--brand), #0cac9c);
      color: #fff;
      box-shadow: 0 10px 22px rgba(14, 143, 131, 0.28);
    }

    .btn-soft {
      background: rgba(14, 143, 131, 0.1);
      color: var(--brand-strong);
      border: 1px solid rgba(14, 143, 131, 0.25);
    }

    .btn-danger {
      background: rgba(192, 57, 43, 0.1);
      color: var(--danger);
      border: 1px solid rgba(192, 57, 43, 0.25);
    }

    .btn-danger:hover { background: rgba(192, 57, 43, 0.18); }

    .btn-sm {
      padding: 6px 12px;
      font-size: 0.8rem;
      border-radius: 8px;
    }

    /* ===== TABLE ===== */
    .table-card {
      border: 1px solid var(--line);
      border-radius: 18px;
      background: var(--card);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .table-wrap {
      overflow-x: auto;
      overflow-y: auto;
      max-height: 470px;
      scrollbar-gutter: stable;
      -webkit-overflow-scrolling: touch;
    }

    .table-wrap thead th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: #d2e1e1;
      box-shadow: 0 1px 0 rgba(18, 33, 39, 0.08);
    }

    table {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0;
      min-width: 820px;
    }

    thead th {
      background: #d2e1e1;
      padding: 12px 14px;
      text-align: left;
      font-size: 0.78rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.4px;
      color: #194149;
      border-bottom: 1px solid var(--line);
    }

    tbody td {
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      font-size: 0.9rem;
      vertical-align: middle;
    }

    .field-preco-readonly {
      background: rgba(14, 143, 131, 0.06);
      font-weight: 700;
    }

    .cell-muted-sm {
      font-size: 0.82rem;
      color: var(--muted);
    }

    .cell-ellipsis {
      max-width: 170px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .cell-muted-md {
      color: var(--muted);
      font-size: 0.88rem;
    }

    .cell-bold {
      font-weight: 700;
    }

    .cell-brand-strong {
      font-weight: 800;
      color: var(--brand-strong);
    }

    tbody tr:last-child td { border-bottom: 0; }

    tbody tr:hover { background: rgba(14, 143, 131, 0.03); }

    .td-nome strong {
      display: block;
      font-size: 0.92rem;
      color: #16353c;
      margin-bottom: 2px;
      max-width: 420px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .td-nome span {
      font-size: 0.78rem;
      color: var(--muted);
    }

    .badge {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      padding: 4px 9px;
      font-weight: 800;
      font-size: 0.75rem;
      white-space: nowrap;
    }

    .badge-ok { color: #0a6359; background: rgba(14, 143, 131, 0.14); }
    .badge-low { color: #954518; background: rgba(238, 127, 59, 0.2); }
    .badge-zero { color: #c0392b; background: rgba(192, 57, 43, 0.14); }
    .badge-category {
      border: 1px solid transparent;
      text-transform: none;
      font-size: 0.74rem;
    }
    .badge-cat-final {
      color: #1a4fb5;
      background: rgba(51, 119, 255, 0.12);
      border-color: rgba(51, 119, 255, 0.28);
    }
    .badge-cat-raw {
      color: #0a6a5f;
      background: rgba(14, 143, 131, 0.12);
      border-color: rgba(14, 143, 131, 0.28);
    }

    .qty-wrap {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .qty-num {
      font-family: 'Sora', sans-serif;
      font-weight: 800;
      font-size: 1rem;
      min-width: 28px;
      text-align: center;
    }

    .qty-unit {
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--muted);
    }

    .qty-btn {
      width: 26px;
      height: 26px;
      border-radius: 7px;
      border: 1px solid var(--line);
      background: var(--card);
      cursor: pointer;
      display: grid;
      place-items: center;
      font-size: 1rem;
      font-weight: 800;
      color: var(--muted);
      transition: background 0.15s, color 0.15s;
      line-height: 1;
    }

    .qty-btn:hover {
      background: rgba(14, 143, 131, 0.13);
      color: var(--brand-strong);
    }

    .td-actions { display: flex; gap: 6px; }

    .empty-state {
      text-align: center;
      padding: 52px 24px;
      color: var(--muted);
    }

    .empty-state svg {
      opacity: 0.3;
      margin-bottom: 14px;
    }

    .empty-state p { font-size: 0.95rem; }

    /* ===== MODAL ===== */
    .overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(10, 25, 30, 0.45);
      z-index: 100;
      backdrop-filter: blur(3px);
      align-items: center;
      justify-content: center;
      padding: 16px;
      overflow-y: auto;
      overscroll-behavior: contain;
    }

    .overlay.open { display: flex; }

    body.modal-open {
      overflow: hidden;
    }

    .modal {
      background: var(--card);
      border-radius: 22px;
      padding: 28px;
      width: 100%;
      max-width: 480px;
      max-height: calc(100dvh - 32px);
      overflow-y: auto;
      box-shadow: 0 32px 80px rgba(0,0,0,0.22);
      animation: popIn 0.25s ease;
    }

    @keyframes popIn {
      from { opacity: 0; transform: scale(0.96) translateY(12px); }
      to { opacity: 1; transform: scale(1) translateY(0); }
    }

    .modal h2 {
      font-family: 'Sora', sans-serif;
      font-size: 1.25rem;
      margin-bottom: 4px;
    }

    .modal .sub {
      color: var(--muted);
      font-size: 0.88rem;
      margin-bottom: 20px;
    }

    .field {
      display: grid;
      gap: 6px;
      margin-bottom: 14px;
    }

    .field label {
      font-size: 0.88rem;
      font-weight: 700;
      color: #1f3840;
    }

    .field input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 11px 13px;
      font-size: 0.92rem;
      font-family: 'Manrope', sans-serif;
      outline: none;
      background: #fafcfc;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .field input:focus {
      border-color: rgba(14, 143, 131, 0.55);
      box-shadow: 0 0 0 4px rgba(14, 143, 131, 0.12);
    }

    .field select {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 11px 13px;
      font-size: 0.92rem;
      font-family: 'Manrope', sans-serif;
      outline: none;
      background: #fafcfc;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .field select:focus {
      border-color: rgba(14, 143, 131, 0.55);
      box-shadow: 0 0 0 4px rgba(14, 143, 131, 0.12);
    }

    /* ===== MODAL OVERLAY (modal-overlay class) ===== */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(10, 25, 30, 0.45);
      z-index: 100;
      backdrop-filter: blur(3px);
      align-items: center;
      justify-content: center;
      padding: 16px;
      overflow-y: auto;
      overscroll-behavior: contain;
    }

    .modal-overlay:not(.is-hidden) {
      display: flex;
    }

    .modal-overlay .modal {
      background: var(--card);
      border-radius: 22px;
      padding: 28px;
      width: 100%;
      max-width: 480px;
      max-height: calc(100dvh - 32px);
      overflow-y: auto;
      box-shadow: 0 32px 80px rgba(0,0,0,0.22);
      animation: popIn 0.25s ease;
      position: relative;
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
      gap: 12px;
    }

    .modal-header h3 {
      font-family: 'Sora', sans-serif;
      font-size: 1.18rem;
      font-weight: 700;
      color: var(--ink);
    }

    .modal-close {
      background: none;
      border: none;
      font-size: 1.3rem;
      cursor: pointer;
      padding: 4px 8px;
      color: var(--muted);
      transition: color 0.2s;
      min-width: auto;
      min-height: auto;
    }

    .modal-close:hover {
      color: var(--ink);
    }

    .modal-body {
      margin-bottom: 20px;
    }

    .modal-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
    }

    .modal-actions .btn {
      flex: 1;
      min-height: 42px;
    }

    #saleMaterialSearch {
      margin-bottom: 8px;
    }

    #saleMaterial {
      min-height: 220px;
      max-height: 260px;
      overflow-y: auto;
      padding: 6px;
      color: #17343f;
      background: #f8fbfc;
      border-color: rgba(18, 33, 39, 0.2);
    }

    #saleMaterial option {
      padding: 6px 8px;
      white-space: normal;
      text-overflow: clip;
      overflow: visible;
      line-height: 1.35;
      font-size: 13px;
      color: #17343f;
      background: #f8fbfc;
    }

    #saleMaterial option:checked {
      background: linear-gradient(135deg, #1d67c6, #2c7be5);
      color: #ffffff;
      font-weight: 700;
    }

    body.dark-mode #saleMaterial {
      color: #e9f5fb;
      background: #0f1b21;
      border-color: rgba(214, 241, 247, 0.2);
    }

    body.dark-mode #saleMaterial option {
      color: #e9f5fb;
      background: #0f1b21;
    }

    .sale-material-preview {
      margin-top: 10px;
      padding: 11px 12px;
      border: 1px solid rgba(36, 174, 189, 0.35);
      border-radius: 12px;
      background: linear-gradient(145deg, rgba(12, 52, 71, 0.88), rgba(8, 32, 43, 0.92));
      line-height: 1.45;
      word-break: break-word;
      color: #eaf6fb;
    }

    .sale-material-preview.is-empty {
      color: #9fb8c2;
      font-size: 0.86rem;
      border-style: dashed;
      background: rgba(9, 35, 49, 0.55);
    }

    .sale-preview-head {
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #89d5e2;
      margin-bottom: 4px;
      font-weight: 700;
    }

    .sale-preview-name {
      font-size: 0.96rem;
      color: #f4fcff;
      font-weight: 800;
      margin-bottom: 8px;
      text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
    }

    .sale-preview-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .sale-chip {
      display: inline-flex;
      align-items: center;
      padding: 4px 8px;
      border-radius: 999px;
      font-size: 0.78rem;
      font-weight: 700;
      color: #d8f5ff;
      background: rgba(15, 125, 129, 0.2);
      border: 1px solid rgba(126, 222, 235, 0.28);
    }

    .sale-chip-stock {
      background: rgba(26, 153, 91, 0.2);
      border-color: rgba(112, 229, 163, 0.4);
      color: #ccffe5;
    }

    .sale-chip-stock.low {
      background: rgba(225, 124, 22, 0.2);
      border-color: rgba(247, 179, 111, 0.45);
      color: #ffe7cc;
    }

    .sale-chip-price {
      background: rgba(14, 143, 131, 0.24);
      border-color: rgba(126, 222, 235, 0.5);
      color: #dffff9;
    }

    .field-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .field-row .field label {
      white-space: nowrap;
      min-height: 22px;
      display: inline-flex;
      align-items: center;
    }

    #modalOverlay .field-row {
      align-items: start;
    }

    #modalOverlay .field-row .field {
      margin-bottom: 0;
      align-content: start;
    }

    #modalOverlay .field-row .field input,
    #modalOverlay .field-row .field select {
      min-height: 44px;
    }

    .modal-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      margin-top: 20px;
    }

    .modal-feedback {
      display: none;
      border-radius: 8px;
      padding: 9px 12px;
      margin-bottom: 12px;
      font-size: 0.85rem;
    }

    .modal-feedback.error {
      display: block;
      color: #8b3a18;
      background: rgba(238, 127, 59, 0.16);
      border: 1px solid rgba(238, 127, 59, 0.38);
    }

    /* ===== RESPONSIVE ===== */
    @media (max-width: 1200px) {
      .kpi-row { grid-template-columns: repeat(2, 1fr); }
      .chip-greeting { display: none; }
      .user-chip { max-width: 180px; }
    }

    @media (max-width: 768px) {
      .topbar {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
      }

      nav {
        width: 100%;
        justify-content: flex-start;
        padding-bottom: 4px;
      }

      .user-area {
        width: 100%;
        justify-content: space-between;
      }

      .page-head {
        flex-direction: column;
        align-items: flex-start;
      }

      .toolbar {
        align-items: stretch;
      }

      .category-filters {
        width: 100%;
      }
    }

    @media (max-width: 560px) {
      main { padding: 24px 0 48px; }

      .shell { width: 94%; }

      .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }

      .kpi-value { font-size: 1.5rem; }

      .kpi,
      .hero,
      .table-card {
        border-radius: 14px;
      }

      .toolbar { flex-direction: column; align-items: stretch; }

      .toolbar,
      .modal-actions {
        gap: 8px;
      }

      .search-wrap { min-width: unset; }

      .toolbar .btn {
        width: 100%;
        justify-content: center;
      }

      .btn,
      .toolbar .btn,
      .modal-actions .btn {
        min-height: 44px;
      }

      .user-chip span { display: none; }

      .field-row { grid-template-columns: 1fr; }

      .modal-actions {
        flex-direction: column-reverse;
      }

      .modal-actions .btn {
        width: 100%;
        justify-content: center;
      }

      .overlay {
        padding: 10px;
      }

      .modal { padding: 20px 16px; }

      .modal input,
      .modal select,
      .modal textarea {
        font-size: 16px;
      }

      #saleMaterial {
        min-height: 180px;
        max-height: 220px;
      }

      .table-wrap {
        max-height: 56dvh;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
      }

      .user-menu-panel {
        right: 0;
      }
    }

    @media (max-width: 520px) {
      .kpi-row { grid-template-columns: 1fr; }
    }

    @media (max-width: 380px) {
      .kpi-row { grid-template-columns: 1fr; }
    }

    /* ===== LOADING ===== */
    .skeleton {
      background: linear-gradient(90deg, rgba(18,33,39,0.07) 25%, rgba(18,33,39,0.12) 50%, rgba(18,33,39,0.07) 75%);
      background-size: 200%;
      animation: shimmer 1.4s infinite;
      border-radius: 8px;
    }

    @keyframes shimmer {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    .reveal-section {
      opacity: 0;
      transform: translateY(16px);
      transition: opacity 0.55s ease, transform 0.55s ease;
    }

    .reveal-section.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .kpi.reveal-section:nth-child(1) { transition-delay: 0ms; }
    .kpi.reveal-section:nth-child(2) { transition-delay: 80ms; }
    .kpi.reveal-section:nth-child(3) { transition-delay: 160ms; }
    .kpi.reveal-section:nth-child(4) { transition-delay: 240ms; }
  