:root[data-brand="叮叮"] {
  --logo-green: #6cb812;
  --logo-green-hover: #80c730;
  --on-logo-green: #172a06;
  --brand-50: #eef6df;
  --brand-100: #e0edc8;
  --brand-300: #a0cb64;
  --brand-500: var(--logo-green);
  --brand-600: #426d0e;
  --brand-primary: var(--logo-green);
  --primary: var(--brand-600);
  --primary-dark: #335507;
  --primary-soft: var(--brand-50);
  --bg: #f5f8ef;
  --line: #dae5cf;
  --line-strong: #c6d5b9;
  --line-faint: #e8efdf;
  --surface-sunken: #eef3e7;
  --surface-hover: #f3f7ed;
  --nav-hover: #e5efd7;
  --ring-brand: 0 0 0 3px #6cb81242;
  --dingding-sidebar-bg: linear-gradient(165deg, #f0f6e5, #e3edd5);
}

:root[data-brand="叮叮"][data-theme="dark"] {
  --brand-50: #29391e;
  --brand-100: #394f2a;
  --brand-300: #82b749;
  --primary: #aedb74;
  --primary-dark: #c4e998;
  --on-primary: #172a06;
  --bg: #182014;
  --surface: #232e1e;
  --panel: var(--surface);
  --surface-raised: #2a3823;
  --surface-sunken: #1c2618;
  --surface-hover: #2d3c25;
  --text: #edf3e6;
  --text-secondary: #cbd7c0;
  --muted: #a7b59d;
  --line: #3b4b33;
  --line-strong: #526447;
  --line-faint: #303e28;
  --nav-hover: #34462d;
  --dingding-sidebar-bg: linear-gradient(165deg, #2a3722, #222e1d);
}

.dingding-login {
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-height: 0;
  background: #74b813;
}

:root .dingding-login::before {
  content: none;
}

.dingding-login .dingding-login-card {
  box-sizing: border-box;
  grid-template-columns: minmax(0, 420px);
  place-content: center;
  gap: 16px;
  min-height: calc(100vh - 25px);
  min-height: calc(100dvh - 25px);
  padding: 32px 16px;
  background: transparent;
}

.dingding-login .dingding-login-card > .dingding-login-brand {
  align-items: center;
  min-height: 0;
  padding: 0;
  background: transparent;
}

.dingding-login .login-wordmark { width: min(62%, 252px); margin: 0; }

.dingding-login .login-wordmark img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  mask-image: radial-gradient(ellipse closest-side, #000 82%, transparent);
}

.dingding-login .dingding-login-card > form {
  min-width: 0;
  gap: 14px;
  padding: clamp(20px, 5vw, 28px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 48px #14240c38;
}

.dingding-login .login-form-head { margin-bottom: 0; text-align: center; }
.dingding-login .login-form-head h2 { font-size: clamp(24px, 5vw, 30px); }
.dingding-login .account-input-wrap { margin-bottom: 0; }
.dingding-login .dingding-login-card > form > button[type="submit"] { margin-top: 2px; }
.dingding-login form > .error:empty { display: none; }

.login-totp-dialog {
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 48px #14240c45;
}
.login-totp-dialog::backdrop { background: #18271172; backdrop-filter: blur(3px); }
.login-totp-dialog h2 { margin: 0 0 6px; font-size: 22px; }
.login-totp-dialog p { margin: 0 0 16px; }
.login-totp-dialog input[name="totp_code"] {
  width: 100%;
  min-height: 48px;
  text-align: center;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .25em;
}
.login-totp-setup { display: grid; gap: 10px; margin-bottom: 12px; }
.login-totp-setup img { display: block; width: min(100%, 184px); height: auto; margin: 0 auto; background: white; }
.login-totp-setup label { display: grid; gap: 5px; font-size: 13px; }
.login-totp-setup .totp-setup-key { width: 100%; padding-inline: 10px; font: 13px monospace; }
.login-totp-dialog p.error { margin: 10px 0 0; }
.login-totp-dialog .error:empty { display: none; }
.login-totp-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 18px; }
.login-totp-actions button { min-height: 40px; }
.login-totp-actions button[type="submit"] { color: var(--on-logo-green); background: var(--logo-green); }

.agent-authenticator {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-sunken);
}
.agent-authenticator-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agent-authenticator-top { justify-content: space-between; }
.agent-authenticator-top strong { margin-inline-end: 10px; }
.agent-authenticator .error { margin: 8px 0 0; }
.agent-authenticator .error:empty { display: none; }


:is(#appView, #clientAppView).island-shell { --island-active: var(--logo-green); --island-text: var(--text); }
:is(#appView, #clientAppView).island-shell > .island-sidebar {
  background: var(--dingding-sidebar-bg);
  border-color: var(--line);
  box-shadow: var(--sh-md);
}
:is(#appView, #clientAppView) .island-sidebar .nav-button:hover:not(.active) { background: var(--nav-hover); }
:is(#appView, #clientAppView) .island-sidebar .brand strong { font-size: 18px; }
:is(#appView, #clientAppView) .brand-mark img { width: 100%; height: 100%; padding: 0; border-radius: inherit; object-fit: cover; }
:is(#appView, #clientAppView) .island-sidebar .brand-mark { width: 44px; height: 44px; min-width: 44px; }
@media (min-width: 761px) {
  :is(#appView, #clientAppView):not(.island-collapsed) .island-sidebar > .brand {
    position: relative;
    justify-content: center;
    gap: 12px;
  }
  :is(#appView, #clientAppView):not(.island-collapsed) .brand > div { flex: 0 1 auto; }
  :is(#appView, #clientAppView):not(.island-collapsed) .brand .island-toggle {
    position: absolute;
    top: 7px;
    right: 3px;
  }
}
#appView .agent-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}
#appView #pageTitle {
  grid-area: 1 / 2;
  margin: 0;
  text-align: center;
}
#appView .agent-topbar > .topbar-actions { grid-area: 1 / 3; justify-content: flex-end; }
#appView #dashboard .stat-section { display: flex; flex-direction: column; }
#appView .dashboard-stat-row { display: flex; justify-content: center; gap: 14px; }
#appView .dashboard-stat-row > .stat-item {
  flex: 0 1 280px;
  min-width: 0;
  text-align: center;
}
#appView .dashboard-stat-row > .stat-item > span { justify-content: center; }
.dashboard-trend {
  --trend-orders: var(--primary);
  --trend-replies: #207782;
  width: min(100%, 1160px);
  box-sizing: border-box;
  margin: 20px auto;
  padding: clamp(12px, 2vw, 24px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
[data-theme="dark"] .dashboard-trend { --trend-replies: #77cbd3; }
.dashboard-trend-head, .dashboard-trend-summary {
  display: flex;
  align-items: center;
  gap: 8px 16px;
}
.dashboard-trend-head { justify-content: space-between; margin-bottom: 14px; }
.dashboard-trend-head h3 { margin: 0; font-size: clamp(16px, 2vw, 21px); }
.dashboard-trend-head > span { color: var(--muted); white-space: nowrap; font-size: 13px; }
.dashboard-trend-summary { flex-wrap: wrap; min-height: 24px; font-size: 13px; }
.dashboard-trend-summary time { color: var(--muted); font-variant-numeric: tabular-nums; }
.dashboard-trend-key { display: inline-flex; align-items: center; gap: 6px; }
.dashboard-trend-key::before { content: ""; width: 16px; border-top: 2px solid var(--trend-orders); }
.dashboard-trend-key.trend-replies::before { border-color: var(--trend-replies); border-top-style: dashed; }
.dashboard-trend-key strong { font-variant-numeric: tabular-nums; }
.dashboard-trend-plot {
  --trend-axis-start: 49px;
  --trend-axis-end: 8px;
  position: relative;
  height: clamp(188px, 27vh, 250px);
  margin-top: 12px;
}
#dashboardTrendCanvas { display: block; width: 100%; height: 100%; }
#dashboardTrendDays {
  position: absolute;
  inset: 0 var(--trend-axis-end) 0 var(--trend-axis-start);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
#dashboardTrendDays > button {
  display: grid;
  align-items: end;
  justify-content: center;
  padding: 0 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
#dashboardTrendDays > button[aria-pressed="true"] { color: var(--primary); font-weight: 700; }
#dashboardTrendDays > button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
#usersTable :is(.user-uid, .user-table-time) { white-space: nowrap; font-variant-numeric: tabular-nums; }
#usersTable td:is(:first-child, :nth-child(3)) { white-space: nowrap; }
#userForm .user-account-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-columns: subgrid;
  gap: inherit;
}
#userForm .user-account-settings > label { display: flex; flex-direction: column; min-width: 0; }
#userForm :is([name="recharge_enabled"], [name="account_type"]) { min-height: 40px; }
#publicRegistrationDrawer .registration-drawer-fields { gap: 14px; }
#publicRegistrationDrawer .registration-switch-row {
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-hover);
  font-weight: 600;
  cursor: pointer;
}
#publicRegistrationDrawer .registration-switch-row > span { margin: 0; }
:is(#publicRegistrationDrawer, #userForm) .registration-switch { width: 46px; min-width: 46px; height: 26px; }
:is(#publicRegistrationDrawer, #userForm) .registration-switch input { width: 100%; height: 100%; min-height: 0; padding: 0; }
:is(#publicRegistrationDrawer, #userForm) .registration-switch > span { height: 100%; margin: 0; background: var(--line-strong); }
:is(#publicRegistrationDrawer, #userForm) .registration-switch > span::after {
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
}
:is(#publicRegistrationDrawer, #userForm) .registration-switch input:checked + span { background: var(--primary); }
:is(#publicRegistrationDrawer, #userForm) .registration-switch input:checked + span::after { transform: translate(20px, -50%); }
:is(#publicRegistrationDrawer, #userForm) .registration-switch input:disabled + span { opacity: .65; }
#userCodeFeedbackField { display: flex; flex-direction: column; }
#userCodeFeedbackLabel {
  margin-bottom: var(--sp-2);
  color: var(--text-secondary);
  font-size: var(--fs-base);
  font-weight: 600;
}
#userCodeFeedbackField > .registration-switch { margin: 7px 0; }
#publicRegistrationDrawer #publicRegistrationStatus:empty { display: none; }
@media (max-width: 760px) {
  #appView .agent-topbar { grid-template-columns: minmax(0, 1fr); }
  #appView #pageTitle { grid-area: 1 / 1; }
  #appView .agent-topbar > .topbar-actions { grid-area: 2 / 1; }
  #appView .dashboard-stat-row { gap: 8px; }
  #appView .dashboard-stat-row > .stat-item { padding-inline: 4px; }
  #appView .dashboard-stat-row .island-stat-icon { display: none; }
  .dashboard-trend-plot { --trend-axis-start: 33px; }
  #dashboardTrendDays > button { font-size: 10px; }
}
#clientAppView .client-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
}
#clientViewTitle {
  grid-area: 1 / 1 / 2 / -1;
  margin: 0;
  text-align: center;
}
#clientAppView:has(#clientUserWorkbench:not(.hidden)) #clientViewTitle {
  padding-inline-start: .06em;
  color: var(--text);
  font-size: clamp(26px, 2.7vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .06em;
  white-space: nowrap;
}
@media (min-width: 601px) {
  #clientAppView .client-topbar:has(.client-own-balance:not(.hidden), .client-uid:not(.hidden)) #clientViewTitle { grid-column-end: 2; }
}
#clientAppView .client-topbar .client-actions { grid-area: 1 / 2; justify-content: flex-end; }
.client-uid {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: all;
}
#clientMonitorList .monitor-task-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
  align-items: stretch;
}
#clientMonitorList .monitor-task-grid > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  #clientAppView .client-topbar { grid-template-columns: minmax(0, 1fr); }
  #clientAppView .client-topbar .client-actions { grid-area: 2 / 1; }
  #clientAppView .client-own-balance { min-width: 0; }
}
#clientAppView .client-project-tags, #clientAppView .client-project-price { color: var(--primary); }

:is(#loginForm > button[type="submit"], #clientLoginForm > button[type="submit"], #clientBuyBtn, #clientAppView .client-category-bar button.active, #clientAppView .island-sidebar .nav-button.active, #appView .island-sidebar .nav-button.active) {
  color: var(--on-logo-green);
  background: var(--logo-green);
}
:is(#loginForm > button[type="submit"], #clientLoginForm > button[type="submit"], #clientBuyBtn, #clientAppView .client-category-bar button.active, #clientAppView .island-sidebar .nav-button.active, #appView .island-sidebar .nav-button.active):hover:not(:disabled) {
  background: var(--logo-green-hover);
}

