/* Fish Lyfe provider portal — design tokens + components.
   Plain CSS, no framework. Light/dark follow the OS. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #e3e8ee;
  --border-strong: #cfd6df;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  --primary: #0e7490;
  --primary-hover: #0b5e75;
  --primary-soft: #e0f4f8;
  --primary-text: #ffffff;

  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --success: #059669;
  --success-soft: #d1fae5;

  --sidebar-bg: #0b1f2a;
  --sidebar-text: #b8c7d1;
  --sidebar-text-active: #ffffff;
  --sidebar-active: rgba(255, 255, 255, 0.08);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.22);

  --sidebar-w: 240px;
  --focus: 0 0 0 3px rgba(14, 116, 144, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1117;
    --surface: #111a22;
    --surface-2: #16212b;
    --border: #1f2c37;
    --border-strong: #2c3b48;
    --text: #e6edf3;
    --text-2: #a4b3c0;
    --text-3: #6b7d8c;

    --primary: #22b8d4;
    --primary-hover: #4ccbe2;
    --primary-soft: rgba(34, 184, 212, 0.14);
    --primary-text: #05222b;

    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.15);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.15);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.15);

    --sidebar-bg: #070d12;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
    --focus: 0 0 0 3px rgba(34, 184, 212, 0.35);
  }
}

/* ---------- base ---------- */

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[v-cloak] { display: none; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 13px; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

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

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
}

.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.brand strong { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.brand span { display: block; font-size: 12px; color: var(--sidebar-text); opacity: 0.8; }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
  text-decoration: none;
}

.nav a:hover { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.nav a.active { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.nav a svg { width: 18px; height: 18px; flex: none; }

.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 14px; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.user-chip strong { display: block; color: #fff; font-size: 13px; line-height: 1.2; }
.user-chip span { font-size: 12px; opacity: 0.7; }
.user-chip button { margin-left: auto; }

.main { min-width: 0; padding: 28px 32px 48px; }

.topbar { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    transform: translateX(-100%); transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 30; }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
  }
  .topbar img { width: 28px; height: 28px; border-radius: 50%; }
  .topbar strong { font-size: 14px; }
  .main { padding: 20px 16px 40px; }
}

/* ---------- page header ---------- */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; }
.page-head p { margin-top: 4px; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; }

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

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

.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.toolbar .spacer { flex: 1; }
.toolbar .summary { color: var(--text-2); font-size: 13px; white-space: nowrap; }

.field-inline { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

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

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }

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

.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }

.icon-btn {
  width: 32px; height: 32px; padding: 0;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.icon-btn svg { width: 16px; height: 16px; }

.sidebar .icon-btn { color: var(--sidebar-text); }
.sidebar .icon-btn:hover { background: var(--sidebar-active); color: #fff; border-color: transparent; }

/* ---------- inputs ---------- */

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: var(--focus); outline: none; }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); }

.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.select.compact { width: auto; height: 34px; }

.form { display: grid; gap: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-2); }
.field .hint { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.field .error { margin-top: 6px; font-size: 12px; color: var(--danger); }

.check-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.check-row strong { display: block; font-size: 13px; font-weight: 500; }
.check-row span { display: block; font-size: 12px; color: var(--text-3); }

/* ---------- toggle ---------- */

.toggle {
  position: relative; width: 38px; height: 22px; flex: none;
  border-radius: 999px; border: none; padding: 0;
  background: var(--border-strong);
  transition: background 0.15s ease;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}
.toggle[aria-checked="true"] { background: var(--primary); }
.toggle[aria-checked="true"]::after { transform: translateX(16px); }
.toggle:disabled { opacity: 0.5; cursor: wait; }

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

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

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; }
.table th {
  font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .icon-btn { opacity: 0.7; }
.table tbody tr:hover td.actions .icon-btn { opacity: 1; }
.table .num { font-variant-numeric: tabular-nums; }
.table td.wrap { max-width: 320px; }

.cell-title { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--primary-soft); color: var(--primary);
}
.pill.neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.pill.success { background: var(--success-soft); color: var(--success); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }

.skeleton {
  display: block; height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty {
  display: grid; place-items: center; gap: 8px; text-align: center;
  padding: 56px 24px; color: var(--text-2);
}
.empty svg { width: 36px; height: 36px; color: var(--text-3); }
.empty strong { color: var(--text); font-weight: 600; }

/* ---------- pagination ---------- */

.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--border);
}

.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-2); font-weight: 500;
}
.pager button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.pager button.active { background: var(--primary); color: var(--primary-text); }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager button svg { width: 16px; height: 16px; display: block; }
.pager .ellipsis { color: var(--text-3); padding: 0 4px; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(2, 8, 20, 0.55);
  display: grid; place-items: center; padding: 16px;
  animation: fade 0.12s ease;
}
.modal {
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: rise 0.16s ease;
}
.modal.narrow { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; flex: none; }
.modal-head h2 { font-size: 17px; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; flex: none; border-top: 1px solid var(--border); }
.modal.narrow .modal-foot { border-top: none; padding-top: 0; }
.modal .lead { color: var(--text-2); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------- toasts ---------- */

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: rise 0.16s ease;
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--primary); }
.toast strong { display: block; font-size: 13px; }
.toast span { display: block; font-size: 13px; color: var(--text-2); }
.toast .icon-btn { margin-left: auto; width: 26px; height: 26px; }

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

.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(14, 116, 144, 0.25), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(14, 177, 210, 0.18), transparent 60%),
    var(--sidebar-bg);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 32px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.auth-brand { display: grid; place-items: center; gap: 10px; margin-bottom: 24px; text-align: center; }
.auth-brand img { width: 64px; height: 64px; border-radius: 50%; }
.auth-brand h1 { font-size: 20px; }
.auth-brand p { color: var(--text-2); font-size: 13px; }
.auth .btn { width: 100%; height: 40px; margin-top: 6px; }
.auth .alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}
.auth .alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
