:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --surface-strong: #f1f5f9;
  --text: #172033;
  --text-strong: #0b1220;
  --muted: #68768a;
  --muted-strong: #405065;
  --line: #dce4ec;
  --line-soft: #edf2f6;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;
  --primary-line: #b8ccff;
  --accent: #0f766e;
  --accent-soft: #e6f7f4;
  --amber: #d97706;
  --amber-soft: #fff7ed;
  --danger: #bd3b31;
  --danger-soft: #fff0ee;
  --warning: #ad6700;
  --warning-soft: #fff4db;
  --blue: #255fbd;
  --blue-soft: #ebf3ff;
  --success: #087443;
  --success-soft: #eaf8ef;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 16px 42px rgba(19, 32, 48, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --control: 42px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scrollbar-gutter: stable;
  touch-action: pan-x pan-y;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: pan-x pan-y;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button,
input,
select,
textarea {
  font: inherit;
  touch-action: manipulation;
}

button {
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

a:focus,
button:focus {
  outline: none;
}

:focus:not(:focus-visible) {
  outline: none;
}

.auth-body {
  background:
    radial-gradient(circle at 16% 18%, rgba(37, 99, 235, 0.12), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef3f7 54%, #e8eef4 100%);
}

.app-body {
  background: var(--bg);
  position: relative;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.mobile-menu-button,
.sidebar-scrim,
.sidebar-close {
  display: none;
}

.sidebar {
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.sidebar-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}

.brand {
  align-items: center;
  border-radius: var(--radius);
  color: var(--text-strong);
  display: inline-flex;
  gap: 11px;
  letter-spacing: 0;
  min-height: 44px;
  min-width: 0;
  padding: 2px 6px;
}

.brand-logo {
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(15, 96, 123, 0.16);
  flex: 0 0 auto;
  height: 38px;
  width: 38px;
}

.brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.18;
  min-width: 0;
}

.brand-copy strong {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.brand-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  align-items: center;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted-strong);
  display: flex;
  font-weight: 750;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  position: relative;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.nav a::before {
  background: transparent;
  border-radius: 999px;
  content: "";
  flex: 0 0 auto;
  height: 18px;
  width: 3px;
}

.nav a:hover {
  background: var(--surface-strong);
  color: var(--text-strong);
}

.nav a.active {
  background: var(--primary-soft);
  box-shadow: none;
  color: var(--primary-hover);
}

.nav a.active::before {
  background: var(--primary);
}

.nav a.active {
  pointer-events: none;
}

.sidebar .nav a,
.sidebar .nav a:link,
.sidebar .nav a:visited,
.sidebar .nav a:any-link,
.sidebar .nav a:-webkit-any-link,
.sidebar .nav a:hover,
.sidebar .nav a:active,
.sidebar .nav a:focus,
.sidebar .nav a:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  text-decoration: none !important;
}

.sidebar .nav a,
.sidebar .nav a:link,
.sidebar .nav a:visited,
.sidebar .nav a:any-link,
.sidebar .nav a:-webkit-any-link {
  background: transparent;
  box-shadow: none !important;
  color: #405065 !important;
  -webkit-text-fill-color: #405065 !important;
}

.sidebar .nav a:hover {
  background: var(--surface-strong);
  color: #0b1220 !important;
  -webkit-text-fill-color: #0b1220 !important;
}

.sidebar .nav a:active {
  background: var(--surface-strong);
  color: #0b1220 !important;
  -webkit-text-fill-color: #0b1220 !important;
}

.sidebar .nav a.active,
.sidebar .nav a.active:link,
.sidebar .nav a.active:visited,
.sidebar .nav a.active:any-link,
.sidebar .nav a.active:-webkit-any-link,
.sidebar .nav a.active:hover,
.sidebar .nav a.active:focus,
.sidebar .nav a.active:focus-visible {
  background: var(--primary-soft);
  box-shadow: none !important;
  color: var(--primary-hover) !important;
  -webkit-text-fill-color: var(--primary-hover) !important;
}

.logout {
  border-top: 1px solid var(--line-soft);
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-hidden-form {
  display: none;
}

.logout span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 2px;
  padding: 11px 12px;
}

.logout strong {
  color: var(--text-strong);
  font-size: 14px;
}

.logout em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.logout button,
.button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: var(--control);
  padding: 9px 14px;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.logout button:hover,
.button:hover {
  background: var(--surface-soft);
  border-color: #c8d3df;
  color: var(--text-strong);
}

.sidebar .logout .button,
.sidebar .logout .button:link,
.sidebar .logout .button:visited,
.sidebar .logout .button:any-link,
.sidebar .logout .button:-webkit-any-link,
.sidebar .logout button {
  color: #172033 !important;
  -webkit-text-fill-color: #172033 !important;
}

.sidebar .logout .button:hover,
.sidebar .logout .button:active,
.sidebar .logout .button:focus,
.sidebar .logout .button:focus-visible,
.sidebar .logout button:hover,
.sidebar .logout button:active,
.sidebar .logout button:focus,
.sidebar .logout button:focus-visible {
  color: #0b1220 !important;
  -webkit-text-fill-color: #0b1220 !important;
}

.sidebar-action {
  all: unset;
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce4ec;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  box-sizing: border-box;
  color: #172033 !important;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 750;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  text-align: center;
  user-select: none;
  white-space: nowrap;
  width: 100%;
  -webkit-appearance: none;
  -webkit-text-fill-color: #172033 !important;
}

.sidebar-action:hover,
.sidebar-action:active,
.sidebar-action:focus,
.sidebar-action:focus-visible {
  background: #ffffff !important;
  border-color: #dce4ec !important;
  box-shadow: none !important;
  color: #172033 !important;
  outline: 0 !important;
  transform: none !important;
  -webkit-text-fill-color: #172033 !important;
}

.logout button:active,
.button:active {
  transform: translateY(1px);
}

.sidebar .logout .sidebar-action,
.sidebar .logout .sidebar-action:hover,
.sidebar .logout .sidebar-action:active,
.sidebar .logout .sidebar-action:focus,
.sidebar .logout .sidebar-action:focus-visible {
  background: #ffffff !important;
  border-color: #dce4ec !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  color: #172033 !important;
  transform: none !important;
  -webkit-text-fill-color: #172033 !important;
}

.button:focus-visible,
.logout button:focus-visible {
  border-color: var(--primary-line);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  outline: none;
}

.sidebar a,
.sidebar button,
.sidebar [role="button"],
.mobile-menu-button,
.sidebar-scrim {
  -webkit-tap-highlight-color: transparent;
}

.sidebar a:focus,
.sidebar a:focus-visible,
.sidebar button:focus,
.sidebar button:focus-visible,
.sidebar [role="button"]:focus,
.sidebar [role="button"]:focus-visible,
.mobile-menu-button:focus,
.mobile-menu-button:focus-visible,
.sidebar-scrim:focus,
.sidebar-scrim:focus-visible {
  box-shadow: none !important;
  outline: 0 !important;
}

.sidebar .nav a:focus,
.sidebar .nav a:focus-visible {
  border: 0 !important;
}

.sidebar .nav a.active:focus,
.sidebar .nav a.active:focus-visible {
  border: 0 !important;
  box-shadow: none !important;
}

.sidebar .logout .button:focus,
.sidebar .logout .button:focus-visible,
.sidebar .logout button:focus,
.sidebar .logout button:focus-visible,
.sidebar-close:focus,
.sidebar-close:focus-visible {
  border-color: var(--line) !important;
  box-shadow: none !important;
  outline: 0 !important;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.button.danger:hover {
  background: #9f3129;
  border-color: #9f3129;
  color: #ffffff;
}

.button.wide {
  width: 100%;
}

.page {
  flex: 1;
  margin: 0 auto;
  max-width: 1240px;
  padding: 34px 32px 48px;
  width: 100%;
}

.site-footer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  margin: -18px auto 24px;
  max-width: 1240px;
  padding: 0 32px;
  text-align: center;
  width: 100%;
}

.auth-body .site-footer {
  bottom: 20px;
  left: 0;
  margin: 0;
  max-width: none;
  position: fixed;
}

.dashboard-topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dashboard-topbar > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-topbar span,
.visual-head h2 {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 850;
}

.dashboard-topbar h1 {
  color: var(--text-strong);
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}

.dashboard-topbar small {
  color: var(--muted);
  font-weight: 800;
}

.dashboard-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dashboard-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--metric-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

a.metric-card:hover {
  border-color: #c4d0dd;
  border-left-color: var(--metric-color);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

.metric-card strong {
  color: var(--text-strong);
  font-size: 32px;
  line-height: 1;
}

.metric-card span {
  color: var(--muted-strong);
  font-weight: 850;
}

.metric-card.blue {
  --metric-color: var(--blue);
}

.metric-card.amber {
  --metric-color: var(--amber);
}

.metric-card.green {
  --metric-color: var(--success);
}

.dashboard-main-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
}

.dashboard-side-stack {
  display: grid;
  gap: 18px;
}

.dashboard-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  padding: 18px;
}

.weekly-panel {
  min-height: 520px;
}

.visual-head {
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.visual-head h2 {
  line-height: 1.3;
  margin: 0;
}

.visual-head strong {
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1;
}

.weekly-topic-list {
  display: grid;
  gap: 10px;
}

.weekly-topic {
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 48px;
  padding: 10px 0;
  transition: color 0.16s ease;
}

.weekly-topic:last-child {
  border-bottom: 0;
}

.weekly-topic:hover strong {
  color: var(--primary-hover);
}

.weekly-topic strong {
  align-items: center;
  color: var(--text-strong);
  display: inline-flex;
  gap: 9px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-title-icon {
  color: var(--primary);
  flex: 0 0 auto;
  height: 16px;
  width: 16px;
}

.weekly-topic span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.weekly-topic .badge {
  justify-self: end;
}

.rank-list,
.publish-legend {
  display: grid;
  gap: 13px;
}

.rank-row {
  display: grid;
  gap: 7px;
}

.rank-row div {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.rank-row span,
.publish-legend span {
  align-items: center;
  color: var(--muted-strong);
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row strong,
.publish-legend strong {
  color: var(--text-strong);
}

.rank-row i {
  background: var(--surface-strong);
  border-radius: 999px;
  display: block;
  grid-column: 1 / -1;
  height: 9px;
  overflow: hidden;
  position: relative;
}

.rank-row i::before {
  background: var(--bar-color);
  border-radius: inherit;
  content: "";
  inset: 0 auto 0 0;
  position: absolute;
  width: var(--percent);
}

.visual-bars {
  --bar-color: linear-gradient(90deg, var(--accent), var(--primary));
}

.publish-analysis {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: 160px minmax(0, 1fr);
}

.publish-donut {
  align-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-self: center;
  max-width: 160px;
  position: relative;
  width: 100%;
}

.publish-donut::after {
  background: var(--surface);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line-soft);
  content: "";
  inset: 22px;
  position: absolute;
}

.publish-donut span,
.publish-donut small {
  position: relative;
  z-index: 1;
}

.publish-donut span {
  color: var(--text-strong);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.publish-donut small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 4px;
}

.publish-legend div {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.status-dot {
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  height: 9px;
  width: 9px;
}

.status-dot.draft {
  background: var(--muted);
}

.status-dot.pending {
  background: var(--amber);
}

.status-dot.approved {
  background: var(--success);
}

.status-dot.rejected {
  background: var(--danger);
}

.status-dot.published {
  background: var(--blue);
}

.dashboard-empty {
  color: var(--muted);
  margin: 0;
  padding: 28px 8px;
  text-align: center;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  background: var(--blue-soft);
  border: 1px solid #c7dcfb;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: #1e4e96;
  font-weight: 700;
  padding: 12px 14px;
}

.flash.error {
  background: var(--danger-soft);
  border-color: #ffd0ca;
  color: var(--danger);
}

.flash.success {
  background: var(--success-soft);
  border-color: #bfe8cc;
  color: var(--success);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
}

.login-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(220, 228, 236, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 420px;
  padding: 30px;
  width: 100%;
}

.login-panel h1,
.section-head h1 {
  color: var(--text-strong);
  font-size: 26px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.22;
  margin: 0;
}

.login-panel p,
.section-head p {
  color: var(--muted);
  margin: 8px 0 0;
}

.login-panel .form {
  margin-top: 22px;
}

.demo-accounts {
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: var(--muted);
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 14px;
}

.demo-accounts strong {
  color: var(--text);
}

.section-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.filters,
.card-form,
.side-panel,
.detail-main,
.error-panel,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.filters {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  padding: 16px;
}

.filters label {
  min-width: 0;
}

.query-page-filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
}

.form-field {
  display: grid;
  gap: 7px;
}

label span,
legend,
.field-label {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid #ccd7e2;
  border-radius: var(--radius-sm);
  color: var(--text);
  min-height: var(--control);
  outline: none;
  padding: 9px 12px;
  width: 100%;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  cursor: pointer;
  padding-right: 38px;
}

select::-ms-expand {
  display: none;
}

input[type="date"] {
  color-scheme: light;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.62;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 0.9;
}

input[type="file"] {
  cursor: pointer;
  padding: 7px;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  margin-right: 12px;
  min-height: 28px;
  padding: 5px 10px;
}

input[type="file"]::file-selector-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary-hover);
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px 12px;
  border: 1.5px solid #b9c6d4;
  border-radius: 5px;
  cursor: pointer;
  display: grid;
  flex: 0 0 18px;
  height: 18px;
  margin: 0;
  min-height: 18px;
  place-items: center;
  width: 18px;
}

input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1.5px solid #b9c6d4;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  height: 18px;
  margin: 0;
  min-height: 18px;
  place-items: center;
  width: 18px;
}

input[type="checkbox"]::before {
  content: none;
}

input[type="radio"]::before {
  background: #ffffff;
  border-radius: 50%;
  content: "";
  height: 8px;
  opacity: 0;
  width: 8px;
}

input[type="checkbox"]:checked {
  background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M2.5%206.1L5%208.6L9.7%203.6%22%20stroke%3D%22white%22%20stroke-width%3D%222.1%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E");
  border-color: var(--primary);
}

input[type="radio"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="radio"]:checked::before {
  opacity: 1;
}

input[type="checkbox"]:disabled {
  background: #eef2f6;
  border-color: #d5dee8;
  cursor: not-allowed;
}

input[type="radio"]:disabled {
  background: #eef2f6;
  border-color: #d5dee8;
  cursor: not-allowed;
}

.check:has(input[type="checkbox"]:checked),
.check:has(input[type="radio"]:checked) {
  background: var(--primary-soft);
  border-color: var(--primary-line);
}

.check:has(input[type="checkbox"]:focus-visible),
.check:has(input[type="radio"]:focus-visible) {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

textarea {
  line-height: 1.65;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #99a6b5;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b7c5d4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #eef2f6;
  color: #8895a7;
  cursor: not-allowed;
}

.filter-actions,
.actions,
.side-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-actions {
  align-self: end;
}

.table-wrap {
  overflow: auto;
  scrollbar-color: #b7c5d4 transparent;
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar,
.modal-panel::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-wrap::-webkit-scrollbar-thumb,
.modal-panel::-webkit-scrollbar-thumb {
  background: #bdc9d6;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  position: sticky;
  top: 0;
  white-space: nowrap;
  z-index: 1;
}

tbody tr {
  transition: background-color 0.16s ease;
}

tbody tr:hover {
  background: #fbfcfe;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: -3px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 14px;
}

.pagination-summary {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.pagination-pages {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.pagination-link,
.pagination-ellipsis {
  align-items: center;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  min-width: 34px;
  padding: 6px 10px;
}

.pagination-link {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.pagination-link:hover {
  background: var(--surface-strong);
  border-color: #c4d0dd;
  color: var(--text-strong);
}

.pagination-link.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  pointer-events: none;
}

.pagination-link.disabled {
  background: #eef2f6;
  border-color: var(--line);
  color: #8a98aa;
  pointer-events: none;
}

.pagination-ellipsis {
  color: var(--muted);
  min-width: 24px;
  padding-left: 4px;
  padding-right: 4px;
}

td small {
  color: var(--muted);
  display: block;
  line-height: 1.55;
  margin-top: 5px;
  max-width: 440px;
}

.title-link {
  color: var(--text-strong);
  font-weight: 800;
}

.title-link:hover {
  color: var(--primary);
}

.empty {
  color: var(--muted);
  padding: 34px 16px;
  text-align: center;
}

.badge {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  padding: 6px 10px;
  white-space: nowrap;
}

.badge.large {
  font-size: 14px;
  padding: 9px 13px;
}

.badge.draft {
  background: #f1f4f8;
  border-color: #e2e8f0;
  color: var(--muted-strong);
}

.badge.pending {
  background: var(--warning-soft);
  border-color: #ffe0a3;
  color: var(--warning);
}

.badge.approved {
  background: var(--success-soft);
  border-color: #bfe8cc;
  color: var(--success);
}

.badge.rejected {
  background: var(--danger-soft);
  border-color: #ffd2ca;
  color: var(--danger);
}

.badge.published {
  background: var(--blue-soft);
  border-color: #c8dcfb;
  color: var(--blue);
}

.card-form {
  max-width: 820px;
  padding: 22px;
}

.card-form > label,
.card-form > .form-field,
.card-form > .approval-field,
.card-form > .approval-add-row,
.card-form > fieldset,
.card-form > .form-note {
  max-width: 760px;
}

.card-form h2 {
  color: var(--text-strong);
  font-size: 18px;
  margin: 0;
}

.compact-form {
  max-width: none;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0;
  padding: 14px;
}

legend {
  padding: 0 6px;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.check {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  gap: 9px;
  min-height: 40px;
  padding: 9px 11px;
}

.check:hover {
  background: var(--surface);
  border-color: #c4d0dd;
}

.check input {
  flex: 0 0 auto;
}

.inline-check {
  justify-content: start;
  width: fit-content;
}

.approval-add-row[hidden],
.approval-extra-field[hidden] {
  display: none !important;
}

.approval-add-row {
  display: flex;
  justify-content: flex-start;
}

.approval-add-button {
  min-height: 38px;
}

.approval-extra-field {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.approval-extra-field label {
  min-width: 0;
}

.approval-remove-button {
  min-height: var(--control);
  white-space: nowrap;
}

.permission-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 360px minmax(0, 1fr);
}

.admin-grid-single {
  grid-template-columns: 1fr;
}

.admin-table table {
  min-width: 760px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, 0.46);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 30;
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-scrim {
  background: transparent;
  cursor: default;
  inset: 0;
  padding: 0;
  position: absolute;
}

.modal-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: calc(100vh - 48px);
  max-width: 620px;
  overflow: auto;
  padding: 22px;
  position: relative;
  width: min(620px, 100%);
  z-index: 1;
  scrollbar-color: #b7c5d4 transparent;
  scrollbar-width: thin;
}

.modal-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-head h2 {
  color: var(--text-strong);
  font-size: 18px;
  margin: 0;
}

.export-modal-panel {
  max-width: 720px;
  width: min(720px, 100%);
}

.export-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.export-field-check {
  min-width: 0;
}

.export-field-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-actions {
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
  padding-top: 16px;
}

.permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 440px;
}

.permission-tags span {
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-radius: 999px;
  color: var(--primary-hover);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.form-note {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  padding: 12px 14px;
}

.person-tags {
  align-items: center;
  background: var(--surface);
  border: 1px solid #ccd7e2;
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: var(--control);
  padding: 7px;
  width: 100%;
}

.person-tags:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  outline: none;
}

.person-tags.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(189, 59, 49, 0.12);
}

.person-tag {
  align-items: center;
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-radius: 999px;
  color: var(--primary-hover);
  display: inline-flex;
  font-size: 13px;
  font-weight: 850;
  gap: 4px;
  min-height: 28px;
  padding: 4px 9px;
}

.person-tag-remove,
.person-add-button {
  align-items: center;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
}

.person-tag-remove {
  background: transparent;
  color: var(--primary-hover);
  font-size: 18px;
  height: 20px;
  line-height: 1;
  padding: 0;
  width: 20px;
}

.person-tag-remove:hover {
  background: rgba(37, 99, 235, 0.1);
}

.person-add-button {
  background: var(--surface-soft);
  border: 1px dashed #aebdcb;
  color: var(--muted-strong);
  font-size: 21px;
  font-weight: 750;
  height: 30px;
  line-height: 1;
  padding: 0 0 2px;
  width: 30px;
}

.person-add-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary-hover);
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
}

.reporter-picker-modal[hidden] {
  display: none !important;
}

.reporter-picker-modal .modal-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reporter-picker-form {
  min-height: 0;
}

.reporter-option-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  max-height: min(330px, 44vh);
  overflow: auto;
  padding: 10px;
}

.reporter-option {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 48px;
  padding: 9px 11px;
}

.reporter-option:hover {
  background: var(--surface);
  border-color: #c4d0dd;
}

.reporter-option input:disabled {
  cursor: not-allowed;
}

.reporter-option input:disabled + span {
  color: var(--muted);
}

.reporter-option strong {
  color: var(--text-strong);
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.reporter-option small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.reporter-picker-actions {
  background: var(--surface);
  border-top: 1px solid var(--line);
  bottom: -22px;
  margin: 4px -22px -22px;
  padding: 14px 22px;
  position: sticky;
  z-index: 2;
}

.detail-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.detail-main,
.side-panel,
.error-panel {
  padding: 22px;
}

.topic-info-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-bottom: 18px;
}

.topic-info-head div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.topic-info-head span:not(.badge),
.topic-summary span,
.readership-record-head span,
.approval-panel-head p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.topic-info-head h2 {
  color: var(--text-strong);
  font-size: 24px;
  line-height: 1.3;
  margin: 0;
}

.topic-summary {
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 8px;
  padding: 18px 0;
}

.topic-summary p,
.readership-record p {
  color: var(--text);
  line-height: 1.8;
  margin: 0;
  white-space: pre-wrap;
}

.readership-record {
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 10px;
  padding: 18px 0;
}

.readership-record-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.readership-edit-button {
  background: transparent;
  border: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 2px 0;
}

.readership-edit-button:hover {
  color: var(--primary-hover);
}

.readership-record-form {
  display: grid;
  gap: 10px;
}

.readership-record-form[hidden],
.readership-record p[hidden],
.readership-edit-button[hidden] {
  display: none;
}

.readership-record-actions {
  display: flex;
  gap: 10px;
}

.empty-text {
  color: var(--muted) !important;
}

.topic-meta-grid {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.topic-meta-grid div {
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 5px;
  padding: 16px 0;
}

.topic-meta-grid div:last-child {
  border-bottom: 0;
}

.topic-meta-grid div:nth-child(odd) {
  padding-right: 18px;
}

.topic-meta-grid div:nth-child(even) {
  border-left: 1px solid var(--line-soft);
  padding-left: 18px;
}

.topic-meta-grid dt {
  color: var(--muted);
  font-size: 13px;
}

.topic-meta-grid dd {
  color: var(--text-strong);
  font-weight: 800;
  line-height: 1.5;
  margin: 0;
}

.approval-panel {
  position: sticky;
  top: 22px;
}

.approval-panel-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.approval-panel-head h2 {
  color: var(--text-strong);
  font-size: 18px;
  margin: 0 0 4px;
}

.approval-panel-head p {
  margin: 0;
}

.approval-state-note {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted-strong);
  font-weight: 750;
  line-height: 1.6;
  margin: 14px 0 18px;
  padding: 10px 12px;
}

.approval-timeline {
  display: grid;
  gap: 0;
}

.approval-timeline-item {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 88px;
  position: relative;
}

.approval-timeline-item:not(:last-child)::after {
  background: var(--line);
  content: "";
  inset: 30px auto 0 13px;
  position: absolute;
  width: 2px;
}

.approval-timeline-marker {
  align-items: center;
  background: var(--surface);
  border: 2px solid #c8d3df;
  border-radius: 50%;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 850;
  height: 28px;
  justify-content: center;
  position: relative;
  width: 28px;
  z-index: 1;
}

.approval-timeline-content {
  display: grid;
  gap: 6px;
  padding: 0 0 18px;
}

.approval-timeline-title {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.approval-timeline-title strong {
  color: var(--text-strong);
  font-size: 14px;
}

.approval-timeline-title span,
.approval-timeline-content em {
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  justify-self: start;
  line-height: 1;
  padding: 5px 8px;
  white-space: nowrap;
}

.approval-timeline-content p {
  color: var(--text);
  font-weight: 750;
  line-height: 1.5;
  margin: 0;
}

.approval-timeline-content small,
.approval-timeline-content time,
.approval-comment {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.approval-timeline-content small::before {
  color: var(--muted);
  content: " · ";
}

.approval-comment {
  background: var(--surface-soft);
  border-left: 3px solid var(--line);
  line-height: 1.6 !important;
  padding: 8px 10px;
}

.approval-timeline-item.approved .approval-timeline-marker,
.approval-timeline-item.approved .approval-timeline-title span {
  background: var(--success-soft);
  border-color: #26a269;
  color: var(--success);
}

.approval-timeline-item.current .approval-timeline-marker,
.approval-timeline-item.current .approval-timeline-title span,
.approval-timeline-item.current .approval-timeline-content em {
  background: var(--warning-soft);
  border-color: #f0a22c;
  color: var(--warning);
}

.approval-timeline-item.rejected .approval-timeline-marker,
.approval-timeline-item.rejected .approval-timeline-title span {
  background: var(--danger-soft);
  border-color: #df665a;
  color: var(--danger);
}

.approval-timeline-item.waiting .approval-timeline-title span {
  background: #eef2f7;
  color: var(--muted-strong);
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  color: var(--text-strong);
  font-weight: 750;
  margin: 0 0 8px;
}

.side-actions {
  align-items: stretch;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.approval-box {
  display: grid;
  gap: 12px;
  width: 100%;
}

.error-panel {
  margin: 80px auto;
  max-width: 520px;
  text-align: center;
}

.error-panel h1 {
  color: var(--text-strong);
  margin: 0 0 10px;
}

.error-panel p {
  color: var(--muted);
  margin: 0 0 20px;
}

:focus-visible {
  outline: none;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .mobile-menu-button {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    color: var(--text-strong);
    height: 42px;
    justify-content: center;
    left: 14px;
    padding: 0;
    position: absolute;
    top: 14px;
    width: 42px;
    z-index: 42;
  }

  .app-body.sidebar-open .mobile-menu-button {
    opacity: 0;
    pointer-events: none;
  }

  .sidebar-scrim {
    background: rgba(15, 23, 42, 0.34);
    display: block;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 0.18s ease;
    z-index: 39;
  }

  .app-body.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    border-bottom: 0;
    border-right: 1px solid var(--line);
    gap: 14px;
    height: 100vh;
    height: 100dvh;
    left: 0;
    max-width: min(86vw, 340px);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 18px 16px;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: 320px;
    z-index: 40;
  }

  .app-body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text-strong);
    cursor: pointer;
    display: flex;
    height: 42px;
    justify-content: center;
    padding: 0;
    width: 42px;
  }

  .nav {
    display: grid;
  }

  .nav a {
    flex: initial;
  }

  .logout {
    align-items: stretch;
    border-top: 1px solid var(--line-soft);
    display: grid;
    margin-top: 10px;
    padding-top: 16px;
  }

  .logout span {
    min-width: 0;
  }

  .page {
    padding: 76px 18px 38px;
  }

  .section-head,
  .detail-grid,
  .admin-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: start;
  }

  .approval-panel {
    position: static;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-topbar,
  .dashboard-actions {
    display: grid;
  }

  .dashboard-topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .dashboard-topbar > div,
  .dashboard-actions {
    justify-self: stretch;
    min-width: 0;
    justify-content: stretch;
    width: 100%;
  }

  .dashboard-actions .button {
    display: flex;
    justify-self: stretch;
    min-height: var(--control);
    max-width: none;
    width: 100%;
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .brand {
    font-size: 15px;
    padding: 0;
  }

  .nav a,
  .logout button,
  .button {
    min-height: 40px;
    padding: 8px 11px;
  }

  .login-shell {
    padding: 14px;
    align-content: start;
    padding-top: 15vh;
  }

  .login-panel,
  .card-form,
  .detail-main,
  .side-panel,
  .error-panel,
  .dashboard-panel {
    padding: 18px;
  }

  .section-head h1,
  .login-panel h1,
  .dashboard-topbar h1 {
    font-size: 23px;
  }

  .weekly-topic,
  .publish-analysis {
    display: grid;
  }

  .weekly-topic {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .weekly-topic span {
    grid-column: 1;
    grid-row: 2;
  }

  .weekly-topic .badge {
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
  }

  .dashboard-actions .button {
    min-height: var(--control);
    padding: 10px 14px;
  }

  .dashboard-cards {
    grid-template-columns: 1fr;
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 86px;
  }

  .publish-donut {
    max-width: 150px;
  }

  .filters,
  .export-fields,
  .permission-checks,
  .topic-meta-grid {
    grid-template-columns: 1fr;
  }

  .topic-info-head {
    display: grid;
  }

  .topic-info-head .badge {
    justify-self: start;
  }

  .topic-meta-grid div,
  .topic-meta-grid div:nth-child(odd),
  .topic-meta-grid div:nth-child(even) {
    border-left: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .filter-actions,
  .actions,
  .side-actions {
    align-items: stretch;
  }

  .pagination {
    align-items: stretch;
    display: grid;
  }

  .pagination-summary,
  .pagination-pages {
    justify-content: center;
    white-space: normal;
  }

  .approval-extra-field {
    grid-template-columns: 1fr;
  }

  .filter-actions .button,
  .actions .button,
  .side-actions .button,
  .side-actions form,
  .side-actions button {
    width: 100%;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 14px;
  }

  .modal-panel {
    max-height: calc(100vh - 28px);
    padding: 18px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .reporter-picker-actions {
    bottom: -18px;
    margin: 4px -18px -18px;
    padding: 14px 18px;
  }
}

.button,
button.button,
a.button,
a.button:link,
a.button:visited,
a.button:any-link,
a.button:-webkit-any-link {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: #ffffff !important;
  border: 1px solid #dce4ec !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  color: #172033 !important;
  outline: 0 !important;
  transform: none !important;
  -webkit-text-fill-color: #172033 !important;
}

.button:hover,
.button:active,
.button:focus,
.button:focus-visible,
button.button:hover,
button.button:active,
button.button:focus,
button.button:focus-visible,
a.button:hover,
a.button:active,
a.button:focus,
a.button:focus-visible {
  background: #ffffff !important;
  border-color: #c8d3df !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  color: #172033 !important;
  outline: 0 !important;
  transform: none !important;
  -webkit-text-fill-color: #172033 !important;
}

.button.primary,
button.button.primary,
a.button.primary,
a.button.primary:link,
a.button.primary:visited,
a.button.primary:any-link,
a.button.primary:-webkit-any-link {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.button.primary:hover,
.button.primary:active,
.button.primary:focus,
.button.primary:focus-visible,
button.button.primary:hover,
button.button.primary:active,
button.button.primary:focus,
button.button.primary:focus-visible,
a.button.primary:hover,
a.button.primary:active,
a.button.primary:focus,
a.button.primary:focus-visible {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  -webkit-text-fill-color: #ffffff !important;
}

.button.danger,
button.button.danger {
  background: #bd3b31 !important;
  border-color: #bd3b31 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.button.danger:hover,
.button.danger:active,
.button.danger:focus,
.button.danger:focus-visible,
button.button.danger:hover,
button.button.danger:active,
button.button.danger:focus,
button.button.danger:focus-visible {
  background: #9f3129 !important;
  border-color: #9f3129 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.sidebar-action,
.sidebar-action:hover,
.sidebar-action:active,
.sidebar-action:focus,
.sidebar-action:focus-visible {
  background: #ffffff !important;
  border-color: #dce4ec !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  color: #172033 !important;
  outline: 0 !important;
  transform: none !important;
  -webkit-text-fill-color: #172033 !important;
}

@keyframes page-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tap-ripple {
  from {
    opacity: 0.34;
    transform: scale(0);
  }

  to {
    opacity: 0;
    transform: scale(2.4);
  }
}

@keyframes flash-sheen {
  from {
    transform: translateX(-110%);
  }

  to {
    transform: translateX(110%);
  }
}

@keyframes badge-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.22);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(217, 119, 6, 0);
  }
}

@keyframes timeline-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.24);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(217, 119, 6, 0);
  }
}

@keyframes tag-pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.965);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes scrim-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.auth-body,
.app-body {
  overflow-x: hidden;
}

.app-body::before {
  background:
    linear-gradient(rgba(37, 99, 235, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 58%);
  opacity: 0.42;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.auth-body {
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.11), transparent 34%),
    linear-gradient(240deg, rgba(15, 118, 110, 0.11), transparent 36%),
    linear-gradient(135deg, #f8fafc 0%, #eef3f7 54%, #e8eef4 100%);
}

.page,
.login-panel {
  animation: page-rise 0.46s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.filters,
.card-form,
.side-panel,
.detail-main,
.error-panel,
.table-wrap,
.login-panel {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.button,
button.button,
a.button,
.sidebar-action,
.nav a,
.pagination-link,
.check,
.reporter-option {
  isolation: isolate;
  overflow: hidden;
  position: relative !important;
}

.button::before,
.sidebar-action::before,
.nav a::after,
.pagination-link::before {
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.72) 48%, transparent 100%);
  content: "";
  inset: -1px auto -1px -60%;
  pointer-events: none;
  position: absolute;
  transform: skewX(-16deg);
  transition: left 0.44s ease;
  width: 42%;
  z-index: -1;
}

.button:hover::before,
.sidebar-action:hover::before,
.nav a:hover::after,
.pagination-link:hover::before {
  left: 118%;
}

.tap-ripple {
  animation: tap-ripple 0.58s ease-out forwards;
  background: currentColor;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: scale(0);
  z-index: 0;
}

.button > :not(.tap-ripple),
.sidebar-action > :not(.tap-ripple),
.nav a > :not(.tap-ripple),
.pagination-link > :not(.tap-ripple),
.check > :not(.tap-ripple),
.reporter-option > :not(.tap-ripple) {
  position: relative;
  z-index: 1;
}

.button,
button.button,
a.button,
a.button:link,
a.button:visited,
a.button:any-link,
a.button:-webkit-any-link {
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}

.button:hover,
button.button:hover,
a.button:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09) !important;
  transform: translateY(-1px) !important;
}

.button:active,
button.button:active,
a.button:active {
  transform: translateY(1px) scale(0.99) !important;
}

.button.primary:hover,
button.button.primary:hover,
a.button.primary:hover {
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.24) !important;
}

.button.danger:hover,
button.button.danger:hover {
  box-shadow: 0 14px 30px rgba(189, 59, 49, 0.22) !important;
}

.button.is-loading {
  pointer-events: none;
}

.button.is-loading::after {
  animation: spinner 0.72s linear infinite;
  border: 2px solid rgba(23, 32, 51, 0.22);
  border-top-color: #172033;
  border-radius: 50%;
  content: "";
  height: 15px;
  margin-left: 8px;
  width: 15px;
}

.button.primary.is-loading,
.button.danger.is-loading {
  color: rgba(255, 255, 255, 0.9) !important;
}

.button.primary.is-loading::after,
.button.danger.is-loading::after {
  border-color: rgba(255, 255, 255, 0.46);
  border-top-color: #ffffff;
}

.nav a {
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease !important;
}

.sidebar .nav a:hover {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08) !important;
  transform: translateX(3px);
}

.sidebar .nav a.active {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12), 0 8px 18px rgba(37, 99, 235, 0.08) !important;
}

.nav a::before {
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.nav a:hover::before,
.nav a.active::before {
  transform: scaleY(1.34);
}

.nav-notice-dot {
  background: var(--danger);
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(189, 59, 49, 0.14);
  flex: 0 0 auto;
  height: 10px;
  margin-left: auto;
  width: 10px;
}

.brand-logo {
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.brand:hover .brand-logo {
  box-shadow: 0 14px 30px rgba(15, 96, 123, 0.22);
  transform: rotate(-2deg) scale(1.04);
}

.flash {
  animation: panel-pop 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  overflow: hidden;
  position: relative;
}

.flash::after {
  animation: flash-sheen 2.2s ease 0.28s both;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

input,
select,
textarea,
.person-tags {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

label:has(input:focus),
label:has(select:focus),
label:has(textarea:focus),
.form-field:has(.person-tags:focus) {
  color: var(--primary-hover);
}

input:focus,
select:focus,
textarea:focus,
.person-tags:focus {
  transform: translateY(-1px);
}

.check {
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.check:hover {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.check:has(input[type="checkbox"]:checked),
.check:has(input[type="radio"]:checked) {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.1), 0 8px 18px rgba(37, 99, 235, 0.08);
}

input[type="checkbox"],
input[type="radio"] {
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  transform: scale(1.08);
}

tbody tr {
  animation: panel-pop 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: background-color 0.16s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

tbody tr:nth-child(2) {
  animation-delay: 0.035s;
}

tbody tr:nth-child(3) {
  animation-delay: 0.07s;
}

tbody tr:nth-child(4) {
  animation-delay: 0.105s;
}

tbody tr:nth-child(5) {
  animation-delay: 0.14s;
}

tbody tr:nth-child(6) {
  animation-delay: 0.175s;
}

.clickable-row:hover {
  background: linear-gradient(90deg, rgba(234, 241, 255, 0.8), rgba(251, 252, 254, 0.96) 44%, #ffffff);
  box-shadow: inset 3px 0 0 var(--primary);
}

.clickable-row:hover td {
  background: transparent;
}

.title-link {
  transition: color 0.16s ease, text-shadow 0.16s ease;
}

.clickable-row:hover .title-link {
  text-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
}

.badge {
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.badge:hover {
  transform: translateY(-1px);
}

.badge.pending {
  animation: badge-breathe 2.6s ease-in-out infinite;
}

.person-tag {
  animation: tag-pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.person-tag-remove,
.person-add-button {
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.person-tag-remove:hover,
.person-add-button:hover {
  transform: scale(1.08);
}

.approval-extra-field {
  animation: panel-pop 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal-backdrop {
  animation: scrim-fade 0.2s ease both;
}

.modal-panel {
  animation: modal-pop 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.reporter-option {
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.reporter-option:hover {
  box-shadow: 0 9px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.approval-timeline-item {
  animation: panel-pop 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.approval-timeline-item:nth-child(2) {
  animation-delay: 0.06s;
}

.approval-timeline-item:nth-child(3) {
  animation-delay: 0.12s;
}

.approval-timeline-marker {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.approval-timeline-item.current .approval-timeline-marker {
  animation: timeline-pulse 2.3s ease-in-out infinite;
  transform: scale(1.04);
}

.approval-state-note {
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.approval-panel:hover .approval-state-note {
  background: var(--amber-soft);
  border-color: #fed7aa;
}

.pagination-link {
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.18s ease, color 0.16s ease, transform 0.18s ease;
}

.pagination-link:hover {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

@media (max-width: 1040px) {
  .sidebar {
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s ease;
  }

  .app-body.sidebar-open .sidebar {
    box-shadow: 20px 0 54px rgba(15, 23, 42, 0.22);
  }

  .sidebar-scrim {
    backdrop-filter: blur(4px);
    transition: opacity 0.22s ease, backdrop-filter 0.22s ease;
  }
}

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

  .tap-ripple {
    display: none !important;
  }
}
