:root {
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  color-scheme: dark;
  color: #e7eef9;
  background: #0b1322;
  font-size: 16px;
  --ink: #e7eef9;
  --accent: #73a9f5;
  --line: #2a3b55;
  --muted: #9cacc2;
  --page: #0b1322;
  --surface: #111d30;
  --surface-soft: #17263d;
  --input: #0d1829;
  --button-bg: #4f8fdf;
  --button-text: #ffffff;
  --sidebar: #14243b;
  --sidebar-text: #bdcbe0;
  --sidebar-line: #304967;
  --sidebar-active: #25466f;
  --sidebar-brand: #91bbf7;
  --danger: #ff9d9d;
  --danger-bg: #3a2022;
  --notice-bg: #332e1d;
  --notice-border: #61562d;
  --notice-text: #f0dfa1;
  --hint-bg: #15263d;
  --hint-border: #304d72;
  --hint-text: #bfd3ee;
  --track: #24344b;
  --border: var(--line);
  --panel: var(--surface-soft);
}
:root[data-theme="light"] {
  color-scheme: light;
  color: #17243a;
  background: #f3f6fa;
  --ink: #17243a;
  --accent: #2f6fb6;
  --line: #d5deea;
  --muted: #65748a;
  --page: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --input: #ffffff;
  --button-bg: #285f9e;
  --button-text: #ffffff;
  --danger: #a33333;
  --danger-bg: #fff1f1;
  --notice-bg: #fff4d9;
  --notice-border: #e9dcae;
  --notice-text: #594b20;
  --hint-bg: #eef5fd;
  --hint-border: #cfdef1;
  --hint-text: #365777;
  --track: #dfe7f1;
  --sidebar: #e6eef8;
  --sidebar-text: #344a67;
  --sidebar-line: #c9d7e8;
  --sidebar-active: #ceddf0;
  --sidebar-brand: #1f5fa9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--page);
  color: inherit;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
a {
  color: inherit;
}
button,
.button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--button-text);
  padding: 12px 18px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
button:hover,
.button:hover {
  filter: brightness(1.12);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}
.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.danger {
  color: var(--danger);
  background: var(--danger-bg);
}
.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}
.danger-zone + .danger-zone {
  margin-top: 22px;
}
.permanent-delete {
  background: var(--danger-bg);
}
.small {
  padding: 7px 11px;
  font-size: 0.875rem;
}
.muted {
  color: var(--muted);
  line-height: 1.6;
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.15em;
}
.brand {
  font-size: 1.25rem;
  text-decoration: none;
  font-weight: 750;
  display: flex;
  gap: 8px;
  align-items: center;
}
.brand span {
  font-weight: 400;
}
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.brand-panel {
  background: var(--sidebar);
  color: var(--ink);
  padding: 48px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}
.brand-panel .brand {
  color: var(--sidebar-brand);
}
.brand-panel h1 {
  font-size: clamp(2.6rem, 4.5vw, 4.6rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
  font-weight: 550;
}
.brand-panel p:not(.eyebrow) {
  color: var(--sidebar-text);
  max-width: 400px;
  line-height: 1.8;
}
.brand-panel small {
  color: var(--sidebar-text);
}
.auth-main {
  display: grid;
  place-items: center;
  padding: 40px;
}
.auth-card {
  width: 100%;
  max-width: 410px;
}
h2 {
  font-size: 2rem;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 12px 0;
}
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin: 18px 0 8px;
}
input,
textarea,
select {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  color: inherit;
  margin-top: 8px;
}
textarea {
  min-height: 105px;
  resize: vertical;
}
input[type="checkbox"] {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--button-bg);
  flex-shrink: 0;
}
.auth-card button {
  width: 100%;
  margin-top: 22px;
  justify-content: space-between;
}
#error,
.error {
  color: var(--danger);
  white-space: pre-wrap;
}
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.bot-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}
.bot-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
}
.bot-sidebar .brand { color: var(--sidebar-brand); text-decoration: none; }
.bot-sidebar .nav { display: grid; gap: 7px; }
.bot-sidebar .identity { margin-top: auto; }
.bot-product {
  display: grid;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--sidebar-line);
  border-radius: 14px;
  background: var(--sidebar-active);
}
.bot-product span { color: var(--sidebar-brand); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.bot-product small { color: var(--sidebar-text); }
.bot-workspace { max-width: 1120px; }
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.dashboard-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.dashboard-toggle span { display: grid; gap: 4px; }
.dashboard-toggle small { color: var(--muted); font-weight: 400; }
.dashboard-toggle input { width: 20px; height: 20px; }
.permission-role-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.4fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.command-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.embed-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr);
  gap: 22px;
  align-items: start;
}
.embed-preview-card { position: sticky; top: 84px; }
.rule-field-editor {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.discord-embed-preview {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-left: 4px solid #2b6cb0;
  border-radius: 4px;
  background: #2b2d31;
  color: #f2f3f5;
  min-height: 120px;
}
.discord-embed-preview h3 { margin: 8px 0; color: white; }
.discord-embed-preview p { color: #dbdee1; font-size: .9rem; }
.embed-author { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.embed-author img, .discord-embed-preview small img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.embed-preview-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.embed-preview-fields > div { grid-column: 1 / -1; display: grid; gap: 4px; font-size: .85rem; }
.embed-preview-fields > div.inline { grid-column: span 1; }
.embed-preview-fields span { color: #dbdee1; }
.embed-thumbnail { position: absolute; right: 16px; top: 44px; width: 72px; height: 72px; object-fit: cover; border-radius: 4px; }
.embed-image { width: 100%; max-height: 280px; object-fit: cover; border-radius: 4px; margin-top: 14px; }
.discord-embed-preview small { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: #b5bac1; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 20px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.sidebar .brand {
  font-size: 1rem;
  color: var(--sidebar-brand);
  flex-wrap: wrap;
}
.nav {
  display: grid;
  gap: 6px;
}
.nav a {
  padding: 12px 15px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
}
.nav a:hover,
.nav a.active {
  background: var(--sidebar-active);
  color: var(--ink);
}
.nav small {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  padding: 18px 15px 6px;
  color: var(--sidebar-text);
}
.identity {
  margin-top: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  border-top: 1px solid var(--sidebar-line);
  padding-top: 22px;
  overflow-wrap: anywhere;
}
.identity button {
  margin-top: 12px;
}
.content {
  min-width: 0;
}
.topbar {
  height: 78px;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}
.topbar-actions {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.theme-toggle {
  min-width: 66px;
  height: 34px;
  padding: 4px 7px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
}
.theme-toggle:hover {
  filter: none;
  border-color: var(--accent);
}
.theme-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.38;
  transition:
    opacity 0.15s,
    background 0.15s;
}
:root[data-theme="dark"] .moon-icon,
:root[data-theme="light"] .sun-icon {
  opacity: 1;
  background: var(--button-bg);
  color: var(--button-text);
}
.auth-theme-toggle {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 3;
}
main.workspace {
  padding: 38px 40px;
  max-width: 1510px;
  margin: auto;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.page-head h1 {
  margin: 7px 0;
  font-size: 2.1rem;
  letter-spacing: -0.045em;
  font-weight: 600;
}
.page-head p {
  margin: 4px 0;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 32px;
}
.metric {
  background: var(--surface);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.metric strong {
  display: block;
  font-size: 2rem;
  font-weight: 550;
  margin-top: 12px;
}
.metric span {
  font-size: 0.875rem;
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  min-width: 0;
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-decoration: none;
  transition:
    transform 0.15s,
    border-color 0.15s;
}
.service-grid { margin-top: 18px; grid-template-columns: repeat(auto-fit,minmax(300px,1fr)); gap: 14px; }
.service-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.service-card h3 { margin: 3px 0 0; }
.service-card h3[data-service-name] { cursor: text; text-decoration: underline dotted transparent; text-underline-offset: 4px; transition: text-decoration-color .15s ease; }
.service-card h3[data-service-name]:hover { text-decoration-color: var(--muted); }
.service-name-editor { width: min(100%,420px); margin: -7px 0; padding: 6px 8px; font: inherit; font-weight: inherit; }
.service-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.service-actions { justify-content: flex-start; }
.service-unlock { max-width: 540px; margin: 30px auto 0; }
.service-unlock form { margin-top: 18px; }
.service-notice { padding-block: 12px; }
.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.project-card h3 {
  margin: 2px 0 8px;
  font-size: 1.25rem;
}
.card p {
  line-height: 1.65;
}
.card h3 {
  font-weight: 600;
}
.catalogue-editor {
  padding: 0;
}
.catalogue-editor summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  list-style: none;
}
.catalogue-editor summary::-webkit-details-marker {
  display: none;
}
.catalogue-editor summary::after {
  content: "›";
  color: var(--muted);
  font-size: 1.4rem;
  order: 3;
  transition: transform 0.15s ease;
}
.catalogue-editor[open] summary::after {
  transform: rotate(90deg);
}
.catalogue-editor summary span {
  margin-left: auto;
  color: var(--muted);
  font-weight: 650;
}
.catalogue-editor-content {
  border-top: 1px solid var(--line);
  padding: 22px 26px 26px;
}
.quote-summary {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}
.quote-summary .quote-group {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.quote-summary .quote-group:first-of-type {
  padding-top: 0;
}
.quote-summary .quote-group:last-of-type {
  border-bottom: 0;
}
.quote-summary .discount-row {
  color: var(--accent);
}
:root[data-theme="light"] .quote-summary .discount-row {
  color: #2f649d;
}
.quote-summary .quote-grand-total {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  font-size: 1.1rem;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.wrap {
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}
.badge.active {
  background: #1d3f6d;
  color: #c9e0ff;
}
.badge.review {
  background: #40371f;
  color: #efd783;
}
:root[data-theme="light"] .badge.active {
  background: #e0edfc;
  color: #245888;
}
:root[data-theme="light"] .badge.review {
  background: #fff1d6;
  color: #896116;
}
.progress {
  height: 8px;
  background: var(--track);
  border-radius: 20px;
  overflow: hidden;
  margin: 13px 0;
}
.progress > div {
  height: 100%;
  background: #4f8fdf;
  border-radius: 20px;
  transition: width 0.25s;
}
.progress-summary {
  background: #17365f;
  color: white;
}
.progress-summary .muted {
  color: #c4d7ef;
}
.progress-summary .progress {
  background: #2b4d78;
}
.progress-summary .progress > div {
  background: #79b0f8;
}
.progress-summary strong {
  font-size: 2.4rem;
  font-weight: 500;
}
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}
.stack {
  display: grid;
  gap: 20px;
}
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin: 25px 0;
  overflow: auto;
}
.tabs a {
  padding: 9px 13px;
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.875rem;
}
.tabs a.active {
  background: var(--surface-soft);
  border-radius: 6px;
  font-weight: 650;
}
.task {
  display: flex;
  gap: 13px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
}
.task span {
  flex: 1;
  overflow-wrap: anywhere;
}
.task.done span {
  text-decoration: line-through;
  color: var(--muted);
}
.task button {
  padding: 4px 9px;
}
.inline {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}
.inline input {
  margin: 0;
}
.feature-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.feature-head h3 {
  margin: 0 0 10px;
}
.feature-head strong {
  white-space: nowrap;
}
.feature-number {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 14px;
  letter-spacing: 0.09em;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.hint {
  padding: 15px 18px;
  border: 1px solid var(--hint-border);
  background: var(--hint-bg);
  border-radius: 8px;
  color: var(--hint-text);
  font-size: 0.875rem;
  line-height: 1.6;
}
.empty {
  text-align: center;
  padding: 60px 25px;
}
.empty h3 {
  font-size: 1.4rem;
}
.check-label {
  display: flex;
  gap: 12px;
  align-items: start;
  font-weight: 400;
  line-height: 1.5;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-weight: 500;
}
td input[type="checkbox"] {
  vertical-align: middle;
}
td label {
  display: inline-flex;
  gap: 8px;
  margin: 4px 10px 4px 0;
}
pre.agreement {
  white-space: pre-wrap;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.timeline {
  padding: 0;
  list-style: none;
}
.timeline li {
  border-left: 2px solid var(--line);
  padding: 0 0 22px 20px;
  margin-left: 5px;
}
.timeline small {
  color: var(--muted);
}
.timeline p {
  margin: 5px 0;
  white-space: pre-wrap;
}
.notice {
  padding: 14px 20px;
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  color: var(--notice-text);
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 20px;
  line-height: 1.6;
}
#toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  max-width: 420px;
  background: #17365f;
  color: white;
  padding: 16px 22px;
  border-radius: 10px;
  box-shadow: 0 8px 35px #0002;
  display: none;
  z-index: 9;
}
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.link {
  background: none;
  padding: 0;
  color: var(--ink);
  text-decoration: underline;
}
.subtle {
  font-size: 0.8rem;
  color: var(--muted);
}
.preserve {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.section-label {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 30px 0 16px;
}
.amount {
  font-variant-numeric: tabular-nums;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
@media (max-width: 1100px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .shell {
    grid-template-columns: 205px 1fr;
  }
  main.workspace {
    padding: 28px;
  }
  .topbar {
    padding: 0 28px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .brand-panel {
    min-height: 240px;
    padding: 30px;
  }
  .brand-panel h1 {
    font-size: 2.4rem;
    margin: 20px 0;
  }
  .brand-panel small,
  .brand-panel p:not(.eyebrow) {
    display: none;
  }
  .auth-main {
    padding: 35px 25px;
  }
  .shell {
    display: block;
  }
  .bot-shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 20px;
    gap: 16px;
  }
  .bot-sidebar {
    position: static;
    height: auto;
    padding: 20px;
    gap: 16px;
  }
  .dashboard-metrics {
    grid-template-columns: 1fr;
  }
  .permission-role-row,
  .command-permission-grid,
  .embed-editor-layout {
    grid-template-columns: 1fr;
  }
  .embed-preview-card { position: static; }
  .nav {
    display: flex;
    overflow: auto;
  }
  .nav a {
    white-space: nowrap;
  }
  .nav small,
  .identity {
    display: none;
  }
  .topbar {
    height: 58px;
    padding: 0 20px;
  }
  .topbar-email {
    display: none;
  }
  .topbar-actions {
    gap: 9px;
  }
  main.workspace {
    padding: 25px 18px;
  }
  .page-head {
    align-items: start;
    flex-direction: column;
  }
  .metrics {
    gap: 8px;
  }
  .metric {
    padding: 15px 11px;
  }
  .metric strong {
    font-size: 1.6rem;
  }
  .metric span {
    font-size: 0.75rem;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 20px;
  }
  .row.wrap {
    align-items: start;
  }
  .inline {
    flex-wrap: wrap;
  }
  .inline input {
    flex: 1;
    min-width: 160px;
  }
  .feature-head {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.inline button {
  white-space: nowrap;
  flex-shrink: 0;
}
.demo-banner {
  padding: 10px 20px;
  background: var(--hint-bg);
  color: var(--hint-text);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--hint-border);
}
.mobile-logout {
  display: none;
}
@media (max-width: 720px) {
  .mobile-logout {
    display: inline-flex;
  }
  .progress-summary .row {
    align-items: start;
  }
}
