@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/assets/fonts/google-sans-flex/google-sans-flex-300.ttf") format("truetype");
}

@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/google-sans-flex/google-sans-flex-400.ttf") format("truetype");
}

@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/google-sans-flex/google-sans-flex-500.ttf") format("truetype");
}

@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/google-sans-flex/google-sans-flex-600.ttf") format("truetype");
}

@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/google-sans-flex/google-sans-flex-700.ttf") format("truetype");
}

@font-face {
  font-family: "Google Sans Flex";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/google-sans-flex/google-sans-flex-800.ttf") format("truetype");
}

:root {
  color-scheme: dark;
  --bg: #343740;
  --bg-accent: #2b2d34;
  --shell: #131419;
  --sidebar: #1b1d22;
  --panel: #1d2026;
  --panel-strong: #242730;
  --panel-soft: #17191f;
  --text: #f3f5f7;
  --muted: #9aa2af;
  --line: rgba(255, 255, 255, 0.08);
  --brand: #9cecdf;
  --brand-strong: #cef47f;
  --brand-soft: rgba(156, 236, 223, 0.12);
  --ready: #8be6d5;
  --pending: #efbb70;
  --planned: #c188ff;
  --danger: #ff8f8f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --radius-lg: 11px;
  --radius-md: 8px;
  --radius-sm: 5px;
  --max-width: 1520px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f4f7;
  --bg-accent: #eaedf2;
  --shell: #ffffff;
  --sidebar: #f8f9fb;
  --panel: #ffffff;
  --panel-strong: #f5f6f8;
  --panel-soft: #f1f3f6;
  --text: #1d2430;
  --muted: #697180;
  --line: rgba(29, 36, 48, 0.1);
  --brand: #318f84;
  --brand-strong: #739b28;
  --brand-soft: rgba(49, 143, 132, 0.1);
  --ready: #247f64;
  --pending: #9b6816;
  --planned: #8857cf;
  --danger: #b54848;
  --shadow: 0 20px 44px rgba(29, 36, 48, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable Text", "Segoe UI", "Aptos", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(156, 236, 223, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
}

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

h1,
h2,
h3,
h4,
p,
ul,
li {
  margin: 0;
}

form {
  margin: 0;
}

code,
.mono,
.code-editor {
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
}

.app-shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 18px;
  display: grid;
  align-items: start;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "sidebar content";
  gap: 14px;
}

.topbar,
.sidebar,
.content-area,
.panel,
.stat-card,
.login-card,
.flash,
.mini-card {
  backdrop-filter: blur(14px);
}

.topbar {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--shell);
  box-shadow: var(--shadow);
  position: sticky;
  top: 18px;
  z-index: 10;
}

.topbar-brand,
.topbar-copy,
.sidebar-section,
.brand,
.page-header > div {
  display: grid;
  gap: 8px;
}

.topbar-copy {
  gap: 2px;
}

.topbar-copy strong,
.sidebar-section-title,
.page-header h1,
.panel-header h2,
.login-card h1,
.login-card h2,
.brand strong {
  margin: 0;
  font-family: "Segoe UI Variable Text", "Segoe UI", "Aptos", Arial, sans-serif;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.topbar-copy strong,
.sidebar-section-title {
  font-size: 1rem;
}

.topbar-copy span,
.panel-meta,
.panel-note,
.empty-state,
.error-text,
.stat-label,
.brand-kicker,
.brand-copy,
.plain-list li,
.mini-card span,
.topbar-user span,
.footer-left,
.footer-right,
.field span {
  color: var(--muted);
}

.eyebrow,
.brand-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.primary-nav,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-nav {
  flex: 1 1 auto;
  justify-content: center;
  flex-wrap: wrap;
}

.primary-nav-link,
.subnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  transition: 180ms ease;
}

.primary-nav-link:hover,
.primary-nav-link.is-active,
.subnav-link:hover,
.subnav-link.is-active {
  color: var(--text);
  border-color: rgba(156, 236, 223, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.theme-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.theme-toggle {
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.theme-toggle.is-active {
  background: var(--panel-strong);
  color: var(--text);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.restart-button,
.button,
.button-link,
.card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: 180ms ease;
}

.button,
.restart-button {
  background: linear-gradient(135deg, #8f7cff, #65d9c9);
  color: #111318;
  border: 0;
}

.button:hover,
.restart-button:hover,
.button-link:hover,
.card-link:hover {
  filter: brightness(1.04);
}

.button-muted,
.card-link {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

.is-small {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 0.84rem;
}

.button-danger {
  background: linear-gradient(135deg, #ff9f8f, #ff6c8f);
  color: #111318;
}

.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 112px;
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sidebar);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.subnav-list {
  display: grid;
  gap: 8px;
}

.subnav-link {
  justify-content: flex-start;
  min-height: 44px;
  padding: 10px 14px;
}

.subnav-link.is-active {
  background: linear-gradient(135deg, rgba(101, 217, 201, 0.18), rgba(143, 124, 255, 0.14));
}

.sidebar-card,
.panel,
.stat-card,
.mini-card,
.login-card,
.flash {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar-card,
.panel,
.login-card {
  padding: 18px;
}

.sidebar-card {
  background: var(--panel-soft);
  display: grid;
  gap: 8px;
}

.content-area {
  grid-area: content;
  display: grid;
  gap: 14px;
}

.page-header,
.panel-header,
.mini-card header,
.mini-card footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

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

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

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

.stats-grid,
.card-grid {
  display: grid;
  gap: 12px;
}

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

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

.stat-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  background: var(--panel-strong);
}

.stat-value {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  line-height: 1;
}

.stack,
.stack-lg,
.plain-list,
.list-table {
  display: grid;
}

.stack {
  gap: 12px;
}

.actions-inline {
  width: 100%;
  align-items: stretch;
  flex-wrap: nowrap;
}

.actions-inline > * {
  flex: 1 1 0;
}

.actions-inline .button,
.actions-inline .card-link {
  width: 100%;
}

.stack-lg {
  gap: 14px;
}

.plain-list {
  gap: 10px;
  padding-left: 18px;
}

.field,
.panel-subsection {
  display: grid;
  gap: 6px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.detail-list dt {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
}

.checkbox-field {
  align-content: start;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
}

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

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

.field input,
.field textarea,
.field select,
input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--text);
}

.field select,
select {
  appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field select:focus,
select:focus {
  outline: none;
  border-color: rgba(156, 236, 223, 0.32);
  box-shadow: 0 0 0 3px rgba(156, 236, 223, 0.08);
}

select option {
  background: var(--panel);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 180px;
}

.code-editor {
  min-height: 260px;
  font-size: 0.92rem;
}

.code-editor.tall {
  min-height: 360px;
}

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

.inline-form {
  display: inline-flex;
}

.top-gap {
  margin-top: 12px;
}

.list-table {
  gap: 10px;
}

.list-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  transition: 180ms ease;
}

.list-row.is-active,
.list-row:hover {
  border-color: rgba(156, 236, 223, 0.26);
  background: rgba(255, 255, 255, 0.05);
}

.list-row-copy {
  display: grid;
  gap: 4px;
}

.list-row-copy p {
  color: var(--muted);
}

.list-row-meta,
.admin-table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--panel-strong);
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.settings-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
}

.settings-row-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-table-head,
.admin-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
}

.admin-table-head {
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-table-row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.admin-table-row.is-active {
  border-color: rgba(156, 236, 223, 0.26);
  background: rgba(255, 255, 255, 0.05);
}

.admin-table-primary {
  font-weight: 700;
}

.link-table {
  display: grid;
  gap: 10px;
}

.link-table-head,
.link-table-row {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(120px, 0.8fr) auto;
  gap: 18px;
}

.link-table-head {
  padding: 0 14px 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.link-table-head span:last-child {
  text-align: right;
}

.link-table-row {
  align-items: center;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  transition: 180ms ease;
}

.link-table-row.is-active,
.link-table-row:hover {
  border-color: rgba(156, 236, 223, 0.26);
  background: rgba(255, 255, 255, 0.05);
}

.link-table-name,
.link-table-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.link-table-name strong,
.link-table-value {
  line-height: 1.3;
}

.link-table-subtext {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

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

.meta-grid dt {
  margin-bottom: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.meta-grid dd {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-ready {
  background: rgba(139, 230, 213, 0.12);
  color: var(--ready);
}

.status-pending {
  background: rgba(239, 187, 112, 0.12);
  color: var(--pending);
}

.status-planned {
  background: rgba(193, 136, 255, 0.12);
  color: var(--planned);
}

.flash {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.flash-success {
  background: rgba(139, 230, 213, 0.08);
}

.flash-error {
  background: rgba(239, 187, 112, 0.08);
}

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

.login-card {
  width: min(460px, 100%);
  background: var(--panel);
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.csv-table-shell {
  background: var(--panel-soft);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

.data-table thead th {
  background: var(--panel-strong);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table-compact {
  font-size: 0.86rem;
}

.data-table-compact th,
.data-table-compact td {
  padding: 8px 10px;
}

.file-table .is-selected {
  background: rgba(255, 255, 255, 0.05);
}

.data-table-primary {
  font-weight: 700;
}

.csv-editor {
  display: grid;
  gap: 12px;
}

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

.csv-row-select,
.csv-row-actions {
  width: 52px;
  text-align: center;
}

.csv-row-delete {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}

.table-sort-button::after {
  content: attr(data-sort-indicator);
  font-size: 0.8rem;
  color: var(--muted);
}

.table-cell-input {
  width: 100%;
  min-width: 150px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
}

.table-cell-input:focus {
  outline: none;
  border-color: rgba(156, 236, 223, 0.34);
  background: rgba(255, 255, 255, 0.04);
}

.data-table-editable tbody tr.is-selected {
  background: rgba(156, 236, 223, 0.08);
}

.wrap {
  overflow-wrap: anywhere;
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-right {
  margin-left: auto;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "content";
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .stats-grid,
  .card-grid,
  .two-columns,
  .field-grid,
  .settings-row-fields,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .admin-table-head,
  .admin-table-row,
  .link-table-head,
  .link-table-row {
    grid-template-columns: 1fr;
  }

  .link-table-head span:last-child,
  .link-table-actions {
    text-align: left;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .sidebar,
  .panel,
  .login-card,
  .stat-card,
  .topbar {
    padding: 16px;
  }

  .topbar,
  .topbar-brand,
  .primary-nav,
  .topbar-actions,
  .topbar-user,
  .page-header,
  .panel-header,
  .page-footer,
  .footer-left,
  .footer-right,
  .actions,
  .list-row,
  .panel-header-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .primary-nav,
  .topbar-actions,
  .theme-switcher {
    width: 100%;
  }

  .primary-nav-link,
  .subnav-link,
  .restart-button,
  .button,
  .button-muted,
  .button-danger {
    width: 100%;
  }

  .actions-inline {
    flex-wrap: wrap;
  }

  .actions-inline > * {
    flex: 1 1 100%;
  }

  .table-toolbar {
    align-items: stretch;
  }
}
