/* ============================================================
   Digital4Win PMS — Design System & Component Library
   Version: 1.0.0
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */

:root {
  /* Colors — Primary */
  --primary: #0F766E;
  --primary-light: #14B8A6;
  --primary-dark: #0D3D38;
  --primary-50: #F0FDFA;

  /* Colors — Accent */
  --accent: #F59E0B;
  --accent-light: #FEF3C7;

  /* Colors — Surfaces */
  --bg: #F0FDF4;
  --surface: #FFFFFF;
  --surface-hover: #F8FAFC;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  /* Colors — Text */
  --text: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Colors — Semantic */
  --success: #16A34A;
  --success-light: #DCFCE7;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --error: #DC2626;
  --error-light: #FEE2E2;
  --info: #0EA5E9;
  --info-light: #E0F2FE;

  /* Typography */
  --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-11: 44px;
  --space-12: 48px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --sidebar-logo-height: 64px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */

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

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

body {
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

a:hover {
  color: var(--primary-dark);
}

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

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── Typography ────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

h1 {
  font-size: 1.875rem;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.0625rem;
}

.text-sm {
  font-size: 0.8125rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--text-muted);
}

.text-light {
  color: var(--text-light);
}

.display {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.mono {
  font-family: var(--font-mono);
}

/* ── App Layout ────────────────────────────────────────────── */

.app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Sidebar ───────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-logo {
  height: var(--sidebar-logo-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border-light);
  gap: var(--space-3);
  flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

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

.sidebar-logo .logo-text span {
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) 0;
}

.nav-section {
  margin-bottom: var(--space-2);
}

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  padding: var(--space-2) var(--space-5) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 var(--space-5);
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-50);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-item svg,
.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--error);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: var(--surface-hover);
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

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

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

.sidebar-user .user-role {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ── Main Content Area ─────────────────────────────────────── */

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ────────────────────────────────────────────────── */

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .hamburger {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: background var(--transition-fast);
}

.topbar .hamburger:hover {
  background: var(--surface-hover);
}

.topbar .hamburger svg {
  width: 22px;
  height: 22px;
}

.topbar .search-box {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 var(--space-4) 0 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-hover);
  font-size: 0.8125rem;
  color: var(--text);
  transition: all var(--transition-fast);
  outline: none;
}

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

.search-box input:focus {
  border-color: var(--primary-light);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.search-box .search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

.topbar .pharmacy-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--surface);
}

.topbar .pharmacy-selector:hover {
  border-color: var(--primary-light);
}

.topbar .pharmacy-selector svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.topbar-action {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  position: relative;
}

.topbar-action:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.topbar-action svg {
  width: 20px;
  height: 20px;
}

.topbar-action .notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: var(--radius-full);
  border: 2px solid var(--surface);
}

.topbar .user-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

.topbar .user-avatar-sm:hover {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

/* ── Content ───────────────────────────────────────────────── */

.content {
  padding: var(--space-6);
  flex: 1;
}

/* ── Page Header ───────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-header .page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header .page-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.page-header .page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── KPI Cards ─────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  gap: var(--space-4);
  transition: box-shadow var(--transition-base);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-card .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-card .kpi-icon svg {
  width: 22px;
  height: 22px;
}

.kpi-card .kpi-icon.primary {
  background: var(--primary-50);
  color: var(--primary);
}

.kpi-card .kpi-icon.success {
  background: var(--success-light);
  color: var(--success);
}

.kpi-card .kpi-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.kpi-card .kpi-icon.info {
  background: var(--info-light);
  color: var(--info);
}

.kpi-card .kpi-icon.error {
  background: var(--error-light);
  color: var(--error);
}

.kpi-card .kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-card .kpi-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-1);
}

.kpi-card .kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kpi-card .kpi-trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--space-1);
}

.kpi-card .kpi-trend.up {
  color: var(--success);
}

.kpi-card .kpi-trend.down {
  color: var(--error);
}

.kpi-card .kpi-trend svg {
  width: 14px;
  height: 14px;
}

/* ── Cards ─────────────────────────────────────────────────── */

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
}

.card-header h3,
.card-header h4 {
  font-size: 0.9375rem;
  font-weight: 600;
}

.card-header .card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-body {
  padding: var(--space-5);
}

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

/* ── Data Tables ───────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-hover);
  white-space: nowrap;
  user-select: none;
}

thead th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast);
}

thead th.sortable:hover {
  color: var(--text);
}

thead th.sortable::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text-light);
}

thead th.sort-asc::after {
  border-top: none;
  border-bottom: 4px solid var(--primary);
}

thead th.sort-desc::after {
  border-top: 4px solid var(--primary);
}

tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
  color: var(--text);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--surface-hover);
}

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

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

/* ── Forms ─────────────────────────────────────────────────── */

.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.form-group .form-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: var(--space-1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--text);
  transition: all var(--transition-fast);
  outline: none;
}

textarea {
  height: auto;
  min-height: 80px;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

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

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--border-light);
  color: var(--text-light);
  cursor: not-allowed;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group .error-message {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: var(--space-1);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-4);
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  text-decoration: none;
  line-height: 1;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-light);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--primary-50);
  color: var(--primary);
  border-color: transparent;
}

.btn-secondary:hover {
  background: var(--primary-light);
  color: white;
  border-color: transparent;
}

.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}

.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: 0.8125rem;
}

.btn-sm svg {
  width: 16px;
  height: 16px;
}

.btn-lg {
  height: 48px;
  padding: 0 var(--space-8);
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
}

/* ── Status Badges ─────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--border-light);
  color: var(--text-muted);
}

.badge.success {
  background: var(--success-light);
  color: var(--success);
}

.badge.warning {
  background: var(--warning-light);
  color: #92400E;
}

.badge.error {
  background: var(--error-light);
  color: var(--error);
}

.badge.info {
  background: var(--info-light);
  color: #0369A1;
}

.badge.pending {
  background: var(--accent-light);
  color: #92400E;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* ── Modals ────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(0.98);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.0625rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* ── Toasts ────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

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

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

.toast .toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast .toast-message {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 500;
}

.toast .toast-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.toast .toast-close:hover {
  color: var(--text);
}

.toast .toast-close svg {
  width: 14px;
  height: 14px;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error {
  border-left: 3px solid var(--error);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info {
  border-left: 3px solid var(--info);
}

.toast.info .toast-icon {
  color: var(--info);
}

/* ── Pagination ────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-4) 0;
}

.pagination button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.pagination button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.pagination button.active {
  background: var(--primary);
  color: white;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .pagination-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 var(--space-3);
}

/* ── Empty State ───────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--text-light);
}

.empty-state .empty-icon svg {
  width: 28px;
  height: 28px;
}

.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.empty-state .empty-description {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 360px;
  margin-bottom: var(--space-5);
}

/* ── Stats Grid ────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ── Chart Container ───────────────────────────────────────── */

.chart-container {
  width: 100%;
  padding: var(--space-4);
}

.chart-container .chart-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-4);
}

.chart-bar-group {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 200px;
  padding-top: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.chart-bar {
  flex: 1;
  background: var(--primary-50);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  transition: background var(--transition-fast);
  min-height: 4px;
}

.chart-bar:hover {
  background: var(--primary-light);
}

.chart-bar .chart-bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.625rem;
  color: var(--text-light);
  white-space: nowrap;
}

.chart-bar .chart-bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chart-legend-item .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

/* ── Mobile Menu Overlay ───────────────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 99;
}

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

/* ============================================================
   Landing Page Styles
   ============================================================ */

/* ── Landing Nav ───────────────────────────────────────────── */

.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  z-index: 200;
  transition: all var(--transition-slow);
}

.landing-nav.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border-light);
}

.landing-nav .landing-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
}

.landing-nav .landing-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.landing-nav .landing-logo span {
  color: var(--primary);
}

.landing-nav .landing-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.landing-nav .landing-nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.landing-nav .landing-nav-links a:hover {
  color: var(--primary);
}

.landing-nav .landing-nav-cta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Landing Hero ──────────────────────────────────────────── */

.landing-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px var(--space-6) var(--space-12);
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--bg) 40%, #E0F2FE 100%);
  position: relative;
  overflow: hidden;
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(20, 184, 166, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(14, 165, 233, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.landing-hero .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  position: relative;
  z-index: 1;
}

.landing-hero .hero-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: var(--radius-full);
  animation: pulse 2s infinite;
}

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

.landing-hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  max-width: 800px;
  margin-bottom: var(--space-5);
  position: relative;
  z-index: 1;
}

.landing-hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-hero .hero-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: var(--space-8);
  position: relative;
  z-index: 1;
}

.landing-hero .hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-12);
  position: relative;
  z-index: 1;
}

.landing-hero .btn-hero {
  height: 52px;
  padding: 0 var(--space-8);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
}

.landing-hero .hero-stats {
  display: flex;
  gap: var(--space-10);
  position: relative;
  z-index: 1;
}

.landing-hero .hero-stat {
  text-align: center;
}

.landing-hero .hero-stat .stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}

.landing-hero .hero-stat .stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ── Landing Sections ──────────────────────────────────────── */

.landing-section {
  padding: 100px var(--space-6);
}

.landing-section .section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-12);
}

.landing-section .section-header .section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: var(--space-3);
}

.landing-section .section-header h2 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
}

.landing-section .section-header p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Landing Features Grid ─────────────────────────────────── */

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  max-width: 1100px;
  margin: 0 auto;
}

.landing-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--transition-base);
}

.landing-feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

.landing-feature-card .feature-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-50);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: var(--space-5);
}

.landing-feature-card .feature-icon svg {
  width: 24px;
  height: 24px;
}

.landing-feature-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.landing-feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── Landing CTA ───────────────────────────────────────────── */

.landing-cta {
  text-align: center;
  padding: 100px var(--space-6);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
}

.landing-cta h2 {
  font-size: 2.25rem;
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-4);
  letter-spacing: -0.03em;
}

.landing-cta p {
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 500px;
  margin: 0 auto var(--space-8);
  line-height: 1.6;
}

.landing-cta .btn {
  background: white;
  color: var(--primary-dark);
  border-color: white;
  height: 52px;
  padding: 0 var(--space-8);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
}

.landing-cta .btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-50);
}

/* ── App Preview (Browser Frame Mockup) ────────────────────── */

.app-preview {
  max-width: 1000px;
  margin: 0 auto;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
}

.app-preview .browser-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-preview .browser-dots {
  display: flex;
  gap: 6px;
}

.app-preview .browser-dots span {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--border);
}

.app-preview .browser-dots span:first-child {
  background: #FCA5A5;
}

.app-preview .browser-dots span:nth-child(2) {
  background: #FCD34D;
}

.app-preview .browser-dots span:nth-child(3) {
  background: #86EFAC;
}

.app-preview .browser-url {
  flex: 1;
  height: 28px;
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  font-size: 0.75rem;
  color: var(--text-light);
  font-family: var(--font-mono);
}

.app-preview .browser-content {
  background: var(--bg);
  min-height: 400px;
}

.app-preview .browser-content img {
  width: 100%;
  display: block;
}

/* ── Landing Footer ────────────────────────────────────────── */

.landing-footer {
  padding: var(--space-8) var(--space-6);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* ============================================================
   Responsive Design
   ============================================================ */

/* ── Tablet (<=1024px) ─────────────────────────────────────── */

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main {
    margin-left: 0;
  }

  .topbar .hamburger {
    display: flex;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-hero h1 {
    font-size: 2.5rem;
  }

  .landing-nav .landing-nav-links {
    display: none;
  }
}

/* ── Mobile (<=768px) ──────────────────────────────────────── */

@media (max-width: 768px) {
  :root {
    --space-6: 16px;
  }

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

  .landing-features-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    padding: 100px var(--space-4) var(--space-8);
  }

  .landing-hero h1 {
    font-size: 2rem;
  }

  .landing-hero .hero-description {
    font-size: 1rem;
  }

  .landing-hero .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .landing-hero .hero-actions .btn-hero {
    width: 100%;
  }

  .landing-hero .hero-stats {
    flex-direction: column;
    gap: var(--space-4);
  }

  .landing-section {
    padding: 60px var(--space-4);
  }

  .landing-cta {
    padding: 60px var(--space-4);
  }

  .landing-cta h2 {
    font-size: 1.75rem;
  }

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

  .page-header .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

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

  .form-actions {
    flex-direction: column;
  }

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

  .topbar .pharmacy-selector {
    display: none;
  }

  .topbar .search-box {
    max-width: none;
  }

  .modal {
    width: 95%;
    max-height: 90vh;
  }

  .toast {
    min-width: auto;
    max-width: 90vw;
  }

  .app-preview {
    border-radius: var(--radius-lg);
  }

  table {
    font-size: 0.8125rem;
  }

  thead th,
  tbody td {
    padding: var(--space-2) var(--space-3);
  }
}

/* ── Utility Classes ───────────────────────────────────────── */

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
