:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-strong: #e8eef8;
  --surface: #ffffff;
  --surface-muted: #f7faff;
  --line: #dce5f1;
  --line-strong: #c6d2e3;
  --text: #0f172a;
  --muted: #64748b;
  --muted-strong: #334155;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #dbeafe;
  --accent: #10b981;
  --accent-soft: #d1fae5;
  --warning: #b7791f;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.13);
  --scrollbar-size: 8px;
  --scrollbar-track: rgba(37, 99, 235, 0.08);
  --scrollbar-thumb: rgba(37, 99, 235, 0.44);
  --scrollbar-thumb-strong: rgba(29, 78, 216, 0.68);
  --sidebar-width: 306px;
  --sidebar-open-width: 306px;
  --sidebar-collapsed-width: 92px;
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  min-width: 34px;
  min-height: 34px;
  border: 2px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(180deg, var(--scrollbar-thumb), var(--scrollbar-thumb-strong))
    padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.62), var(--brand-strong))
    padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

html,
body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.09), transparent 32%),
    radial-gradient(circle at 86% 12%, rgba(16, 185, 129, 0.09), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(244, 247, 251, 0.98)),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  max-width: 100vw;
  overflow-x: clip;
  transition: grid-template-columns 220ms ease;
}

.content-shell {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body.pre-authenticated .content-shell {
  grid-column: 2;
}

.content-shell *,
.record-dialog *,
.dropdown-card *,
.select-menu * {
  min-width: 0;
}

body.pre-guest .page-shell {
  grid-template-columns: 1fr;
}

body.pre-auth-check .page-shell {
  grid-template-columns: 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  overflow-x: hidden;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98));
  color: #e5edf8;
  box-shadow: 18px 0 46px rgba(15, 23, 42, 0.14);
  z-index: 20;
  transition:
    width 220ms ease,
    min-width 220ms ease,
    max-width 220ms ease;
}

body.pre-authenticated .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
}

.sidebar-inner {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sidebar-brand {
  min-width: 0;
  flex: 1 1 auto;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
}

.brand-mark img,
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 3px;
  color: rgba(226, 232, 240, 0.72);
  font-size: 12px;
}

.brand-copy {
  min-width: 0;
  overflow: hidden;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    max-width 180ms ease;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 28px;
}

.sidebar-section + .sidebar-section {
  margin-top: 22px;
}

.sidebar-label {
  padding: 0 10px 8px;
  color: rgba(203, 213, 225, 0.72);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-grid {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(226, 232, 240, 0.74);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(96, 165, 250, 0.26);
  background: rgba(37, 99, 235, 0.14);
  color: #f8fafc;
}

.nav-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.34);
  color: #93c5fd;
}

.nav-icon svg,
.icon-button svg,
.global-search svg {
  width: 20px;
  height: 20px;
}

.nav-copy {
  min-width: 0;
}

.nav-title,
.nav-subtitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-title {
  font-size: 14px;
  font-weight: 800;
}

.nav-subtitle {
  margin-top: 3px;
  color: rgba(203, 213, 225, 0.64);
  font-size: 11px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 251, 0.9);
  backdrop-filter: blur(18px);
}

.topbar-main,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-main {
  flex: 1 1 auto;
}

.topbar-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.topbar-context {
  min-width: 0;
}

.topbar-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-dot,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.status-dot.offline {
  background: #fee2e2;
  color: var(--danger);
}

.view-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.view-subtitle {
  max-width: 640px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.app-shell {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

.view-root {
  padding: 24px 28px 42px;
  max-width: 100%;
  overflow-x: hidden;
}

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

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 14px;
}

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

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

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

.panel,
.stat-card,
.table-shell,
.form-panel,
.empty-state,
.auth-card,
.dropdown-card,
.record-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.1);
}

.panel,
.form-panel,
.table-shell {
  padding: 18px;
}

.panel,
.stat-card,
.table-shell,
.form-panel,
.empty-state,
.dialog-body,
.cell-title,
.section-title,
.form-title,
.section-subtitle,
.stat-label,
.stat-value,
.stat-meta,
.bar-row,
.status-pill,
td,
th {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.section-head,
.table-head,
.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title,
.form-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.section-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.stat-card {
  min-height: 126px;
  padding: 16px;
  overflow: hidden;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.12;
}

.stat-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.global-search {
  display: grid;
  grid-template-columns: 28px minmax(160px, 250px);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px 0 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.global-search-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.global-search-button:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.global-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.icon-button,
.ghost-button,
.primary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 8px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 800;
  max-width: 100%;
  text-align: center;
  white-space: normal;
}

.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted-strong);
}

.icon-button:hover,
.ghost-button:hover,
.mini-button:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--brand-soft);
  color: var(--brand-strong);
  transform: translateY(-1px);
}

.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.mini-button {
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.icon-button:disabled,
.ghost-button:disabled,
.primary-button:disabled,
.danger-button:disabled,
.mini-button:disabled {
  opacity: 0.72;
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.primary-button.is-loading,
.ghost-button.is-loading,
.danger-button.is-loading,
.mini-button.is-loading {
  pointer-events: none;
}

.primary-button.is-loading::before,
.ghost-button.is-loading::before,
.danger-button.is-loading::before,
.mini-button.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 999px;
  opacity: 0.78;
  animation: spin 0.72s linear infinite;
}

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

.wide-button {
  width: 100%;
}

.auth-card .wide-button {
  margin-top: 8px;
}

.profile-menu-wrap {
  position: relative;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--surface);
  color: var(--text);
}

.profile-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
}

.profile-button strong,
.profile-button small {
  display: block;
  max-width: 140px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-button small {
  color: var(--muted);
  font-size: 12px;
}

.profile-chevron {
  margin-left: 2px;
}

.profile-menu-wrap.open .profile-chevron {
  transform: rotate(180deg);
}

.dropdown-card {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: 8px;
  z-index: 40;
}

.dropdown-head {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.dropdown-head span {
  color: var(--muted);
  font-size: 12px;
}

.dropdown-item {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.dropdown-item:hover {
  background: var(--surface-muted);
}

.auth-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(96, 165, 250, 0.34), transparent 28%),
    radial-gradient(circle at 80% 18%, rgba(16, 185, 129, 0.22), transparent 34%),
    #020617;
}

.auth-shell-login {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(430px, 0.82fr);
  background: #020617;
}

.auth-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 56px;
  color: #f8fafc;
}

.auth-bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.62;
  filter: saturate(1.1) contrast(1.08);
}

.auth-shell-login .auth-bg-video {
  position: absolute;
  opacity: 0.82;
  filter: saturate(1.16) contrast(1.08) brightness(0.82);
}

.auth-bg-overlay {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 6, 23, 0.9), rgba(15, 23, 42, 0.6) 44%, rgba(219, 234, 254, 0.18)),
    linear-gradient(180deg, rgba(239, 246, 255, 0.12), rgba(2, 6, 23, 0.76));
  backdrop-filter: blur(1px);
  pointer-events: none;
}

.auth-shell-login .auth-bg-overlay {
  position: absolute;
  background:
    linear-gradient(90deg, rgba(2, 6, 23, 0.92), rgba(15, 23, 42, 0.48) 54%, rgba(37, 99, 235, 0.18)),
    linear-gradient(180deg, rgba(2, 6, 23, 0.14), rgba(2, 6, 23, 0.88));
  backdrop-filter: none;
}

.auth-visual-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 20px;
  max-width: 640px;
}

.auth-visual-badge {
  width: fit-content;
  border: 1px solid rgba(191, 219, 254, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.38);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-visual h2 {
  max-width: 620px;
  margin: 0;
  font-size: 64px;
  line-height: 0.98;
}

.auth-visual p {
  max-width: 520px;
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  font-size: 17px;
  line-height: 1.55;
}

.auth-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.auth-visual-grid div {
  min-height: 104px;
  border: 1px solid rgba(226, 232, 240, 0.16);
  border-radius: 10px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.46);
  box-shadow: 0 24px 64px rgba(2, 6, 23, 0.28);
  backdrop-filter: blur(14px);
}

.auth-visual-grid span,
.auth-visual-grid strong {
  display: block;
}

.auth-visual-grid span {
  color: rgba(191, 219, 254, 0.76);
  font-size: 12px;
  font-weight: 850;
}

.auth-visual-grid strong {
  margin-top: 12px;
  color: #fff;
  font-size: 15px;
  line-height: 1.25;
}

.session-guard {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-stage {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.auth-shell-login .auth-stage {
  min-height: 100vh;
  place-items: center;
  padding: 48px;
  border-left: 1px solid rgba(226, 232, 240, 0.8);
  background:
    radial-gradient(circle at 18% 14%, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 1));
  box-shadow: -30px 0 90px rgba(2, 6, 23, 0.28);
}

.auth-card {
  width: min(100%, 460px);
  padding: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 34px 90px rgba(2, 6, 23, 0.36);
  backdrop-filter: blur(22px);
}

.auth-page .auth-stage {
  place-items: center;
  padding: 44px 28px;
}

.auth-page .auth-card {
  border-color: rgba(255, 255, 255, 0.36);
}

.auth-page .auth-shell-login .auth-stage {
  padding: 48px;
}

.auth-page .auth-shell-login .auth-card {
  width: min(100%, 460px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.auth-card .brand-subtitle {
  color: var(--muted);
}

.auth-copy {
  margin: 28px 0 22px;
}

.auth-copy h1 {
  margin: 8px 0 8px;
  font-size: 30px;
  line-height: 1.1;
}

.auth-copy p,
.auth-help {
  color: var(--muted);
  line-height: 1.5;
}

.auth-help {
  margin-top: 14px;
  font-size: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.manager-fieldset {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(247, 250, 255, 0.92), rgba(255, 255, 255, 0.98));
}

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

.field span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: 0;
  background: #fff;
  color: var(--text);
}

.field .native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.select-shell {
  position: relative;
  min-width: 0;
}

.select-trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.98));
  color: var(--text);
  font-weight: 750;
  text-align: left;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.select-trigger:hover {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.09);
}

.select-shell.open .select-trigger {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-chevron {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: currentColor;
  transition: transform 350ms ease;
}

.select-chevron svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.select-shell.open .select-chevron {
  transform: rotate(180deg);
}

.select-menu {
  position: absolute;
  z-index: 70;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: none;
  overflow: auto;
  max-height: 260px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.18);
}

.select-shell.open .select-menu {
  display: grid;
  gap: 4px;
}

.select-option {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted-strong);
  font-weight: 750;
  text-align: left;
}

.select-option:hover,
.select-option.selected {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

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

.error-note,
.info-note {
  margin-top: 14px;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.error-note {
  background: #fff0ee;
  color: var(--danger);
}

.info-note {
  background: var(--accent-soft);
  color: var(--accent);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.filter-row .field {
  min-width: 160px;
}

.table-scroll {
  overflow-x: auto;
  padding-bottom: 2px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 13px;
}

tbody tr:hover {
  background: var(--surface-muted);
}

[data-table-row][hidden] {
  display: none !important;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pagination-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-button {
  display: inline-grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.pagination-button:hover:not(:disabled),
.pagination-button.active {
  border-color: rgba(37, 99, 235, 0.26);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.pagination-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.cell-title {
  display: grid;
  gap: 4px;
  max-width: 100%;
}

.cell-title strong {
  font-size: 14px;
  line-height: 1.25;
}

.cell-title span,
.muted {
  color: var(--muted);
  line-height: 1.35;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  max-width: 100%;
  white-space: normal;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
}

.status-pill.active,
.status-pill.confirmed,
.status-pill.completed,
.status-pill.success {
  background: var(--accent-soft);
  color: var(--success);
}

.status-pill.draft,
.status-pill.new,
.status-pill.processing {
  background: #fff2d5;
  color: var(--warning);
}

.status-pill.hidden,
.status-pill.paused,
.status-pill.cancelled,
.status-pill.expired,
.status-pill.error {
  background: #ffe7e3;
  color: var(--danger);
}

.placement-badges {
  display: flex;
  max-width: 280px;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.placement-picker {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 10px;
  padding: 14px;
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(247, 250, 255, 0.96), rgba(255, 255, 255, 1));
}

.placement-picker legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.placement-picker p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.placement-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.placement-option {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 850;
}

.placement-option:has(input:checked) {
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.placement-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.thumb {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 170px) 1fr minmax(40px, auto);
  align-items: center;
  gap: 12px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.csv-preview {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.record-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  border: 1px solid var(--line);
}

.record-dialog::backdrop {
  background: rgba(15, 23, 42, 0.46);
}

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

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-body {
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 18px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 44px));
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--text);
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.error {
  background: var(--danger);
}

.topbar-toggle {
  display: none;
}

.topbar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.topbar-toggle {
  gap: 3px;
  flex-direction: column;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: 15;
}

body.sidebar-collapsed,
html.sidebar-collapsed body {
  --sidebar-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .page-shell,
html.sidebar-collapsed .page-shell {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar,
html.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
  max-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-inner,
html.sidebar-collapsed .sidebar-inner {
  align-items: center;
}

body.sidebar-collapsed .sidebar-header,
html.sidebar-collapsed .sidebar-header {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 18px 10px 14px;
}

body.sidebar-collapsed .sidebar-brand,
html.sidebar-collapsed .sidebar-brand {
  width: 52px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 0;
}

body.sidebar-collapsed .brand-mark,
html.sidebar-collapsed .brand-mark {
  width: 40px;
  height: 40px;
  margin: 0;
}

body.sidebar-collapsed .sidebar-collapse-button,
html.sidebar-collapsed .sidebar-collapse-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  flex: 0 0 40px;
  margin: 0;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-copy,
body.sidebar-collapsed .sidebar-label,
html.sidebar-collapsed .brand-copy,
html.sidebar-collapsed .nav-copy,
html.sidebar-collapsed .sidebar-label {
  max-width: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-8px);
}

body.sidebar-collapsed .sidebar-scroll,
html.sidebar-collapsed .sidebar-scroll {
  width: 100%;
  padding: 12px 10px 22px;
}

body.sidebar-collapsed .sidebar-section,
html.sidebar-collapsed .sidebar-section {
  margin-top: 10px;
}

body.sidebar-collapsed .nav-item,
html.sidebar-collapsed .nav-item {
  width: 52px;
  min-height: 52px;
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 8px;
}

body.sidebar-collapsed .nav-item.active,
html.sidebar-collapsed .nav-item.active {
  box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.28);
}

body.sidebar-collapsed .sidebar-collapse-button svg,
html.sidebar-collapsed .sidebar-collapse-button svg {
  transform: rotate(180deg);
}

body.pre-auth-check .page-shell,
html.sidebar-collapsed body.pre-auth-check .page-shell {
  grid-template-columns: 1fr;
}

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

@media (max-width: 1180px) {
  .auth-shell-login {
    grid-template-columns: minmax(0, 1fr) minmax(400px, 0.86fr);
  }

  .auth-visual {
    padding: 40px;
  }

  .auth-visual h2 {
    font-size: 48px;
  }

  .auth-visual-grid {
    grid-template-columns: 1fr;
  }

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

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .topbar-main {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 860px) {
  .auth-shell-login {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 360px;
    padding: 30px 24px;
  }

  .auth-visual h2 {
    font-size: 40px;
    line-height: 1.04;
  }

  .auth-visual p {
    font-size: 15px;
  }

  .auth-page .auth-shell-login .auth-stage {
    min-height: auto;
    padding: 32px 24px;
    border-left: 0;
    box-shadow: none;
  }

  body.sidebar-collapsed,
  html.sidebar-collapsed body {
    --sidebar-width: 0px;
  }

  .page-shell,
  body.sidebar-collapsed .page-shell,
  html.sidebar-collapsed .page-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100vw;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: min(86vw, 320px);
    min-width: min(86vw, 320px);
    max-width: min(86vw, 320px);
    transition: transform 0.2s ease;
  }

  body.sidebar-collapsed .sidebar,
  html.sidebar-collapsed .sidebar {
    width: min(86vw, 320px);
    min-width: min(86vw, 320px);
    max-width: min(86vw, 320px);
  }

  body.sidebar-collapsed .sidebar-header,
  html.sidebar-collapsed .sidebar-header {
    flex-direction: row;
    justify-content: space-between;
    padding: 22px 18px 16px;
  }

  body.sidebar-collapsed .sidebar-brand,
  html.sidebar-collapsed .sidebar-brand {
    justify-content: flex-start;
    flex: 1 1 auto;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-copy,
  body.sidebar-collapsed .sidebar-label,
  html.sidebar-collapsed .brand-copy,
  html.sidebar-collapsed .nav-copy,
  html.sidebar-collapsed .sidebar-label {
    max-width: none;
    max-height: none;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  body.sidebar-collapsed .nav-item,
  html.sidebar-collapsed .nav-item {
    width: auto;
    min-height: 58px;
    grid-template-columns: 36px minmax(0, 1fr);
    justify-items: stretch;
    padding: 10px;
  }

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

  .topbar-toggle {
    display: inline-flex;
  }

  .content-shell,
  .app-shell,
  .topbar,
  .view-root {
    width: 100%;
    max-width: 100vw;
  }

  body.pre-authenticated .content-shell {
    grid-column: 1;
  }

  .view-root,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    align-items: stretch;
    min-height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .topbar-main {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .topbar-context {
    width: 100%;
  }

  .topbar-badge-row {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
  }

  .eyebrow,
  .status-dot,
  .pill {
    overflow-wrap: normal;
    word-break: normal;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  .status-dot,
  .pill {
    min-height: 22px;
    padding: 3px 7px;
    font-size: 11px;
  }

  .view-title {
    font-size: 24px;
  }

  .view-subtitle {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .global-search {
    grid-column: 1 / -1;
    min-height: 38px;
    padding-right: 10px;
  }

  .profile-menu-wrap,
  .profile-button,
  .topbar-actions > .ghost-button {
    width: 100%;
  }

  .profile-button {
    justify-content: flex-start;
  }

  .profile-button strong,
  .profile-button small {
    max-width: 104px;
  }

  .dropdown-card {
    right: 0;
    width: min(260px, calc(100vw - 28px));
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid.two,
  .form-grid.three,
  .placement-picker-grid {
    grid-template-columns: 1fr;
  }

  .global-search {
    grid-template-columns: 28px minmax(0, 1fr);
    width: 100%;
  }
}

@media (max-width: 560px) {
  .auth-visual {
    min-height: 254px;
    padding: 24px 18px;
  }

  .auth-visual-content {
    gap: 14px;
  }

  .auth-visual h2 {
    font-size: 32px;
  }

  .auth-visual p {
    font-size: 14px;
    line-height: 1.45;
  }

  .auth-visual-grid {
    display: none;
  }

  .auth-page .auth-shell-login .auth-stage {
    padding: 24px 18px;
  }

  .view-title {
    font-size: 22px;
  }

  .view-root {
    padding: 14px 12px 28px;
  }

  .auth-stage {
    padding: 14px;
  }

  .auth-card,
  .panel,
  .form-panel,
  .table-shell {
    padding: 14px;
  }

  .toolbar,
  .section-head,
  .table-head,
  .form-head {
    align-items: stretch;
    flex-direction: column;
  }

  .action-row,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .action-row > *,
  .filter-row > * {
    width: 100%;
  }

  .table-scroll,
  .csv-preview {
    overflow-x: hidden;
  }

  .table-scroll table,
  .csv-preview table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .table-scroll thead,
  .csv-preview thead {
    display: none;
  }

  .table-scroll tbody,
  .csv-preview tbody,
  .table-scroll tr,
  .csv-preview tr,
  .table-scroll td,
  .csv-preview td {
    display: block;
    width: 100%;
  }

  .table-scroll tbody tr,
  .csv-preview tbody tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .table-scroll td,
  .csv-preview td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }

  .table-scroll td:last-child,
  .csv-preview td:last-child {
    border-bottom: 0;
  }

  .table-scroll td::before,
  .csv-preview td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .table-scroll td[colspan],
  .csv-preview td[colspan] {
    display: block;
  }

  .table-scroll td[colspan]::before,
  .csv-preview td[colspan]::before {
    content: "";
  }

  .table-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .record-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .dialog-head {
    padding: 12px 14px;
  }

  .dialog-head h2 {
    font-size: 18px;
  }

  .dialog-body {
    max-height: calc(100vh - 104px);
    padding: 14px;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions > * {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
