:root {
  color-scheme: dark light;
  --bg: #071112;
  --bg-2: #0a181a;
  --surface: rgba(13, 25, 28, 0.88);
  --surface-2: rgba(15, 31, 34, 0.94);
  --surface-3: rgba(18, 40, 43, 0.98);
  --text: #f3fbf8;
  --muted: #b7c8c5;
  --quiet: #8ca4a1;
  --line: rgba(177, 221, 214, 0.18);
  --line-strong: rgba(177, 221, 214, 0.34);
  --blue: #6bbce7;
  --green: #79dfb1;
  --amber: #e8cb71;
  --danger: #ee9292;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
  --glow: 0 0 0 1px rgba(121, 223, 177, 0.08), 0 0 38px rgba(107, 188, 231, 0.08);
  --focus: #9fe8ff;
  --focus-ring: 0 0 0 3px rgba(115, 189, 231, 0.34);
  --control-bg: rgba(5, 13, 15, 0.9);
  --nav-bg: rgba(6, 16, 18, 0.91);
  --hover-bg: rgba(255, 255, 255, 0.068);
  --card-bg: rgba(13, 25, 28, 0.88);
  --soft-band: rgba(255, 255, 255, 0.018);
  --tab-bg: rgba(18, 112, 86, 0.92);
  --tab-text: #f2fff8;
  --page-bg:
    linear-gradient(180deg, rgba(7, 19, 22, 0.94) 0%, rgba(6, 16, 18, 1) 56%, #050d0f 100%),
    radial-gradient(circle at 15% -10%, rgba(121, 223, 177, 0.12), transparent 30%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 0.18em; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface-3);
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }
.wrap { width: min(1040px, calc(100% - 32px)); margin: 0 auto; }
.topbar .wrap { width: min(1240px, calc(100% - 32px)); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: var(--nav-bg);
  backdrop-filter: blur(18px) saturate(130%);
}
.nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 820; letter-spacing: 0; text-decoration: none; white-space: nowrap; }
.brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: var(--glow);
  object-fit: contain;
  padding: 3px;
}
.links {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.links::-webkit-scrollbar { display: none; }
.theme-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.035);
}
.theme-toggle button {
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  padding: 5px 8px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 780;
  cursor: pointer;
}
.theme-toggle button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: var(--glow);
}
.theme-toggle button:hover {
  color: var(--text);
}
.links a, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 720;
  font-size: 0.86rem;
  line-height: 1.15;
}
.links a:hover, .button:hover { border-color: var(--line-strong); background: var(--hover-bg); text-decoration: none; }
.button.primary { background: rgba(37, 87, 77, 0.82); border-color: rgba(121, 223, 177, 0.5); color: #f2fff8; }
.button.warn { border-color: rgba(232, 203, 113, 0.45); color: #fff1b8; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.78rem;
  font-weight: 820;
  line-height: 1.12;
  text-decoration: none;
  white-space: nowrap;
}
.pill.ok {
  border-color: rgba(121, 223, 177, 0.42);
  color: var(--text);
  background: rgba(121, 223, 177, 0.1);
}

.hero {
  padding: 38px 0 24px;
  border-bottom: 1px solid rgba(177, 221, 214, 0.1);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 860;
}
h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 820px;
}
h2 { margin: 0 0 12px; font-size: clamp(1.16rem, 2vw, 1.55rem); line-height: 1.18; letter-spacing: 0; }
h3 { margin: 0 0 6px; font-size: 0.98rem; letter-spacing: 0; }
p { color: var(--muted); margin: 0 0 10px; }
.lede { font-size: clamp(1rem, 1.35vw, 1.14rem); max-width: 760px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.band { padding: 18px 0; }
.intro-band {
  border-bottom: 1px solid rgba(177, 221, 214, 0.08);
  background: rgba(255, 255, 255, 0.012);
}
.split {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 24px;
  align-items: start;
}
.split h2 {
  max-width: 460px;
  margin-bottom: 0;
}
.split p:last-child { margin-bottom: 0; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card, .notice, .form-panel {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card-bg);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(14px) saturate(116%);
}
.card {
  min-height: 104px;
  padding: 14px;
}
.card h3 { color: #ffffff; }
.card p { font-size: 0.93rem; }
.notice {
  padding: 14px;
  border-color: rgba(232, 203, 113, 0.36);
  background: rgba(25, 25, 18, 0.78);
}
.notice strong { color: var(--amber); }
.form-panel {
  padding: 18px;
  background: var(--surface-2);
}

label {
  display: grid;
  gap: 5px;
  color: var(--text);
  font-size: 0.91rem;
  font-weight: 720;
}
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--control-bg);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(107, 188, 231, 0.28);
  outline-offset: 1px;
  border-color: rgba(107, 188, 231, 0.66);
}
textarea { min-height: 108px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.full { grid-column: 1 / -1; }
.check { display: flex; gap: 9px; align-items: flex-start; color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.check input { width: auto; min-height: 0; margin-top: 4px; }
.status { padding: 12px; border-radius: 6px; background: rgba(121, 223, 177, 0.1); border: 1px solid rgba(121, 223, 177, 0.26); }
.private { border-color: rgba(238, 146, 146, 0.35); }
.private strong { color: var(--danger); }
.table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 6px; font-size: 0.92rem; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 8px 9px; text-align: left; vertical-align: top; }
.table th { color: var(--green); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table tr:hover td { background: rgba(255, 255, 255, 0.035); }
.table-wrap { overflow-x: auto; }
.admin-table td { min-width: 160px; }
.admin-review-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 8px;
  min-width: min(520px, 68vw);
}
.admin-review-form label { font-size: 0.82rem; }
.admin-review-form textarea { min-height: 72px; }
.admin-review-form .button, .admin-review-form label:nth-of-type(4) { grid-column: 1 / -1; }
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.profile-head h2 {
  margin-bottom: 4px;
}
.profile-photo {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  color: var(--green);
  background: var(--surface-3);
  box-shadow: var(--glow);
  font-size: 1.7rem;
  font-weight: 860;
}
.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-photo-change {
  position: absolute;
  inset: auto 6px 6px;
  display: inline-flex;
  justify-content: center;
  min-height: 0;
  border: 1px solid rgba(121, 223, 177, 0.46);
  border-radius: 999px;
  padding: 4px 7px;
  color: #f2fff8;
  background: rgba(4, 20, 19, 0.78);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-size: 0.67rem;
  font-weight: 840;
  line-height: 1.1;
  text-align: center;
  backdrop-filter: blur(10px) saturate(125%);
}
.profile-photo-change:hover {
  border-color: rgba(159, 232, 255, 0.72);
  background: rgba(17, 74, 67, 0.9);
}
.profile-photo-change:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.profile-photo-change input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.profile-form {
  display: grid;
  gap: 12px;
}
.footer {
  padding: 24px 0;
  color: var(--quiet);
  border-top: 1px solid var(--line);
  margin-top: 24px;
  background: rgba(0, 0, 0, 0.14);
  font-size: 0.9rem;
}
.small { font-size: 0.88rem; color: var(--muted); }
.message-widget {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}
.message-widget > * { pointer-events: auto; }
.message-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(121, 223, 177, 0.28);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--tab-text);
  background: var(--tab-bg);
  box-shadow: 0 12px 28px rgba(8, 33, 31, 0.24), 0 0 0 1px rgba(255, 255, 255, 0.055);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 840;
  cursor: pointer;
}
.message-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  color: #0b211f;
  background: #baf7dc;
  font-size: 0.72rem;
  font-weight: 900;
}
.message-tab:hover {
  border-color: rgba(159, 232, 255, 0.64);
  filter: brightness(1.04);
}
.message-widget.is-hidden .message-tab {
  opacity: 0.9;
}
.message-widget.is-open .message-tab {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.message-panel {
  width: 100%;
  max-height: min(72vh, 620px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0;
  color: var(--text);
  background: var(--surface-2);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25), var(--glow);
  backdrop-filter: blur(18px) saturate(128%);
}
.message-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(121, 223, 177, 0.07);
}
.message-panel-head strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.98rem;
}
.message-panel-head p,
.message-panel p {
  margin-bottom: 0;
  font-size: 0.88rem;
}
.message-panel > p,
.message-panel > .status,
.message-panel > .notice,
.message-panel > .actions,
.message-panel > .message-widget-threads,
.message-panel > .message-new-thread {
  margin-left: 14px;
  margin-right: 14px;
}
.message-panel > p,
.message-panel > .status,
.message-panel > .notice {
  margin-top: 12px;
}
.message-panel > .actions,
.message-panel > .message-new-thread {
  margin-top: 12px;
  margin-bottom: 14px;
}
.message-panel > .message-widget-threads {
  margin-top: 12px;
}
.message-panel .status {
  padding: 10px 11px;
  border-radius: 8px;
  color: var(--text);
  background: rgba(121, 223, 177, 0.12);
}
.message-form {
  display: grid;
  gap: 9px;
}
.message-form textarea {
  min-height: 92px;
}
.message-form .button {
  width: 100%;
}
.message-new-thread {
  border-top: 1px solid var(--line);
  padding-top: 11px;
}
.message-new-thread summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 780;
  list-style-position: outside;
}
.message-new-thread .message-form {
  margin-top: 10px;
}
.message-widget-threads {
  display: grid;
  gap: 9px;
}
.message-widget-thread {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: rgba(121, 223, 177, 0.055);
}
.message-widget-thread.has-unread {
  border-color: rgba(86, 210, 178, 0.58);
  box-shadow: inset 3px 0 0 rgba(86, 210, 178, 0.75);
}
.message-widget-thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.message-widget-thread-head strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.22;
}
.message-widget-thread p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 8px;
  color: var(--muted);
}
.message-unread-line {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
}
.compact-reply {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.compact-reply textarea {
  min-height: 78px;
}
.actions.compact {
  margin-top: 10px;
  gap: 7px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
.section-head p {
  max-width: 760px;
}
.partner-thread {
  display: grid;
  gap: 14px;
}
.thread-list {
  display: grid;
  gap: 12px;
  align-items: start;
}
.thread-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.026);
  box-shadow: var(--glow);
}
.thread-filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 780;
  line-height: 1.12;
  text-decoration: none;
  white-space: nowrap;
}
.thread-filter-pill:hover {
  border-color: var(--line);
  color: var(--text);
  background: var(--hover-bg);
}
.thread-filter-pill.is-active,
.thread-filter-pill[aria-current="page"] {
  border-color: rgba(121, 223, 177, 0.38);
  color: var(--text);
  background: rgba(37, 87, 77, 0.72);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}
.message-inbox-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.82fr) minmax(0, 1.8fr);
  gap: 14px;
  align-items: start;
}
.thread-sidebar,
.thread-detail {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
}
.thread-sidebar {
  display: grid;
  gap: 6px;
  padding: 8px;
  max-height: 680px;
  overflow: auto;
}
.thread-detail {
  padding: 14px;
  box-shadow: var(--glow);
}
.thread-row {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: var(--soft-band);
}
.thread-row:hover,
.thread-row.selected {
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.thread-row.has-unread {
  border-left-color: rgba(86, 210, 178, 0.84);
  border-left-width: 4px;
  background: rgba(121, 223, 177, 0.07);
}
.thread-row strong {
  line-height: 1.22;
}
.thread-row-meta {
  color: var(--quiet);
  font-size: 0.78rem;
}
.thread-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  box-shadow: var(--glow);
}
.thread-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.thread-card-head h3 {
  margin: 2px 0 0;
  font-size: 1rem;
}
.thread-messages {
  display: grid;
  gap: 11px;
}
.thread-message {
  width: min(700px, 88%);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: var(--surface);
  box-shadow: var(--glow);
}
.thread-message.from-audia {
  border-color: rgba(121, 223, 177, 0.35);
  border-left: 3px solid rgba(121, 223, 177, 0.72);
  justify-self: start;
}
.thread-message.from-partner {
  justify-self: end;
  background: var(--surface-3);
  border-right: 3px solid rgba(107, 188, 231, 0.62);
}
.thread-message h3 {
  margin: 6px 0;
  font-size: 0.98rem;
}
.thread-message p {
  margin-bottom: 0;
  white-space: pre-wrap;
}
.thread-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}
.thread-meta strong {
  color: var(--green);
}
.thread-reply-form {
  display: grid;
  gap: 10px;
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
  background: var(--surface-2);
}
.thread-card .thread-reply-form {
  width: 100%;
  background: rgba(255, 255, 255, 0.035);
}
.new-thread-form {
  width: 100%;
}
.thread-reply-form h3 {
  margin-bottom: 2px;
}
.thread-reply-form textarea {
  min-height: 112px;
}
.inline-reply textarea {
  min-height: 88px;
}
.thread-reply-form .actions {
  margin-top: 2px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef6f3;
    --bg-2: #e4efec;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-2: rgba(255, 255, 255, 0.98);
    --surface-3: rgba(239, 249, 245, 0.98);
    --text: #102123;
    --muted: #344f51;
    --quiet: #5d7476;
    --line: rgba(29, 72, 76, 0.22);
    --line-strong: rgba(29, 72, 76, 0.42);
    --blue: #126c92;
    --green: #147a5d;
    --amber: #7a5c00;
    --danger: #9b2f35;
    --shadow: 0 14px 30px rgba(21, 51, 54, 0.11);
    --glow: 0 0 0 1px rgba(20, 122, 93, 0.08);
    --focus: #005f83;
    --focus-ring: 0 0 0 3px rgba(18, 108, 146, 0.22);
    --control-bg: rgba(255, 255, 255, 0.96);
    --nav-bg: rgba(247, 252, 250, 0.94);
    --hover-bg: rgba(20, 122, 93, 0.075);
    --card-bg: rgba(255, 255, 255, 0.94);
    --soft-band: rgba(17, 89, 76, 0.035);
    --tab-bg: #166b56;
    --tab-text: #ffffff;
    --page-bg:
      linear-gradient(180deg, #f8fcfb 0%, #eef6f3 54%, #e7f0ed 100%),
      radial-gradient(circle at 12% -12%, rgba(20, 122, 93, 0.08), transparent 30%);
  }

  .brand-logo,
  .links a,
  .button {
    background: rgba(255, 255, 255, 0.68);
  }

  .links a:hover,
  .button:hover,
  .table tr:hover td {
    background: rgba(20, 122, 93, 0.07);
  }

  .button.primary {
    background: #166b56;
    color: #ffffff;
  }

  .button.warn {
    color: #684f00;
    background: rgba(255, 247, 214, 0.86);
  }

  .card h3 {
    color: #132225;
  }

  .notice {
    background: rgba(255, 250, 229, 0.9);
  }

  .message-tab {
    color: #ffffff;
    background: #166b56;
  }

}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef6f3;
  --bg-2: #e4efec;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(255, 255, 255, 0.98);
  --surface-3: rgba(239, 249, 245, 0.98);
  --text: #102123;
  --muted: #344f51;
  --quiet: #5d7476;
  --line: rgba(29, 72, 76, 0.22);
  --line-strong: rgba(29, 72, 76, 0.42);
  --blue: #126c92;
  --green: #147a5d;
  --amber: #7a5c00;
  --danger: #9b2f35;
  --shadow: 0 14px 30px rgba(21, 51, 54, 0.11);
  --glow: 0 0 0 1px rgba(20, 122, 93, 0.08);
  --focus: #005f83;
  --focus-ring: 0 0 0 3px rgba(18, 108, 146, 0.22);
  --control-bg: rgba(255, 255, 255, 0.96);
  --nav-bg: rgba(247, 252, 250, 0.94);
  --hover-bg: rgba(20, 122, 93, 0.075);
  --card-bg: rgba(255, 255, 255, 0.94);
  --soft-band: rgba(17, 89, 76, 0.035);
  --tab-bg: #166b56;
  --tab-text: #ffffff;
  --page-bg:
    linear-gradient(180deg, #f8fcfb 0%, #eef6f3 54%, #e7f0ed 100%),
    radial-gradient(circle at 12% -12%, rgba(20, 122, 93, 0.08), transparent 30%);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071112;
  --bg-2: #0a181a;
  --surface: rgba(13, 25, 28, 0.88);
  --surface-2: rgba(15, 31, 34, 0.94);
  --surface-3: rgba(18, 40, 43, 0.98);
  --text: #f3fbf8;
  --muted: #b7c8c5;
  --quiet: #8ca4a1;
  --line: rgba(177, 221, 214, 0.18);
  --line-strong: rgba(177, 221, 214, 0.34);
  --blue: #6bbce7;
  --green: #79dfb1;
  --amber: #e8cb71;
  --danger: #ee9292;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
  --glow: 0 0 0 1px rgba(121, 223, 177, 0.08), 0 0 38px rgba(107, 188, 231, 0.08);
  --focus: #9fe8ff;
  --focus-ring: 0 0 0 3px rgba(115, 189, 231, 0.34);
  --control-bg: rgba(5, 13, 15, 0.9);
  --nav-bg: rgba(6, 16, 18, 0.91);
  --hover-bg: rgba(255, 255, 255, 0.068);
  --card-bg: rgba(13, 25, 28, 0.88);
  --soft-band: rgba(255, 255, 255, 0.018);
  --tab-bg: rgba(18, 112, 86, 0.92);
  --tab-text: #f2fff8;
  --page-bg:
    linear-gradient(180deg, rgba(7, 19, 22, 0.94) 0%, rgba(6, 16, 18, 1) 56%, #050d0f 100%),
    radial-gradient(circle at 15% -10%, rgba(121, 223, 177, 0.12), transparent 30%);
}

html[data-theme="dark"] .brand-logo,
html[data-theme="dark"] .links a,
html[data-theme="dark"] .button {
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .links a:hover,
html[data-theme="dark"] .button:hover,
html[data-theme="dark"] .table tr:hover td {
  background: rgba(255, 255, 255, 0.068);
}

html[data-theme="dark"] .button.primary {
  background: rgba(37, 87, 77, 0.82);
  color: #f2fff8;
}

html[data-theme="dark"] .button.warn {
  color: #fff1b8;
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .card h3 {
  color: #ffffff;
}

html[data-theme="dark"] .notice {
  background: rgba(25, 25, 18, 0.78);
}

html[data-theme="light"] .brand-logo,
html[data-theme="light"] .links a,
html[data-theme="light"] .button {
  background: rgba(255, 255, 255, 0.68);
}

html[data-theme="light"] .links a:hover,
html[data-theme="light"] .button:hover,
html[data-theme="light"] .table tr:hover td {
  background: rgba(20, 122, 93, 0.07);
}

html[data-theme="light"] .button.primary {
  background: #166b56;
  color: #ffffff;
}

html[data-theme="light"] .button.warn {
  color: #684f00;
  background: rgba(255, 247, 214, 0.86);
}

html[data-theme="light"] .card h3 {
  color: #132225;
}

html[data-theme="light"] .notice {
  background: rgba(255, 250, 229, 0.9);
}

html[data-theme="light"] .message-tab {
  color: #ffffff;
  background: #166b56;
}

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

.access-chip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-weight: 720;
}

.access-chip span:last-child {
  color: var(--text);
}

.access-chip.ok {
  border-color: rgba(121, 223, 177, 0.45);
  background: rgba(121, 223, 177, 0.06);
}

.access-chip.deny {
  border-color: rgba(232, 203, 113, 0.38);
  background: rgba(232, 203, 113, 0.05);
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(159, 232, 255, 0.55);
    --line-strong: rgba(159, 232, 255, 0.82);
  }

  .card,
  .notice,
  .form-panel,
  .links a,
  .button,
  input,
  select,
  textarea {
    border-width: 2px;
  }
}

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

@media (max-width: 900px) {
  .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
  }
  .brand {
    min-width: 0;
    flex: 1 1 auto;
  }
  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .links {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .links a, .button { font-size: 0.84rem; }
  .split {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .grid, .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .wrap { width: min(100% - 24px, 1040px); }
  .topbar .wrap { width: min(100% - 24px, 1240px); }
  .nav {
    min-height: 0;
    padding: 9px 0;
    gap: 8px;
  }
  .brand {
    max-width: calc(100% - 178px);
  }
  .brand-logo {
    width: 30px;
    height: 30px;
  }
  .theme-toggle {
    width: auto;
    max-width: 176px;
  }
  .theme-toggle button {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 4px 8px;
  }
  .links {
    width: 100%;
    margin-top: 1px;
    padding-bottom: 2px;
    mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 28px), transparent 100%);
  }
  .links a {
    width: auto;
    flex: 0 0 auto;
    min-height: 31px;
    padding: 6px 9px;
    white-space: nowrap;
  }
  .hero { padding-top: 26px; }
  .grid, .grid.two, .fields, .access-grid { grid-template-columns: 1fr; }
  .button { width: 100%; }
  main {
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }
  .form-panel { padding: 14px; }
  .profile-head {
    align-items: flex-start;
  }
  .profile-photo {
    width: 86px;
    height: 86px;
    border-radius: 10px;
  }
  .profile-photo-change {
    inset: auto 5px 5px;
    padding: 4px 6px;
    font-size: 0.64rem;
  }
  .message-widget {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    width: min(360px, calc(100vw - 20px));
    align-items: stretch;
  }
  .message-widget.is-hidden {
    width: auto;
    max-width: calc(100vw - 18px);
  }
  .message-panel {
    max-height: min(68vh, 560px);
    overflow: auto;
    border-radius: 14px;
  }
  .message-tab {
    width: fit-content;
    align-self: flex-end;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  .message-panel-head {
    padding: 13px 13px 11px;
  }
  .message-panel > p,
  .message-panel > .status,
  .message-panel > .notice,
  .message-panel > .actions,
  .message-panel > .message-widget-threads,
  .message-panel > .message-new-thread {
    margin-left: 13px;
    margin-right: 13px;
  }
  .message-inbox-layout {
    grid-template-columns: 1fr;
  }
  .thread-sidebar {
    max-height: 360px;
  }
  .thread-message {
    width: min(100%, 100%);
  }
}
