:root {
  --ink: #18201d;
  --muted: #69726e;
  --paper: #f5f4ef;
  --card: rgba(255, 255, 255, 0.9);
  --line: #dedfd8;
  --accent: #d64a33;
  --accent-dark: #b63724;
  --green: #23745a;
  --green-soft: #e6f2ec;
  --amber: #936414;
  --amber-soft: #fbf0d8;
  --danger: #b93434;
  --danger-soft: #fae9e7;
  --shadow: 0 22px 65px rgba(32, 41, 36, 0.11);
  --radius-lg: 26px;
  --radius-md: 17px;
  --radius-sm: 11px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(225, 220, 206, 0.5), transparent 42%),
    radial-gradient(circle at 90% 10%, rgba(214, 74, 51, 0.08), transparent 28%),
    var(--paper);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.25;
}

.page-glow-one {
  top: -180px;
  right: -100px;
  background: #e5a18d;
}

.page-glow-two {
  bottom: -220px;
  left: -150px;
  background: #b8cdbd;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.muted {
  color: var(--muted);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  align-items: stretch;
  min-height: calc(100vh - 68px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 34px;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(22px);
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(46px, 8vw, 110px);
  color: #f8f6ef;
  background:
    linear-gradient(145deg, rgba(15, 30, 24, 0.3), rgba(15, 30, 24, 0.9)),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 12px),
    #17362b;
}

.brand-panel .eyebrow {
  color: #f7a08d;
}

.brand-panel h1 {
  max-width: 690px;
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.brand-copy {
  max-width: 570px;
  margin: 32px 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.96rem;
  line-height: 1.72;
}

.security-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
}

.security-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7cd9ad;
  box-shadow: 0 0 0 5px rgba(124, 217, 173, 0.12);
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(38px, 6vw, 78px);
  background: rgba(255, 255, 255, 0.82);
}

.login-card h2,
.topbar h1,
.hero-card h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-weight: 500;
}

.login-card h2 {
  font-size: 1.8rem;
}

.login-card p {
  margin: 8px 0 0;
}

.field-label {
  color: #3d4642;
  font-size: 0.9rem;
  font-weight: 700;
}

.control {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea.control {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

.control:focus {
  border-color: rgba(214, 74, 51, 0.72);
  box-shadow: 0 0 0 4px rgba(214, 74, 51, 0.1);
  background: #fff;
}

.control:disabled {
  color: #8b918e;
  background: #eeefeb;
}

.button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 750;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(214, 74, 51, 0.22);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button-secondary {
  border-color: #cfd2cc;
  color: #34413b;
  background: #fff;
}

.button-ghost {
  color: #4a5550;
  background: transparent;
}

.button-full {
  width: 100%;
  margin-top: 4px;
}

.form-message {
  min-height: 22px;
  margin: 0 !important;
  font-size: 0.87rem;
}

.error-text {
  color: var(--danger);
}

.dashboard {
  min-height: calc(100vh - 68px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.topbar h1 {
  font-size: clamp(1.85rem, 3.2vw, 3rem);
  line-height: 1.08;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 750;
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-online {
  color: var(--green);
  background: var(--green-soft);
}

.status-online span {
  background: #39a67c;
  box-shadow: 0 0 0 5px rgba(57, 166, 124, 0.12);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.sidebar {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 16px;
}

.sidebar-card,
.hero-card,
.config-section,
.action-bar {
  border: 1px solid rgba(210, 213, 206, 0.85);
  box-shadow: 0 14px 38px rgba(34, 42, 38, 0.06);
  background: var(--card);
  backdrop-filter: blur(16px);
}

.sidebar-card {
  padding: 18px;
  border-radius: var(--radius-md);
}

.sidebar-title {
  margin: 0 0 12px;
  color: #7a817d;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.group-navigation {
  display: grid;
  gap: 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  color: #4a534f;
  text-align: left;
  background: transparent;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-dark);
  background: #f8ece8;
}

.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #7b817e;
  background: #eceee9;
  font-size: 0.72rem;
}

.notice-card {
  color: #59625e;
  font-size: 0.82rem;
  line-height: 1.7;
}

.notice-card ol {
  margin: 0;
  padding-left: 20px;
}

.content-column {
  min-width: 0;
}

#config-form {
  padding-bottom: 92px;
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 28px 30px;
  border-radius: var(--radius-lg);
}

.hero-card h2 {
  font-size: clamp(1.45rem, 2.2vw, 2.05rem);
}

.hero-card p:not(.eyebrow) {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.mode-badge {
  flex: 0 0 auto;
  padding: 11px 15px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.mode-badge.mode-live {
  color: var(--danger);
  background: var(--danger-soft);
}

.global-message {
  margin: 0 0 18px;
  padding: 14px 17px;
  border: 1px solid #ead6a7;
  border-radius: var(--radius-sm);
  color: var(--amber);
  background: var(--amber-soft);
  line-height: 1.55;
}

.global-message.success {
  border-color: #bcddce;
  color: var(--green);
  background: var(--green-soft);
}

.global-message.error {
  border-color: #edc5c1;
  color: var(--danger);
  background: var(--danger-soft);
}

.config-section {
  scroll-margin-top: 24px;
  margin-bottom: 18px;
  padding: 28px 30px 30px;
  border-radius: var(--radius-lg);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid #e8e9e4;
}

.section-heading h3 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 1.42rem;
  font-weight: 500;
}

.section-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.field-item {
  min-width: 0;
}

.field-item.field-wide {
  grid-column: 1 / -1;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
  margin-bottom: 8px;
}

.field-key {
  overflow: hidden;
  color: #989d99;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-tag,
.secret-tag {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
}

.danger-tag {
  color: var(--danger);
  background: var(--danger-soft);
}

.secret-tag {
  color: var(--green);
  background: var(--green-soft);
}

.field-help,
.secret-status {
  margin: 7px 0 0;
  color: #838a86;
  font-size: 0.77rem;
  line-height: 1.55;
}

.secret-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.clear-secret {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--danger);
  font-size: 0.75rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.86);
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cfd3cf;
  transition: background 150ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  content: "";
  transition: transform 150ms ease;
}

.switch input:checked + .switch-track {
  background: var(--green);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid rgba(35, 116, 90, 0.2);
}

.account-editor {
  padding: 24px 0 28px;
  border-bottom: 1px solid #e8e9e4;
}

.account-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.account-toolbar h4 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 1.28rem;
  font-weight: 500;
}

.account-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.account-warning {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #ead6a7;
  border-radius: 11px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

.account-rows {
  display: grid;
  gap: 12px;
}

.account-row {
  display: grid;
  grid-template-columns: 118px minmax(130px, 0.75fr) minmax(260px, 1.35fr) 118px 118px auto;
  align-items: start;
  gap: 12px;
  padding: 15px;
  border: 1px solid #dfe1dc;
  border-radius: 15px;
  background: rgba(250, 250, 247, 0.78);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.account-row.drag-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(214, 74, 51, 0.1);
  transform: translateY(2px);
}

.account-order {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.account-order strong,
.account-order span {
  display: block;
}

.order-hint {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.drag-handle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 42px;
  border-radius: 9px;
  color: #8b918d;
  background: #eceee9;
  cursor: grab;
  font-size: 1.2rem;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.account-field {
  display: block;
  min-width: 0;
}

.account-field-label {
  display: block;
  margin: 0 0 6px;
  color: #777f7b;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.account-control {
  min-height: 42px;
  padding: 9px 10px;
  font-size: 0.82rem;
}

.account-token {
  min-width: 0;
}

.token-display {
  display: flex;
  align-items: center;
  min-height: 42px;
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #4f5954;
  background: #fff;
}

.token-display code {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-display.token-revealed {
  border-color: #e2b2a7;
  color: var(--danger);
  background: #fff8f6;
}

.token-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.token-input {
  margin-top: 8px;
}

.mini-button,
.icon-button {
  min-height: 29px;
  padding: 5px 9px;
  border: 1px solid #d7dad4;
  border-radius: 8px;
  color: #56605b;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.mini-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  border-color: #bdc2bb;
  color: var(--accent-dark);
}

.mini-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.account-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-height: 48px;
}

.icon-danger {
  color: var(--danger);
}

.account-empty {
  padding: 28px;
  border: 1px dashed #ccd0ca;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 24, 20, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(13, 20, 17, 0.28);
}

.modal-card h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 1.7rem;
  font-weight: 500;
}

.modal-card .muted {
  margin: 9px 0 20px;
  line-height: 1.55;
}

.modal-card .control {
  margin-top: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.action-bar {
  position: sticky;
  z-index: 5;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 22px;
  padding: 16px 18px 16px 22px;
  border-radius: 20px;
}

.action-bar strong,
.action-bar span {
  display: block;
}

.action-bar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 28px;
  bottom: 28px;
  max-width: min(430px, calc(100vw - 40px));
  padding: 14px 17px;
  border-radius: 13px;
  color: #fff;
  background: #24342d;
  box-shadow: 0 16px 40px rgba(20, 28, 24, 0.24);
  line-height: 1.5;
}

.toast.error {
  background: #8e3030;
}

@media (max-width: 1220px) {
  .account-row {
    grid-template-columns: 110px repeat(2, minmax(0, 1fr));
  }
}

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

  .login-layout {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 420px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .notice-card {
    display: none;
  }

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

  .nav-link {
    justify-content: center;
    text-align: center;
  }

  .nav-count {
    display: none;
  }
}

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

  .login-layout {
    min-height: calc(100vh - 24px);
    border-radius: 24px;
  }

  .brand-panel {
    min-height: 330px;
    padding: 36px 28px;
  }

  .brand-panel h1 {
    font-size: 2.65rem;
  }

  .brand-copy {
    margin: 22px 0;
  }

  .login-card {
    padding: 36px 25px;
  }

  .topbar,
  .hero-card,
  .action-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .action-buttons {
    width: 100%;
  }

  .topbar-actions .button,
  .action-buttons .button {
    flex: 1;
  }

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

  .hero-card,
  .config-section {
    padding: 23px 20px;
    border-radius: 20px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-item.field-wide {
    grid-column: auto;
  }

  .account-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .account-row {
    grid-template-columns: 1fr;
  }

  .account-row-actions {
    justify-content: flex-start;
  }

  .action-bar {
    bottom: 8px;
    padding: 15px;
  }

  .toast {
    right: 14px;
    bottom: 14px;
  }
}
