/* Feedback Bridge — design tokens (design-system/feedback-bridge/MASTER.md, monochrome override)
   shadcn/ui aesthetic: neutral zinc palette, 10px radius, 1px borders, flat surfaces, no gradients. */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Fira+Sans:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #fafafa;
  --fg: #09090b;
  --card: #ffffff;
  --card-fg: #09090b;
  --muted: #f4f4f5;
  --muted-fg: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --primary: #18181b;
  --primary-fg: #fafafa;
  --primary-hover: #27272a;
  --destructive: #dc2626;
  --destructive-fg: #fafafa;
  --ring: #18181b;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, .06);
  --shadow-md: 0 4px 16px rgba(9, 9, 11, .08);
  --shadow-lg: 0 24px 60px rgba(9, 9, 11, .18);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --font-sans: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', ui-monospace, 'SF Mono', Menlo, monospace;
  --dur: 160ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #09090b;
  --fg: #fafafa;
  --card: #121214;
  --card-fg: #fafafa;
  --muted: #18181b;
  --muted-fg: #a1a1aa;
  --border: #27272a;
  --border-strong: #3f3f46;
  --primary: #fafafa;
  --primary-fg: #18181b;
  --primary-hover: #e4e4e7;
  --destructive: #ef4444;
  --destructive-fg: #0a0a0a;
  --ring: #d4d4d8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .7);
}

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

html, body { height: 100%; }

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code, .mono, .tnum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.muted { color: var(--muted-fg); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover { background: var(--muted); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

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

.btn-outline { border-color: var(--border-strong); background: var(--card); }
.btn-outline:hover { background: var(--muted); }

.btn-ghost { color: var(--muted-fg); }
.btn-ghost:hover { color: var(--fg); }

.btn-danger { border-color: var(--border-strong); color: var(--destructive); background: var(--card); }
.btn-danger:hover { background: var(--destructive); border-color: var(--destructive); color: var(--destructive-fg); }

.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ---------- inputs ---------- */
.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none;
}
.textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted-fg); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 14%, transparent);
}
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.select {
  padding-right: 34px;
  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='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
label.field { display: block; margin-bottom: var(--space-2); font-size: 13px; font-weight: 500; }
.field-label { font-size: 13px; font-weight: 500; margin-bottom: 6px; display: block; }
.field-hint { font-size: 12px; color: var(--muted-fg); margin-top: 6px; }

/* ---------- badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-fg);
  white-space: nowrap;
}
.badge-solid { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.badge-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex: none; }
.badge-code { font-family: var(--font-mono); letter-spacing: .04em; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--muted-fg);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tab:hover { background: var(--muted); color: var(--fg); }
.tab[aria-selected='true'] { background: var(--card); color: var(--fg); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.tab .count { font-family: var(--font-mono); font-size: 12px; color: var(--muted-fg); }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted-fg);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr { cursor: pointer; transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--muted); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---------- dialog ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  background: rgba(9, 9, 11, .55);
  backdrop-filter: blur(2px);
  animation: fade var(--dur) var(--ease);
}
.dialog {
  width: 100%; max-width: 720px; max-height: 88vh; overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop 180ms var(--ease);
}
.dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 2;
}
.dialog-body { padding: var(--space-6); display: grid; gap: var(--space-5); }
.dialog-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--card);
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- misc ---------- */
.kbd {
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; color: var(--muted-fg); background: var(--muted);
}
.skeleton { background: var(--muted); border-radius: var(--radius-sm); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0%,100% { opacity: .6; } 50% { opacity: 1; } }
.stack { display: grid; gap: var(--space-3); }
.row { display: flex; align-items: center; gap: var(--space-2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--space-4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
