/* ============================================================
   SIREKO — Sistem Perencanaan Kebutuhan Obat
   Main Stylesheet v1.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --primary:       #0A6EBD;
  --primary-dark:  #085A9E;
  --primary-light: #E8F4FD;
  --secondary:     #1A9E6B;
  --danger:        #DC3545;
  --danger-light:  #FFF0F0;
  --warning:       #F59E0B;
  --warning-light: #FFFBEB;
  --info:          #0DCAF0;
  --text-primary:  #1E2B3C;
  --text-secondary:#6B7A8E;
  --text-muted:    #A0AEC0;
  --border:        #E2E8F0;
  --bg-page:       #F0F4F8;
  --bg-card:       #FFFFFF;
  --sidebar-w:     260px;
  --sidebar-bg:    #0F1C2E;
  --sidebar-active:#0A6EBD;
  --topbar-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --font-main:     'Plus Jakarta Sans', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
  --transition:    0.2s ease;
}

/* ── Reset / Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Auth Layout ───────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0F1C2E 0%, #0A6EBD 60%, #1A9E6B 100%);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-card {
  background: var(--bg-card);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
  position: relative;
  z-index: 1;
  animation: slideUp 0.4s ease;
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo .logo-icon {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 24px rgba(10,110,189,.3);
}

.auth-logo .app-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.auth-logo .app-tagline {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ── Main Layout ───────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand .logo-box {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-text .name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-brand .brand-text .tagline {
  font-size: 0.65rem;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.sidebar-user .user-info .user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
}

.sidebar-user .user-info .user-role {
  font-size: 0.68rem;
  color: rgba(255,255,255,.4);
  text-transform: capitalize;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.3);
  padding: 0.75rem 1.25rem 0.35rem;
}

.nav-item {
  padding: 0 0.75rem;
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  line-height: 1.6;
}

.nav-link:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
}

.nav-link.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(10,110,189,.4);
}

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

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-footer .logout-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.45);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.sidebar-footer .logout-btn:hover {
  background: rgba(220,53,69,.15);
  color: #ff6b75;
}

/* ── Top Bar ───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}

.topbar-toggle:hover { background: var(--bg-page); }

.page-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* ── Main Content ──────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-area {
  padding: 1.5rem;
  flex: 1;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: transparent;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body { padding: 1.25rem; }

/* ── Stat Cards ────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.primary   { background: var(--primary-light); color: var(--primary); }
.stat-icon.danger    { background: var(--danger-light);  color: var(--danger); }
.stat-icon.success   { background: #E8F8F1; color: var(--secondary); }
.stat-icon.warning   { background: var(--warning-light); color: var(--warning); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ── Tables ────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius) var(--radius);
}

table.sireko-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

table.sireko-table thead tr th {
  background: #F7FAFC;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.sireko-table tbody tr td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

table.sireko-table tbody tr:hover td { background: #FAFCFF; }

/* ── Badges ────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-reorder  { background: #FFF0F0; color: var(--danger); }
.badge-reorder::before { background: var(--danger); animation: pulse 1.5s infinite; }

.badge-aman     { background: #E8F8F1; color: var(--secondary); }
.badge-aman::before { background: var(--secondary); }

.badge-pending  { background: var(--warning-light); color: #92710A; }
.badge-pending::before { background: var(--warning); animation: pulse 1.5s infinite; }

.badge-selesai  { background: #E8F8F1; color: var(--secondary); }
.badge-selesai::before { background: var(--secondary); }

/* ── Lead Time Badge ───────────────────────────────────── */
.lead-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.lead-fast     { background: #E8F8F1; color: #0F7A4D; }
.lead-normal   { background: #E8F4FD; color: #085A9E; }
.lead-slow     { background: #FFFBEB; color: #92710A; }
.lead-critical { background: #FFF0F0; color: #991B1B; }
.lead-pending  { background: #F5F3FF; color: #5B21B6; }

/* ── Stock Progress Bar ────────────────────────────────── */
.stock-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stock-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.stock-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.stock-bar-fill.safe     { background: var(--secondary); }
.stock-bar-fill.warning  { background: var(--warning); }
.stock-bar-fill.critical { background: var(--danger); }

.stock-bar-pct {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 34px;
  text-align: right;
  font-family: var(--font-mono);
}

/* ── Pagination ────────────────────────────────────────── */
.pagination-wrapper {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.page-item .page-link {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition);
  padding: 0;
}

.page-item .page-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.page-item.active .page-link {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(10,110,189,.35);
}

.page-item.disabled .page-link {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Filter Bar ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #FAFCFF;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Form Controls ─────────────────────────────────────── */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-family: var(--font-main);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  line-height: 1.5;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,110,189,.12);
}

.form-control-sm, .form-select-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-main);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.5;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(10,110,189,.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(10,110,189,.4);
  color: white;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--secondary);
  color: white;
  box-shadow: 0 2px 8px rgba(26,158,107,.3);
}
.btn-success:hover {
  background: #157A52;
  color: white;
  transform: translateY(-1px);
}

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b02a37; color: white; }

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-outline-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-outline-secondary:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid transparent;
  animation: slideDown 0.3s ease;
}

.alert-success { background: #ECFDF5; border-color: #86EFAC; color: #166534; }
.alert-danger  { background: var(--danger-light); border-color: #FCA5A5; color: #991B1B; }
.alert-warning { background: var(--warning-light); border-color: #FCD34D; color: #92400E; }
.alert-info    { background: var(--primary-light); border-color: #BAE6FD; color: #0C4A6E; }

/* ── Modal ─────────────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 1.5rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

/* ── Breadcrumbs ───────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0;
  background: none;
  list-style: none;
  flex-wrap: wrap;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--border);
  margin-right: 0.3rem;
}

.breadcrumb-item a { color: var(--text-secondary); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 600; }

/* ── Page Header ───────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 0.3rem;
  letter-spacing: -0.3px;
}

.page-header .sub { font-size: 0.85rem; color: var(--text-secondary); }

/* ── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state svg {
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state p { font-size: 0.9rem; margin: 0; }

/* ── Print Styles ──────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .filter-bar, .pagination-wrapper,
  .btn, .modal, .alert, .no-print { display: none !important; }

  .main-content { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
  body { background: white !important; font-size: 12px; }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #333;
  }

  table.sireko-table thead tr th { background: #f0f0f0 !important; }
}

.print-header { display: none; }

/* ── Animations ────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Overlay / Sidebar Mobile ──────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show { display: block; }

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

  .topbar-toggle { display: flex; }

  .stat-grid { grid-template-columns: 1fr 1fr; }

  .filter-bar { gap: 0.5rem; }

  .content-area { padding: 1rem; }
}

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

  .pagination-wrapper { flex-direction: column; align-items: flex-start; }

  .auth-card { padding: 2rem 1.5rem; }

  .topbar { padding: 0 1rem; }

  .card-header { gap: 0.5rem; }

  .content-area { padding: 0.75rem; }

  /* Fix filter bar wrapping on mobile */
  .filter-bar { flex-direction: column; align-items: stretch !important; }
  .filter-bar .filter-group { width: 100%; }
  .filter-bar .d-flex.gap-1 { flex-wrap: wrap; }
  .filter-bar .btn-sm { flex: 1; min-width: 70px; text-align: center; }
  .filter-bar .flex-grow-1 { max-width: 100% !important; }

  /* Page header stack on mobile */
  .page-header { flex-direction: column !important; align-items: flex-start !important; }
  .page-header .d-flex.gap-2 { width: 100%; }
  .page-header .btn { flex: 1; justify-content: center; }

  /* Stat cards compact on mobile */
  .stat-card { padding: 0.75rem 1rem; }
  .stat-value { font-size: 1.4rem; }
  .stat-icon { width: 40px; height: 40px; border-radius: 10px; }

  /* Table horizontal scroll hint */
  .table-wrapper { position: relative; }
  .table-wrapper::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 24px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,.8));
    pointer-events: none;
    border-radius: 0 0 var(--radius) 0;
  }

  /* Pagination compact */
  .pagination .page-link { padding: 0.3rem 0.55rem; font-size: .78rem; }

  /* Rencana kebutuhan modal */
  .rko-modal-dialog { margin: 0.5rem; }
}

/* ── Rencana Kebutuhan Obat (RKO) styles ─────────────────── */
.rko-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.7rem 1.25rem;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(10,110,189,.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 998;
  transition: all var(--transition);
}
.rko-fab:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(10,110,189,.5); }
.rko-fab .badge-count {
  background: var(--danger);
  color: white;
  border-radius: 20px;
  font-size: 0.72rem;
  padding: 0 7px;
  min-width: 20px;
  text-align: center;
}

/* Modal overlay */
.rko-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1050;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.rko-overlay.show { display: flex; }

.rko-modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.rko-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.rko-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.rko-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}
.rko-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

.rko-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.rko-item:last-child { border-bottom: none; }
.rko-item-info { flex: 1; min-width: 0; }
.rko-item-name { font-weight: 600; font-size: .88rem; margin-bottom: 0.2rem; }
.rko-item-meta { font-size: .75rem; color: var(--text-secondary); }
.rko-item-input { flex-shrink: 0; }
.rko-item-input input {
  width: 110px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: .88rem;
  font-family: var(--font-mono);
  text-align: right;
  transition: border-color var(--transition);
}
.rko-item-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,110,189,.1); }

/* Checkbox styling */
.rko-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Row checkbox in table */
.tr-reorder-check { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* ── Utilities ─────────────────────────────────────────── */
.text-primary-color { color: var(--primary) !important; }
.text-mono { font-family: var(--font-mono); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.gap-2 { gap: 0.5rem; }
.bg-primary-light { background: var(--primary-light); }
.border-primary { border-color: var(--primary) !important; }

.rotate-180 { transform: rotate(180deg); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ═══════════════════════════════════════════════════════════
   BUFFER STOCK — Professional UI v2
═══════════════════════════════════════════════════════════ */

/* ── Page Header ── */
.bs-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.bs-page-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.bs-page-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--primary-light), #dbeafe);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(10,110,189,.12);
}
.bs-page-icon svg { width: 22px; height: 22px; stroke: var(--primary); }
.bs-page-title { font-size: 1.35rem; font-weight: 800; margin: 0; color: var(--text-primary); }
.bs-page-sub   { font-size: .8rem; color: var(--text-secondary); margin: .15rem 0 0; }
.bs-page-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.btn-ghost-action {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  cursor: pointer; text-decoration: none;
  transition: all var(--transition);
}
.btn-ghost-action svg { width: 14px; height: 14px; }
.btn-ghost-action:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-solid-action {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 700;
  color: white;
  background: var(--primary);
  cursor: pointer; text-decoration: none;
  transition: all var(--transition);
}
.btn-solid-action svg { width: 14px; height: 14px; }
.btn-solid-action:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(10,110,189,.3); color: white; }

/* ── Stat Cards ── */
.bs-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 640px) {
  .bs-stats-row { grid-template-columns: 1fr; }
}

.bs-stat-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  position: relative;
  overflow: hidden;
}
.bs-stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.bs-stat-danger::before  { background: var(--danger); }
.bs-stat-success::before { background: var(--secondary); }
.bs-stat-primary::before { background: var(--primary); }

.bs-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.bs-stat-card.is-active { border-color: transparent; box-shadow: var(--shadow); }
.bs-stat-danger.is-active  { background: #FFF8F8; border-color: #FECACA; }
.bs-stat-success.is-active { background: #F0FDF4; border-color: #BBF7D0; }
.bs-stat-primary.is-active { background: var(--primary-light); border-color: rgba(10,110,189,.25); }

.bs-stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bs-stat-icon svg { width: 20px; height: 20px; }
.bs-stat-danger  .bs-stat-icon { background: #FEE2E2; }
.bs-stat-danger  .bs-stat-icon svg { stroke: var(--danger); }
.bs-stat-success .bs-stat-icon { background: #D1FAE5; }
.bs-stat-success .bs-stat-icon svg { stroke: var(--secondary); }
.bs-stat-primary .bs-stat-icon { background: var(--primary-light); }
.bs-stat-primary .bs-stat-icon svg { stroke: var(--primary); }

.bs-stat-body { flex: 1; min-width: 0; }
.bs-stat-value {
  font-size: 1.5rem; font-weight: 800;
  line-height: 1.1; letter-spacing: -0.5px;
  color: var(--text-primary);
}
.bs-stat-label { font-size: .75rem; color: var(--text-secondary); margin-top: .15rem; }
.bs-stat-badge { color: var(--border); }
.bs-stat-badge svg { width: 16px; height: 16px; }
.bs-stat-card:hover .bs-stat-badge, .bs-stat-card.is-active .bs-stat-badge { color: var(--text-secondary); }

/* ── Card override ── */
.bs-card { overflow: visible; }

/* ── Toolbar ── */
.bs-toolbar {
  display: flex; align-items: center;
  flex-wrap: wrap; gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.bs-filter-tabs {
  display: flex; gap: .35rem;
  flex-wrap: wrap;
}
.bs-tab {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: .8rem; font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.bs-tab:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.bs-tab.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.bs-tab-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bs-tab-dot.danger  { background: var(--danger); }
.bs-tab-dot.success { background: var(--secondary); }

.bs-tab-count {
  background: var(--danger);
  color: white;
  border-radius: 20px;
  font-size: .68rem;
  padding: .05rem .4rem;
  min-width: 18px;
  text-align: center;
}

.bs-search-form {
  display: flex; align-items: center; gap: .5rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.bs-search-wrap {
  position: relative;
  display: flex; align-items: center;
}
.bs-search-icon {
  position: absolute; left: .65rem;
  width: 14px; height: 14px;
  stroke: var(--text-muted);
  pointer-events: none;
}
.bs-search-input {
  padding: .42rem .65rem .42rem 2.1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  background: var(--bg-page);
  color: var(--text-primary);
  width: 220px;
  transition: border-color var(--transition), width var(--transition);
}
.bs-search-input:focus { outline: none; border-color: var(--primary); background: var(--bg-card); width: 260px; }
.bs-search-clear {
  position: absolute; right: .55rem;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
}
.bs-search-clear svg { width: 13px; height: 13px; }
.bs-search-clear:hover { color: var(--danger); }

.bs-btn-search {
  padding: .42rem .9rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.bs-btn-search:hover { background: var(--primary-dark); }

/* ── Reorder Action Bar ── */
.bs-reorder-bar {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: .5rem;
  padding: .7rem 1.25rem;
  background: #FFF8F0;
  border-bottom: 1.5px solid #FED7AA;
  font-size: .82rem;
  color: #92400E;
}
.bs-reorder-bar-left {
  display: flex; align-items: center; gap: .5rem;
}
.bs-reorder-bar-left svg { width: 15px; height: 15px; flex-shrink: 0; }

.bs-btn-selectall {
  padding: .32rem .85rem;
  background: white;
  border: 1.5px solid #FED7AA;
  border-radius: 50px;
  font-size: .78rem; font-weight: 700;
  color: #92400E;
  cursor: pointer;
  transition: all var(--transition);
}
.bs-btn-selectall:hover { background: #FFFBEB; border-color: #F59E0B; }

/* ── Custom Checkbox ── */
.bs-checkbox-wrap {
  display: inline-flex; align-items: center;
  cursor: pointer;
}
.bs-checkbox-wrap input[type="checkbox"] { display: none; }
.bs-checkbox-box {
  width: 17px; height: 17px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.bs-checkbox-wrap input:checked + .bs-checkbox-box {
  background: var(--primary);
  border-color: var(--primary);
}
.bs-checkbox-wrap input:checked + .bs-checkbox-box::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}
.bs-checkbox-wrap input:indeterminate + .bs-checkbox-box {
  background: var(--primary);
  border-color: var(--primary);
}
.bs-checkbox-wrap input:indeterminate + .bs-checkbox-box::after {
  content: '';
  width: 9px; height: 2px;
  background: white;
  display: block;
  margin: 0 auto;
}

/* ── Table overrides ── */
.bs-table .bs-th-check,
.bs-table .bs-td-check { width: 42px; padding: 0 .5rem; }
.bs-row-reorder { background: #FFFAF5 !important; }
.bs-row-reorder:hover { background: #FFF3E0 !important; }

/* ── FAB ── */
.rko-fab {
  position: fixed; bottom: 1.75rem; right: 1.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  padding: .8rem 1.5rem;
  font-size: .85rem; font-weight: 700;
  box-shadow: 0 4px 20px rgba(10,110,189,.4);
  cursor: pointer;
  display: flex; align-items: center; gap: .55rem;
  z-index: 998;
  transition: all var(--transition);
  animation: fabIn .3s ease;
}
@keyframes fabIn {
  from { opacity: 0; transform: translateY(16px) scale(.9); }
  to   { opacity: 1; transform: none; }
}
.rko-fab svg { width: 16px; height: 16px; }
.rko-fab:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(10,110,189,.5); }
.rko-fab .badge-count {
  background: var(--danger);
  color: white;
  border-radius: 20px;
  font-size: .72rem; font-weight: 700;
  padding: .05rem .5rem;
  min-width: 22px; text-align: center;
}

/* ── Modal Overlay ── */
.rko-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,28,46,.6);
  backdrop-filter: blur(4px);
  z-index: 1050;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.rko-overlay.show { display: flex; }

/* ── Modal ── */
.rko-modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,.2);
  width: 100%; max-width: 740px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  animation: modalIn .25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-12px); }
  to   { opacity: 1; transform: none; }
}

.rko-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.rko-modal-title { display: flex; align-items: center; gap: .85rem; }
.rko-modal-icon {
  width: 40px; height: 40px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rko-modal-icon svg { width: 18px; height: 18px; stroke: var(--primary); }
.rko-modal-title-text { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.rko-modal-title-sub  { font-size: .75rem; color: var(--text-secondary); margin-top: .1rem; }
.rko-modal-close {
  width: 32px; height: 32px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.rko-modal-close svg { width: 14px; height: 14px; stroke: var(--text-secondary); }
.rko-modal-close:hover { background: #FEE2E2; border-color: #FECACA; }
.rko-modal-close:hover svg { stroke: var(--danger); }

.rko-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto; flex: 1;
}

/* ── Info Grid (Form fields) ── */
.rko-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}
.rko-field-full { grid-column: span 2; }
@media (max-width: 560px) {
  .rko-info-grid { grid-template-columns: 1fr; }
  .rko-field-full { grid-column: 1; }
}

.rko-field-label {
  display: flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .4px;
  margin-bottom: .35rem;
}
.rko-field-label svg { width: 12px; height: 12px; flex-shrink: 0; }
.rko-field-label .req { color: var(--danger); font-size: .85em; }

.rko-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
  font-size: .85rem;
  color: var(--text-primary);
  background: var(--bg-card);
  font-family: var(--font-main);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.rko-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,110,189,.1); }

/* ── Section label ── */
.rko-section-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .72rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: .65rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.rko-item-count {
  background: var(--primary-light);
  color: var(--primary);
  font-size: .72rem; font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 20px;
}

/* ── RKO Item Row ── */
.rko-items-wrap { display: flex; flex-direction: column; gap: 0; }
.rko-item-row {
  display: flex; align-items: flex-start; gap: .85rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
  transition: opacity .22s, transform .22s;
}
.rko-item-row:last-child { border-bottom: none; }

.rko-item-seq {
  width: 24px; height: 24px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0; margin-top: 2px;
}

.rko-item-info { flex: 1; min-width: 0; }
.rko-item-name {
  font-weight: 700; font-size: .9rem;
  color: var(--text-primary);
  margin-bottom: .4rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rko-item-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.rko-chip {
  display: inline-flex;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .15rem .55rem;
  font-size: .72rem; color: var(--text-secondary);
  white-space: nowrap;
}
.chip-buf  { background: #FFF9E6; border-color: #FDE68A; color: #92400E; }
.chip-stok { background: #FEF2F2; border-color: #FECACA; color: var(--danger); font-weight: 700; }

.rko-item-qty { flex-shrink: 0; }
.rko-qty-label {
  font-size: .68rem; font-weight: 700;
  color: var(--text-secondary);
  text-align: right; display: block;
  margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .3px;
}
.rko-qty-wrap { display: flex; align-items: center; gap: .35rem; }
.rko-qty-input {
  width: 100px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .38rem .6rem;
  font-size: .88rem; font-weight: 700;
  font-family: var(--font-mono);
  text-align: right;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.rko-qty-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,110,189,.1); }
.rko-qty-unit { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }

.rko-item-remove {
  width: 28px; height: 28px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; margin-top: 2px;
  transition: all var(--transition);
  color: var(--text-muted);
}
.rko-item-remove svg { width: 13px; height: 13px; stroke: var(--text-muted); }
.rko-item-remove:hover { background: #FEF2F2; border-color: #FECACA; }
.rko-item-remove:hover svg { stroke: var(--danger); }

/* ── Modal Footer ── */
.rko-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: .65rem;
  justify-content: flex-end; flex-shrink: 0;
  background: var(--bg-page);
  border-radius: 0 0 var(--radius) var(--radius);
}
.rko-btn-cancel {
  padding: .55rem 1.1rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.rko-btn-cancel:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.rko-btn-save {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1.25rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 700;
  color: white; cursor: pointer;
  transition: all var(--transition);
}
.rko-btn-save svg { width: 14px; height: 14px; }
.rko-btn-save:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(10,110,189,.3); }
.rko-btn-save:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

.rko-btn-print {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1.1rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  transition: all var(--transition);
}
.rko-btn-print svg { width: 14px; height: 14px; }
.rko-btn-print:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── Toast ── */
.bs-toast-wrap {
  position: fixed; top: 1.25rem; right: 1.25rem;
  z-index: 2000;
  display: flex; flex-direction: column; gap: .5rem;
}
.bs-toast {
  padding: .75rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 600;
  box-shadow: var(--shadow);
  min-width: 260px; max-width: 360px;
  opacity: 0; transform: translateX(24px);
  transition: all .3s ease;
  border-left: 4px solid transparent;
}
.bs-toast.show { opacity: 1; transform: none; }
.bs-toast-success { background: #F0FDF4; border-left-color: var(--secondary); color: #166534; }
.bs-toast-warning { background: #FFFBEB; border-left-color: var(--warning); color: #92400E; }
.bs-toast-danger  { background: #FEF2F2; border-left-color: var(--danger); color: #991B1B; }
.bs-toast-info    { background: var(--primary-light); border-left-color: var(--primary); color: var(--primary-dark); }

/* ── Spin animation ── */
.spin { animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }

/* ══════════════════════════════════════════════════
   MOBILE RESPONSIVE IMPROVEMENTS — Buffer Stock & RKO
   ══════════════════════════════════════════════════ */

/* Page header mobile stack */
@media (max-width: 767.98px) {
  .bs-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .bs-page-actions {
    width: 100%;
    display: flex;
    gap: .5rem;
  }
  .btn-ghost-action,
  .btn-solid-action {
    flex: 1;
    justify-content: center;
    font-size: .8rem;
    padding: .5rem .75rem;
  }

  /* Stat cards: 2-col on tablet, 1-col on phone */
  .bs-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }

  /* Toolbar stack */
  .bs-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: .6rem;
    padding: .85rem 1rem;
  }
  .bs-filter-tabs { width: 100%; }
  .bs-tab { flex: 1; justify-content: center; padding: .45rem .6rem; }
  .bs-search-form { width: 100%; }
  .bs-btn-search { min-width: 64px; }

  /* Reorder bar stack */
  .bs-reorder-bar {
    flex-direction: column;
    gap: .6rem;
    align-items: flex-start;
    padding: .75rem 1rem;
  }
  .bs-reorder-bar-left { font-size: .8rem; }
  .bs-reorder-bar-right { width: 100%; }
  .bs-btn-selectall { width: 100%; }

  /* Table: hide less important columns on mobile */
  .bs-table th:nth-child(3),
  .bs-table td:nth-child(3),
  .bs-table th:nth-child(5),
  .bs-table td:nth-child(5) {
    display: none;
  }

  /* FAB: full-width bottom bar on mobile */
  .rko-fab {
    left: 1rem;
    right: 1rem;
    width: auto;
    border-radius: var(--radius);
    justify-content: center;
    font-size: .9rem;
    padding: .85rem 1.25rem;
    bottom: 1.25rem;
  }

  /* Modal: full-screen on mobile */
  .rko-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .rko-modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius) var(--radius) 0 0;
    animation: modalInMobile .25s ease;
  }
  @keyframes modalInMobile {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: none; }
  }

  /* Modal footer: stack buttons on very small screens */
  .rko-modal-footer {
    flex-wrap: wrap;
    gap: .5rem;
  }
  .rko-btn-cancel { order: 3; flex: 1; min-width: 80px; justify-content: center; }
  .rko-btn-save   { order: 1; flex: 2; justify-content: center; }
  .rko-btn-print  { order: 2; flex: 1; min-width: 80px; justify-content: center; }

  /* RKO item rows: stack on mobile */
  .rko-item-row {
    flex-wrap: wrap;
    gap: .6rem;
  }
  .rko-item-qty {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .rko-qty-label { margin-bottom: 0; }
  .rko-qty-wrap { flex: 1; justify-content: flex-end; }
  .rko-qty-input { width: 90px; }
}

@media (max-width: 479.98px) {
  .bs-stats-row { grid-template-columns: 1fr; }
  .bs-stat-card { padding: .85rem 1rem; }
  .bs-stat-value { font-size: 1.3rem; }
}
