/* Examopotamia UI — shadcn/ui-inspired design system in plain CSS. */
:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #a1a1aa;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --brand: #6d28d9;
  --brand-2: #db2777;
  --brand-soft: #f5f3ff;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --destructive: #dc2626;
  --destructive-soft: #fef2f2;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px rgb(0 0 0 / 0.08), 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 20px 50px -12px rgb(0 0 0 / 0.25);
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --background: #09090b; --foreground: #fafafa; --card: #0c0c0f; --muted: #18181b; --muted-foreground: #a1a1aa;
    --accent: #1f1f23; --border: #27272a; --input: #27272a; --ring: #52525b; --primary: #fafafa; --primary-foreground: #18181b;
    --secondary: #1f1f23; --brand: #a78bfa; --brand-2: #f472b6; --brand-soft: #1e1533; --success: #4ade80; --success-soft: #0f2418;
    --warning: #fbbf24; --warning-soft: #2a1f08; --destructive: #f87171; --destructive-soft: #2a1010; color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --background: #09090b; --foreground: #fafafa; --card: #0c0c0f; --muted: #18181b; --muted-foreground: #a1a1aa;
  --accent: #1f1f23; --border: #27272a; --input: #27272a; --ring: #52525b; --primary: #fafafa; --primary-foreground: #18181b;
  --secondary: #1f1f23; --brand: #a78bfa; --brand-2: #f472b6; --brand-soft: #1e1533; --success: #4ade80; --success-soft: #0f2418;
  --warning: #fbbf24; --warning-soft: #2a1f08; --destructive: #f87171; --destructive-soft: #2a1010; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--background); color: var(--foreground); font-family: var(--font);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, svg { display: block; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0; }
code, kbd { font-family: var(--mono); }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted-foreground); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.gradient-text { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; font: inherit; font-weight: 500; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s, transform .05s;
  background: var(--primary); color: var(--primary-foreground);
}
.btn:hover { opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.btn.secondary { background: var(--secondary); color: var(--foreground); }
.btn.secondary:hover { background: var(--accent); opacity: 1; filter: brightness(.97); }
.btn.outline { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn.outline:hover { background: var(--accent); opacity: 1; }
.btn.ghost { background: transparent; color: var(--foreground); }
.btn.ghost:hover { background: var(--accent); opacity: 1; }
.btn.destructive { background: var(--destructive); color: #fff; }
.btn.brand { background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }

/* Forms */
.label { font-size: 13px; font-weight: 500; display: block; margin-bottom: 6px; }
.field { display: grid; gap: 6px; }
.field .hint { font-size: 12px; color: var(--muted-foreground); }
.input, .textarea, .select {
  width: 100%; height: 36px; padding: 0 12px; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--input);
  background: transparent; color: var(--foreground); font: inherit; font-size: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select option { background: var(--card); color: var(--foreground); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-foreground); }
.input-icon .input { padding-left: 34px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; border-radius: 99px; background: var(--input); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--background); box-shadow: var(--shadow); transition: transform .2s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Card */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { padding: 18px 20px 0; display: grid; gap: 4px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-desc { color: var(--muted-foreground); font-size: 13px; }
.card-body { padding: 18px 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* Badge */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--border); color: var(--foreground); background: var(--background); white-space: nowrap; }
.badge.solid { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.danger { background: var(--destructive-soft); color: var(--destructive); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted-foreground); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Tabs */
.tabs { display: inline-flex; padding: 3px; background: var(--muted); border-radius: var(--radius); gap: 2px; }
.tab { border: 0; background: transparent; color: var(--muted-foreground); font: inherit; font-size: 13px; font-weight: 500; height: 30px; padding: 0 12px; border-radius: calc(var(--radius) - 3px); cursor: pointer; }
.tab[aria-selected='true'] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow); }

/* Dialog */
dialog.dialog { border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); padding: 0; background: var(--card); color: var(--foreground); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); }
dialog.dialog.wide { width: min(980px, calc(100vw - 32px)); }
dialog.dialog::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(3px); }
dialog.dialog[open] { animation: pop .18s ease-out; }
.dialog-head { padding: 20px 22px 6px; display: grid; gap: 4px; }
.dialog-head h2 { font-size: 17px; }
.dialog-body { padding: 14px 22px; overflow: auto; max-height: calc(100vh - 210px); }
.dialog-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* Toast */
.toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 100; max-width: calc(100vw - 36px); }
.toast { background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 16px; font-size: 13.5px; min-width: 260px; display: flex; gap: 10px; align-items: flex-start; animation: pop .2s ease-out; }
.toast strong { display: block; font-weight: 600; }
.toast.error { border-color: color-mix(in srgb, var(--destructive) 40%, var(--border)); }
.toast.error svg { color: var(--destructive); }
.toast.success svg { color: var(--success); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* Misc */
.kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; color: var(--muted-foreground); background: var(--muted); font-family: var(--mono); }
.sep { height: 1px; background: var(--border); border: 0; margin: 0; }
.skeleton { background: linear-gradient(90deg, var(--muted), var(--accent), var(--muted)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.progress { height: 6px; background: var(--muted); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s; }
.progress.brand > span { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; flex: none; }
.empty { text-align: center; padding: 48px 20px; display: grid; justify-items: center; gap: 10px; }
.empty .icon-ring { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--muted); }
.empty .icon-ring svg { width: 22px; height: 22px; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: -0.03em; text-decoration: none; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; }
.logo-mark svg { width: 15px; height: 15px; }
.logo-img { width: 26px; height: 26px; border-radius: 7px; flex: none; }

/* Command palette */
.cmdk { padding: 0; }
.cmdk-input { border: 0; border-bottom: 1px solid var(--border); width: 100%; height: 50px; padding: 0 18px; font: inherit; font-size: 15px; background: transparent; color: var(--foreground); outline: none; }
.cmdk-list { max-height: 340px; overflow: auto; padding: 6px; }
.cmdk-group { font-size: 11.5px; color: var(--muted-foreground); padding: 8px 10px 4px; font-weight: 500; }
.cmdk-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--foreground); font: inherit; font-size: 13.5px; padding: 9px 10px; border-radius: 7px; cursor: pointer; text-align: left; }
.cmdk-item svg { width: 16px; height: 16px; color: var(--muted-foreground); }
.cmdk-item[aria-selected='true'] { background: var(--accent); }
