:root {
  color-scheme: light;
  --bg: #f4f5f8;
  --bg-top: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef1f4;
  --surface-glass: rgba(255, 255, 255, 0.84);
  --text: #191c23;
  --text-soft: #69717f;
  --text-faint: #949ba8;
  --border: #dde2e9;
  --border-strong: #cbd2dc;
  --accent: #ff6737;
  --accent-hover: #ed592c;
  --accent-soft: #fff0eb;
  --green: #27b57b;
  --green-soft: #e9f8f2;
  --yellow: #c99025;
  --yellow-soft: #fff6e3;
  --red: #d85b67;
  --red-soft: #ffedf0;
  --blue: #5c80df;
  --blue-soft: #edf2ff;
  --purple: #856ee0;
  --purple-soft: #f0ecff;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --content: 1480px;
  --header-height: 68px;
  --shadow-popover: 0 18px 60px rgba(20, 24, 34, 0.16);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1016;
  --bg-top: #11151c;
  --surface: #161a22;
  --surface-2: #1a1f28;
  --surface-3: #202630;
  --surface-glass: rgba(14, 17, 24, 0.82);
  --text: #f2f3f6;
  --text-soft: #a3abba;
  --text-faint: #747d8d;
  --border: #29303a;
  --border-strong: #39414d;
  --accent: #ff6737;
  --accent-hover: #ff794f;
  --accent-soft: #352018;
  --green: #55d6a2;
  --green-soft: #163027;
  --yellow: #e2ac4e;
  --yellow-soft: #332815;
  --red: #f07a86;
  --red-soft: #351c22;
  --blue: #83a1f1;
  --blue-soft: #1b273d;
  --purple: #aa90ed;
  --purple-soft: #2a2240;
  --shadow-popover: 0 22px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--bg-top) 88%, transparent) 0,
      var(--bg) 240px
    ),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  letter-spacing: -0.025em;
}
h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 3vw, 44px);
  line-height: 1.1;
}
h2 {
  margin-bottom: 10px;
  font-size: clamp(23px, 2vw, 28px);
  line-height: 1.2;
}
h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
}
p {
  margin-bottom: 14px;
}

.muted {
  color: var(--text-soft);
}
.faint {
  color: var(--text-faint);
}
.small {
  font-size: 13px;
}
.accent {
  color: var(--accent);
}
.success {
  color: var(--green);
}
.danger {
  color: var(--red);
}

.app-main {
  width: 100%;
  padding: 46px 28px 84px;
}
.app-main__inner {
  width: min(100%, var(--content));
  margin-inline: auto;
}
.section {
  margin-top: 38px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.section-head h1,
.section-head h2,
.section-head h3,
.section-head p {
  margin-bottom: 0;
}
.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.row {
  display: flex;
  align-items: center;
  gap: 11px;
}
.row--between {
  justify-content: space-between;
}
.row--wrap {
  flex-wrap: wrap;
}
.stack {
  display: grid;
  gap: 14px;
}
.stack--sm {
  gap: 9px;
}
.stack--lg {
  gap: 22px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ===== topbar ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--surface-glass) 97%, var(--purple) 3%),
    var(--surface-glass) 50%,
    color-mix(in srgb, var(--surface-glass) 97%, var(--accent) 3%)
  );
  backdrop-filter: blur(18px) saturate(125%);
}

.app-header__inner {
  width: min(100% - 48px, var(--content));
  height: 100%;
  display: flex;
  align-items: stretch;
  margin-inline: auto;
}

.brand {
  display: flex;
  align-items: center;
  padding-right: 34px;
  color: var(--text);
  font-size: 18px;
  font-weight: 880;
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark {
  display: none;
}
.brand__text {
  display: inline;
}

.app-nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.app-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
  transition:
    color 0.14s ease,
    background 0.14s ease;
}
.app-nav__link:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
}
.app-nav__link.is-active {
  color: var(--text);
}
.app-nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
}

.app-header__actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}
.header-separator {
  width: 1px;
  height: 28px;
  margin: 0 5px;
  background: var(--border);
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-decoration: none;
  transition: 0.14s ease;
}
.icon-btn:hover,
.icon-btn.is-active {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notification-trigger {
  position: relative;
}
.notification-trigger::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface-glass);
}
.notification-trigger.notifications-read::after {
  display: none;
}

.user-chip {
  display: grid;
  align-items: center;
  min-height: 40px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}
.user-chip__avatar {
  display: none;
}
.user-chip__meta {
  display: grid;
  gap: 2px;
  min-width: 88px;
}
.user-chip__meta strong {
  font-size: 12px;
  line-height: 1.2;
}
.user-chip__meta span {
  color: var(--text-faint);
  font-size: 10px;
}
.header-logout {
  width: auto;
  min-width: 72px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  padding: 0 10px;
  gap: 7px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.header-logout span {
  display: inline-block;
  line-height: 1;
}

.mobile-menu-btn {
  display: none;
}
.mobile-menu {
  position: fixed;
  inset: var(--header-height) 0 auto 0;
  z-index: 95;
  padding: 12px 18px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
}
.mobile-menu a {
  display: block;
  padding: 12px 10px;
  border-radius: 8px;
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 650;
}
.mobile-menu a:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ===== notification popover ===== */
.notification-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 96px;
  width: min(390px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-popover);
}
.notification-popover__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border);
}
.notification-popover__head strong {
  font-size: 14px;
}
.notification-popover__all {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.notification-list {
  display: grid;
}
.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.notification-item:last-child {
  border-bottom: 0;
}
.notification-item:hover {
  background: var(--surface-2);
}
.notification-item__body {
  display: grid;
  gap: 3px;
}
.notification-item__body strong {
  font-size: 12px;
}
.notification-item__body span {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}
.notification-item time {
  color: var(--text-faint);
  font-size: 10px;
  white-space: nowrap;
}
.notification-item.is-new::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 18px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== cards / buttons ===== */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 760;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.08s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-hover);
}
.btn--secondary {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.btn--secondary:hover,
.btn--outline:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}
.btn--outline {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}
.btn--danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 25%, var(--border));
}
.btn--wide {
  width: 100%;
}
.btn--small {
  min-height: 34px;
  padding: 8px 11px;
  font-size: 11px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 760;
}
.badge--draft {
  color: var(--yellow);
  border-color: color-mix(in srgb, var(--yellow) 24%, var(--border));
  background: var(--yellow-soft);
}
.badge--review {
  color: var(--blue);
  border-color: color-mix(in srgb, var(--blue) 24%, var(--border));
  background: var(--blue-soft);
}
.badge--published {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 24%, var(--border));
  background: var(--green-soft);
}

/* ===== forms ===== */
.form-group {
  display: grid;
  gap: 7px;
}
.label {
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}
.form-help {
  margin-top: 1px;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.45;
}
.input,
.textarea,
.select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease;
}
.textarea {
  min-height: 104px;
  resize: none;
  overflow: hidden;
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--border-strong);
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}
.input-wrap {
  position: relative;
}
.input-wrap .input {
  padding-right: 46px;
}
.input-action {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.input-action:hover {
  background: var(--surface-2);
  color: var(--text);
}
.input-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.select {
  appearance: none;
  cursor: pointer;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
    linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
}
.select option {
  background: var(--surface);
  color: var(--text);
}

/* custom select */
.custom-select {
  position: relative;
  width: 100%;
}
.custom-select__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.custom-select__button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.custom-select__button:hover {
  border-color: var(--border-strong);
}
.custom-select.is-open .custom-select__button {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}
.custom-select__arrow {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-right: 2px;
  border-right: 1.5px solid var(--text-soft);
  border-bottom: 1.5px solid var(--text-soft);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.14s ease;
}
.custom-select.is-open .custom-select__arrow {
  transform: translateY(2px) rotate(225deg);
}
.custom-select__menu {
  position: absolute;
  z-index: 160;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-popover);
}
.custom-select__option {
  width: 100%;
  display: block;
  padding: 10px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.custom-select__option:hover,
.custom-select__option.is-highlighted {
  background: var(--surface-2);
}
.custom-select__option.is-selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
}

.checkbox {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}
.checkbox__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.checkbox__control {
  position: relative;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface-2);
  transition: 0.13s ease;
}
.checkbox:hover .checkbox__control {
  border-color: var(--accent);
}
.checkbox__input:checked + .checkbox__control {
  border-color: var(--accent);
  background: var(--accent);
}
.checkbox__input:checked + .checkbox__control::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg);
}
.checkbox__input:focus-visible + .checkbox__control {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* ===== tables ===== */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}
.table-wrap--scroll {
  max-height: 430px;
}
.table-wrap--scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
td {
  font-size: 12px;
}
tr:last-child td {
  border-bottom: 0;
}
tr.clickable-row {
  cursor: pointer;
}
tr.clickable-row:hover td {
  background: var(--surface-2);
}

/* ===== modal / toast ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 11, 0.62);
  backdrop-filter: blur(4px);
}
.modal__card {
  width: min(100%, 650px);
  max-height: min(88vh, 780px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-popover);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.modal__head h2 {
  margin: 0;
}
.toast {
  position: fixed;
  z-index: 300;
  right: 20px;
  bottom: 20px;
  max-width: 380px;
  padding: 12px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-popover);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.18s ease;
}
.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.inline-message {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
}
.inline-message--success {
  border-color: color-mix(in srgb, var(--green) 25%, var(--border));
  background: var(--green-soft);
  color: var(--green);
}
.inline-message--danger {
  border-color: color-mix(in srgb, var(--red) 25%, var(--border));
  background: var(--red-soft);
  color: var(--red);
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-glass);
  color: var(--text);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

@media (max-width: 1000px) {
  .app-header__inner {
    width: min(100% - 30px, var(--content));
  }
  .brand {
    padding-right: 16px;
  }
  .app-nav {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-grid;
  }
  .user-chip__meta {
    min-width: 0;
  }
  .notification-popover {
    right: 0;
  }
  .app-main {
    padding-inline: 20px;
  }
}

@media (max-width: 680px) {
  :root {
    --header-height: 60px;
  }
  .app-header__inner {
    width: min(100% - 20px, var(--content));
  }
  .brand {
    padding-right: 6px;
    font-size: 16px;
  }
  .header-separator {
    display: none;
  }
  .user-chip {
    display: none;
  }
  .header-logout span {
    display: none;
  }
  .app-main {
    padding: 26px 14px 78px;
  }
  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }
  .section-head {
    align-items: flex-start;
  }
  .modal {
    align-items: end;
    padding: 0;
  }
  .modal__card {
    width: 100%;
    max-height: 88vh;
    border-radius: 12px 12px 0 0;
    padding: 18px;
  }
  .toast {
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
  }
}

/* ========================================
   SCROLLBARS
   ======================================== */
html {
  scrollbar-color: color-mix(in srgb, var(--text-faint) 58%, transparent)
    transparent;
  scrollbar-width: thin;
}

* {
  scrollbar-color: color-mix(in srgb, var(--text-faint) 52%, transparent)
    transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

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

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-faint) 52%, transparent);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-soft) 72%, transparent);
  background-clip: padding-box;
}

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

/* ========================================
   PORTALLED SELECTS + MOBILE TAB BAR
   ======================================== */
.custom-select__menu--portal {
  position: fixed;
  z-index: 520;
  right: auto;
  bottom: auto;
  min-width: 160px;
  max-width: calc(100vw - 16px);
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 760px) {
  body {
    padding-bottom: 68px;
  }
  .app-main {
    padding-bottom: 96px;
  }
  .app-header__inner {
    width: min(100% - 20px, var(--content));
  }
  .app-nav {
    display: none;
  }
  .mobile-menu-btn,
  .mobile-menu {
    display: none !important;
  }
  .brand {
    padding-right: 4px;
  }
  .app-header__actions {
    gap: 3px;
  }
  .user-chip {
    display: none;
  }
  .header-separator {
    display: none;
  }
  .header-logout {
    min-width: 40px;
    width: 40px;
    padding: 0;
  }
  .header-logout span {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 180;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    min-height: 62px;
    padding: 5px max(8px, env(safe-area-inset-left))
      max(5px, env(safe-area-inset-bottom));
    border-top: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
    background: linear-gradient(
      90deg,
      color-mix(in srgb, var(--surface-glass) 97%, var(--purple) 3%),
      var(--surface-glass) 50%,
      color-mix(in srgb, var(--surface-glass) 97%, var(--accent) 3%)
    );
    backdrop-filter: blur(18px) saturate(125%);
  }

  .mobile-bottom-nav__link {
    min-width: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    padding: 4px 8px;
    border-radius: 8px;
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.15;
    text-decoration: none;
  }

  .mobile-bottom-nav__link svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-bottom-nav__link.is-active {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 58%, transparent);
  }

  .notification-popover {
    position: fixed;
    top: calc(var(--header-height) - 2px);
    left: 10px;
    right: 10px;
    width: auto;
  }
}

@media (min-width: 761px) and (max-width: 1000px) {
  .app-nav {
    display: flex;
  }
  .app-nav__link {
    padding-inline: 11px;
    font-size: 13px;
  }
  .brand {
    padding-right: 10px;
  }
  .user-chip {
    display: none;
  }
  .header-separator {
    display: none;
  }
}

/* ========================================
   MOBILE NAV: true viewport bottom bar
   ======================================== */
@media (max-width: 760px) {
  .mobile-bottom-nav {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    top: auto !important;
    bottom: 0 !important;
    transform: none !important;
    width: 100% !important;
    margin: 0 !important;
  }

  /* leave room for the app-style bottom tabs */
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
  .app-main {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

/* Dynamic API states used by the integrated FastAPI build. */
.empty-state {
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}

.auth-error,
.inline-error {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--border));
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
  line-height: 1.4;
}

.modal__head h3 {
  margin: 0;
}
