/* Inova Admin — palette rooted in client_lov/src/assets/styles/index.css
   ("Clinical Trust": deep navy brand + mid teal accent), extended with a
   wider accent range for stat chips / status badges so the dashboard reads
   as a modern, colorful product rather than a flat back-office form. */

:root {
  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 6px);

  --navy: oklch(0.25 0.05 250);
  --brand: #011b42;
  --brand-light: #0d3670;
  --brand-foreground: #ffffff;

  --background: oklch(0.97 0.006 240);
  --foreground: oklch(0.2 0.04 250);

  --card: oklch(1 0 0);
  --card-foreground: oklch(0.2 0.04 250);

  --primary: oklch(0.32 0.09 255);
  --primary-foreground: oklch(0.98 0.01 220);

  --secondary: oklch(0.95 0.015 240);
  --secondary-foreground: oklch(0.25 0.05 250);

  --muted: oklch(0.96 0.01 235);
  --muted-foreground: oklch(0.5 0.03 250);

  --accent: oklch(0.68 0.14 200);
  --accent-foreground: oklch(0.99 0 0);

  --mint: oklch(0.8 0.1 190);
  --destructive: oklch(0.58 0.21 25);
  --destructive-foreground: oklch(0.99 0 0);

  /* extended accent range, used for icon chips / stat highlights */
  --violet: oklch(0.55 0.19 290);
  --amber: oklch(0.72 0.15 70);
  --rose: oklch(0.62 0.19 15);
  --emerald: oklch(0.62 0.14 155);
  --sky: oklch(0.62 0.13 235);

  --border: oklch(0.91 0.012 230);
  --input: oklch(0.92 0.012 230);
  --ring: oklch(0.62 0.13 200);

  --shadow-soft: 0 1px 2px rgba(1, 27, 66, 0.04), 0 8px 24px -12px rgba(1, 27, 66, 0.14);
  --shadow-elevated: 0 24px 60px -20px rgba(1, 27, 66, 0.35);
  --shadow-hover: 0 4px 16px -4px rgba(1, 27, 66, 0.18);

  --sidebar-width: 16rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: oklch(0.18 0.04 255);
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

h4 {
  font-size: 0.92rem;
  color: var(--primary);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
}
h4:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

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

p {
  margin: 0 0 0.75rem;
  color: var(--muted-foreground);
}

code {
  background: var(--muted);
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.85em;
}

.icon {
  flex-shrink: 0;
  vertical-align: -3px;
}

/* ---------------------------------------------------------------- shell */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand) 0%, #051b3e 100%);
  color: var(--brand-foreground);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  transition: transform 0.2s ease;
  box-shadow: 4px 0 24px -8px rgba(0, 0, 0, 0.25);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid color-mix(in oklab, white 12%, transparent);
}

.sidebar-brand img {
  height: 26px;
  width: auto;
  border-radius: 0.3rem;
}

.sidebar-brand span {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 0.65rem;
}

.sidebar-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  color: color-mix(in oklab, white 45%, transparent);
  padding: 1.1rem 0.75rem 0.4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: color-mix(in oklab, white 82%, transparent);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link .icon {
  opacity: 0.85;
}

.sidebar-link:hover {
  background: color-mix(in oklab, white 8%, transparent);
  color: white;
  text-decoration: none;
}

.sidebar-link.active {
  background: color-mix(in oklab, var(--accent) 22%, transparent);
  color: white;
  font-weight: 600;
}
.sidebar-link.active .icon {
  opacity: 1;
  color: oklch(0.85 0.12 195);
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -0.65rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.75rem;
  background: color-mix(in oklab, var(--card) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: oklch(0.18 0.04 255);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--foreground);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
}
.menu-toggle:hover {
  background: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.admin-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--foreground);
  background: var(--muted);
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  border-radius: 999px;
}

.admin-avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.content {
  padding: 1.75rem;
  max-width: 1400px;
  width: 100%;
}

/* ---------------------------------------------------------------- flash */

.flash {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
}

.flash-success {
  background: color-mix(in oklab, var(--emerald) 14%, white);
  border-color: color-mix(in oklab, var(--emerald) 35%, transparent);
  color: oklch(0.35 0.1 155);
}

.flash-error {
  background: color-mix(in oklab, var(--destructive) 10%, white);
  border-color: color-mix(in oklab, var(--destructive) 35%, transparent);
  color: var(--destructive);
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.15s ease;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.card-header h1,
.card-header h2,
.card-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.card-header .icon {
  color: var(--accent);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-header h1 {
  margin: 0;
}
.page-header p {
  margin: 0.15rem 0 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.icon-chip {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-chip.chip-sm {
  width: 2.1rem;
  height: 2.1rem;
}

.chip-navy {
  background: color-mix(in oklab, var(--primary) 14%, white);
  color: var(--primary);
}
.chip-emerald {
  background: color-mix(in oklab, var(--emerald) 16%, white);
  color: oklch(0.42 0.13 155);
}
.chip-violet {
  background: color-mix(in oklab, var(--violet) 15%, white);
  color: var(--violet);
}
.chip-sky {
  background: color-mix(in oklab, var(--sky) 16%, white);
  color: oklch(0.4 0.11 235);
}
.chip-amber {
  background: color-mix(in oklab, var(--amber) 20%, white);
  color: oklch(0.42 0.1 70);
}
.chip-rose {
  background: color-mix(in oklab, var(--rose) 15%, white);
  color: var(--rose);
}

.stat-card .stat-body {
  min-width: 0;
}

.stat-card .label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 0.2rem;
}

.stat-card .value {
  font-size: 1.45rem;
  font-weight: 700;
  color: oklch(0.18 0.04 255);
  line-height: 1.1;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
}

.status-grid .stat-card {
  padding: 0.9rem 1rem;
}
.status-grid .stat-card .value {
  font-size: 1.2rem;
}
.status-grid .stat-card .label {
  text-transform: capitalize;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------- table */

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

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

thead th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted-foreground);
  padding: 0.65rem 0.9rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.1s ease;
}
tbody tr:hover {
  background: color-mix(in oklab, var(--accent) 5%, transparent);
}
tbody tr:last-child td {
  border-bottom: none;
}

.table-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted-foreground);
}

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.65rem 0.24rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
  background: var(--muted);
  color: var(--muted-foreground);
}
.badge::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-draft,
.badge-not_completed {
  background: color-mix(in oklab, var(--muted-foreground) 14%, white);
  color: var(--muted-foreground);
}
.badge-pending_payment,
.badge-in_progress {
  background: color-mix(in oklab, var(--amber) 20%, white);
  color: oklch(0.42 0.12 70);
}
.badge-paid {
  background: color-mix(in oklab, var(--sky) 18%, white);
  color: oklch(0.38 0.12 235);
}
.badge-confirmed,
.badge-succeeded {
  background: color-mix(in oklab, var(--accent) 20%, white);
  color: oklch(0.36 0.11 205);
}
.badge-shipped {
  background: color-mix(in oklab, var(--violet) 16%, white);
  color: var(--violet);
}
.badge-delivered,
.badge-completed,
.badge-active {
  background: color-mix(in oklab, var(--emerald) 18%, white);
  color: oklch(0.36 0.12 155);
}
.badge-cancelled,
.badge-failed,
.badge-inactive {
  background: color-mix(in oklab, var(--destructive) 14%, white);
  color: var(--destructive);
}

/* ---------------------------------------------------------------- forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--foreground);
}

.hint {
  font-size: 0.76rem;
  color: var(--muted-foreground);
  margin-top: -0.2rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--foreground);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in oklab, var(--ring) 50%, var(--input));
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 22%, transparent);
}

input:disabled {
  background: var(--muted);
  color: var(--muted-foreground);
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 5rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-row label {
  font-weight: 500;
}
input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem 1rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--muted);
}
.checkbox-grid .checkbox-row {
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover {
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--brand-light));
  color: var(--primary-foreground);
  box-shadow: 0 2px 10px -2px color-mix(in oklab, var(--primary) 55%, transparent);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px -2px color-mix(in oklab, var(--primary) 65%, transparent);
  color: var(--primary-foreground);
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-secondary {
  background: var(--card);
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--muted);
  border-color: color-mix(in oklab, var(--ring) 40%, var(--border));
}

.btn-danger {
  background: transparent;
  color: var(--destructive);
  border-color: color-mix(in oklab, var(--destructive) 35%, transparent);
}
.btn-danger:hover {
  background: color-mix(in oklab, var(--destructive) 8%, transparent);
  border-color: var(--destructive);
}

.btn-sm {
  padding: 0.36rem 0.75rem;
  font-size: 0.78rem;
}

.btn-icon {
  padding: 0.4rem;
  width: 2.05rem;
  height: 2.05rem;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- filters */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-bar select,
.filter-bar input {
  width: auto;
}

.search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-box .icon {
  position: absolute;
  left: 0.65rem;
  color: var(--muted-foreground);
  pointer-events: none;
}
.search-box input {
  padding-left: 2.15rem;
}

.pill-nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pill-nav a {
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: capitalize;
  transition: background 0.15s ease, color 0.15s ease;
}
.pill-nav a:hover {
  text-decoration: none;
  background: var(--secondary);
}
.pill-nav a.active {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* ---------------------------------------------------------------- detail */

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

.kv-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.88rem;
}
.kv-list dt {
  color: var(--muted-foreground);
}
.kv-list dd {
  margin: 0;
  font-weight: 600;
}

/* ---------------------------------------------------------------- login */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 15% 20%, oklch(0.4 0.12 220 / 55%), transparent 45%),
    radial-gradient(circle at 85% 80%, oklch(0.55 0.15 195 / 45%), transparent 50%),
    linear-gradient(160deg, var(--brand) 0%, #0a2a5c 55%, #124a7a 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elevated);
  padding: 2.25rem 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-card .lock-badge {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -6px color-mix(in oklab, var(--primary) 60%, transparent);
}

.login-card img {
  height: 32px;
  margin-bottom: 1rem;
}

.login-card h1 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.login-card p.subtitle {
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-card form {
  text-align: left;
}

/* ---------------------------------------------------------------- errors */

.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--background);
  text-align: center;
  padding: 2rem;
}

.error-page .code {
  font-size: 4rem;
  font-weight: 700;
  color: var(--brand);
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------------------------------------------------------------- empty state */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  color: var(--muted-foreground);
}
.empty-state .icon {
  color: var(--border);
  width: 2.5rem;
  height: 2.5rem;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .menu-toggle {
    display: inline-flex;
  }
}
