:root {
  color-scheme: light;
  --bg: #f4f4f5;
  --bg-elevated: rgba(255, 255, 255, 0.8);
  --card: #ffffff;
  --muted: #f4f4f5;
  --text: #09090b;
  --subtle: #71717a;
  --border: rgba(9, 9, 11, 0.08);
  --accent: #1d4ed8;
  --accent-fg: #ffffff;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --err: #be123c;
  --err-bg: #fff1f2;
  --ring: #1d4ed8;
  --shadow: 0 1px 2px rgba(9, 9, 11, 0.05);
  --header: 64px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --bg-elevated: rgba(9, 9, 11, 0.8);
  --card: #111113;
  --muted: #18181b;
  --text: #fafafa;
  --subtle: #a1a1aa;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #60a5fa;
  --accent-fg: #082f49;
  --ok: #34d399;
  --ok-bg: rgba(16, 185, 129, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --err: #fb7185;
  --err-bg: rgba(244, 63, 94, 0.12);
  --ring: #60a5fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Plus Jakarta Sans", "Segoe UI", "Arial Hebrew", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body, .bar, .card, .tile, .stat, button, .link-btn, input, select {
  transition: background-color 200ms ease-out, color 200ms ease-out, border-color 200ms ease-out, box-shadow 200ms ease-out;
}
a { color: inherit; }
button, .link-btn, .icon-btn {
  font: inherit;
  cursor: pointer;
}
button, .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
button:hover, .link-btn:hover { filter: brightness(1.05); }
button:active, .link-btn:active { transform: translateY(1px); }
button:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible,
input:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ring);
}
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button.ghost, .link-btn.ghost, .tab {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}
button.ghost:hover, .link-btn.ghost:hover, .tab:hover {
  filter: none;
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  border-color: color-mix(in srgb, var(--text) 20%, transparent);
}
button.danger {
  background: var(--err-bg);
  color: var(--err);
  border-color: transparent;
  box-shadow: none;
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header);
  padding: 12px 16px;
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}
.bar-brand img { width: 36px; height: 36px; border-radius: 999px; }
.bar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.bar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bar nav:empty { display: none; }
.bar form { margin: 0; }
.who { color: var(--subtle); font-size: 13px; font-weight: 600; }

.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 64px; }
.page-title { margin: 0 0 24px; }
.page-title h1, h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
h2 { margin: 0 0 16px; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.product, .lede { margin: 8px 0 0; color: var(--subtle); font-size: 15px; font-weight: 500; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.card {
  width: min(1120px, 100%);
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.login-card {
  width: min(400px, 100%);
  margin: 8vh auto 0;
  padding: 24px;
  text-align: center;
}
.login-card .logo { width: min(148px, 46vw); height: auto; display: block; margin: 0 auto 8px; }
.login-card h1 { margin-top: 8px; font-size: 32px; }
.login-card .product { margin-top: 8px; font-size: 14px; }
.brand-line { display: flex; align-items: center; justify-content: center; gap: 8px; }
.fc-icon { width: 22px; height: 22px; border-radius: 999px; display: block; }
.stack { display: grid; gap: 0; text-align: right; margin-top: 16px; }
label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 600; text-align: right; }
input, select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}
.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
  font-size: 13px;
  font-weight: 600;
}
.remember input { width: 16px; height: 16px; min-height: 16px; padding: 0; }
.login-card button[type="submit"] { width: 100%; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 168px;
  padding: 24px;
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.tile:hover { border-color: color-mix(in srgb, var(--text) 20%, transparent); background: color-mix(in srgb, var(--muted) 40%, var(--card)); }
.tile h2 { margin: 0; font-size: 18px; }
.tile p { margin: 0; color: var(--subtle); font-weight: 500; }

.tabs { display: flex; gap: 8px; margin: 0 0 20px; }
.tab.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.msg { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--muted); font-weight: 600; }
.msg.ok { color: var(--ok); background: var(--ok-bg); }
.msg.err { color: var(--err); background: var(--err-bg); }
.role { color: var(--subtle); font-size: 12px; font-weight: 600; }
code.path {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--muted);
  font-size: 13px;
}

.filters { display: grid; gap: 12px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.stat {
  padding: 16px;
  border-radius: 16px;
  background: var(--muted);
  border: 1px solid var(--border);
}
.stat span { display: block; color: var(--subtle); font-size: 12px; font-weight: 600; }
.stat strong { display: block; margin-top: 8px; font-size: 22px; letter-spacing: -0.03em; line-height: 1.2; }
.add-grid, .pass-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.add-grid > div { flex: 1 1 160px; }
.pass-form input { width: min(180px, 100%); }
.actions { display: flex; justify-content: flex-end; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--subtle); font-size: 12px; font-weight: 600; }
tr:last-child td { border-bottom: 0; }

@media (min-width: 800px) {
  .filters.three { grid-template-columns: 1fr 1fr 1.4fr auto; align-items: end; }
}
@media (prefers-reduced-motion: reduce) {
  body, .bar, .card, .tile, .stat, button, .link-btn, input, select { transition: none; }
}
@media (min-width: 980px) {
  .bar { flex-direction: row; align-items: center; }
  .bar-top { width: auto; }
}
@media (max-width: 979px) {
  .bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
  .bar nav { width: 100%; }
}
@media (max-width: 700px) {
  .shell { width: min(1120px, calc(100% - 24px)); padding-top: 20px; }
  .card { padding: 16px; }
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; }
  td { border: 0; padding: 6px 0; }
  .actions { justify-content: flex-start; }
}
