/* =====================================================================
   Sarasota Networks — Inventory Portal Stylesheet
   Dark professional theme — sidebar layout
   ===================================================================== */

/* --- Variables -------------------------------------------------------- */
:root {
  --bg:           #0f1117;
  --sidebar:      #13161f;
  --surface:      #1a1d27;
  --surface-2:    #1f2335;
  --border:       #252840;
  --border-lt:    #2e3250;

  --text:         #e2e5f0;
  --text-muted:   #8b8fa8;
  --text-subtle:  #4e5270;

  --blue:         #185FA5;
  --blue-lt:      #378ADD;
  --blue-dim:     rgba(55, 138, 221, 0.12);

  --teal:         #1D9E75;
  --teal-lt:      #25c490;
  --teal-dim:     rgba(29, 158, 117, 0.12);

  --red:          #c94444;
  --red-lt:       #e05252;
  --red-dim:      rgba(224, 82, 82, 0.12);

  --amber:        #d4882a;
  --amber-lt:     #f0a535;
  --amber-dim:    rgba(212, 136, 42, 0.13);

  --radius:       8px;
  --radius-sm:    4px;
  --radius-lg:    14px;
  --shadow:       0 2px 12px rgba(0, 0, 0, .45);
  --shadow-lg:    0 8px 40px rgba(0, 0, 0, .65);

  --topbar-h:     60px;
  --sidebar-w:    234px;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
}

/* --- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--blue-lt); text-decoration: none; }
a:hover { color: var(--text); }
button, input, select, textarea { font-family: var(--font); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-lt); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }


/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-lg);
  padding: 48px 44px 44px;
  box-shadow: var(--shadow-lg);
}

.login-brand { text-align: center; margin-bottom: 40px; }

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.25px;
}

.login-tagline {
  margin-top: 7px;
  font-size: .78rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.login-heading {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.access-denied {
  text-align: center;
  padding: 24px 0 12px;
}
.access-denied .ad-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--red-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--red-lt);
}
.access-denied h2 { font-size: 1.05rem; margin-bottom: 8px; }
.access-denied p  { font-size: .875rem; color: var(--text-muted); }


/* =====================================================================
   APP TOPBAR
   ===================================================================== */
.app-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 200;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px; height: 34px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
  transition: background .2s;
}

.hamburger:hover span { background: var(--text); }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  letter-spacing: -.2px;
  text-decoration: none;
}

.topbar-brand:hover { color: var(--text); }

.topbar-spacer { flex: 1; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  font-size: .83rem;
  color: var(--text-muted);
}

.topbar-clock {
  font-size: .78rem;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  padding-right: 4px;
}

.topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .79rem;
  color: var(--text-muted);
  padding: 5px 12px;
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  transition: color .2s, border-color .2s;
  text-decoration: none;
}

.topbar-logout:hover { color: var(--text); border-color: var(--text-muted); }


/* =====================================================================
   APP SIDEBAR
   ===================================================================== */
.app-sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 20px 0 24px;
}

.sidebar-section-label {
  font-size: .67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-subtle);
  padding: 10px 18px 6px;
  margin-top: 4px;
}

.sidebar-section-label:first-child { margin-top: 0; padding-top: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: .855rem;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.nav-link svg { flex-shrink: 0; opacity: .65; transition: opacity .15s; }
.nav-link:hover { background: var(--blue-dim); color: var(--text); border-left-color: transparent; }
.nav-link:hover svg { opacity: 1; }
.nav-link.active { color: var(--blue-lt); background: var(--blue-dim); border-left-color: var(--blue-lt); }
.nav-link.active svg { opacity: 1; }

.nav-link-indent {
  padding-left: 40px;
  font-size: .82rem;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}


/* =====================================================================
   MAIN WRAP & CONTENT
   ===================================================================== */
.page-shell {
  padding-top: var(--topbar-h);
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.main-content {
  padding: 36px 32px;
  max-width: 1240px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 90;
}


/* =====================================================================
   PAGE HEADER
   ===================================================================== */
.page-header {
  margin-bottom: 32px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-subtle); }
.breadcrumb .current { color: var(--text); }

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.35px;
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 5px;
  font-size: .9rem;
  color: var(--text-muted);
}

.page-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.section-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-subtle);
  margin-bottom: 14px;
}


/* =====================================================================
   STAT CARDS
   ===================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}

.stat-label {
  font-size: .73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1;
}

.stat-value.blue   { color: var(--blue-lt); }
.stat-value.amber  { color: var(--amber-lt); }
.stat-value.teal   { color: var(--teal-lt); }
.stat-value.muted  { color: var(--text-muted); font-size: 1.1rem; font-weight: 600; }

.stat-sub {
  margin-top: 4px;
  font-size: .78rem;
  color: var(--text-subtle);
}


/* =====================================================================
   CARDS & GRID
   ===================================================================== */
.cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

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

.card-title {
  font-size: .95rem;
  font-weight: 600;
}


/* =====================================================================
   TABLE
   ===================================================================== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

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

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .65px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--sidebar);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }

tbody td {
  padding: 12px 14px;
  vertical-align: middle;
}

.td-name   { font-weight: 500; }
.td-sub    { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.td-muted  { color: var(--text-muted); font-size: .82rem; }
.td-right  { text-align: right; }

/* Inline actions */
.td-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}


/* =====================================================================
   BADGES
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-admin      { background: var(--blue-dim);   color: var(--blue-lt);   }
.badge-technician { background: var(--blue-dim);   color: #7ec8f5;          }
.badge-readonly   { background: var(--border);     color: var(--text-muted);}
.badge-active     { background: var(--teal-dim);   color: var(--teal-lt);   }
.badge-inactive   { background: var(--red-dim);    color: var(--red-lt);    }
.badge-category   { background: var(--surface-2);  color: var(--text-muted);}
.badge-low        { background: var(--amber-dim);  color: var(--amber-lt);  }


/* =====================================================================
   QUANTITY PILLS & CONTROLS
   ===================================================================== */
.qty-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.qty-pill.low {
  background: var(--amber-dim);
  border-color: rgba(212, 136, 42, 0.3);
  color: var(--amber-lt);
}

.qty-pill .loc-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}

/* Per-location qty table on item detail */
.qty-table { width: 100%; border-collapse: collapse; }

.qty-table tr { border-bottom: 1px solid var(--border); }
.qty-table tr:last-child { border-bottom: none; }

.qty-table td { padding: 11px 14px; vertical-align: middle; font-size: .875rem; }

.qty-loc-name { font-weight: 500; }
.qty-subloc   { font-size: .82rem; color: var(--text-muted); margin-top: 1px; }

.qty-num {
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
  display: inline-block;
}

.qty-num.low { color: var(--amber-lt); }

.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-lt);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}

.qty-btn:hover { border-color: var(--blue-lt); color: var(--blue-lt); background: var(--blue-dim); }
.qty-btn.minus:hover { border-color: var(--red-lt); color: var(--red-lt); background: var(--red-dim); }

.qty-total-row td { font-weight: 600; border-top: 2px solid var(--border); }


/* =====================================================================
   AUDIT LOG FEED
   ===================================================================== */
.audit-feed { list-style: none; }

.audit-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: .855rem;
}

.audit-item:last-child { border-bottom: none; }

.audit-icon {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.audit-icon.increase { background: var(--teal-dim); color: var(--teal-lt); }
.audit-icon.decrease { background: var(--red-dim);  color: var(--red-lt);  }

.audit-body { flex: 1; min-width: 0; }

.audit-main {
  color: var(--text);
  line-height: 1.4;
}

.audit-main strong { color: var(--text); font-weight: 600; }
.audit-main .qty-change.increase { color: var(--teal-lt); font-weight: 600; }
.audit-main .qty-change.decrease { color: var(--red-lt);  font-weight: 600; }

.audit-comment {
  margin-top: 3px;
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
}

.audit-meta {
  margin-top: 3px;
  font-size: .78rem;
  color: var(--text-subtle);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Compact table version for admin audit log */
.audit-log-table td { vertical-align: top; }
.audit-change.increase { color: var(--teal-lt); font-weight: 600; }
.audit-change.decrease { color: var(--red-lt);  font-weight: 600; }


/* =====================================================================
   QR CODE CARD
   ===================================================================== */
.qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.qr-canvas-wrap {
  background: #fff;
  border-radius: var(--radius);
  padding: 10px;
  display: inline-block;
}

.qr-canvas-wrap canvas { display: block; }

.qr-id {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
}

/* Print label styles */
@media print {
  .no-print { display: none !important; }

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

  .page-shell,
  .main-content { margin: 0 !important; padding: 0 !important; }

  .print-label {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    font-family: sans-serif;
  }

  .print-label .pl-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
  }

  .print-label .pl-sku {
    font-size: 13px;
    color: #555;
    margin-bottom: 12px;
  }

  .qr-canvas-wrap {
    background: #fff;
    padding: 0;
  }

  .print-label .pl-id {
    margin-top: 8px;
    font-size: 11px;
    color: #999;
  }

  /* Hide everything except the print target */
  body > *:not(.print-target) { display: none !important; }
}


/* =====================================================================
   SEARCH BAR
   ===================================================================== */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
}

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

.search-input {
  width: 100%;
  padding: 9px 13px 9px 38px;
  background: var(--surface);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--blue-lt);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

.search-input::placeholder { color: var(--text-subtle); }


/* =====================================================================
   FILTERS ROW
   ===================================================================== */
.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}


/* =====================================================================
   ITEM DETAIL: HEADER BLOCK
   ===================================================================== */
.item-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.item-head-info { flex: 1; min-width: 0; }

.item-name {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.2;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: .85rem;
  color: var(--text-muted);
}

.item-meta-sep { color: var(--text-subtle); }

.item-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.item-image {
  width: 100%;
  max-width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.item-image-placeholder {
  width: 100px; height: 80px;
  border: 1px dashed var(--border-lt);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  flex-shrink: 0;
}


/* =====================================================================
   DETAIL GRID (2-col layout for item page)
   ===================================================================== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.detail-right { display: flex; flex-direction: column; gap: 20px; }

.detail-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-subtle);
  margin-bottom: 2px;
}

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

.detail-row {
  display: flex;
  gap: 24px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }
.detail-row .detail-label { min-width: 130px; }


/* =====================================================================
   FORMS
   ===================================================================== */
.form-group  { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-label .req { color: var(--red-lt); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--blue-lt);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b8fa8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.form-input::placeholder { color: var(--text-subtle); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint  { font-size: .78rem; color: var(--text-subtle); margin-top: 5px; }

.form-divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

.form-section-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-subtle);
  margin-bottom: 14px;
}

/* Image upload */
.upload-zone {
  border: 2px dashed var(--border-lt);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s;
}

.upload-zone:hover { border-color: var(--blue-lt); }

.upload-zone input[type="file"] {
  display: none;
}

.upload-zone-text { font-size: .875rem; color: var(--text-muted); }
.upload-zone-sub  { font-size: .78rem; color: var(--text-subtle); margin-top: 4px; }

/* Location rows (dynamic, for item form) */
.loc-rows { display: flex; flex-direction: column; gap: 10px; }

.loc-row {
  display: grid;
  grid-template-columns: 1fr 1fr 120px auto;
  gap: 10px;
  align-items: center;
}

.loc-row-remove {
  width: 32px; height: 32px;
  background: none;
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-sm);
  color: var(--text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
  flex-shrink: 0;
}

.loc-row-remove:hover { color: var(--red-lt); border-color: var(--red-lt); background: var(--red-dim); }

/* Inline current image on edit */
.current-image {
  max-height: 80px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}


/* =====================================================================
   PAGINATION
   ===================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-info { font-size: .82rem; color: var(--text-muted); }

.pagination-links {
  display: flex;
  gap: 4px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px; height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-sm);
  font-size: .83rem;
  color: var(--text-muted);
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}

.page-link:hover { background: var(--blue-dim); border-color: var(--blue-lt); color: var(--blue-lt); }
.page-link.active { background: var(--blue); border-color: var(--blue); color: #fff; pointer-events: none; }
.page-link.disabled { opacity: .35; pointer-events: none; }


/* =====================================================================
   ALERT / FLASH
   ===================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.alert-error   { background: var(--red-dim);   border-color: var(--red-lt);  color: #f4a3a3; }
.alert-success { background: var(--teal-dim);  border-color: var(--teal-lt); color: #7eecc9; }
.alert-warning { background: var(--amber-dim); border-color: var(--amber);   color: #f7cc82; }

/* Toast notification (JS-injected, position fixed) */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: toastIn .2s ease;
  max-width: 340px;
}

.toast-success { background: var(--teal);  color: #fff; }
.toast-error   { background: var(--red);   color: #fff; }

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


/* =====================================================================
   MODALS
   ===================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .16s ease;
}

.modal-sm { max-width: 360px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1);   }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: .975rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  line-height: 1;
  transition: color .15s, background .15s;
}

.modal-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.modal-body   { padding: 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--border);
}


/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary   { background: var(--blue);  color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-lt); border-color: var(--blue-lt); color: #fff; }

.btn-secondary { background: transparent; color: var(--text-muted); border-color: var(--border-lt); }
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

.btn-danger    { background: transparent; color: var(--red-lt); border-color: var(--red-dim); }
.btn-danger:hover { background: var(--red-dim); border-color: var(--red-lt); }

.btn-ghost     { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.05); }

.btn-sm   { padding: 5px 12px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled, .btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }


/* =====================================================================
   MISC
   ===================================================================== */
.divider    { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.text-muted { color: var(--text-muted) !important; }
.mt-16      { margin-top: 16px; }
.mt-24      { margin-top: 24px; }
.mb-20      { margin-bottom: 20px; }
.gap-8      { gap: 8px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--text-muted);
}
.empty-state svg  { opacity: .3; margin-bottom: 12px; }
.empty-state p    { font-size: .9rem; }


/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1024px) {
  .stat-grid    { grid-template-columns: repeat(2, 1fr); }
  .detail-grid  { grid-template-columns: 1fr; }
  .detail-right { display: grid; grid-template-columns: 1fr 1fr; }
}

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

@media (max-width: 768px) {
  .hamburger { display: flex; }

  .app-sidebar {
    left: calc(-1 * var(--sidebar-w));
    transition: left .25s ease;
    z-index: 150;
  }

  body.sidebar-open .app-sidebar { left: 0; }
  body.sidebar-open .sidebar-overlay { display: block; }

  .page-shell { margin-left: 0; }

  .main-content { padding: 24px 16px; }

  .topbar-user { display: none; }

  .loc-row { grid-template-columns: 1fr 1fr 80px 32px; }

  .page-toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap  { max-width: 100%; }

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

  .detail-right { grid-template-columns: 1fr; }

  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }
}

@media (max-width: 540px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .item-head  { flex-direction: column; }
  .item-image, .item-image-placeholder { display: none; }
  .loc-row { grid-template-columns: 1fr 80px 32px; }
}

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