:root {
  --bg-primary: #0d0f1a;
  --bg-secondary: #141728;
  --bg-card: #1a1d33;
  --bg-card-hover: #1f223d;
  --border-subtle: #252845;
  --border-active: #3a3f60;
  --text-primary: #e8e9f0;
  --text-secondary: #a8aab8;
  --text-muted: #6b6d80;
  --gold: #f0c060;
  --gold-bright: #f8d478;
  --accent-green: #4ade80;
  --accent-blue: #60a5fa;
  --danger: #f87171;
  --bg-input: #111320;
  --gold-dark: #b8903a;
  --accent-green-bg: rgba(74, 222, 128, 0.12);
  --accent-blue-bg: rgba(96, 165, 250, 0.12);
  --accent-purple: #a78bfa;
  --accent-pink: #f472b6;
  --accent-cyan: #22d3bb;
  --accent-orange: #fb923c;
  --accent-red: #f87171;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
  --btn-primary-text: #1a1a0a;
  --quote-border: #b8903a;
  color-scheme: dark;
}

body.light-theme {
  --bg-primary: #f5f2e8;
  --bg-secondary: #ffffff;
  --bg-card: #fffaf0;
  --bg-card-hover: #fff4d8;
  --border-subtle: #e5d8b8;
  --border-active: #d4b866;
  --text-primary: #2d2416;
  --text-secondary: #6b5d48;
  --text-muted: #9b8a70;
  --gold: #c89830;
  --gold-bright: #e8b84a;
  --bg-input: #fffdf7;
  --shadow-card: 0 4px 24px rgba(120, 90, 30, 0.12), 0 1px 4px rgba(120, 90, 30, 0.08);
  --btn-primary-text: #ffffff;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(240, 192, 96, 0.03) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 60%, rgba(96, 165, 250, 0.03) 0%, transparent 55%),
    var(--bg-primary);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: auto;
}

.shell {
  width: 1600px;
  max-width: 1600px;
  min-width: 1600px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: calc(100vh - 40px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f8d478 0%, #f0c060 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.header-subtitle {
  font-size: 0.8rem;
}

.topbar p,
.muted,
.section-heading p {
  color: var(--text-secondary);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.button {
  min-height: 40px;
  border: 1px solid var(--border-active);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  color: #1a1a0a;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  letter-spacing: 0.03em;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #f0c060 0%, #d4a040 100%);
  color: var(--btn-primary-text);
  box-shadow: 0 4px 18px rgba(240, 192, 96, 0.25);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-active);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 16px;
}

.btn-theme {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  border: 1.5px solid var(--border-active);
  background: var(--bg-card);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.button.ghost {
  background: transparent;
}

.link-button,
.btn-danger-text {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}

.link-button:hover {
  color: var(--gold-bright);
}

.btn-danger-text {
  color: var(--danger);
  border-radius: 8px;
  padding: 4px 8px;
}

.btn-danger-text:hover {
  background: rgba(248, 113, 113, 0.12);
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--btn-primary-text);
  box-shadow: 0 8px 28px rgba(240, 192, 96, 0.35);
  font-weight: 900;
  cursor: pointer;
}

.toast-container {
  position: fixed;
  right: 20px;
  top: 90px;
  display: grid;
  gap: 10px;
  z-index: 30;
}

.toast {
  max-width: 280px;
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.92);
  color: #fff;
  box-shadow: var(--shadow-card);
  font-size: 0.86rem;
}

.toast.success {
  background: rgba(34, 197, 94, 0.92);
}

.toast.warning {
  background: rgba(245, 158, 11, 0.94);
}

.auth-gate,
.bento-grid,
.dashboard-grid,
.admin-grid {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

[hidden] {
  display: none !important;
}

.auth-gate {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  align-items: stretch;
  margin-top: 0;
}

.auth-gate > div,
.login-panel,
.card,
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.eyebrow {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-gate h2 {
  margin-top: 8px;
  font-size: clamp(1.35rem, 4vw, 2.4rem);
}

.auth-gate p:last-child {
  margin-top: 10px;
  color: var(--text-secondary);
}

.login-panel {
  display: grid;
  gap: 14px;
}

.login-panel form {
  display: grid;
  gap: 14px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-secondary);
}

.segment {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text-secondary);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.segment.active {
  color: #1a1a0a;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
}

.inline-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.form-status {
  min-height: 1.4em;
  color: var(--gold);
  font-size: 0.84rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
}

select {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
}

textarea {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
}

.password-output {
  display: block;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--gold-bright);
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  z-index: 20;
}

.modal {
  width: min(480px, 100%);
  max-height: 88vh;
  overflow: auto;
  display: grid;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-wide {
  width: min(640px, 100%);
}

.archive-preview {
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.settings-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.settings-section h4 {
  margin: 0;
  color: var(--gold-bright);
}

.settings-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.settings-row,
.settings-dim-row,
.settings-inline-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.settings-quote-row,
.settings-inline-3 {
  grid-template-columns: 130px minmax(0, 1fr) auto;
}

.settings-dim-row {
  grid-template-columns: minmax(100px, 1.1fr) 96px minmax(140px, 1.5fr);
}

.modal form {
  display: grid;
  gap: 14px;
}

.bento-grid {
  grid-template-columns: 260px 1fr 280px;
  gap: 20px;
  align-items: stretch;
  margin-top: 0;
}

.bento-col-left,
.bento-col-middle,
.bento-col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header,
.split-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.split-header {
  justify-content: space-between;
}

.small-label {
  font-size: 0.72rem;
  font-weight: 600;
}

.icon-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(240, 192, 96, 0.5);
}

.icon-dot.green {
  background: var(--accent-green);
}

.icon-dot.blue {
  background: var(--accent-blue);
}

.icon-dot.purple {
  background: #a78bfa;
}

.role-overview {
  text-align: center;
  padding: 25px 15px;
}

.role-level-badge {
  width: 75px;
  height: 75px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: conic-gradient(from 210deg, #f0c060, #f8d478, #f0c060);
  color: #1a1a0a;
  font-weight: 900;
  font-size: 1.8rem;
  margin-bottom: 10px;
  animation: badge-pulse 3s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(240, 192, 96, 0.2); }
  50% { box-shadow: 0 0 45px rgba(240, 192, 96, 0.4); }
}

.role-level-badge .lv-label {
  position: absolute;
  top: -6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #1a1a0a;
  color: var(--gold-bright);
  font-size: 0.62rem;
}

.role-exp-info,
.role-exp-remaining {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.exp-bar-outer,
.growth-bar-outer {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.exp-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

.exp-bar-label {
  width: 100%;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.radar-placeholder {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  position: relative;
}

canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.radar-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: absolute;
  border: 1px solid rgba(240, 192, 96, 0.28);
  background:
    radial-gradient(circle, rgba(240, 192, 96, 0.16) 0 2px, transparent 3px),
    repeating-radial-gradient(circle, transparent 0 24px, rgba(255, 255, 255, 0.06) 25px 26px);
}

.quote-list,
.goal-list {
  display: grid;
  gap: 10px;
}

.quote-item,
.goal-list li {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.quote-item {
  border-left: 3px solid var(--quote-border);
  border-radius: 0 8px 8px 0;
}

.quote-date {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.goal-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checkin-grid,
.growth-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.checkin-item,
.growth-item {
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-secondary);
  transition: all 0.3s;
}

.checkin-item {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  border-width: 1.5px;
}

.checkin-item.completed {
  border-color: rgba(74, 222, 128, 0.4);
  background: var(--accent-green-bg);
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.08);
}

.checkin-item.pending {
  opacity: 0.75;
}

.ci-level,
.ci-status,
.ci-exp,
.growth-stats,
.growth-desc {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.ci-name,
.growth-name {
  color: var(--text-primary);
  font-weight: 700;
  min-width: 0;
}

.ci-name {
  font-size: 0.85rem;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ci-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: #555;
}

.checkin-item.completed .ci-status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

.growth-item {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.growth-top,
.growth-stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.growth-lv {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-card);
  white-space: nowrap;
  border: 1px solid rgba(240, 192, 96, 0.3);
}

.growth-bar-inner {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6b6d80, #888);
}

.record-table-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.record-table-wrap::-webkit-scrollbar {
  display: none;
}

.record-table,
.calendar-table {
  width: 100%;
  border-collapse: collapse;
}

.calendar-table {
  min-width: 0;
  text-align: center;
  font-size: 0.75rem;
}

.record-table {
  min-width: 0;
  font-size: 0.78rem;
}

.record-table th,
.record-table td,
.calendar-table th,
.calendar-table td {
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px;
  text-align: left;
}

.record-table th,
.calendar-table th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.record-card {
  display: flex;
  flex-direction: column;
  height: 415px;
  min-height: 415px;
  max-height: 415px;
}

.status-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-green);
  font-weight: 600;
  font-size: 0.78rem;
}

.exp-badge {
  display: inline-block;
  background: rgba(240, 192, 96, 0.15);
  color: var(--gold-bright);
  padding: 3px 9px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.75rem;
}

.empty-cell {
  text-align: center !important;
  color: var(--text-muted);
}

.calendar-table td {
  text-align: center;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
}

.calendar-table td.today {
  background: rgba(240, 192, 96, 0.2);
  color: var(--gold-bright);
  font-weight: 800;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(240, 192, 96, 0.25);
}

.calendar-table td.empty {
  color: transparent;
}

.calendar-info {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.stats-vertical {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.stats-chart-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px;
  background: var(--bg-secondary);
  text-align: center;
}

.stats-chart-wrap h4 {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 0.6rem;
}

.chart-placeholder {
  min-height: 108px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(240, 192, 96, 0.08), rgba(96, 165, 250, 0.04));
}

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

.hero-stat {
  display: grid;
  place-items: center;
  text-align: center;
}

.badge {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--gold), var(--gold-bright), var(--gold));
  color: #1a1a0a;
  font-weight: 900;
}

.hero-stat strong,
.metric-card strong {
  font-size: 2rem;
  color: var(--gold-bright);
}

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

.placeholder-list span {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-secondary);
}

.admin-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  display: grid;
  gap: 8px;
}

.metric-card span {
  color: var(--text-secondary);
  font-weight: 700;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

th {
  color: var(--text-muted);
  font-size: 0.78rem;
}

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

  .bento-col-middle {
    grid-column: 1 / -1;
  }

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

  .hero-stat {
    grid-column: 1 / -1;
  }
}

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

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

  .auth-gate,
  .bento-grid,
  .dashboard-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .bento-col-middle {
    grid-column: auto;
  }

  .actions,
  .button {
    width: 100%;
  }

  .button {
    text-align: center;
  }

  .placeholder-list {
    grid-template-columns: 1fr;
  }

  .checkin-grid,
  .growth-grid {
    grid-template-columns: 1fr;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }
}
