/* ── RESET & BASE ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: 'Segoe UI', system-ui, Arial, sans-serif; font-size: 14px; color: #1e293b; background: #0f172a; }
.hidden { display: none !important; }
a { text-decoration: none; color: inherit; }

/* ── LOGIN ─────────────────────────────────────────────────────────────── */
body.login-body { overflow: auto; background: #0f172a; }
.login-bg { display: flex; min-height: 100vh; }
.login-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 60%, #1e3a5f 100%);
  padding: 60px 40px; position: relative; overflow: hidden;
}
.login-left::before {
  content: '⬡'; position: absolute; font-size: 600px; color: rgba(37,99,235,0.04);
  top: -100px; left: -100px; line-height: 1; pointer-events: none;
}
.login-brand-block { max-width: 420px; position: relative; z-index: 1; }
.login-brand-icon { font-size: 52px; color: #3b82f6; margin-bottom: 16px; }
.login-brand-name { font-size: 36px; font-weight: 800; color: #f1f5f9; letter-spacing: -1px; margin-bottom: 12px; }
.login-brand-desc { font-size: 15px; color: #64748b; line-height: 1.7; margin-bottom: 28px; }
.login-modules { display: flex; flex-wrap: wrap; gap: 8px; }
.login-module-chip {
  padding: 5px 12px; border: 1px solid #1e3a5f; border-radius: 20px;
  color: #94a3b8; font-size: 12px; background: rgba(37,99,235,0.06);
}
.login-right {
  width: 440px; flex-shrink: 0; background: #f8fafc;
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.login-card { width: 100%; max-width: 380px; }
.login-card-icon { font-size: 36px; color: #2563eb; margin-bottom: 8px; }
.login-card-title { font-size: 24px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.login-card-sub { font-size: 13px; color: #64748b; margin-bottom: 28px; }
.login-form .form-group { margin-bottom: 14px; }
.login-error {
  background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}
.login-hint { text-align: center; color: #94a3b8; font-size: 12px; margin-top: 20px; }
@media (max-width: 700px) {
  .login-left { display: none; }
  .login-right { width: 100%; }
}

/* ── APP SHELL ─────────────────────────────────────────────────────────── */
#app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ───────────────────────────────────────────────────────────── */
#sidebar {
  width: 224px; flex-shrink: 0;
  background: #0f172a;
  display: flex; flex-direction: column;
  border-right: 1px solid #1e293b;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px; border-bottom: 1px solid #1e293b;
}
.brand-icon { font-size: 26px; color: #3b82f6; flex-shrink: 0; }
.brand-name { font-size: 14px; font-weight: 700; color: #f1f5f9; letter-spacing: -0.3px; }
.brand-sub { font-size: 10px; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label {
  font-size: 10px; font-weight: 700; color: #334155;
  letter-spacing: 1px; padding: 8px 10px 4px; margin-top: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 7px;
  color: #64748b; font-size: 13px; cursor: pointer;
  transition: all 0.12s; border: none; background: none; width: 100%;
  text-align: left;
}
.nav-item:hover { background: #1e293b; color: #cbd5e1; }
.nav-item.active { background: #1d4ed8; color: #fff; font-weight: 600; }
.nav-icon { font-size: 15px; opacity: 0.85; }
.sidebar-footer { padding: 14px; border-top: 1px solid #1e293b; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.user-role { font-size: 11px; color: #475569; }
.btn-logout {
  display: block; width: 100%; padding: 8px; text-align: center;
  background: #1e293b; color: #64748b; border-radius: 6px; font-size: 12px;
  transition: all 0.12s; border: none; cursor: pointer;
}
.btn-logout:hover { background: #dc2626; color: #fff; }

/* ── MAIN CONTENT ──────────────────────────────────────────────────────── */
#main-content {
  flex: 1; overflow-y: auto; background: #f1f5f9;
  padding: 28px 32px; min-width: 0;
}
.flash-msg {
  background: #fef9c3; border: 1px solid #fde047; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 16px; font-size: 13px; color: #713f12;
}

/* ── PAGE HEADER ───────────────────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 700; color: #1e293b; letter-spacing: -0.4px; }
.page-sub { font-size: 13px; color: #64748b; margin-top: 3px; }
.page-header-meta { font-size: 12px; color: #94a3b8; align-self: flex-end; }

/* ── STAT GRID ─────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #f1f5f9;
}
.stat-card-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-card-value { font-size: 24px; font-weight: 700; color: #1e293b; line-height: 1.1; }
.stat-card-label { font-size: 11px; color: #64748b; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ── DASHBOARD BOTTOM ──────────────────────────────────────────────────── */
.dash-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.quick-links { display: flex; flex-direction: column; gap: 10px; }
.quick-link-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; border: 1px solid #f1f5f9; transition: all 0.12s; }
.quick-link-item:hover { background: #f8fafc; border-color: #e2e8f0; }
.quick-link-item strong { font-size: 13px; color: #1e293b; display: block; }
.quick-link-item p { font-size: 12px; color: #64748b; margin-top: 2px; }
.ql-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.log-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px; flex-wrap: wrap; }
.log-row:last-child { border-bottom: none; }
.log-summary { flex: 1; color: #475569; min-width: 80px; }
.log-meta { color: #94a3b8; font-size: 11px; }

/* ── CARDS ─────────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #f1f5f9; }
.card-title { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 14px; }

/* ── SUBTABS ───────────────────────────────────────────────────────────── */
.subtab-bar { display: flex; gap: 2px; border-bottom: 2px solid #e2e8f0; margin-bottom: 18px; }
.subtab {
  padding: 9px 18px; background: none; border: none; cursor: pointer;
  font-size: 13px; color: #64748b; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.12s; border-radius: 6px 6px 0 0;
}
.subtab:hover { color: #1e293b; background: #f8fafc; }
.subtab.active { color: #1d4ed8; font-weight: 600; border-bottom-color: #1d4ed8; }
.network-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.network-tab {
  padding: 7px 16px; background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 20px; cursor: pointer; font-size: 13px; color: #64748b; transition: all 0.12s;
}
.network-tab.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.tab-panel { display: block; }
.tab-panel.hidden { display: none; }

/* ── TOOLBAR ───────────────────────────────────────────────────────────── */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.search-input {
  padding: 7px 12px; border: 1px solid #e2e8f0; border-radius: 7px;
  font-size: 13px; background: #fff; width: 240px; max-width: 100%;
}
.search-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.count-label { font-size: 12px; color: #94a3b8; }

/* ── BULK BAR ──────────────────────────────────────────────────────────── */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 8px 14px; margin-bottom: 10px; font-size: 13px; color: #1d4ed8;
}

/* ── TABLE ─────────────────────────────────────────────────────────────── */
.h-scroll-proxy { overflow-x: auto; overflow-y: hidden; height: 14px; margin-bottom: 4px; background: transparent; }
.h-scroll-proxy::-webkit-scrollbar { height: 10px; }
.h-scroll-proxy::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 6px; }
.h-scroll-proxy::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; }
.h-scroll-proxy::-webkit-scrollbar-thumb:hover { background: #64748b; }
.h-scroll-proxy > div { height: 1px; }
.table-wrap { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); overflow-x: auto; border: 1px solid #f1f5f9; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f8fafc; color: #475569; font-weight: 600; padding: 10px 13px; border-bottom: 2px solid #e2e8f0; white-space: nowrap; text-align: center; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
td { padding: 9px 13px; border-bottom: 1px solid #f8fafc; vertical-align: middle; white-space: nowrap; text-align: center; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
.cb-col { width: 36px; text-align: center; padding: 0 8px; }
.cb-header { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; }
.selected-row { background: #eff6ff !important; }

/* ── PAGINATION ────────────────────────────────────────────────────────── */
/* ── Unified pagination-bar (asset tracker & legacy) ── */
.pagination-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 14px; gap: 8px; flex-wrap: wrap;
  background: #fff; border-top: 2px solid #e2e8f0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  font-size: 12px; min-height: 42px;
}
.pagination-info { color: #64748b; white-space: nowrap; font-weight: 500; }
.pagination-controls { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.pagination-size-label { color: #64748b; display: flex; align-items: center; gap: 5px; }
.pagination-size-select {
  padding: 4px 6px; border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: 12px; background: #f8fafc; color: #1e293b;
  width: 72px; cursor: pointer;
}
.pagination-nav { display: flex; align-items: center; gap: 4px; }
.pagination-nav .btn { padding: 4px 9px !important; font-size: 13px !important; min-width: 30px; border-radius: 6px !important; }
.pagination-page { font-size: 12px; color: #475569; padding: 0 8px; font-weight: 500; }

/* ── BADGES ────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.badge-green    { background: #dcfce7; color: #166534; }
.badge-blue     { background: #dbeafe; color: #1e40af; }
.badge-purple   { background: #ede9fe; color: #5b21b6; }
.badge-yellow   { background: #fef9c3; color: #854d0e; }
.badge-red      { background: #fee2e2; color: #991b1b; }
.badge-orange   { background: #ffedd5; color: #9a3412; }
.badge-slate    { background: #f1f5f9; color: #475569; }
/* status-specific */
.badge-DEPLOYED, .badge-ACTIVE, .badge-open       { background: #dcfce7; color: #166534; }
.badge-BUFFER                                       { background: #dbeafe; color: #1e40af; }
.badge-RETURNED                                     { background: #fef9c3; color: #854d0e; }
.badge-DISPOSED, .badge-INACTIVE, .badge-closed    { background: #fee2e2; color: #991b1b; }
.badge-FOR-PURCHASE, .badge-FOR-TRANSFER           { background: #ede9fe; color: #5b21b6; }
.badge-FOR-REPAIR, .badge-FOR-TERMINATION          { background: #ffedd5; color: #9a3412; }
.badge-admin    { background: #fef3c7; color: #92400e; }
.badge-user     { background: #e0f2fe; color: #075985; }
.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-hidden   { background: #fef3c7; color: #92400e; }
.badge-text     { background: #ede9fe; color: #5b21b6; }
.badge-dropdown { background: #dbeafe; color: #1e40af; }
.badge-date     { background: #dcfce7; color: #166534; }

/* ── FORMS ─────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 7px;
  font-size: 13px; color: #1e293b; background: #fff; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.error-msg { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 7px; padding: 8px 12px; font-size: 13px; }
.progress-msg { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 7px; padding: 8px 12px; font-size: 13px; }

/* ── BUTTONS ───────────────────────────────────────────────────────────── */
.btn { padding: 8px 16px; border: none; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.12s; display: inline-flex; align-items: center; gap: 5px; font-family: inherit; }
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: #f1f5f9; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── MODALS ────────────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,0.6); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); max-height: 90vh; display: flex; flex-direction: column; }
.modal-lg { max-width: 680px; }
.modal-xl { max-width: 860px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid #f1f5f9; flex-shrink: 0; }
.modal-title { font-size: 15px; font-weight: 600; color: #1e293b; }
.modal-subtitle { font-size: 13px; color: #64748b; margin-bottom: 10px; }
.modal-close { background: none; border: none; font-size: 18px; color: #94a3b8; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: #f1f5f9; color: #475569; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid #f1f5f9; display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* ── ATTACHMENTS ───────────────────────────────────────────────────────── */
.attach-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.attach-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; }
.attach-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid #e2e8f0; }
.attach-thumb-pdf { width: 54px; height: 54px; background: #fee2e2; display: flex; align-items: center; justify-content: center; font-size: 22px; border-radius: 6px; flex-shrink: 0; }
.attach-info { flex: 1; min-width: 0; }
.attach-label { font-size: 13px; font-weight: 600; color: #1e293b; }
.attach-fname { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-btn { background: none; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 13px; position: relative; transition: all 0.12s; }
.attach-btn.attach-has-files { border-color: #3b82f6; background: #eff6ff; }
.attach-count { background: #1d4ed8; color: #fff; border-radius: 10px; font-size: 10px; padding: 0 4px; margin-left: 3px; }
.attach-upload-section { border-top: 1px solid #f1f5f9; padding-top: 14px; }
.drop-zone {
  border: 2px dashed #cbd5e1; border-radius: 10px; padding: 28px; text-align: center;
  cursor: pointer; transition: all 0.15s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: #3b82f6; background: #eff6ff; }
.drop-zone-icon { font-size: 28px; margin-bottom: 6px; }
.drop-zone-text { font-size: 14px; font-weight: 500; color: #475569; }
.drop-zone-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.file-chosen { font-size: 12px; color: #475569; margin-top: 8px; line-height: 1.6; }

/* ── MANAGE FIELDS ─────────────────────────────────────────────────────── */
.option-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.option-row:last-child { border-bottom: none; }

/* ── GEAR / ROW ACTIONS ────────────────────────────────────────────────── */
.row-gear-btn { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 14px; transition: all 0.12s; }
.row-gear-btn:hover { background: #e2e8f0; }
.row-dropdown {
  position: absolute; right: 0; top: 100%; z-index: 20;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); min-width: 160px; padding: 5px;
  margin-top: 4px;
}
.row-dropdown button {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  background: none; border: none; cursor: pointer; font-size: 13px; color: #475569;
  border-radius: 6px; transition: all 0.1s;
}
.row-dropdown button:hover { background: #f8fafc; color: #1e293b; }
.row-dropdown button.danger:hover { background: #fee2e2; color: #b91c1c; }
.row-dropdown-divider { height: 1px; background: #f1f5f9; margin: 4px 0; }
.field-gear-btn { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 14px; transition: all 0.12s; }
.field-gear-btn:hover { background: #e2e8f0; }
.field-dropdown { position: absolute; right: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid #e2e8f0; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); min-width: 180px; padding: 5px; margin-top: 4px; }
.field-dropdown button { display: block; width: 100%; text-align: left; padding: 8px 12px; background: none; border: none; cursor: pointer; font-size: 13px; color: #475569; border-radius: 6px; transition: all 0.1s; }
.field-dropdown button:hover { background: #f8fafc; color: #1e293b; }
.field-dropdown button.danger:hover { background: #fee2e2; color: #b91c1c; }
.field-dropdown-divider { height: 1px; background: #f1f5f9; margin: 4px 0; }

/* ── REPORTS ───────────────────────────────────────────────────────────── */
.reports-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; height: calc(100vh - 180px); }
.reports-controls { align-self: start; position: sticky; top: 0; }
.reports-content { min-height: 300px; overflow-y: auto; height: 100%; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bar-chart-wrap { display: flex; flex-direction: column; gap: 8px; }
.stat-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stat-label { width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #475569; font-size: 12px; }
.stat-bar-wrap { flex: 1; background: #f1f5f9; border-radius: 4px; overflow: hidden; height: 16px; }
.stat-bar { height: 100%; border-radius: 4px; transition: width 0.4s; }
.stat-count { width: 30px; text-align: right; font-size: 12px; font-weight: 600; color: #1e293b; }
.export-btns { display: flex; gap: 8px; }

/* ── STORE STATUS: MATRIX ──────────────────────────────────────────────── */
.matrix-open   { background: #dcfce7; color: #166534; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.matrix-closed { background: #fee2e2; color: #991b1b; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }

/* ── IMPORT ────────────────────────────────────────────────────────────── */
.match-good td:first-child { border-left: 3px solid #22c55e; }
.match-none td:first-child { border-left: 3px solid #e2e8f0; }
.mapping-select { width: 100%; padding: 5px 8px; border: 1px solid #e2e8f0; border-radius: 5px; font-size: 12px; }

/* ── TOAST ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15); pointer-events: none;
  animation: fadeSlideIn 0.2s ease;
}
.toast.success { background: #1e293b; color: #fff; border-left: 4px solid #22c55e; }
.toast.error   { background: #1e293b; color: #fff; border-left: 4px solid #ef4444; }
.toast.loading { background: #1e293b; color: #fff; border-left: 4px solid #3b82f6; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── EMPTY STATE ───────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 32px; color: #94a3b8; font-size: 13px; }

/* ── DASHBOARD SECTION LABELS ──────────────────────────────────────────────── */
.dash-section-label {
  font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px; padding-left: 2px;
}

/* ── STORE STATUS FILTER CHIPS ─────────────────────────────────────────────── */
.status-summary-bar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px;
}
.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: 24px; cursor: pointer;
  border: 1.5px solid #e2e8f0; background: #fff;
  font-size: 13px; font-weight: 500; color: #475569;
  transition: all 0.12s; font-family: inherit;
}
.status-chip:hover { border-color: #cbd5e1; background: #f8fafc; }
.status-chip.active {
  background: #1e293b; color: #fff; border-color: #1e293b;
}
.status-chip.active .chip-dot { box-shadow: 0 0 0 2px rgba(255,255,255,0.4); }
.chip-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.chip-count {
  background: rgba(0,0,0,0.08); border-radius: 10px;
  padding: 1px 7px; font-size: 11px; font-weight: 700;
}
.status-chip.active .chip-count { background: rgba(255,255,255,0.2); }

/* ── STATUS-SPECIFIC BADGES ────────────────────────────────────────────────── */
.badge-OPEN-24H     { background: #dcfce7; color: #166534; }
.badge-OPEN-DAYTIME { background: #dbeafe; color: #1e40af; }
.badge-CLOSED-24H   { background: #ffedd5; color: #9a3412; }

/* ── MONTHLY MATRIX ────────────────────────────────────────────────────────── */
.matrix-legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #64748b; margin-bottom: 10px;
  padding: 8px 12px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 8px;
}
.matrix-outer {
  position: relative;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
}
.matrix-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 62vh;
  /* Scrollbar always visible at bottom */
  scrollbar-gutter: stable;
}
/* Styled scrollbars */
.matrix-scroll-wrap::-webkit-scrollbar        { height: 10px; width: 8px; }
.matrix-scroll-wrap::-webkit-scrollbar-track  { background: #f1f5f9; }
.matrix-scroll-wrap::-webkit-scrollbar-thumb  { background: #94a3b8; border-radius: 6px; }
.matrix-scroll-wrap::-webkit-scrollbar-thumb:hover { background: #64748b; }

.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  width: max-content;
  min-width: 100%;
}

/* Sticky header row */
.matrix-table thead th {
  position: sticky;
  top: 0;
  background: #1e293b;
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 9px 10px;
  border-bottom: 2px solid #334155;
  white-space: nowrap;
  z-index: 3;
}

/* Frozen: Store No column */
.matrix-freeze-col {
  position: sticky;
  background: #fff;
  z-index: 2;
  border-right: 1px solid #e2e8f0;
}
thead .matrix-freeze-col {
  background: #1e293b;
  z-index: 4;
  border-right: 1px solid #334155;
}
/* Store No */
.matrix-freeze-store-no {
  left: 0;
  min-width: 90px;
  width: 90px;
}
/* Store Name */
.matrix-freeze-store-name {
  left: 90px;
  min-width: 200px;
  width: 200px;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
thead .matrix-freeze-store-name {
  box-shadow: 2px 0 6px rgba(0,0,0,0.15);
  border-right: 2px solid #334155 !important;
}

/* Day columns */
.matrix-day-col {
  min-width: 72px;
  width: 72px;
  text-align: center;
  padding: 7px 4px;
  border-bottom: 1px solid #f8fafc;
  white-space: nowrap;
}
.matrix-table tbody tr:hover td { background: #f8fafc; }
.matrix-table tbody tr:hover .matrix-freeze-col { background: #f1f5f9; }

/* Body freeze cols */
.matrix-table tbody .matrix-freeze-col {
  padding: 7px 10px;
  border-bottom: 1px solid #f8fafc;
  white-space: nowrap;
}

/* Status pills inside matrix */
.matrix-open    { background:#dcfce7; color:#166534; font-size:10px; font-weight:700; padding:2px 7px; border-radius:4px; display:inline-block; }
.matrix-daytime { background:#dbeafe; color:#1e40af; font-size:10px; font-weight:700; padding:2px 7px; border-radius:4px; display:inline-block; }
.matrix-closed  { background:#fee2e2; color:#991b1b; font-size:10px; font-weight:700; padding:2px 7px; border-radius:4px; display:inline-block; }

/* ══════════════════════════════════════════════════════════════════
   ASSET MANAGEMENT MODULE (AMS) — additional styles
   ══════════════════════════════════════════════════════════════════ */

/* Stats bar */
.ams-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.ams-stats-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.ams-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  border-left: 4px solid #3b82f6;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.ams-stat-n {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: #1e293b;
}
.ams-stat-l {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

/* ── Inventory stats bar (compact horizontal) ───────────────────────────── */
.inv-stats-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 14px;
}
.inv-stats-label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  margin-right: 4px;
}
.inv-stats-divider {
  width: 1px;
  height: 32px;
  background: #e2e8f0;
  margin: 0 6px;
  flex-shrink: 0;
}
.inv-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 10%, white);
  border: 1px solid color-mix(in srgb, var(--c) 20%, white);
  min-width: 64px;
}
.inv-stat-pill .inv-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--c);
  line-height: 1.2;
}
.inv-stat-pill .inv-stat-lbl {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.inv-stat-device {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--c) 20%, white);
  min-width: 100px;
}
.inv-stat-icon { font-size: 18px; line-height: 1; }
.inv-stat-device .inv-stat-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--c);
  line-height: 1.2;
}
.inv-stat-device .inv-stat-lbl {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.inv-stat-sub {
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
  white-space: nowrap;
}

/* Badges */
.ams-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.ams-b-onhand    { background: #14532d22; color: #4ade80; }
.ams-b-deployed  { background: #1e40af22; color: #60a5fa; }
.ams-b-working   { background: #14532d22; color: #4ade80; }
.ams-b-defective { background: #7f1d1d22; color: #f87171; }
.ams-b-pending   { background: #78350f22; color: #fbbf24; }
.ams-b-testing   { background: #4c1d9522; color: #a78bfa; }
.ams-b-disposal  { background: #1e293b;   color: #64748b; }
.ams-b-buffer    { background: #78350f22; color: #fbbf24; }
.ams-b-instore   { background: #1e40af22; color: #60a5fa; }
.ams-b-newstore  { background: #14532d22; color: #4ade80; }
.ams-b-returned  { background: #7f1d1d22; color: #f87171; }

/* Log badge (count chip) */
.ams-log-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 600;
  background: #1e40af22;
  color: #60a5fa;
  border: 1px solid #1e40af55;
  cursor: pointer;
  margin-left: 3px;
}

/* Action icons */
.ams-aicon {
  cursor: pointer;
  color: #94a3b8;
  font-size: 13px;
  padding: 3px 5px;
  border-radius: 4px;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
}
.ams-aicon:hover { background: #334155; color: #e2e8f0; }
.ams-aicon.log:hover { color: #60a5fa; }
.ams-aicon.edit:hover { color: #4ade80; }
.ams-aicon.del:hover { color: #f87171; }

/* Selection bar (reuse bulk-bar style, already in system) */

/* Stepbar */
.ams-stepbar {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}
.ams-step {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}
.ams-step.active { color: #60a5fa; font-weight: 600; }
.ams-step.done   { color: #4ade80; }
.ams-stepnum {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.ams-step.active .ams-stepnum { border-color: #3b82f6; background: #3b82f6; color: #fff; }
.ams-step.done   .ams-stepnum { border-color: #22c55e; background: #22c55e; color: #fff; }
.ams-stepline {
  flex: 1;
  height: 1px;
  background: #334155;
  margin: 0 4px;
}

/* Drop zone */
.ams-dropzone {
  border: 2px dashed #334155;
  border-radius: 10px;
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  color: #94a3b8;
}
.ams-dropzone:hover, .ams-dropzone.drag { border-color: #3b82f6; background: rgba(59,130,246,.06); }
.ams-dropzone.ready { border-color: #22c55e; background: rgba(34,197,94,.05); }

/* Info / warn boxes */
.ams-infobox {
  background: rgba(59,130,246,.08);
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 12px;
  line-height: 1.5;
}
.ams-warnbox {
  background: rgba(251,191,36,.08);
  border-left: 3px solid #fbbf24;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* Column map grid */
.ams-col-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.ams-col-map-item {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
}
.ams-col-map-label {
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 3px;
}
.ams-col-map-item select {
  width: 100%;
  font-size: 11px;
}

/* Inline row edit inputs */
.ams-row-inp {
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #0f172a;
  color: #e2e8f0;
}

/* Activity log entries */
.ams-log-entry {
  display: flex;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid #1e293b;
}
.ams-log-entry:last-child { border-bottom: none; }
.ams-log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  margin-top: 4px;
  flex-shrink: 0;
}
.ams-log-dot.g { background: #22c55e; }
.ams-log-dot.r { background: #ef4444; }
.ams-log-dot.a { background: #f59e0b; }

/* Transmittal & Return Slip preview (white document on dark bg) */
.ams-doc-preview {
  background: #fff;
  color: #000;
  font-family: Arial, sans-serif;
  font-size: 9px;
  padding: 16px 18px;
  min-width: 640px;
  border-radius: 6px;
}

/* Mode buttons */
.ams-mode-btn.active {
  background: #3b82f6 !important;
  color: #fff !important;
  border-color: #3b82f6 !important;
}

/* filter-select reuse */
.filter-select {
  font-size: 12px;
  padding: 5px 9px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #1e293b;
  color: #e2e8f0;
}

@media (max-width: 640px) {
  .ams-stats { grid-template-columns: repeat(2, 1fr); }
  .ams-stats-row { grid-template-columns: repeat(4, 1fr); }
  .ams-col-map-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .ams-stats-row { grid-template-columns: repeat(4, 1fr); }
}

/* AMS Bulk Import */
.ams-import-step { display: none; }
.ams-import-step.active { display: block; }
.ams-map-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ams-map-table th { padding: 7px 10px; background: #f8fafc; border: 1px solid #e2e8f0;
  font-weight: 600; font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing:.04em; }
.ams-map-table td { padding: 7px 10px; border: 1px solid #e2e8f0; vertical-align: middle; color: #1e293b; }
.ams-map-table tr:nth-child(even) td { background: #f8fafc; }
.ams-map-select { width: 100%; padding: 4px 7px; border: 1px solid #cbd5e1;
  border-radius: 5px; font-size: 11px; background: #fff; color: #1e293b; }
.ams-map-select.mapped { border-color: #22c55e; background: #f0fdf4; }
.ams-import-preview-wrap { max-height: 320px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 6px; }
.ams-import-preview-wrap table { width: 100%; border-collapse: collapse; font-size: 11px; }
.ams-import-preview-wrap th { padding: 6px 9px; background: #1e40af; color: #fff;
  font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing:.04em; position: sticky; top: 0; }
.ams-import-preview-wrap td { padding: 5px 9px; border-bottom: 1px solid #f1f5f9; color: #1e293b; }
.ams-import-preview-wrap tr:hover td { background: #f8fafc; }
.ams-import-stepbar { display: flex; align-items: center; margin-bottom: 16px; }
.ams-import-step-item { display:flex; align-items:center; gap:5px; font-size:11px;
  color:#94a3b8; white-space:nowrap; }
.ams-import-step-item.active { color:#3b82f6; font-weight:600; }
.ams-import-step-item.done { color:#22c55e; }
.ams-import-step-num { width:20px; height:20px; border-radius:50%; border:1.5px solid #cbd5e1;
  display:flex; align-items:center; justify-content:center; font-size:9px; font-weight:700; }
.ams-import-step-item.active .ams-import-step-num { border-color:#3b82f6; background:#3b82f6; color:#fff; }
.ams-import-step-item.done .ams-import-step-num { border-color:#22c55e; background:#22c55e; color:#fff; }
.ams-import-step-line { flex:1; height:1px; background:#e2e8f0; margin: 0 5px; }
.ams-import-progress { background:#f0fdf4; border:1px solid #bbf7d0; border-radius:6px;
  padding:12px 16px; font-size:12px; color:#15803d; margin-top:8px; }
.ams-import-error { background:#fef2f2; border:1px solid #fecaca; border-radius:6px;
  padding:10px 14px; font-size:12px; color:#dc2626; margin-top:8px; }
.ams-drop-import { border:2px dashed #cbd5e1; border-radius:10px; padding:2rem 1rem;
  text-align:center; cursor:pointer; transition:border-color .2s, background .2s; background:#fafafa; }
.ams-drop-import:hover, .ams-drop-import.drag { border-color:#3b82f6; background:#eff6ff; }
.ams-drop-import.ready { border-color:#22c55e; background:#f0fdf4; }
.ams-field-tag { display:inline-block; padding:2px 7px; border-radius:4px; font-size:10px;
  font-weight:600; background:#dbeafe; color:#1d4ed8; margin-left:4px; }
.ams-field-tag.required { background:#fce7f3; color:#be185d; }

/* ── Unified Table Sticky Footer (scrollbar + pagination) ──────────────── */
.tbl-sticky-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border-top: 2px solid #e2e8f0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
}
.tbl-hscroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 18px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.tbl-hscroll > div { height: 1px; }
.tbl-hscroll::-webkit-scrollbar { height: 12px; }
.tbl-hscroll::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 6px; }
.tbl-hscroll::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; }
.tbl-hscroll::-webkit-scrollbar-thumb:hover { background: #475569; }

.tbl-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  gap: 8px;
  min-height: 42px;
}
.pag-info {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  font-weight: 500;
}
.pag-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.pag-size-select {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e293b;
  width: 72px;
  cursor: pointer;
}
.pag-btn {
  padding: 4px 9px !important;
  font-size: 13px !important;
  min-width: 30px;
  border-radius: 6px !important;
}
.pag-pages {
  display: flex;
  gap: 3px;
}
.pag-pages .btn {
  min-width: 30px;
  padding: 4px 7px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}
.pag-pages .btn.active,
.pag-pages .btn[style*="background:#3b82f6"] {
  background: #3b82f6 !important;
  color: #fff !important;
  border-color: #3b82f6 !important;
}
.pag-controls .btn.active {
  background: #3b82f6;
  color: #fff;
}
