:root {
  color-scheme: dark;
  --background: #090b10;
  --surface: #10141b;
  --surface-raised: #171c25;
  --surface-soft: #1d2430;
  --border: #29303c;
  --border-strong: #3b4554;
  --text: #f2f4f8;
  --text-muted: #a6afbf;
  --text-faint: #707b8c;
  --accent: #d8ff72;
  --accent-ink: #11150b;
  --accent-soft: rgba(216, 255, 114, 0.12);
  --danger: #ff7c86;
  --danger-soft: rgba(255, 124, 134, 0.12);
  --success: #83e6ad;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 18%, rgba(216, 255, 114, 0.08), transparent 30%),
    radial-gradient(circle at 82% 82%, rgba(92, 129, 255, 0.1), transparent 32%),
    var(--background);
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.authShell {
  display: grid;
  width: min(1120px, calc(100vw - 40px));
  min-height: min(720px, calc(100vh - 64px));
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  margin: 32px auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(16, 20, 27, 0.94);
  box-shadow: var(--shadow);
}

.brandPanel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  background:
    linear-gradient(145deg, rgba(216, 255, 114, 0.08), transparent 42%),
    linear-gradient(180deg, #141922, #0d1117);
}

.brandMark {
  display: block;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 13px;
  background: #090b10;
  text-decoration: none;

  img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.brandPanel h1,
.adminLogin h1,
.dashboardHeader h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.brandDescription {
  max-width: 460px;
  margin: 22px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.8;
}

.brandFooter {
  margin: 0;
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.formPanel {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 46px;
}

.panelContent {
  width: min(100%, 410px);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 34px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.tab {
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
}

.tab.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.formStack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.formStack h2,
.accountHeader h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.04em;
}

.formStack label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formStack label > span:first-child {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input {
  height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 270px;
  padding: 14px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: #566173;
}

.codeField {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.primaryButton,
.secondaryButton {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    opacity 160ms ease,
    border-color 160ms ease;
}

.primaryButton {
  width: 100%;
  height: 46px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.secondaryButton {
  padding: 0 15px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-muted);
}

.primaryButton:hover,
.secondaryButton:hover {
  transform: translateY(-1px);
}

.primaryButton:disabled,
.secondaryButton:disabled {
  opacity: 0.45;
  cursor: wait;
  transform: none;
}

.quietLink {
  align-self: center;
  color: var(--text-faint);
  font-size: 10px;
  text-decoration: none;
}

.quietLink:hover {
  color: var(--text);
}

.formMessage {
  min-height: 16px;
  margin: -4px 0;
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.5;
}

.formMessage.success {
  color: var(--success);
}

.formMessage.error,
.globalMessage.error {
  color: var(--danger);
}

.fieldHint {
  margin: -7px 0 0;
  color: var(--text-faint);
  font-size: 9px;
}

.globalMessage {
  min-height: 18px;
  margin: 18px 0 0;
  color: var(--text-faint);
  font-size: 10px;
  text-align: center;
}

.accountHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.accountIdentity {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.settingsCard,
.dashboardCard,
.statCard {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.settingsCard {
  padding: 20px;
}

.cardHeading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cardHeading h2,
.cardHeading h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.cardHeading p {
  margin: 7px 0 0;
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.5;
}

.mutedBadge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-faint);
  font-size: 8px;
}

.settingsCard textarea {
  margin-top: 18px;
}

.cardActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}

.cardActions .formMessage {
  margin: 0;
}

.cardActions .primaryButton {
  width: auto;
  min-width: 122px;
  padding: 0 18px;
}

.adminShell {
  width: min(1320px, calc(100vw - 40px));
  margin: 32px auto;
}

.adminLogin {
  display: grid;
  max-width: 520px;
  gap: 34px;
  margin: 8vh auto;
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.adminLogin h1 {
  font-size: 42px;
}

.dashboardHeader {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 28px;
}

.dashboardHeader h1 {
  font-size: 44px;
}

.dashboardTitle {
  display: flex;
  align-items: center;
  gap: 16px;

  > img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  }
}

.dashboardActions {
  display: flex;
  gap: 8px;
}

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

.statCard {
  display: flex;
  min-height: 164px;
  flex-direction: column;
  padding: 22px;
}

.statCard span {
  color: var(--text-muted);
  font-size: 11px;
}

.statCard strong {
  margin: auto 0 8px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.06em;
}

.statCard small {
  color: var(--text-faint);
  font-size: 9px;
}

.statCard.accentCard {
  border-color: rgba(216, 255, 114, 0.3);
  background:
    linear-gradient(145deg, rgba(216, 255, 114, 0.12), transparent 62%),
    var(--surface);
}

.accentCard strong {
  color: var(--accent);
}

.dashboardGrid {
  display: grid;
  grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
  margin-top: 14px;
}

.dashboardCard {
  min-width: 0;
  padding: 22px;
}

.weeklyChart {
  display: flex;
  height: 230px;
  align-items: flex-end;
  gap: 9px;
  margin-top: 28px;
}

.chartBar {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.chartBarFill {
  width: min(100%, 34px);
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent), rgba(216, 255, 114, 0.3));
}

.chartBarValue {
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.chartBarDate {
  color: var(--text-faint);
  font-size: 8px;
}

.tableWrap {
  margin-top: 18px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

th,
td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--text-faint);
  font-size: 8px;
  font-weight: 600;
}

td {
  color: var(--text-muted);
}

td:first-child {
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.roleBadge {
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--text-faint);
  font-size: 8px;
}

.roleBadge.admin {
  background: var(--accent-soft);
  color: var(--accent);
}

.emptyTable {
  padding: 38px 0;
  color: var(--text-faint);
  font-size: 10px;
  text-align: center;
}

@media (max-width: 900px) {
  .authShell {
    grid-template-columns: 1fr;
  }

  .brandPanel {
    min-height: 340px;
    padding: 32px;
  }

  .brandPanel h1 {
    font-size: 42px;
  }

  .formPanel {
    padding: 36px 28px;
  }

  .statGrid,
  .dashboardGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .authShell,
  .adminShell {
    width: min(100% - 20px, 1120px);
    margin: 10px auto;
  }

  .brandPanel {
    min-height: 300px;
    padding: 26px;
  }

  .formPanel {
    padding: 30px 20px;
  }

  .dashboardHeader {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .secondaryButton {
    height: 40px;
  }
}

.mailProviderBadge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-faint);
  font-size: 9px;
}

.mailSettingsCard {
  margin-top: 14px;
}

.mailProviderOptions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.mailProviderOption {
  position: relative;
  display: flex;
  min-height: 92px;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.mailProviderOption:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.mailProviderOption.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.mailProviderOption.current {
  background:
    linear-gradient(145deg, var(--accent-soft), transparent 62%),
    var(--surface-raised);
}

.mailProviderOption:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mailProviderName {
  font-size: 14px;
  font-weight: 650;
}

.mailProviderMeta {
  color: var(--text-faint);
  font-size: 10px;
}

.mailProviderOption .mailProviderBadge {
  position: absolute;
  top: 14px;
  right: 14px;
}

.mailProviderOption.current .mailProviderBadge {
  background: var(--accent-soft);
  color: var(--accent);
}

.mailSettingsActions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.mailSettingsActions .formMessage {
  margin: 0;
}

.mailTestRow {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.mailTestField {
  display: grid;
  flex: 1;
  gap: 8px;
}

.mailTestField span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.mailTestRow .secondaryButton {
  flex: 0 0 auto;
}

.mailSettingsCard #mailTestMessage {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .mailProviderOptions {
    grid-template-columns: 1fr;
  }

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