:root {
  --primary: #1e40af;
  --primary-hover: #1e3a8a;
  --primary-light: #eff6ff;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --bg-main: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.06);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Modal Backdrops */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

/* Login Card */
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  text-align: left;
  border: 1px solid var(--border);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.login-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.login-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-error-msg {
  color: var(--danger);
  font-size: 0.82rem;
  margin-bottom: 12px;
  min-height: 16px;
}

.login-footer {
  text-align: center;
  margin-top: 18px;
}

.back-to-kiosk {
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* Admin Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
}

.badge-online {
  font-size: 0.65rem;
  background: rgba(5, 150, 105, 0.2);
  color: #34d399;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--sidebar-text);
  border: none;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-kiosk-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  text-decoration: none;
  padding: 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.sidebar-kiosk-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-logout-link {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: center;
  padding: 4px;
}

.btn-logout-link:hover {
  color: #f87171;
}

/* Main Area */
.admin-main {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
  max-width: 1400px;
}

/* Topbar */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-topbar h1 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* Tab Panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.18s ease-out;
}

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

/* Summary Cards Grid */
.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon.blue { background: #eff6ff; color: #1e40af; }
.card-icon.green { background: #ecfdf5; color: #059669; }
.card-icon.purple { background: #f5f3ff; color: #7c3aed; }
.card-icon.orange { background: #fff7ed; color: #c2410c; }

.card-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-main);
  margin-bottom: 2px;
}

.card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard Grid 2 */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Panel Card */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.panel-header h2 {
  font-size: 1.02rem;
  font-weight: 700;
}

.panel-body {
  padding: 20px;
}

.panel-body.no-padding {
  padding: 0;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: #f8fafc;
  padding: 10px 16px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

.data-table td.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #f1f5f9;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.completed { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.status-badge.printing { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-badge.failed { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.badge-dept {
  background: #e2e8f0;
  color: #334155;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Filter Controls */
.filter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.quick-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.filter-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  background: #e2e8f0;
}

.pill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.filter-controls-grid {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-group input,
.filter-group select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* Pagination */
.table-pagination {
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.pagination-btns {
  display: flex;
  gap: 6px;
}

/* Monthly Receipt Card */
.monthly-report-receipt {
  max-width: 480px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.receipt-period-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.receipt-dept-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.92rem;
}

.receipt-total-row {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px dashed var(--text-main);
  font-size: 1.08rem;
  font-weight: 700;
}

/* Department Overview Progress */
.dept-bar-item {
  margin-bottom: 14px;
}

.dept-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.dept-progress-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.dept-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

/* User Modal Timeline */
.user-detail-card {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid var(--border);
}

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

.btn-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.user-summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.user-stat-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary);
}

.timeline-day-group {
  margin-bottom: 14px;
}

.timeline-day-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 3px;
}

.timeline-job-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.84rem;
}

.timeline-job-item .time {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  width: 75px;
}

.timeline-job-item .pages {
  font-weight: 700;
  color: var(--text-main);
  width: 85px;
}

.timeline-job-item .doc {
  flex: 1;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.dept-list {
  list-style: none;
}

.dept-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

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

.spooler-status-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator-dot.online {
  background: var(--success);
}

/* Buttons */
.btn {
  height: 36px;
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  transition: all 0.15s ease;
}

.btn-sm { height: 30px; padding: 0 10px; font-size: 0.78rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #f1f5f9; color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger-outline:hover { background: #fef2f2; }
.btn-danger-sm { background: transparent; color: #dc2626; border: 1px solid #fecaca; padding: 3px 6px; border-radius: 4px; cursor: pointer; font-size: 0.72rem; }
.btn-danger-sm:hover { background: #fee2e2; }
.btn-block { width: 100%; }

.danger-zone {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 6px;
  padding: 12px;
  margin-top: 10px;
}

.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap-2 { display: flex; gap: 8px; }
.flex-1 { flex: 1; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.my-3 { margin-top: 14px; margin-bottom: 14px; border: 0; border-top: 1px solid var(--border); }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
