:root {
  color-scheme: light;
  --canvas: oklch(0.975 0.006 285);
  --surface: oklch(0.995 0.004 285);
  --raised: oklch(0.955 0.009 285);
  --text: oklch(0.245 0.022 282);
  --muted: oklch(0.50 0.018 282);
  --border: oklch(0.875 0.014 282);
  --accent: oklch(0.53 0.17 292);
  --accent-hover: oklch(0.47 0.17 292);
  --success: oklch(0.55 0.12 153);
  --danger: oklch(0.54 0.18 27);
  --danger-soft: oklch(0.95 0.025 27);
  --focus: oklch(0.65 0.15 292 / 0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: 0.48; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.78rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 0.68rem; font-weight: 750; letter-spacing: 0.13em; }
.product-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--text); color: var(--surface); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; }
.product-mark.small { width: 34px; height: 34px; border-radius: 8px; font-size: 0.68rem; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--canvas) 0 65%, var(--raised) 65% 100%); }
.login-panel { width: min(100%, 390px); padding: 36px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 24px 70px oklch(0.3 0.03 282 / 0.1); }
.login-panel .eyebrow { margin-top: 24px; }
.login-panel h1 { margin: 0; font-size: 1.55rem; line-height: 1.2; }
.login-copy { margin: 12px 0 28px; max-width: 45ch; color: var(--muted); font-size: 0.86rem; line-height: 1.6; }
form label, .filter-control span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 0.75rem; font-weight: 650; }
input, select { width: 100%; min-height: 40px; border: 1px solid var(--border); border-radius: 7px; padding: 8px 11px; color: var(--text); background: var(--surface); }
input:hover, select:hover { border-color: oklch(0.73 0.04 282); }
.form-error { margin: 8px 0 0; color: var(--danger); font-size: 0.78rem; }

button { min-height: 36px; border-radius: 7px; border: 1px solid transparent; padding: 7px 13px; font-size: 0.82rem; font-weight: 650; transition: background-color 160ms cubic-bezier(.25,1,.5,1), color 160ms cubic-bezier(.25,1,.5,1), opacity 160ms cubic-bezier(.25,1,.5,1); }
button.primary { margin-top: 18px; background: var(--accent); color: var(--surface); }
button.primary:hover { background: var(--accent-hover); }
button.wide { width: 100%; }
button.quiet { color: var(--muted); background: transparent; border-color: var(--border); }
button.quiet:hover { color: var(--text); background: var(--raised); }
button.secondary { color: var(--text); background: var(--surface); border-color: var(--border); }
button.secondary:hover { background: var(--raised); }
button.danger { color: var(--surface); background: var(--danger); }
button.danger-quiet { padding-left: 0; color: var(--danger); background: transparent; }
button.text-action, button.icon-action { min-height: 30px; padding: 4px 7px; color: var(--accent); background: transparent; }
button.text-action:hover, button.icon-action:hover { background: var(--raised); }

.app-shell { min-height: 100vh; }
.topbar { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--border); background: var(--surface); }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup div { display: grid; gap: 1px; }
.brand-lockup strong { font-size: 0.86rem; }
.brand-lockup span { color: var(--muted); font-size: 0.7rem; }
.workspace { width: min(100%, 90rem); margin: 0 auto; padding: 32px 28px 48px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.page-heading h1 { margin: 0; font-size: 1.55rem; letter-spacing: -0.02em; }
.page-heading > p { max-width: 53ch; margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.55; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(160px, 240px)) 1fr; align-items: end; gap: 12px; margin-bottom: 18px; }
.filters .clear { justify-self: end; }
.notice { display: flex; gap: 12px; align-items: baseline; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px; font-size: 0.8rem; }
.notice.error { border-color: oklch(0.76 0.09 27); background: var(--danger-soft); color: var(--danger); }

.data-surface { overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.table-meta { display: flex; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 0.73rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { padding: 10px 13px; color: var(--muted); background: var(--raised); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.035em; text-align: left; white-space: nowrap; }
td { padding: 12px 13px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tbody tr:not(.detail-row):hover td { background: oklch(0.98 0.009 292); }
tr.selected td { background: oklch(0.96 0.018 292); }
.identity { display: grid; gap: 2px; min-width: 150px; }
.identity strong { font-size: 0.82rem; }
.identity span, time { color: var(--muted); font-size: 0.73rem; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; font-size: 0.7rem; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.detail-row td { padding: 0; background: oklch(0.975 0.012 292); }
.detail-panel { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 16px 20px 17px 28px; }
.detail-panel dl { display: flex; flex-wrap: wrap; gap: 24px 40px; margin: 0; }
.detail-panel dl div { display: grid; gap: 5px; }
.detail-panel dt { color: var(--muted); font-size: 0.68rem; }
.detail-panel dd { margin: 0; overflow-wrap: anywhere; }
.delete-confirm { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.delete-confirm > div:first-child { display: grid; gap: 3px; }
.delete-confirm span { color: var(--muted); font-size: 0.73rem; }
.delete-confirm > div:last-child { display: flex; gap: 7px; }
.pagination { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.empty-state { display: grid; justify-items: center; gap: 7px; padding: 64px 20px; }
.empty-state strong { font-size: 0.92rem; }
.empty-state span { color: var(--muted); font-size: 0.78rem; }
.skeleton-row span { display: block; width: 100%; height: 22px; border-radius: 5px; background: linear-gradient(90deg, var(--raised), var(--canvas), var(--raised)); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }

@media (max-width: 820px) {
  .workspace { padding: 24px 16px 40px; }
  .topbar { padding: 0 16px; }
  .page-heading { display: grid; }
  .filters { grid-template-columns: 1fr; }
  .filters .clear { justify-self: stretch; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody > tr:not(.detail-row) { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 15px; border-top: 1px solid var(--border); }
  tbody > tr:first-child { border-top: 0; }
  tbody > tr:not(.detail-row) td { display: grid; grid-template-columns: 92px 1fr; padding: 0; border: 0; background: transparent; }
  td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.68rem; }
  .row-actions { justify-content: flex-start; }
  .detail-panel, .delete-confirm { align-items: stretch; flex-direction: column; }
  .detail-panel { padding: 17px; }
  .delete-confirm { gap: 12px; }
  .delete-confirm > div:last-child { justify-content: flex-end; }
}

@media (max-width: 520px) {
  .login-panel { padding: 28px 22px; }
  tbody > tr:not(.detail-row) { grid-template-columns: 1fr; }
  .page-heading > p { display: none; }
}

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