:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-soft: #eef4fb;
  --text: #172033;
  --text-secondary: #536173;
  --text-muted: #8290a3;
  --border: #dce4ee;
  --border-strong: #c8d4e2;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8f0ff;
  --cyan: #0891b2;
  --green: #16a34a;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --yellow: #b45309;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --body-layer: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 247, 251, 0.96));
  --accent-layer: radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 32rem);
  --glass: rgba(255, 255, 255, 0.86);
  --chip-bg: rgba(255, 255, 255, 0.72);
  --input-bg: #ffffff;
  --placeholder: #a2adbb;
  --brand-fg: #ffffff;
  --control-bg: #172033;
  --control-fg: #ffffff;
  --icon-cyan-bg: #ecfeff;
  --icon-indigo-bg: #eef2ff;
  --icon-green-bg: #ecfdf5;
  --icon-blue-bg: #eff6ff;
  --status-bg: #f1f5f9;
  --status-set-bg: #dcfce7;
  --status-set-text: #15803d;
  --button-bg: #ffffff;
  --button-hover-bg: #f8fafc;
  --danger-border: #fecaca;
  --success-bg: #dcfce7;
  --success-border: #bbf7d0;
  --success-text: #15803d;
  --radius: 8px;
  --radius-lg: 12px;
  --font: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1422;
  --surface: #151d2c;
  --surface-muted: #101827;
  --surface-soft: #1d2a3f;
  --text: #edf3fb;
  --text-secondary: #b4c1d2;
  --text-muted: #8291a6;
  --border: #273448;
  --border-strong: #3a4b63;
  --primary: #7aa7ff;
  --primary-dark: #9bbdff;
  --primary-soft: #1f3356;
  --cyan: #67e8f9;
  --green: #86efac;
  --red: #f87171;
  --red-soft: #3b1d27;
  --yellow: #facc15;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.24);
  --body-layer: linear-gradient(180deg, rgba(14, 20, 34, 0.94), rgba(10, 15, 25, 0.98));
  --accent-layer: radial-gradient(circle at top left, rgba(122, 167, 255, 0.14), transparent 32rem);
  --glass: rgba(21, 29, 44, 0.86);
  --chip-bg: rgba(21, 29, 44, 0.72);
  --input-bg: #0f1726;
  --placeholder: #66758b;
  --brand-fg: #0e1422;
  --control-bg: #edf3fb;
  --control-fg: #0e1422;
  --icon-cyan-bg: #123646;
  --icon-indigo-bg: #1f2546;
  --icon-green-bg: #143828;
  --icon-blue-bg: #1c2f52;
  --status-bg: #1d2838;
  --status-set-bg: #123824;
  --status-set-text: #86efac;
  --button-bg: #111a2a;
  --button-hover-bg: #1b2638;
  --danger-border: #5c2a35;
  --success-bg: #123824;
  --success-border: #1d6b43;
  --success-text: #86efac;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    var(--body-layer),
    var(--accent-layer),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 120px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--brand-fg);
  font-size: 14px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 760;
}

.brand p {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-secondary);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 650;
}

.quick-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow: var(--shadow-soft);
  padding: 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-nav::-webkit-scrollbar {
  display: none;
}

.quick-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: max-content;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 0 13px;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.quick-nav-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quick-nav-item:active {
  transform: translateY(1px);
}

.quick-nav-item span {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
}

.quick-nav-item strong {
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

#contestTodayCard,
#poemCard,
#wordsCard,
#contestCalendarCard,
#weatherCard,
#apiHubCard,
#problemAdminCard,
#vaultCard,
#settings {
  scroll-margin-top: 92px;
}

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  margin-top: 34px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.overview h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.08;
  font-weight: 780;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 10px;
}

.stat {
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.stat-value {
  display: block;
  color: var(--text);
  font-size: 22px;
  font-weight: 760;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.contest-board {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 18px;
  align-items: start;
  margin-top: 20px;
}

.contest-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.contest-calendar-card {
  grid-column: 1 / -1;
}

.contest-body {
  margin-top: 20px;
}

.contest-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  text-align: center;
}

.contest-empty h3 {
  margin: 0;
  font-size: 18px;
}

.contest-empty p {
  max-width: 420px;
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.problem-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.problem-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 760;
}

.problem-title {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.3;
}

.problem-statement,
.answer-text,
.submission-text {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  padding: 16px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.problem-statement .katex-display,
.answer-text .katex-display,
.submission-text .katex-display {
  margin: 10px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.problem-source,
.submission-image-link {
  display: inline-flex;
  margin: 12px 0 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
}

.contest-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.contest-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 760;
}

.contest-form textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 12px;
  line-height: 1.6;
}

.contest-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.contest-upload-row input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.contest-upload-row span,
.contest-hint {
  color: var(--text-muted);
  font-size: 13px;
}

.contest-form-error {
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  padding: 10px 12px;
  font-size: 13px;
}

.answer-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.answer-panel h4 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 15px;
}

.answer-status {
  width: fit-content;
  border-radius: 999px;
  background: var(--status-set-bg);
  color: var(--status-set-text);
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-toolbar strong {
  text-align: center;
  font-size: 16px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 6px;
}

.calendar-weekdays span {
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
  font-weight: 760;
}

.calendar-cell {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  padding: 6px;
  text-align: center;
}

button.calendar-cell:hover {
  border-color: var(--primary);
}

.calendar-cell span {
  font-weight: 800;
}

.calendar-cell small {
  color: var(--text-muted);
  font-size: 11px;
}

.calendar-cell.is-empty {
  border-color: transparent;
  background: transparent;
}

.calendar-cell.is-done {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.calendar-cell.is-missed {
  border-color: var(--danger-border);
  background: var(--red-soft);
}

.calendar-cell.is-pending {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.calendar-cell.is-future,
.calendar-cell.is-empty {
  opacity: 0.72;
}

.contest-history-panel {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.contest-history-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.contest-history-empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 16px;
  text-align: center;
}

.history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  margin-top: 8px;
  padding: 8px 10px;
  text-align: left;
}

.history-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item span,
.history-item em {
  color: var(--text-muted);
  font-size: 12px;
  font-style: normal;
}

.history-detail {
  display: grid;
  gap: 12px;
}

.poem-preview {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  padding: 18px;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.poem-preview:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.poem-text {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  padding: 16px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.poem-preview .poem-text {
  background: var(--surface);
  font-size: 16px;
}

.poem-preview .problem-title {
  display: block;
}

.poem-click-hint {
  display: block;
  margin-top: 12px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 760;
}

.learning-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.learning-summary strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
}

.word-list {
  display: grid;
  gap: 12px;
}

.word-item {
  display: grid;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 14px;
}

.word-item.is-mastered {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.word-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.word-head strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
}

.word-head em {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: normal;
}

.word-master-btn {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 760;
}

.word-master-btn:hover {
  border-color: var(--primary);
  background: var(--button-hover-bg);
}

.word-master-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.is-mastered .word-master-btn {
  border-color: var(--success-border);
  background: var(--surface);
  color: var(--success-text);
}

.word-definition {
  color: var(--text);
  font-weight: 760;
  line-height: 1.5;
}

.word-example,
.word-translation,
.word-memory {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

.word-example {
  color: var(--text);
}

.word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.word-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 720;
}

.calendar-learning {
  color: var(--primary) !important;
  font-weight: 760;
}

.daily-detail {
  display: grid;
  gap: 18px;
}

.daily-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.daily-section h4 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 15px;
}

.daily-section-title {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.card {
  position: relative;
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.card-glow {
  display: none;
}

.card-content {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  height: 100%;
  padding: 22px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
}

.card-icon,
.weather-icon-large,
.balance-currency,
.detail-icon,
.provider-icon,
.apihub-row-icon,
.apihub-mgr-icon,
.error-icon,
.empty-mark {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.card-icon {
  width: 42px;
  height: 42px;
}

.card-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 760;
}

.card-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 170px;
  padding: 22px 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.update-time {
  color: var(--text-muted);
  font-size: 13px;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 14px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 840ms linear infinite;
}

.loading-text {
  margin: 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-state,
.empty-state {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.error-icon,
.empty-mark {
  width: 44px;
  height: 44px;
  background: var(--red-soft);
  color: var(--red);
}

.empty-mark {
  background: var(--surface-soft);
  color: var(--text-secondary);
}

.error-text,
.empty-copy {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.error-hint {
  max-width: 260px;
  color: var(--text-muted);
  font-size: 13px;
}

.weather-permission {
  display: grid;
  gap: 11px;
  justify-items: center;
  text-align: center;
}

.weather-permission h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.weather-permission p {
  max-width: 280px;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.weather-permission .btn,
.error-state .weather-permission-btn {
  margin-top: 4px;
  max-width: 100%;
  white-space: normal;
}

.weather-action-row,
.weather-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.weather-divider {
  display: grid;
  grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  color: var(--text-muted);
  font-size: 12px;
}

.weather-divider::before,
.weather-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
}

.weather-city-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: min(100%, 320px);
}

.weather-city-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 11px;
}

.weather-city-input::placeholder {
  color: var(--placeholder);
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 18px;
}

.weather-icon-large {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  background: var(--icon-cyan-bg);
  color: var(--cyan);
}

.weather-temp {
  font-size: 46px;
  line-height: 0.95;
  font-weight: 780;
}

.weather-info {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.weather-desc {
  color: var(--text);
  font-weight: 700;
}

.weather-details,
.balance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.weather-detail,
.balance-item {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.detail-icon {
  width: 34px;
  height: 26px;
  margin-bottom: 10px;
  background: var(--icon-indigo-bg);
  color: #4f46e5;
}

.detail-value,
.item-value {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.detail-label,
.item-label {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.weather-actions {
  margin-top: 16px;
  justify-content: flex-start;
}

.balance-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.balance-currency {
  width: 34px;
  height: 34px;
  background: var(--icon-green-bg);
  color: var(--green);
}

.balance-amount {
  font-size: 44px;
  line-height: 1;
  font-weight: 780;
}

.apihub-rows {
  display: grid;
  gap: 10px;
}

.apihub-row,
.apihub-mgr-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.apihub-row-icon,
.apihub-mgr-icon {
  width: 34px;
  height: 34px;
  background: var(--icon-blue-bg);
}

.apihub-row-name,
.apihub-mgr-name {
  min-width: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apihub-row-balance,
.apihub-mgr-balance {
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
  white-space: nowrap;
}

.apihub-row-balance.loading,
.apihub-row-balance.dim {
  color: var(--text-muted);
}

.apihub-row-balance.error {
  color: var(--red);
}

.apihub-mgr-row {
  grid-template-columns: 38px minmax(120px, 1fr) minmax(110px, auto) auto auto;
  margin-bottom: 10px;
}

.apihub-mgr-edit-panel {
  margin: -2px 0 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.apihub-relay-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.apihub-relay-panel strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.apihub-relay-panel small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.apihub-relay-panel .input-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.apihub-manager-note {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.apihub-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 360px;
}

.apihub-mode-option {
  display: block;
  min-width: 0;
}

.apihub-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.apihub-mode-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.apihub-mode-option input:checked + span,
.apihub-mode-option.is-active span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.apihub-mode-option input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.apihub-mode-field.is-hidden {
  display: none;
}

.apihub-extractor-input {
  width: 100%;
  min-width: 0;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 11px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.apihub-extractor-input::placeholder {
  color: var(--placeholder);
}

.problem-admin-card-state {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 760;
  text-align: center;
}

.problem-admin-summary {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.problem-admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.problem-admin-stats div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 13px 10px;
  text-align: center;
}

.problem-admin-stats strong {
  display: block;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.problem-admin-stats span {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 720;
}

.problem-admin-modal {
  width: min(1180px, 100%);
}

.problem-admin {
  display: grid;
  gap: 16px;
}

.problem-admin-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px;
}

.problem-admin-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.problem-admin-panel-head strong {
  color: var(--text);
  font-size: 15px;
}

.problem-admin-panel-head span,
.problem-admin-status {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.problem-admin-status {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 8px 10px;
}

.problem-admin-status.is-ok {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.problem-admin-status.is-error {
  border-color: var(--danger-border);
  background: var(--red-soft);
  color: var(--red);
}

.problem-admin-token-row,
.problem-admin-actions,
.problem-admin-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.problem-admin-filters {
  grid-template-columns: minmax(180px, 1fr) minmax(130px, auto) minmax(120px, auto) minmax(90px, auto);
}

.problem-admin-token-row input,
.problem-admin-filters input,
.problem-admin-filters select,
.problem-editor-grid input,
.problem-editor-grid select,
.problem-editor-field input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 11px;
}

.problem-admin-json,
.problem-editor-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 11px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.problem-admin-json::placeholder,
.problem-admin-token-row input::placeholder,
.problem-admin-filters input::placeholder,
.problem-editor-grid input::placeholder,
.problem-editor-field input::placeholder,
.problem-editor-field textarea::placeholder {
  color: var(--placeholder);
}

.problem-admin-actions input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.problem-admin-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: start;
}

.problem-draft-list {
  display: grid;
  gap: 8px;
  max-height: 690px;
  overflow-y: auto;
  padding-right: 2px;
}

.problem-draft-item {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  padding: 11px;
  text-align: left;
}

.problem-draft-item:hover,
.problem-draft-item.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.problem-draft-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.problem-draft-item small,
.problem-draft-item em {
  color: var(--text-muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.problem-draft-status {
  width: fit-content;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.problem-draft-status.is-ready {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.problem-draft-status.is-needsReview {
  border-color: var(--danger-border);
  background: var(--red-soft);
  color: var(--red);
}

.problem-editor {
  min-width: 0;
}

.problem-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.problem-editor-head div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.problem-editor-head strong {
  color: var(--text);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.problem-editor-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.problem-validation {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  padding: 10px;
  font-size: 12px;
  font-weight: 720;
}

.problem-validation span {
  overflow-wrap: anywhere;
}

.problem-validation.is-ok {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.problem-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(90px, 0.5fr) minmax(110px, 0.5fr) minmax(0, 1fr);
  gap: 10px;
}

.problem-editor-grid label,
.problem-editor-field {
  display: grid;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 720;
}

.problem-editor-field {
  margin-top: 10px;
}

.problem-editor-field textarea {
  min-height: 150px;
}

.problem-preview {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.problem-preview .daily-section {
  background: var(--surface-muted);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.vault-summary {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.vault-large-mark {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
}

.vault-count {
  color: var(--text-secondary);
  font-size: 15px;
}

.vault-count span {
  color: var(--text);
  font-size: 24px;
  font-weight: 780;
}

.settings {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: min(390px, calc(100vw - 32px));
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--control-bg);
  color: var(--control-fg);
  box-shadow: var(--shadow);
  font-weight: 760;
}

.toggle-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--control-fg) 12%, transparent);
  font-size: 11px;
  font-weight: 800;
}

.settings-panel {
  display: none;
  max-height: min(620px, calc(100vh - 110px));
  margin-top: 10px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.settings-panel.open {
  display: block;
}

.settings-section {
  display: grid;
  gap: 14px;
}

.settings-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-section-header span {
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
}

.settings-section-header small {
  color: var(--text-muted);
  font-size: 12px;
}

.theme-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  cursor: pointer;
}

.theme-toggle-copy {
  display: grid;
  gap: 6px;
}

.theme-toggle-copy strong {
  color: var(--text);
  font-size: 15px;
}

.theme-toggle-copy small {
  color: var(--text-muted);
  font-size: 13px;
}

.theme-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-switch {
  position: relative;
  width: 52px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease;
}

.theme-switch span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 160ms ease, background 160ms ease;
}

.theme-toggle-input:checked + .theme-switch {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.theme-toggle-input:checked + .theme-switch span {
  transform: translateX(22px);
  background: var(--primary);
}

.theme-toggle-input:focus-visible + .theme-switch {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.sync-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 14px;
}

.sync-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sync-panel-header div {
  display: grid;
  gap: 5px;
}

.sync-panel-header strong {
  color: var(--text);
  font-size: 15px;
}

.sync-panel-header small {
  color: var(--text-muted);
  font-size: 12px;
}

.sync-badge {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.sync-passphrase-group {
  margin-bottom: 0;
}

.sync-remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 720;
  cursor: pointer;
}

.sync-remember-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sync-actions .btn {
  min-width: 0;
  white-space: normal;
}

.sync-status {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sync-status.is-ok {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.sync-status.is-error {
  border-color: var(--danger-border);
  background: var(--red-soft);
  color: var(--red);
}

.provider-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.provider-item + .provider-item {
  margin-top: 12px;
}

.provider-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  margin-bottom: 14px;
}

.provider-icon {
  width: 32px;
  height: 32px;
}

.provider-label {
  min-width: 0;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-status {
  border-radius: 999px;
  background: var(--status-bg);
  color: var(--text-muted);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.provider-status.is-set {
  background: var(--status-set-bg);
  color: var(--status-set-text);
}

.provider-delete-btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--red);
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 760;
}

.setting-group {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

.setting-group label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 720;
}

.setting-group input,
.vault-add-row input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 11px;
}

.setting-group input::placeholder,
.vault-add-row input::placeholder {
  color: var(--placeholder);
}

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

.setting-hint {
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.setting-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.btn,
.icon-btn,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--text);
  padding: 0 13px;
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.btn:hover,
.icon-btn:hover,
.modal-close:hover {
  border-color: var(--border-strong);
  background: var(--button-hover-bg);
}

.btn:active,
.icon-btn:active,
.modal-close:active {
  transform: translateY(1px);
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.btn-danger,
.icon-btn.danger {
  border-color: var(--danger-border);
  background: var(--button-bg);
  color: var(--red);
}

.btn-danger:hover,
.icon-btn.danger:hover {
  background: var(--red-soft);
}

.btn-outline {
  border-color: var(--primary);
  color: var(--primary);
}

.toggle-vis-btn,
.toggle-vis-btn-small {
  min-width: 44px;
}

.icon-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.icon-btn.copy-success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  padding: 24px;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.26);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.modal-header .modal-close {
  width: 38px;
  padding: 0;
  font-size: 22px;
}

.modal-body {
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.vault-empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 22px;
  text-align: center;
}

.vault-list {
  display: grid;
  gap: 10px;
}

.vault-item {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(80px, 1fr) minmax(110px, 1.2fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.vault-item-name,
.vault-item-note,
.vault-item-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vault-item-name {
  font-weight: 760;
}

.vault-item-note {
  color: var(--text-muted);
  font-size: 13px;
}

.vault-item-value {
  color: var(--text-secondary);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
}

.vault-add-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.4fr) minmax(120px, 1fr) auto;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 28px, 760px);
  }

  .overview {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .overview-stats,
  .cards,
  .contest-board,
  .problem-admin-workspace {
    grid-template-columns: 1fr;
  }

  .problem-editor-grid,
  .problem-admin-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card,
  .card-content {
    min-height: 260px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: calc(100% - 24px);
    padding-top: 18px;
  }

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

  .topbar-meta {
    justify-content: flex-start;
  }

  .quick-nav {
    gap: 8px;
    margin-top: 16px;
    padding: 8px;
  }

  .quick-nav-item {
    min-height: 40px;
    padding: 0 12px;
  }

  .quick-nav-item span {
    min-width: 28px;
    height: 24px;
    padding: 0 7px;
  }

  .overview {
    margin-top: 20px;
    padding: 22px;
  }

  .overview h2 {
    font-size: 32px;
  }

  .overview-stats,
  .weather-details,
  .balance-grid {
    grid-template-columns: 1fr;
  }

  .contest-card {
    padding: 18px;
  }

  .problem-title {
    font-size: 19px;
  }

  .calendar-cell {
    min-height: 62px;
    padding: 5px;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .word-head {
    grid-template-columns: 1fr;
  }

  .word-master-btn {
    width: 100%;
  }

  .card-content {
    padding: 18px;
  }

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

  .weather-city-form,
  .weather-city-form .btn,
  .weather-actions .btn {
    width: 100%;
  }

  .weather-city-form,
  .weather-actions {
    grid-template-columns: 1fr;
  }

  .weather-actions {
    flex-direction: column;
    justify-content: stretch;
  }

  .sync-actions {
    grid-template-columns: 1fr;
  }

  .settings {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .provider-header {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .provider-delete-btn {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .modal-overlay {
    align-items: stretch;
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .apihub-row,
  .apihub-mgr-row,
  .vault-item,
  .vault-add-row,
  .problem-admin-token-row,
  .problem-admin-actions,
  .problem-admin-filters,
  .problem-editor-grid {
    grid-template-columns: 1fr;
  }

  .apihub-relay-panel .input-row {
    grid-template-columns: 1fr;
  }

  .apihub-row-icon,
  .apihub-mgr-icon {
    display: none;
  }

  .apihub-row-balance,
  .apihub-mgr-balance {
    white-space: normal;
  }

  .vault-item-value {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .setting-actions,
  .modal-footer,
  .sync-actions {
    flex-direction: column;
  }

  .setting-actions .btn,
  .sync-actions .btn,
  .modal-footer .btn,
  .modal-footer .modal-close,
  .vault-add-row .btn,
  .problem-admin-actions .btn,
  .problem-admin-token-row .btn {
    width: 100%;
  }
}

/* ===== Owner account ===== */
html.auth-pending body > .app-shell { visibility: hidden; }
.auth-gate { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: #111315; color: #f5f4ef; }
.auth-shell { width: min(100%, 420px); }
.auth-brand { margin-bottom: 18px; color: #f5f4ef; font-size: 20px; font-weight: 700; text-align: center; }
.auth-card { padding: 28px; border: 1px solid #34383d; border-radius: 8px; background: #1b1e21; box-shadow: 0 20px 60px rgba(0,0,0,.36); }
.auth-card-header { margin-bottom: 22px; }
.auth-kicker { display: block; margin-bottom: 8px; color: #d5a84b; font-size: 12px; font-weight: 700; letter-spacing: 0; }
.auth-card h1 { margin: 0; color: #fff; font-size: 24px; letter-spacing: 0; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 7px; color: #d7d8da; font-size: 13px; font-weight: 600; }
.auth-form input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #454a50; border-radius: 6px; outline: none; background: #101214; color: #fff; font: inherit; }
.auth-form input:focus { border-color: #d5a84b; box-shadow: 0 0 0 3px rgba(213,168,75,.18); }
.auth-submit { min-height: 44px; margin-top: 4px; }
.auth-message { min-height: 20px; color: #aeb2b7; font-size: 13px; }
.auth-message.is-error { color: #ff9088; }
.account-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.account-actions .btn { min-width: 0; padding-inline: 8px; white-space: normal; }
.account-session-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border,rgba(127,127,127,.2)); }
.account-session-row div { min-width: 0; }
.account-session-row strong, .account-session-row small { display: block; }
.account-session-row small { margin-top: 4px; overflow-wrap: anywhere; color: var(--text-muted,#777); }
@media (max-width:520px) { .auth-gate { padding: 16px; } .auth-card { padding: 22px 18px; } .account-actions { grid-template-columns: 1fr; } }