/* ============================================================
   GoFaster Warehouse  |  Solid Dark Navigation Theme (Octet-inspired)
   ============================================================
   Font: Inter (Google Fonts)
   Base: #060A12  |  Primary: #00D4C8
   ============================================================ */

/* --- Google Font ------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- Design Tokens ----------------------------------------- */
:root {
  /* backgrounds */
  --bg:      #0A0A0A;
  --bg2:     #141414;
  --bg3:     #1A1A1A;

  /* surfaces — solid, no transparency */
  --s1:      #161616;
  --s2:      #1E1E1E;
  --s3:      #262626;

  /* borders — solid, visible */
  --border:  #2A2A2A;
  --border2: #363636;

  /* primary */
  --primary:  #00D4C8;
  --primary2: #00A8A0;
  --p-glow:   rgba(0,212,200,0.25);
  --p-soft:   rgba(0,212,200,0.12);

  /* accent palette */
  --purple:   #8B5CF6;
  --green:    #22C55E;
  --gr-soft:  rgba(34,197,94,0.12);
  --amber:    #F59E0B;
  --am-soft:  rgba(245,158,11,0.12);
  --red:      #EF4444;
  --re-soft:  rgba(239,68,68,0.12);
  --blue:     #3B82F6;
  --bl-soft:  rgba(59,130,246,0.12);

  /* text — warmer tones */
  --text:   #F0EDEB;
  --text2:  #938A87;
  --text3:  #605E5E;

  /* shared */
  --blur:   0px;
  --r:      22px;
  --r2:     16px;
  --r3:     12px;

  /* layout */
  --sidebar-w: 260px;
  --header-h:  56px;
  --bottom-h:  64px;

  /* transitions */
  --ease: cubic-bezier(.4,0,.2,1);
}

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--primary2); }

img { max-width: 100%; display: block; }

::selection { background: var(--p-glow); color: var(--text); }

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--s3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 4px var(--p-glow); }
  50%      { box-shadow: 0 0 12px var(--p-glow); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(0) translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ============================================================
   LAYOUT — Desktop
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #111111;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .35s var(--ease);
}

.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 32px 36px 48px;
  animation: fadeIn .4s var(--ease);
}

/* --- Sidebar Header / Logo --------------------------------- */
.sidebar-header {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-radius: var(--r3);
  font-size: 18px;
  color: var(--bg);
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--p-glow);
}

.sidebar-logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.sidebar-logo-text span { color: var(--primary); }

/* --- Sidebar Navigation ------------------------------------ */
.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r3);
  color: var(--text2);
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s var(--ease);
  text-decoration: none;
  position: relative;
}

.sidebar-link:hover {
  background: var(--s2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--p-soft);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.sidebar-link-icon {
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  opacity: .8;
}

.sidebar-link.active .sidebar-link-icon { opacity: 1; }

/* --- Sidebar Footer / User --------------------------------- */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--r3);
  transition: background .2s var(--ease);
}
.sidebar-user:hover { background: var(--s1); }

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: .75rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r3);
  background: transparent;
  color: var(--text2);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
  text-decoration: none;
  text-align: center;
}
.sidebar-logout:hover {
  background: var(--re-soft);
  border-color: rgba(239,68,68,.25);
  color: var(--red);
}

/* ============================================================
   MOBILE HEADER
   ============================================================ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: #111111;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--border);
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.mobile-hamburger {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1E1E1E;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r3);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.mobile-hamburger:hover { background: var(--s2); }

.mobile-hamburger span {
  display: block;
  width: 20px;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.2s var(--ease);
}

.mobile-hamburger span + span {
  margin-top: 5px;
}

.mobile-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.mobile-header-title span { color: var(--primary); }

.mobile-header-logout {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r3);
  color: var(--text2);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all .2s var(--ease);
  text-decoration: none;
}
.mobile-header-logout:hover { color: var(--red); border-color: rgba(239,68,68,.25); }

/* ============================================================
   MOBILE SIDEBAR  (slide-out)
   ============================================================ */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
z-index: 299;
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.mobile-sidebar-overlay.open {
  display: block;
  opacity: 1;
}

.mobile-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  height: 100vh;
  background: #111111;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-right: 1px solid var(--border);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform .35s var(--ease);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.mobile-sidebar.open {
  transform: translateX(0);
}

.mobile-sidebar-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text2);
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.mobile-sidebar-close:hover { background: var(--s3); color: var(--text); }

.mobile-sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

/* Re-use sidebar-nav and sidebar-link styles inside mobile-sidebar */
.mobile-sidebar .sidebar-nav { padding: 12px; }
.mobile-sidebar .sidebar-link { font-size: .88rem; }

/* ============================================================
   BOTTOM NAVIGATION  (mobile)
   ============================================================ */
.tg-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-h);
  background: #111111;
-webkit-
border-top: 1px solid var(--border);
  z-index: 200;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* --- Nav Item (pip indicator style) --- */
.ni {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 8px 6px;
  border-radius: var(--r3);
  color: var(--text3);
  text-decoration: none;
  font-size: .65rem;
  font-weight: 500;
  transition: color .2s var(--ease);
  min-width: 52px;
  cursor: pointer;
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
.ni:hover { color: var(--text2); }

.ni.on {
  color: var(--primary);
}

.ni-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.ni-label {
  white-space: nowrap;
  letter-spacing: .01em;
  font-size: .62rem;
}

.ni-pip {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: var(--primary);
  margin-top: 1px;
  opacity: 0;
  transition: all .25s var(--ease);
}

.ni.on .ni-pip {
  width: 18px;
  opacity: 1;
}

/* Keep old class names working for backward compat */
.tg-bottom-nav-item { /* alias */ }
.tg-bottom-nav-icon { font-size: 1.2rem; line-height: 1; }
.tg-bottom-nav-label { white-space: nowrap; letter-spacing: .01em; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  padding: 24px;
  animation: fadeUp .45s var(--ease) both;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}

.card:hover {
  border-color: var(--border2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

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

.card-header h2,
.card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  animation: fadeUp .35s var(--ease) both;
}

.page-header h1 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  padding: 20px;
  animation: fadeUp .45s var(--ease) both;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}

.stat-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: .06s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .18s; }
.stat-card:nth-child(5) { animation-delay: .24s; }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stat-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 4px;
}

/* ============================================================
   DATA TABLES
   ============================================================ */
.table-wrap,
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--s1);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table thead th {
  background: var(--s2);
  color: var(--text2);
  font-weight: 600;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.data-table tbody tr {
  transition: background .18s var(--ease);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover {
  background: var(--s2);
}

.data-table tbody td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr.low-stock {
  background: var(--am-soft);
}
.data-table tbody tr.low-stock:hover {
  background: rgba(245,158,11,0.18);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-child { margin-bottom: 0; }

label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .04em;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--text3);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--p-soft);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: .5;
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238899B4'%3E%3Cpath d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option {
  background: var(--bg2);
  color: var(--text);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--r3);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .22s var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.3;
}

.btn:active { transform: scale(.97); }

/* Primary — gradient teal */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: var(--bg);
  box-shadow: 0 4px 18px var(--p-glow);
}
.btn-primary:hover {
  box-shadow: 0 6px 26px var(--p-glow);
  filter: brightness(1.08);
  color: var(--bg);
}

/* Secondary — glass */
.btn-secondary {
  background: var(--s2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--s3);
  border-color: var(--border2);
}

/* Outline */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-outline:hover {
  background: var(--s1);
  color: var(--text);
  border-color: var(--primary);
}

/* Danger */
.btn-danger {
  background: var(--re-soft);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover {
  background: rgba(239,68,68,.2);
  border-color: rgba(239,68,68,.35);
}

/* Small */
.btn-sm {
  padding: 7px 14px;
  font-size: .8rem;
  border-radius: 8px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-primary {
  background: var(--p-soft);
  color: var(--primary);
}

.badge-success {
  background: var(--gr-soft);
  color: var(--green);
}

.badge-danger {
  background: var(--re-soft);
  color: var(--red);
}

.badge-warning {
  background: var(--am-soft);
  color: var(--amber);
}

.badge-info {
  background: var(--bl-soft);
  color: var(--blue);
}

.badge-purple {
  background: rgba(139,92,246,0.12);
  color: var(--purple);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 14px 18px;
  border-radius: var(--r3);
  font-size: .88rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  animation: fadeUp .35s var(--ease) both;
  border: 1px solid;
}

.alert-success {
  background: var(--gr-soft);
  border-color: rgba(34,197,94,.2);
  color: var(--green);
}

.alert-danger {
  background: var(--re-soft);
  border-color: rgba(239,68,68,.2);
  color: var(--red);
}

.alert-warning {
  background: var(--am-soft);
  border-color: rgba(245,158,11,.2);
  color: var(--amber);
}

.alert-info {
  background: var(--bl-soft);
  border-color: rgba(59,130,246,.2);
  color: var(--blue);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  padding: 14px 20px;
  border-radius: var(--r3);
  font-size: .88rem;
  font-weight: 500;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
  animation: toastIn .4s var(--ease) both;
}

.toast.hide {
  animation: toastOut .35s var(--ease) both;
}

.toast-success {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,.25);
  color: var(--green);
}

.toast-error {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,.25);
  color: var(--red);
}

.toast-warning {
  background: rgba(245,158,11,0.15);
  border-color: rgba(245,158,11,.25);
  color: var(--amber);
}

.toast-info {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,.25);
  color: var(--blue);
}

/* ============================================================
   SEARCH INPUT
   ============================================================ */
.search-input,
input[type="search"] {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 18px 10px 40px;
  color: var(--text);
  font-size: .88rem;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%234A5E78' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}

.search-input:focus,
input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--p-soft);
  background-color: var(--bg2);
}

/* ============================================================
   HTMX LOADING / SPINNER
   ============================================================ */
.htmx-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
  display: flex;
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--s3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* centered full-area spinner */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,10,18,0.6);
border-radius: inherit;
  z-index: 10;
}

/* ============================================================
   BACK LINK
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text2);
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: color .2s var(--ease);
}
.back-link:hover { color: var(--primary); }

/* ============================================================
   LOW STOCK LIST
   ============================================================ */
.low-stock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.low-stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--am-soft);
  border: 1px solid rgba(245,158,11,.15);
  border-radius: var(--r3);
  font-size: .85rem;
  color: var(--amber);
}

/* ============================================================
   ADMIN SECTION
   ============================================================ */
.admin-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.admin-section h2,
.admin-section h3 {
  color: var(--text);
  font-weight: 700;
  margin-bottom: 16px;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text3); }
.text-accent { color: var(--primary); }
.text-danger { color: var(--red); }
.fw-600      { font-weight: 600; }
.nowrap      { white-space: nowrap; }

.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.mt-3  { margin-top: 24px; }
.mb-1  { margin-bottom: 8px; }
.mb-2  { margin-bottom: 16px; }
.mb-3  { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.flex        { display: flex; }
.flex-wrap   { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE — Mobile (<=768px)
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .tg-bottom-nav {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: calc(var(--header-h) + 16px);
    padding-bottom: calc(var(--bottom-h) + 16px);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .page-header .btn {
    width: 100%;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .card {
    padding: 16px;
    border-radius: var(--r2);
  }

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

  .form-actions {
    flex-direction: column;
  }
  .form-actions .btn {
    width: 100%;
  }

  .data-table {
    font-size: .82rem;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: 10px 12px;
  }

  .toast-container {
    top: calc(var(--header-h) + 8px);
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: auto;
    max-width: none;
    width: 100%;
  }
}

/* Extra small — phones < 480px */
@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 12px;
    padding-top: calc(var(--header-h) + 12px);
    padding-bottom: calc(var(--bottom-h) + 12px);
  }
}

/* Large screens */
@media (min-width: 1400px) {
  .main-content {
    padding: 40px 56px 56px;
  }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .mobile-header, .tg-bottom-nav,
  .mobile-sidebar, .mobile-sidebar-overlay,
  .toast-container { display: none !important; }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: none;
    backdrop-filter: none;
  }
}



/* ===== FILTER CHIPS ===== */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 20px;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover {
  background: var(--p-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.chip.active {
  background: linear-gradient(135deg, #4DD9D0, #38BCD8);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(56, 188, 216, 0.3);
}

@media (max-width: 768px) {
  .filter-chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .filter-chips::-webkit-scrollbar { display: none; }
  .chip { font-size: 12px; padding: 6px 12px; }
}

/* ===== GF LOGO STYLES ===== */
.sidebar-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4DD9D0, #38BCD8);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 16px;
    border-radius: 10px;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(56, 188, 216, 0.35);
}

.gf-logo-big {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #4DD9D0, #38BCD8);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 30px;
    border-radius: 18px;
    letter-spacing: -1px;
    margin: 0 auto 16px;
    box-shadow: 0 6px 24px rgba(56, 188, 216, 0.4);
}

.mobile-gf-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4DD9D0, #38BCD8);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 13px;
    border-radius: 8px;
    letter-spacing: -0.5px;
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: 0 2px 12px rgba(56, 188, 216, 0.5);
}

/* ===== LOGIN PAGE ===== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg, #060A12);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 48px 36px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-logo {
    text-align: center;
    margin-bottom: 8px;
}

.login-logo-text {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.login-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: #4DD9D0;
    box-shadow: 0 0 0 3px rgba(77, 217, 208, 0.15);
}

.login-form input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4DD9D0, #38BCD8);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(56, 188, 216, 0.35);
}

.btn-login:active {
    transform: translateY(0);
}

.login-card .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px;
        border-radius: 16px;
    }
    .gf-logo-big {
        width: 60px;
        height: 60px;
        font-size: 26px;
    }
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  /* backgrounds — solid light */
  --bg:      #F5F5F4;
  --bg2:     #EBEBEA;
  --bg3:     #E0E0DE;

  /* surfaces — solid */
  --s1:      #FFFFFF;
  --s2:      #F8F8F7;
  --s3:      #F0F0EE;

  /* borders — solid */
  --border:  #E5E5E3;
  --border2: #D4D4D2;

  /* primary stays same */
  --primary:  #00B8AE;
  --primary2: #009990;
  --p-glow:   rgba(0,184,174,0.2);
  --p-soft:   rgba(0,184,174,0.1);

  /* accent palette (slightly adjusted for light bg) */
  --purple:   #7C3AED;
  --green:    #16A34A;
  --gr-soft:  rgba(22,163,74,0.1);
  --amber:    #D97706;
  --am-soft:  rgba(217,119,6,0.1);
  --red:      #DC2626;
  --re-soft:  rgba(220,38,38,0.1);
  --blue:     #2563EB;
  --bl-soft:  rgba(37,99,235,0.1);

  /* text */
  --text:   #1E293B;
  --text2:  #64748B;
  --text3:  #94A3B8;
}

/* Light theme overrides for glass surfaces */
[data-theme="light"] body {
  background: var(--bg);
}

[data-theme="light"] .sidebar {
  background: #FFFFFF;
  border-right: 1px solid #E5E5E3;
}

[data-theme="light"] .sidebar-link:hover,
[data-theme="light"] .sidebar-link.active {
  background: rgba(0,184,174,0.1);
}

[data-theme="light"] .sidebar-user-avatar {
  background: linear-gradient(135deg, #4DD9D0, #38BCD8);
  color: #fff;
}

[data-theme="light"] .card,
[data-theme="light"] .login-card {
  background: #FFFFFF;
  border: 1px solid #E5E5E3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

[data-theme="light"] .mobile-header {
  background: #FFFFFF;
  border-bottom: 1px solid #E5E5E3;
}

[data-theme="light"] .mobile-sidebar {
  background: #FFFFFF;
}

[data-theme="light"] .tg-bottom-nav {
  background: #FFFFFF;
  border-top: 1px solid #E5E5E3;
}

[data-theme="light"] .ni.on {
  color: var(--primary);
}

[data-theme="light"] .tg-bottom-nav-item.active {
  color: var(--primary);
}

[data-theme="light"] table th {
  background: rgba(0,0,0,0.03);
  color: var(--text2);
}

[data-theme="light"] table td {
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

[data-theme="light"] table tr:hover td {
  background: rgba(0,184,174,0.04);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.12);
  color: var(--text);
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,184,174,0.12);
}

[data-theme="light"] input::placeholder {
  color: var(--text3);
}

[data-theme="light"] .login-form input[type="text"],
[data-theme="light"] .login-form input[type="password"] {
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.1);
  color: var(--text);
}

[data-theme="light"] .login-body {
  background: var(--bg);
}

[data-theme="light"] .mobile-hamburger span {
  background: var(--text);
}

[data-theme="light"] .mobile-hamburger {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.1);
}

[data-theme="light"] .badge {
  border: 1px solid rgba(0,0,0,0.06);
}

[data-theme="light"] .chip {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.1);
  color: var(--text2);
}

[data-theme="light"] .chip.active,
[data-theme="light"] .chip:hover {
  background: rgba(0,184,174,0.1);
  border-color: var(--primary);
  color: var(--primary);
}

[data-theme="light"] .stat-card {
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.06);
}

[data-theme="light"] .toast {
  background: rgba(255,255,255,0.95);
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
}

.theme-toggle-label {
  font-size: 12px;
  color: var(--text3);
}

.theme-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--s3);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.3s var(--ease);
  flex-shrink: 0;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  padding: 0;
  appearance: none;
}

.theme-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s var(--ease);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  pointer-events: none;
}

.theme-switch.active {
  background: linear-gradient(135deg, #4DD9D0, #38BCD8);
}

.theme-switch.active::after {
  transform: translateX(20px);
}

.theme-toggle-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-icon {
  font-size: 16px;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.theme-icon.active-icon {
  opacity: 1;
}


/* ============================================================
   v2.0 ADDITIONS — Pagination, Sorting, Stock Bars, Theme Transition
   ============================================================ */

/* ===== SMOOTH THEME TRANSITION ===== */
html,
html *,
html *::before,
html *::after {
  transition: background-color 0.35s cubic-bezier(.4,0,.2,1),
              border-color 0.35s cubic-bezier(.4,0,.2,1),
              color 0.25s cubic-bezier(.4,0,.2,1),
              box-shadow 0.35s cubic-bezier(.4,0,.2,1);
}
/* Exclude elements where transition causes visual glitches */
.spinner, .htmx-indicator, .toast, .theme-switch::after,
input, select, textarea {
  transition: none !important;
}
/* Re-enable input focus transition */
input:focus, select:focus, textarea:focus {
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text2);
  background: var(--s1);
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: all .2s var(--ease);
}

.pagination-btn:hover {
  background: var(--s2);
  border-color: var(--border2);
  color: var(--text);
}

.pagination-active {
  background: linear-gradient(135deg, var(--primary), var(--primary2)) !important;
  color: var(--bg) !important;
  border-color: transparent !important;
  font-weight: 700;
  box-shadow: 0 2px 10px var(--p-glow);
  cursor: default;
}

.pagination-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  color: var(--text3);
  font-size: .85rem;
}

/* ===== TABLE SORTING ===== */
.sortable-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sortable-table th.sortable:hover {
  color: var(--primary);
  background: var(--s3);
}

.sort-icon {
  font-size: .7rem;
  opacity: .6;
  margin-left: 2px;
}

th.sorted-asc .sort-icon,
th.sorted-desc .sort-icon {
  opacity: 1;
  color: var(--primary);
}

/* Clickable table rows */
.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table tbody tr.clickable:hover {
  background: var(--p-soft);
}

/* ===== LOW STOCK ROW HIGHLIGHTING ===== */
.data-table tbody tr.low-stock {
  background: var(--re-soft);
}
.data-table tbody tr.low-stock:hover {
  background: rgba(239,68,68,0.15);
}

/* ===== STOCK BARS (article detail) ===== */
.stock-bars {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stock-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stock-bar-label {
  width: 100px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text2);
  text-align: right;
  flex-shrink: 0;
}

.stock-bar-track {
  flex: 1;
  height: 28px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.stock-bar-fill {
  height: 100%;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  min-width: 32px;
  transition: width .6s var(--ease);
}

.stock-bar-value {
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

.stock-bar-new {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 0 10px var(--p-glow);
}

.stock-bar-used {
  background: linear-gradient(135deg, var(--blue), #2563EB);
  box-shadow: 0 0 10px var(--bl-soft);
}

.stock-bar-min {
  background: linear-gradient(135deg, var(--amber), #D97706);
  box-shadow: 0 0 10px var(--am-soft);
}

/* ===== STOCK DISPLAY CARDS ===== */
.stock-display {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stock-card {
  flex: 1;
  min-width: 140px;
  padding: 20px;
  border-radius: var(--r2);
  text-align: center;
  border: 1px solid var(--border);
  background: var(--s1);
  backdrop-filter: blur(var(--blur));
}

.stock-card-ok {
  border-color: rgba(0,212,200,.2);
  background: var(--p-soft);
}

.stock-card-zero {
  border-color: rgba(239,68,68,.2);
  background: var(--re-soft);
}

.stock-card-neutral {
  border-color: var(--border);
}

.stock-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.stock-label {
  display: block;
  font-size: .8rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 4px;
}

/* ===== DETAIL GRID ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.detail-value {
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
}

/* ===== TG KEYBOARD / INLINE BUTTONS ===== */
.tg-keyboard {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tg-inline-btn {
  padding: 10px 18px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  color: var(--text2);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
  font-family: inherit;
}

.tg-inline-btn:hover {
  background: var(--s2);
  border-color: var(--border2);
  color: var(--text);
}

.tg-inline-btn.active {
  background: var(--p-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* ===== TG MESSAGES (mobile timeline) ===== */
.timeline {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tg-message {
  padding: 12px 16px;
  border-radius: var(--r3);
  background: var(--s1);
  border: 1px solid var(--border);
}

.tg-message-in {
  border-left: 3px solid var(--green);
}

.tg-message-out {
  border-left: 3px solid var(--red);
}

.tg-message-body {
  font-size: .88rem;
  color: var(--text);
}

.tg-message-meta {
  font-size: .75rem;
  color: var(--text3);
  margin-top: 4px;
}

.tg-message-comment {
  font-size: .8rem;
  color: var(--text2);
  margin-top: 4px;
  font-style: italic;
}

/* Desktop / Mobile visibility */
.desktop-only { display: block; }
.mobile-only { display: none; }

@media (max-width: 768px) {
  .desktop-only { display: none; }
  .mobile-only { display: block; }
}

/* ===== MOBILE REFRESH HINT ===== */
.mobile-refresh-hint {
  display: none;
  margin-bottom: 12px;
}

.refresh-btn {
  width: 100%;
  text-align: center;
}

@media (max-width: 768px) {
  .mobile-refresh-hint {
    display: block;
  }
  .pagination {
    gap: 2px;
    padding: 12px 8px;
  }
  .pagination-btn {
    min-width: 32px;
    height: 32px;
    font-size: .78rem;
    padding: 0 6px;
  }
  .stock-bars {
    padding: 12px;
  }
  .stock-bar-label {
    width: 70px;
    font-size: .75rem;
  }
  .stock-bar-track {
    height: 24px;
  }
}

/* ===== HTMX GLOBAL INDICATOR (fix) ===== */
#globalIndicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  display: none;
  background: transparent;
  padding: 0;
}

#globalIndicator .spinner {
  width: 100%;
  height: 3px;
  border: none;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: htmxProgress 1.2s ease-in-out infinite;
}

@keyframes htmxProgress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

#globalIndicator.active {
  display: block;
}


/* ============================================================
   DB VIEWER (EXCEL STYLE) — полная перезапись
   ============================================================ */

/* --- Page header --- */
.db-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

/* --- Tab bar (Excel-like) --- */
.db-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.db-tabs::-webkit-scrollbar { display: none; }

.db-tab {
  padding: 10px 20px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}
.db-tab:hover { background: var(--s2); color: var(--text); }
.db-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- Panels --- */
.db-panel { display: none; }
.db-panel.active { display: block; }

/* --- Record count badge --- */
.db-count {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: var(--text2);
  padding: 6px 14px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin-bottom: 16px;
  font-weight: 500;
}

/* --- Table wrapper --- */
.db-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  max-height: 70vh;
  overflow-y: auto;
  margin-bottom: 24px;
  background: var(--bg2);
}

/* --- Table --- */
.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

.db-table th {
  position: sticky;
  top: 0;
  background: var(--bg3);
  color: var(--text);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border2);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  z-index: 10;
}
.db-table th:last-child { border-right: none; }

.db-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-table td:last-child { border-right: none; }

.db-table tr:nth-child(even) { background: var(--s1); }
.db-table tr:hover td { background: var(--p-soft); transition: background 0.15s; }

.db-table .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.db-table .cell-id { color: var(--text3); font-size: 11px; text-align: center; width: 40px; }
.db-table .nowrap { white-space: nowrap; }

/* --- Operations toolbar --- */
.db-ops-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.db-ops-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}
.db-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.date-sep { color: var(--text3); font-size: 13px; }

/* --- Date inputs --- */
.db-date-input {
  padding: 7px 12px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  max-width: 155px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.db-date-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--p-soft);
}

/* --- Column header colors (4 operation types) --- */
.col-prihod { background: rgba(34,197,94,0.13) !important; color: #22c55e !important; }
.col-rashod { background: rgba(239,68,68,0.13) !important; color: #ef4444 !important; }
.col-prihod-bu { background: rgba(59,130,246,0.13) !important; color: #3b82f6 !important; }
.col-rashod-bu { background: rgba(249,115,22,0.13) !important; color: #f97316 !important; }
.col-stock { background: rgba(139,92,246,0.10) !important; }
.col-num { text-align: right !important; }
.col-id { width: 40px; text-align: center !important; }

/* --- Cell value highlights --- */
.cell-prihod { color: #22c55e !important; font-weight: 700; }
.cell-rashod { color: #ef4444 !important; font-weight: 700; }
.cell-prihod-bu { color: #3b82f6 !important; font-weight: 700; }
.cell-rashod-bu { color: #f97316 !important; font-weight: 700; }
.cell-stock { font-weight: 600; }

.empty-cell {
  text-align: center !important;
  padding: 3rem 1rem !important;
  color: var(--text3);
  font-size: 14px;
}

/* --- Section subheaders inside panels --- */
.db-panel h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.db-panel h3:first-of-type { margin-top: 0; }

/* ============================================================
   DB VIEWER — LIGHT THEME
   ============================================================ */
[data-theme="light"] .db-tab { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.10); }
[data-theme="light"] .db-tab:hover { background: rgba(0,0,0,0.06); }
[data-theme="light"] .db-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
[data-theme="light"] .db-table th { background: #E8ECF1; }
[data-theme="light"] .db-table tr:nth-child(even) { background: rgba(0,0,0,0.018); }
[data-theme="light"] .db-table tr:hover td { background: rgba(0,184,174,0.06); }
[data-theme="light"] .db-table td { border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .db-table-wrap { border-color: rgba(0,0,0,0.10); background: #fff; }
[data-theme="light"] .db-count { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .db-date-input {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
  color: var(--text);
}
[data-theme="light"] .col-prihod { background: rgba(34,197,94,0.08) !important; color: #16a34a !important; }
[data-theme="light"] .col-rashod { background: rgba(239,68,68,0.08) !important; color: #dc2626 !important; }
[data-theme="light"] .col-prihod-bu { background: rgba(59,130,246,0.08) !important; color: #2563eb !important; }
[data-theme="light"] .col-rashod-bu { background: rgba(249,115,22,0.08) !important; color: #ea580c !important; }
[data-theme="light"] .col-stock { background: rgba(139,92,246,0.06) !important; }
[data-theme="light"] .cell-prihod { color: #16a34a !important; }
[data-theme="light"] .cell-rashod { color: #dc2626 !important; }
[data-theme="light"] .cell-prihod-bu { color: #2563eb !important; }
[data-theme="light"] .cell-rashod-bu { color: #ea580c !important; }
[data-theme="light"] .db-panel h3 { border-color: rgba(0,0,0,0.08); }

/* ============================================================
   DB VIEWER — MOBILE (768px)
   ============================================================ */
@media (max-width: 768px) {
  .db-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .db-header h1 { font-size: 1.25rem; }
  .db-header .btn { width: 100%; text-align: center; }

  .db-tabs {
    gap: 3px;
    margin-bottom: 14px;
    padding-bottom: 2px;
  }
  .db-tab {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px 8px 0 0;
  }

  .db-count {
    font-size: 12px;
    padding: 5px 10px;
    margin-bottom: 10px;
  }

  .db-table-wrap {
    border-radius: var(--r3);
    max-height: 60vh;
    margin-bottom: 16px;
  }

  .db-table {
    font-size: 11px;
  }
  .db-table th {
    padding: 7px 8px;
    font-size: 9px;
    letter-spacing: 0.2px;
  }
  .db-table td {
    padding: 6px 8px;
  }
  .db-table .cell-id { width: 30px; font-size: 10px; }

  .db-ops-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }
  .db-ops-filters {
    margin-left: 0;
    justify-content: flex-start;
    gap: 6px;
  }
  .db-date-range {
    width: 100%;
    gap: 4px;
  }
  .db-date-input {
    flex: 1;
    max-width: none;
    font-size: 12px;
    padding: 6px 8px;
  }

  .db-panel h3 {
    font-size: 0.88rem;
    margin: 16px 0 8px;
    padding-bottom: 6px;
  }
}

/* ============================================================
   DB VIEWER — EXTRA SMALL (480px)
   ============================================================ */
@media (max-width: 480px) {
  .db-header { margin-bottom: 12px; }
  .db-header h1 { font-size: 1.1rem; }

  .db-tabs { gap: 2px; margin-bottom: 10px; }
  .db-tab { padding: 7px 10px; font-size: 11px; }

  .db-table { font-size: 10px; }
  .db-table th { padding: 5px 6px; font-size: 8.5px; }
  .db-table td { padding: 4px 6px; }

  .db-count { font-size: 11px; padding: 4px 8px; }

  .db-table-wrap { max-height: 55vh; margin-bottom: 12px; }
}

/* ============================================================
   COLOR THEMES — Neon/Cyberpunk Palette (10 options)
   ============================================================ */


/* --- Warm Mono (#938A87 — Octet-inspired) --- */
[data-color="warm-mono"] {
  --primary: #938A87; --primary2: #7A726F;
  --p-glow: rgba(147,138,135,0.25); --p-soft: rgba(147,138,135,0.12);
}
[data-color="warm-mono"][data-theme="light"] {
  --primary: #7A726F; --primary2: #605E5E;
  --p-glow: rgba(122,114,111,0.2); --p-soft: rgba(122,114,111,0.1);
}

/* --- Neon Purple (#EA00D9) --- */
[data-color="neon-purple"] {
  --primary: #EA00D9; --primary2: #BD00AE;
  --p-glow: rgba(234,0,217,0.25); --p-soft: rgba(234,0,217,0.12);
}
[data-color="neon-purple"][data-theme="light"] {
  --primary: #C800B8; --primary2: #A00094;
  --p-glow: rgba(200,0,184,0.2); --p-soft: rgba(200,0,184,0.1);
}

/* --- Electric Blue (#0066FF) --- */
[data-color="electric-blue"] {
  --primary: #0066FF; --primary2: #0052CC;
  --p-glow: rgba(0,102,255,0.25); --p-soft: rgba(0,102,255,0.12);
}
[data-color="electric-blue"][data-theme="light"] {
  --primary: #0052CC; --primary2: #003D99;
  --p-glow: rgba(0,82,204,0.2); --p-soft: rgba(0,82,204,0.1);
}

/* --- Hot Pink / Magenta (#FF2D78) --- */
[data-color="hot-pink"] {
  --primary: #FF2D78; --primary2: #E0195F;
  --p-glow: rgba(255,45,120,0.25); --p-soft: rgba(255,45,120,0.12);
}
[data-color="hot-pink"][data-theme="light"] {
  --primary: #E0195F; --primary2: #B8104C;
  --p-glow: rgba(224,25,95,0.2); --p-soft: rgba(224,25,95,0.1);
}

/* --- Acid Green (#00FF9F) --- */
[data-color="acid-green"] {
  --primary: #00FF9F; --primary2: #00CC7F;
  --p-glow: rgba(0,255,159,0.25); --p-soft: rgba(0,255,159,0.12);
}
[data-color="acid-green"][data-theme="light"] {
  --primary: #00B872; --primary2: #009E62;
  --p-glow: rgba(0,184,114,0.2); --p-soft: rgba(0,184,114,0.1);
}

/* --- Solar Orange (#FF6B2B) --- */
[data-color="solar-orange"] {
  --primary: #FF6B2B; --primary2: #E55A1B;
  --p-glow: rgba(255,107,43,0.25); --p-soft: rgba(255,107,43,0.12);
}
[data-color="solar-orange"][data-theme="light"] {
  --primary: #E55A1B; --primary2: #CC4A10;
  --p-glow: rgba(229,90,27,0.2); --p-soft: rgba(229,90,27,0.1);
}

/* --- Ice Blue (#18E0FF) --- */
[data-color="ice-blue"] {
  --primary: #18E0FF; --primary2: #00B8D4;
  --p-glow: rgba(24,224,255,0.25); --p-soft: rgba(24,224,255,0.12);
}
[data-color="ice-blue"][data-theme="light"] {
  --primary: #00ACC1; --primary2: #0097A7;
  --p-glow: rgba(0,172,193,0.2); --p-soft: rgba(0,172,193,0.1);
}

/* --- Ruby (#DC2626) --- */
[data-color="ruby"] {
  --primary: #EF4444; --primary2: #DC2626;
  --p-glow: rgba(239,68,68,0.25); --p-soft: rgba(239,68,68,0.12);
}
[data-color="ruby"][data-theme="light"] {
  --primary: #DC2626; --primary2: #B91C1C;
  --p-glow: rgba(220,38,38,0.2); --p-soft: rgba(220,38,38,0.1);
}

/* --- Gold (#FFB800) --- */
[data-color="gold"] {
  --primary: #FFB800; --primary2: #E5A600;
  --p-glow: rgba(255,184,0,0.25); --p-soft: rgba(255,184,0,0.12);
}
[data-color="gold"][data-theme="light"] {
  --primary: #D4990A; --primary2: #B8860B;
  --p-glow: rgba(212,153,10,0.2); --p-soft: rgba(212,153,10,0.1);
}

/* --- Lavender (#A78BFA) --- */
[data-color="lavender"] {
  --primary: #A78BFA; --primary2: #8B5CF6;
  --p-glow: rgba(167,139,250,0.25); --p-soft: rgba(167,139,250,0.12);
}
[data-color="lavender"][data-theme="light"] {
  --primary: #7C3AED; --primary2: #6D28D9;
  --p-glow: rgba(124,58,237,0.2); --p-soft: rgba(124,58,237,0.1);
}


/* ============================================================
   MORE PAGE — Navigation + Settings
   ============================================================ */

.more-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 0 0;
}

.more-section {
  margin-bottom: 28px;
}

.more-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text3);
  margin-bottom: 12px;
  padding-left: 4px;
}

/* Nav grid */
.more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.more-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s var(--ease);
}
.more-card:hover {
  background: var(--s2);
  border-color: var(--border2);
  transform: translateY(-1px);
  color: var(--text);
}

.more-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.more-card-text {
  min-width: 0;
}

.more-card-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more-card-desc {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Settings card */
.settings-card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }

.settings-row-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.settings-row-icon {
  font-size: 18px;
}

/* Mode toggle segmented control */
.settings-mode-toggle {
  display: flex;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.smt-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.smt-btn:hover { color: var(--text2); }
.smt-btn.active {
  background: var(--p-soft);
  color: var(--primary);
}
.smt-btn svg { flex-shrink: 0; }

/* Color palette swatches — premium round design */
.settings-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 18px 8px;
  justify-content: flex-start;
}

.sp-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease);
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sp-swatch:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.sp-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text);
}

.sp-check {
  display: none;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.sp-swatch.active .sp-check { display: block; }

/* Swatch colors — gradients */
.sp-cyan         { background: linear-gradient(135deg, #00D4C8, #00A8A0); }
.sp-warm-mono    { background: linear-gradient(135deg, #938A87, #605E5E); }
.sp-neon-purple  { background: linear-gradient(135deg, #EA00D9, #BD00AE); }
.sp-electric-blue{ background: linear-gradient(135deg, #0066FF, #0052CC); }
.sp-hot-pink     { background: linear-gradient(135deg, #FF2D78, #E0195F); }
.sp-acid-green   { background: linear-gradient(135deg, #00FF9F, #00CC7F); }
.sp-solar-orange { background: linear-gradient(135deg, #FF6B2B, #E55A1B); }
.sp-ice-blue     { background: linear-gradient(135deg, #18E0FF, #00B8D4); }
.sp-ruby         { background: linear-gradient(135deg, #EF4444, #DC2626); }
.sp-gold         { background: linear-gradient(135deg, #FFB800, #E5A600); }
.sp-lavender     { background: linear-gradient(135deg, #A78BFA, #8B5CF6); }

/* Preview bar */
.settings-preview {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}

.sp-preview-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
  margin-bottom: 10px;
}

.sp-preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--s2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.sp-preview-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--p-glow);
  flex-shrink: 0;
}

.sp-preview-line {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--p-soft));
}

.sp-preview-badge {
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--p-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Profile section */
.profile-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.profile-details {
  min-width: 0;
}

.profile-name {
  font-size: 15px;
  font-weight: 700;
}

.profile-role {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.more-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--red);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.more-logout-btn:hover {
  background: var(--re-soft);
  color: var(--red);
}

/* Mobile responsive for more page */
@media (max-width: 480px) {
  .more-grid { gap: 8px; }
  .more-card { padding: 12px 12px; gap: 10px; }
  .more-card-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
  .more-card-name { font-size: 12px; }
  .more-card-desc { font-size: 10px; }
  .sp-swatch { width: 38px; height: 38px; }
  .settings-palette { gap: 8px; padding: 14px 14px 6px; }
}
