:root {
  font-family: "DM Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1e293b;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1e293b;
  --muted: #788397;
  --line: #e8ecf3;
  --blue: #4169e1;
  --blue-deep: #3156c5;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f5f7fb; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }

.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(28px, calc((100vw - 1200px) / 2)); background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: -.35px; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: #fff; background: linear-gradient(145deg, #637ff1, #385bc9); font-weight: 700; font-size: 16px; box-shadow: 0 4px 8px #4969dc30; }
.top-actions { display: flex; align-items: center; gap: 24px; color: #58657b; font-size: 14px; }
.top-actions a:hover, .link-button:hover { color: var(--blue); }
.top-actions form { margin: 0; }
.link-button { padding: 0; color: #58657b; border: 0; background: transparent; font-size: 14px; }
.main-shell { width: min(1200px, calc(100% - 48px)); min-height: calc(100vh - 127px); margin: 0 auto; padding: 42px 0 64px; }
.footer { padding: 20px; color: #9aa3b2; text-align: center; font-size: 12px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-heading h1, .login-card h1 { margin: 4px 0 7px; color: var(--ink); font-size: clamp(24px, 3vw, 30px); letter-spacing: -.8px; }
.page-heading p, .login-card p { margin: 0; }
.eyebrow { color: #73819a; font-size: 11px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 600; transition: background .15s, border-color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--blue); box-shadow: 0 4px 10px #4169e124; }
.button-primary:hover { background: var(--blue-deep); }
.button-secondary { color: #48566d; border-color: #dfe5ee; background: #fff; }
.button-secondary:hover { border-color: #bcc9dc; background: #fbfcff; }
.button-wide { width: 100%; }
.filters { display: flex; align-items: center; gap: 10px; padding: 15px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.filters input, .filters select, .form-grid input, .form-grid select, .form-grid textarea, .stack-form input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #dfe5ee; border-radius: 7px; outline: 0; color: #334155; background: #fff; font-size: 13px; }
.filters input:focus, .filters select:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .stack-form input:focus { border-color: #8da4f3; box-shadow: 0 0 0 3px #4169e11a; }
.search-field { flex: 1 1 auto; min-width: 180px; }
.filters select { width: auto; min-width: 132px; }
.table-card, .form-card { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 2px 8px #1c315006; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 13px 15px; color: #8390a3; background: #fbfcfe; text-align: left; font-size: 11px; font-weight: 600; }
td { padding: 15px; border-top: 1px solid #eef1f6; color: #4c596e; font-size: 12px; vertical-align: middle; }
tbody tr:hover { background: #fcfdff; }
.name-cell { min-width: 180px; color: #26334a; }
.subline { display: block; margin-top: 4px; color: #929caf; font-size: 11px; }
.tagline { display: block; max-width: 210px; overflow: hidden; margin-top: 5px; color: #7085c5; font-size: 10px; text-overflow: ellipsis; }
.category-pill { display: inline-block; padding: 4px 7px; border-radius: 5px; color: #526485; background: #f1f4f9; font-size: 10px; }
.status { display: inline-block; padding: 5px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; }
.status-active { color: #32835a; background: #e9f7ef; }
.status-upcoming { color: #a36914; background: #fff4df; }
.status-today, .status-expired { color: #b94040; background: #fff0ef; }
.status-archived { color: #6e7788; background: #eef0f4; }
.renew-on { color: #4f8a67; font-size: 11px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.row-actions form { display: inline; margin: 0; }
.small-action { padding: 0; border: 0; background: transparent; color: #607089; font-size: 11px; }
.small-action:hover { color: var(--blue); }
.danger-text { color: #ba5656; }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 18px; color: #6680e5; background: #edf1ff; font-size: 32px; font-weight: 300; }
.empty-state h2 { margin: 0 0 8px; font-size: 18px; }
.empty-state p { margin: 0 0 20px; }
.login-wrap { display: grid; min-height: 64vh; place-items: center; }
.login-card { width: min(410px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 10px 30px #263b5a0d; }
.login-card h1 { margin: 6px 0 8px; }
.stack-form { display: grid; gap: 17px; margin-top: 26px; }
.stack-form label, .form-grid label { display: grid; gap: 7px; color: #536178; font-size: 12px; font-weight: 600; }
.alert { padding: 11px 13px; margin: 0 0 16px; border-radius: 8px; font-size: 13px; }
.alert-error { border: 1px solid #f1d1cf; color: #a6423f; background: #fff3f2; }
.form-heading { margin-bottom: 18px; }
.back-link { display: inline-block; margin-bottom: 17px; color: #71809a; font-size: 12px; }
.back-link:hover { color: var(--blue); }
.form-card { padding: 26px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.checkbox-field { display: flex !important; align-items: flex-start; gap: 10px !important; padding: 13px; border-radius: 8px; background: #f7f9fc; }
.checkbox-field input { width: 16px; min-height: 16px; margin: 1px 0 0; accent-color: var(--blue); }
.checkbox-field span { display: grid; gap: 4px; }
.checkbox-field small { color: #8692a5; font-size: 11px; font-weight: 400; }
.form-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 22px; margin-top: 24px; border-top: 1px solid var(--line); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .topbar { height: 60px; padding: 0 18px; }
  .main-shell { width: calc(100% - 32px); padding-top: 28px; }
  .page-heading { align-items: flex-start; }
  .page-heading > .button { flex-shrink: 0; }
  .filters { align-items: stretch; flex-wrap: wrap; }
  .search-field { flex: 1 0 100%; }
  .filters label:not(.search-field) { flex: 1; }
  .filters select { width: 100%; min-width: 0; }
  .form-card { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 15px; }
  .span-2 { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
