/* ============================================================
   Lockboard — shadcn/ui (zinc) inspired design tokens
   ============================================================ */

:root {
  --radius: 0.625rem;
  --mono-font: "JetBrains Mono";
  --accent-h: 0;
  --accent-s: 0%;
  --accent-l: 98%;

  /* Mist — official shadcn mist palette (preset bRAR4U3Ga), oklch→hsl */
  --background: 200 14% 4%;
  --foreground: 180 20% 98%;
  --card: 197 13% 10%;
  --card-foreground: 180 20% 98%;
  --popover: 197 13% 10%;
  --popover-foreground: 180 20% 98%;
  --primary: var(--accent-h) var(--accent-s) var(--accent-l);
  --primary-foreground: 197 13% 10%;
  --secondary: 193 12% 15%;
  --secondary-foreground: 180 20% 98%;
  --muted: 193 12% 15%;
  --muted-foreground: 192 8% 64%;
  --accent: 193 12% 15%;
  --accent-foreground: 180 20% 98%;
  --destructive: 359 100% 70%;
  --destructive-foreground: 0 0% 98%;
  --border: 200 4% 14%;
  --input: 200 3% 19%;
  --ring: var(--accent-h) var(--accent-s) 65%;

  --ok: 162 60% 45%;
  --warn: 38 92% 55%;
  --info: 199 80% 58%;

  --sidebar: 197 13% 10%;
  --shadow-color: 205 45% 2%;
}

[data-theme="light"] {
  /* Mist — official shadcn mist light palette (preset bRAR4U3Ga), oklch→hsl.
     Background tinted (vs. preset white) so white cards read against the page. */
  --background: 180 6% 96%;
  --foreground: 200 14% 4%;
  --card: 0 0% 100%;
  --card-foreground: 200 14% 4%;
  --popover: 0 0% 100%;
  --popover-foreground: 200 14% 4%;
  --primary: var(--accent-h) var(--accent-s) var(--accent-l);
  --primary-foreground: 0 0% 100%;
  --secondary: 180 7% 95%;
  --secondary-foreground: 197 13% 10%;
  --muted: 180 7% 95%;
  --muted-foreground: 191 9% 44%;
  --accent: 180 7% 95%;
  --accent-foreground: 197 13% 10%;
  --destructive: 357 100% 45%;
  --destructive-foreground: 0 0% 98%;
  --border: 192 11% 90%;
  --input: 192 11% 90%;
  --ring: var(--accent-h) var(--accent-s) 45%;

  --ok: 162 62% 36%;
  --warn: 38 92% 42%;
  --info: 199 85% 46%;

  --sidebar: 0 0% 100%;
  --card-hover-border: #c0c0c0;
}

/* Accent presets (driven by Tweaks) */
[data-accent="neutral"][data-theme="dark"] { --accent-h: 0; --accent-s: 0%; --accent-l: 98%; }
[data-accent="neutral"][data-theme="light"] { --accent-h: 197; --accent-s: 13%; --accent-l: 10%; }
[data-accent="neutral"] { --primary-foreground: 197 13% 10%; }
[data-accent="neutral"][data-theme="light"] { --primary-foreground: 0 0% 100%; }
[data-accent="blue"]   { --accent-h: 217; --accent-s: 91%; --accent-l: 60%; }
[data-accent="emerald"]{ --accent-h: 160; --accent-s: 64%; --accent-l: 45%; }
[data-accent="violet"] { --accent-h: 263; --accent-s: 70%; --accent-l: 60%; }
[data-accent="blue"]   { --primary-foreground: 0 0% 100%; }
[data-accent="emerald"]{ --primary-foreground: 0 0% 100%; }
[data-accent="violet"] { --primary-foreground: 0 0% 100%; }

[data-mono="jetbrains"] { --mono-font: "JetBrains Mono"; }
[data-mono="plex"]      { --mono-font: "IBM Plex Mono"; }
[data-mono="space"]     { --mono-font: "Space Mono"; }

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

html, body, #root { height: 100%; }

body {
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.5;
}

.mono { font-family: var(--mono-font), ui-monospace, "SF Mono", Menlo, monospace; }

::selection { background: hsl(var(--primary) / 0.25); }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 99px; border: 3px solid hsl(var(--background)); }
*::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / 0.5); }

/* ---------- Layout primitives ---------- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; justify-content: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: hsl(var(--muted-foreground)); }

/* ---------- Buttons ---------- */
.btn {
  --h: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 14px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  background: transparent; color: hsl(var(--foreground));
  font: inherit; font-weight: 500; font-size: 13.5px;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .04s, box-shadow .15s;
}
.btn:active { transform: translateY(0.5px) scale(0.995); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)); }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { background: hsl(var(--primary) / 0.9); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover { background: hsl(var(--secondary) / 0.7); }
.btn-outline { border-color: hsl(var(--border)); background: hsl(var(--background)); }
.btn-outline:hover { background: hsl(var(--accent)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-destructive:hover { background: hsl(var(--destructive) / 0.9); }
.btn-sm { --h: 32px; padding: 0 11px; font-size: 13px; }
.btn-icon { --h: 36px; width: 36px; padding: 0; }
.btn-icon.btn-sm { --h: 32px; width: 32px; }
.btn-icon.xs { --h: 28px; width: 28px; }
.btn-icon.xs svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ---------- Inputs ---------- */
.field-label { font-size: 13px; font-weight: 500; margin-bottom: 7px; display: block; }
.input, .textarea, .select {
  width: 100%;
  height: 38px; padding: 0 12px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--foreground)); font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 9px 12px; resize: vertical; min-height: 78px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground) / 0.7); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}
.select { appearance: none; cursor: pointer;
  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='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px;
}
.input-group { position: relative; }
.input-group .input { padding-left: 38px; }
.input-group > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: hsl(var(--muted-foreground)); pointer-events: none; }

/* ---------- Card ---------- */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 22px; padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em; line-height: 1;
  border: 1px solid transparent; white-space: nowrap;
}
.badge svg { flex: none; }
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge-ok    { color: hsl(var(--ok)); background: hsl(var(--ok) / 0.12); border-color: hsl(var(--ok) / 0.25); }
.badge-warn  { color: hsl(var(--warn)); background: hsl(var(--warn) / 0.12); border-color: hsl(var(--warn) / 0.25); }
.badge-muted { color: hsl(var(--muted-foreground)); background: hsl(var(--muted) / 0.6); border-color: hsl(var(--border)); }
.badge-outline { color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.badge-destructive { color: hsl(var(--destructive)); background: hsl(var(--destructive) / 0.12); border-color: hsl(var(--destructive) / 0.25); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 99px; background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground)); font-weight: 600;
  flex: none; overflow: hidden; font-size: 13px;
}

/* ---------- Tooltip-ish kbd ---------- */
kbd {
  font-family: var(--mono-font), monospace; font-size: 11px;
  background: hsl(var(--muted)); border: 1px solid hsl(var(--border));
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: hsl(var(--muted-foreground));
}

/* ---------- Modal / dialog ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: hsl(240 10% 2% / 0.6);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 7vh 20px 20px;
  animation: overlay-in .18s ease;
  overflow-y: auto;
}
@keyframes overlay-in { from { opacity: 0; } }
.dialog {
  width: 100%; max-width: 520px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -12px hsl(var(--shadow-color) / 0.6);
  animation: dialog-in .2s cubic-bezier(.16,1,.3,1);
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog-head { padding: 20px 22px 0; }
.dialog-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.dialog-desc { color: hsl(var(--muted-foreground)); font-size: 13.5px; margin-top: 4px; }
.dialog-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 15px; }
.dialog-foot { padding: 0 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; z-index: 90; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 1px);
  padding: 11px 15px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 12px 30px -8px hsl(var(--shadow-color) / 0.5);
  animation: toast-in .25s cubic-bezier(.16,1,.3,1);
}
.toast svg { width: 17px; height: 17px; color: hsl(var(--ok)); flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateX(18px); } }

/* ---------- Divider ---------- */
.divider { height: 1px; background: hsl(var(--border)); border: 0; width: 100%; }

/* ---------- Switch ---------- */
.switch {
  position: relative; width: 38px; height: 22px; border-radius: 99px;
  background: hsl(var(--input)); border: none; cursor: pointer; flex: none;
  transition: background .18s;
}
.switch[data-on="true"] { background: hsl(var(--primary)); }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 99px; background: #fff;
  transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch[data-on="true"]::after { transform: translateX(16px); }

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

/* ---------- Notification bell (topbar, admin) ---------- */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-btn[data-open="true"] { background: hsl(var(--muted)); }
.notif-count {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: hsl(var(--destructive)); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notif-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; max-width: calc(100vw - 32px);
  z-index: 70; padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}
.notif-head {
  padding: 8px 10px 6px; font-size: 12px; font-weight: 600;
  color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: .04em;
}
/* Pending-request item styled after reui c-alert-14: bordered card, avatar
   leading, title + description, xs action buttons on the right. */
.notif-item {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 4px 6px; padding: 10px 12px;
  border: 1px solid hsl(var(--border)); border-radius: 10px;
  background: hsl(var(--card));
}
.notif-item:hover { background: hsl(var(--muted) / 0.45); }
.notif-item-actions { display: flex; gap: 6px; flex: none; }
.btn-xs {
  height: 24px; padding: 0 10px;
  font-size: 12px; font-weight: 600; border-radius: 7px;
}
.btn-approve { background: hsl(var(--ok)); border: 1px solid hsl(var(--ok)); color: #fff; }
.btn-approve:hover { filter: brightness(0.93); }
.btn-deny { background: transparent; border: 1px solid hsl(var(--destructive) / 0.4); color: hsl(var(--destructive)); }
.btn-deny:hover { background: hsl(var(--destructive) / 0.08); }
.btn-keep { background: transparent; border: 1px solid hsl(var(--border)); color: hsl(var(--foreground)); }
.btn-keep:hover { background: hsl(var(--muted) / 0.6); }
.notif-exp-ico {
  flex: none; width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive));
}
.notif-empty { padding: 14px 10px 16px; font-size: 13px; }
.notif-foot {
  width: 100%; margin-top: 4px; padding: 9px;
  border: 0; border-top: 1px solid hsl(var(--border));
  background: none; cursor: pointer;
  color: hsl(var(--primary)); font: inherit; font-size: 12.5px; font-weight: 600;
}
.notif-foot:hover { text-decoration: underline; }

/* ---------- Search match chips (board results) ---------- */
.match-chip {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 170px; padding: 2px 8px;
  background: hsl(var(--muted)); border-radius: 6px;
  font-size: 11.5px; color: hsl(var(--muted-foreground));
}

/* ---------- Ghost card: add access inside an owner group ---------- */
.owner-add-card {
  display: flex; align-items: center; justify-content: center;
  padding: 16px; margin-top: 2px;
  border: 1px dashed hsl(var(--border)); border-radius: 12px;
}
.owner-add-card:hover { border-color: hsl(var(--primary) / 0.45); }

/* ---------- Pinned (favorite) access ---------- */
.pin-on { color: hsl(var(--warn)); }
.pin-on svg { fill: hsl(var(--warn) / 0.25); }
