:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #66736b;
  --line: #dfe7df;
  --paper: #f8faf6;
  --panel: #ffffff;
  --jade: #176b55;
  --jade-soft: #e2f1eb;
  --gold: #b8872f;
  --red: #a84632;
  --blue: #276a9f;
  --wood: #2d7d46;
  --fire: #b9492f;
  --earth: #a57435;
  --metal: #7d8790;
  --water: #2e6496;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 12%, rgba(23, 107, 85, 0.12), transparent 30%),
    linear-gradient(135deg, #f3f7f1 0%, #f8faf6 48%, #edf4f7 100%);
  color: var(--ink);
}

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

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p,
.fine-print,
.eyebrow {
  color: var(--muted);
}

.account-panel,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

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

.account-login-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}

.account-login-row[hidden] {
  display: none;
}

.account-login-row input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  outline: none;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-mode-tabs button,
.contact-row select,
.contact-row button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.auth-mode-tabs button.active {
  border-color: var(--jade);
  background: var(--jade-soft);
  color: var(--jade);
  font-weight: 800;
}

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

.contact-row[hidden] {
  display: none;
}

.contact-row button {
  grid-column: 1 / -1;
}

.contact-row input[hidden],
.contact-row button[hidden] {
  display: none;
}

.contact-row:has(input[hidden]) {
  grid-template-columns: 1fr;
}

.auth-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-panel span,
.profile-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-panel strong {
  display: block;
  margin-top: 4px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--jade);
  font-weight: 800;
  cursor: pointer;
}

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

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

.birth-form label,
.birth-place-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.birth-form input,
.birth-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.birth-form input:focus,
.birth-form select:focus,
.chat-form input:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(23, 107, 85, 0.14);
}

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

.segmented.calendar-mode {
  grid-template-columns: repeat(3, 1fr);
}

.segmented label {
  display: block;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: var(--jade);
  background: var(--jade-soft);
  color: var(--jade);
  font-weight: 700;
}

.manual-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.manual-pillars[hidden] {
  display: none;
}

.manual-pillars label {
  min-width: 0;
}

.manual-pillars input {
  text-align: center;
  padding-inline: 6px;
}

.date-picker-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 8px;
}

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

.date-picker-row select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.region-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.time-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.time-options label {
  display: flex;
  align-items: center;
  min-height: 38px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.time-options input {
  width: 16px;
  height: 16px;
  accent-color: var(--jade);
}

.rule-preview {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.location-preview {
  margin: -6px 0 0;
  border: 1px solid #edf2ed;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdfb;
  color: var(--jade);
  font-size: 12px;
  line-height: 1.5;
}

.primary-button,
.chat-form button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--jade);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.chart-panel,
.element-panel,
.timeline-panel,
.report-panel,
.chat-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 40px rgba(23, 33, 27, 0.06);
}

.module-nav {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.profile-panel {
  margin-top: 16px;
}

.saved-profiles {
  display: grid;
  gap: 8px;
}

.profile-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.profile-load {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.profile-delete {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.profile-chip small {
  color: var(--muted);
}

.profile-chip.active {
  border-color: var(--jade);
  background: var(--jade-soft);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.module-tab {
  display: flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.module-tab.active {
  border-color: var(--jade);
  background: var(--jade-soft);
  color: var(--jade);
  font-weight: 800;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.section-title strong {
  font-size: 13px;
  color: var(--jade);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 36px);
}

.status-pill,
.view-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
}

.view-mode-toggle {
  border-color: rgba(23, 107, 85, 0.26);
  background: var(--jade-soft);
  color: var(--jade);
  cursor: pointer;
  font-weight: 800;
  z-index: 5;
}

.liuren-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.consult-entry {
  color: #fff5e8;
  background: #8e332a;
  border-color: #a84a3f;
}

.bazi-current {
  color: #176b55;
  background: #eef8f2;
  border-color: rgba(23, 107, 85, .35);
}

.view-mode-toggle .pulse {
  flex: 0 0 auto;
}

.view-mode-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--jade);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

#view-mode-label:empty {
  display: none;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #24a46f;
  box-shadow: 0 0 0 5px rgba(36, 164, 111, 0.12);
}

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

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  margin-top: 18px;
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.feature-strip article {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.feature-strip strong,
.feature-strip span {
  display: block;
}

.feature-strip span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chart-panel,
.element-panel,
.timeline-panel,
.report-panel,
.chat-panel,
.module-panel {
  padding: 18px;
}

.chart-panel {
  grid-column: 1 / -1;
}

.element-panel,
.timeline-panel {
  align-self: start;
  min-height: 0;
}

.module-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 40px rgba(23, 33, 27, 0.06);
}

.module-view {
  min-height: 240px;
}

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

.module-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: linear-gradient(180deg, #fff, #f8fbf8);
}

.module-card h3 {
  margin: 0;
  font-size: 16px;
}

.module-card p {
  margin: 9px 0 0;
  color: #3f4b43;
  line-height: 1.62;
}

.module-card small {
  display: inline-flex;
  margin-top: 12px;
  color: var(--muted);
}

.mind-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.mind-node {
  display: grid;
  place-items: center;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  text-align: center;
}

.mind-node.core {
  min-height: 116px;
  border-color: var(--jade);
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 18px;
  font-weight: 800;
}

.map-view {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.compass {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.direction {
  display: grid;
  place-items: center;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.direction.good {
  border-color: var(--jade);
  background: var(--jade-soft);
  color: var(--jade);
  font-weight: 800;
}

.rag-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
}

.rag-search {
  display: grid;
  gap: 10px;
}

.rag-search input,
.rag-search select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
}

.rag-result {
  border-left: 3px solid var(--jade);
  padding: 10px 0 10px 12px;
}

.rag-result strong {
  display: block;
}

.rag-result p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.58;
}

.rag-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.rag-evidence strong {
  color: var(--jade);
  margin-right: 2px;
}

.rag-evidence span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  line-height: 1.3;
}

.deep-insight-cta {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--jade-soft);
}

.deep-insight-cta strong {
  color: var(--jade);
  font-size: 16px;
}

.deep-insight-cta p {
  margin: 0;
  color: #3d4941;
  line-height: 1.68;
}

.deep-insight-cta .secondary-button {
  justify-self: start;
  background: #fff;
}

.career-tool {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.career-tool textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.career-tool textarea:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(23, 107, 85, 0.14);
}

.offer-result {
  min-height: 72px;
  white-space: pre-wrap;
  border-left: 3px solid var(--jade);
  padding: 10px 0 10px 12px;
  color: #3f4b43;
  line-height: 1.68;
}

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

.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: var(--jade);
  font-weight: 800;
  cursor: pointer;
}

.overview-result {
  min-height: 56px;
  margin-top: 12px;
  white-space: pre-wrap;
  border-left: 3px solid var(--gold);
  padding: 10px 0 10px 12px;
  color: #3f4b43;
  line-height: 1.68;
}

.pillars {
  display: grid;
  gap: 16px;
}

.basic-info-panel,
.professional-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.basic-info-panel {
  padding: 14px;
}

.basic-info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.basic-info-head span,
.basic-info-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.basic-info-head strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.rule-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.rule-tags em {
  border-radius: 999px;
  padding: 6px 10px;
  background: #f7f3ea;
  color: var(--gold);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.basic-info-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.basic-info-grid div {
  min-width: 0;
  border: 1px solid #edf2ed;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfb;
}

.basic-info-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.professional-detail {
  padding: 14px;
  overflow-x: auto;
}

.bazi-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.original-table {
  min-width: 720px;
}

.transit-table {
  min-width: 520px;
}

.bazi-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.bazi-table th,
.bazi-table td {
  border-bottom: 1px solid #edf2ed;
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
}

.bazi-table thead th {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.bazi-table tbody th {
  width: 82px;
  background: #f7faf7;
  color: #9aa39d;
  font-weight: 800;
}

.bazi-table tr:last-child th,
.bazi-table tr:last-child td {
  border-bottom: 0;
}

.ganzhi-token {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  min-height: 58px;
  border-radius: 8px;
  background: #f1f6f3;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
}

.ganzhi-token small {
  margin-top: 3px;
  color: currentColor;
  font-size: 12px;
  opacity: 0.72;
}

.wood { color: #17c846; }
.fire { color: #d71919; }
.earth { color: #b8872f; }
.metal { color: #d28a00; }
.water { color: #2f7df3; }
.gold { color: var(--gold); }

.stacked-values {
  display: grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.3;
}

.stacked-values span {
  display: block;
}

.bazi-insight {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.relation-summary {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--ink);
  line-height: 1.55;
}

.relation-summary strong {
  color: var(--gold);
}

.relation-panel,
.classical-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.relation-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.relation-pillars div {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
}

.relation-pillars strong {
  font-size: 24px;
  line-height: 1;
}

.relation-lines {
  display: grid;
  gap: 8px;
}

.relation-line {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 90px;
  align-items: center;
  gap: 8px;
  color: #7a847d;
}

.relation-line span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  text-align: center;
  background: #fff;
}

.relation-line em {
  position: relative;
  border-top: 1px solid #cfd8d1;
  padding-top: 6px;
  text-align: center;
  color: var(--ink);
  font-style: normal;
}

.classical-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: -4px -14px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.classical-tabs button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  cursor: default;
}

.classical-tabs button:last-child {
  border-right: 0;
}

.classical-tabs button.active {
  background: #fff;
  color: var(--muted);
}

.classical-reference {
  display: grid;
  gap: 12px;
  color: #59645d;
  line-height: 1.8;
}

.classical-reference p,
.classical-reference h4 {
  margin: 0;
}

.classical-reference h4 {
  color: var(--ink);
}

.classical-reference span {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  margin-left: 6px;
  border-radius: 8px;
  background: var(--gold);
  color: #fff;
  font-weight: 800;
}

.stem,
.branch {
  display: grid;
  place-items: center;
  height: 42px;
  border-radius: 8px;
  font-size: 24px;
  font-weight: 800;
}

.stem {
  background: var(--jade-soft);
  color: var(--jade);
}

.branch {
  background: #f5ead8;
  color: var(--gold);
}

.fine-print {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.element-bars {
  display: grid;
  gap: 8px;
}

.element-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ec;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.kline {
  display: grid;
  grid-template-columns: repeat(8, minmax(42px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 128px;
  max-height: 168px;
}

.luck-column {
  display: grid;
  align-items: end;
  gap: 7px;
  min-width: 0;
  text-align: center;
}

.luck-bar {
  max-height: 132px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #d49b3f, #176b55);
}

.luck-column span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report {
  display: grid;
  gap: 14px;
}

.report-group {
  display: grid;
  gap: 14px;
}

.report-group-title {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #f8fbf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-subgrid {
  display: grid;
  gap: 14px;
}

.report-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  margin: -4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--jade-soft);
  color: var(--jade);
  font-size: 12px;
  font-weight: 800;
}

.report-section {
  border-left: 3px solid var(--jade);
  padding-left: 12px;
}

.report-section h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.report-section p {
  margin: 0;
  color: #3d4941;
  line-height: 1.72;
}

.ai-report-section ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: #26332c;
  line-height: 1.68;
}

.ai-report-section li::marker {
  color: var(--jade);
  font-weight: 800;
}

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

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  max-height: 430px;
  padding-right: 4px;
}

.memory-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin: -6px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f7fbf8;
  color: var(--muted);
  font-size: 12px;
}

.memory-strip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  max-width: 88%;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.55;
}

.message.user {
  align-self: flex-end;
  background: var(--jade);
  color: #fff;
}

.message.assistant {
  align-self: flex-start;
  background: #eef4f0;
  color: #243029;
}

.markdown-message {
  display: grid;
  gap: 8px;
}

.markdown-message h4 {
  margin: 4px 0 0;
  color: var(--jade);
  font-size: 14px;
}

.markdown-message p,
.markdown-message ul {
  margin: 0;
}

.markdown-message ul {
  padding-left: 18px;
}

.markdown-message li {
  margin: 4px 0;
}

.markdown-message strong {
  color: #0f3f33;
}

.markdown-message code {
  border-radius: 4px;
  padding: 1px 4px;
  background: rgba(23, 107, 85, 0.1);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  margin-top: 14px;
}

.chat-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  outline: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .overview-grid,
  .content-grid,
  .feature-strip,
  .module-grid,
  .map-view,
  .rag-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .workspace {
    padding: 18px;
  }

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

  .basic-info-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .rule-tags {
    justify-content: flex-start;
  }

  .basic-info-grid {
    grid-template-columns: 1fr;
  }

  .relation-pillars,
  .classical-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .relation-line {
    grid-template-columns: 64px minmax(0, 1fr) 64px;
  }

  .kline {
    grid-template-columns: repeat(4, 1fr);
  }

  .mind-map {
    grid-template-columns: 1fr;
  }
}

body[data-view-mode="mobile"] {
  background: #f7faf6;
}

body[data-view-mode="mobile"] .app-shell {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 520px);
  margin: 0 auto;
}

body[data-view-mode="mobile"] .sidebar {
  border-right: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

body[data-view-mode="mobile"] .workspace {
  padding: 14px;
}

body[data-view-mode="mobile"] .topbar {
  align-items: center;
  flex-direction: row;
  gap: 12px;
  margin-bottom: 14px;
}

body[data-view-mode="mobile"] .topbar h2 {
  font-size: 22px;
}

body[data-view-mode="mobile"] .eyebrow {
  font-size: 11px;
}

body[data-view-mode="mobile"] .view-mode-toggle {
  position: absolute;
  top: 16px;
  right: 14px;
  min-height: 34px;
  width: 58px;
  padding: 0 9px;
  font-size: 12px;
}

body[data-view-mode="mobile"] .brand {
  position: relative;
  padding-right: 72px;
  margin-bottom: 16px;
}

body[data-view-mode="mobile"] .brand-mark {
  width: 38px;
  height: 38px;
}

body[data-view-mode="mobile"] .birth-form {
  gap: 10px;
}

body[data-view-mode="mobile"] .account-panel,
body[data-view-mode="mobile"] .profile-panel,
body[data-view-mode="mobile"] .chart-panel,
body[data-view-mode="mobile"] .report-panel,
body[data-view-mode="mobile"] .chat-panel {
  padding: 12px;
}

body[data-view-mode="mobile"] .content-grid,
body[data-view-mode="mobile"] .overview-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

body[data-view-mode="mobile"] .content-grid {
  margin-top: 12px;
}

body[data-view-mode="mobile"] .section-title {
  gap: 8px;
  margin-bottom: 10px;
}

body[data-view-mode="mobile"] .section-title span,
body[data-view-mode="mobile"] .section-title strong {
  font-size: 12px;
}

body[data-view-mode="mobile"] .pillars {
  gap: 12px;
}

body[data-view-mode="mobile"] .basic-info-head {
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}

body[data-view-mode="mobile"] .basic-info-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

body[data-view-mode="mobile"] .basic-info-grid div {
  min-height: 38px;
  padding: 8px 10px;
}

body[data-view-mode="mobile"] .basic-info-grid strong {
  font-size: 13px;
  line-height: 1.45;
}

body[data-view-mode="mobile"] .professional-detail {
  padding: 10px;
}

body[data-view-mode="mobile"] .bazi-table-wrap,
body[data-view-mode="mobile"] .original-table,
body[data-view-mode="mobile"] .transit-table {
  min-width: 0;
  overflow-x: hidden;
}

body[data-view-mode="mobile"] .bazi-table {
  table-layout: fixed;
}

body[data-view-mode="mobile"] .bazi-table th,
body[data-view-mode="mobile"] .bazi-table td {
  padding: 7px 3px;
  font-size: 12px;
  line-height: 1.25;
}

body[data-view-mode="mobile"] .bazi-table thead th {
  font-size: 12px;
}

body[data-view-mode="mobile"] .bazi-table tbody th {
  width: 44px;
  font-size: 12px;
}

body[data-view-mode="mobile"] .ganzhi-token {
  min-width: 34px;
  min-height: 40px;
  border-radius: 7px;
  font-size: 22px;
}

body[data-view-mode="mobile"] .ganzhi-token small {
  margin-top: 1px;
  font-size: 10px;
}

body[data-view-mode="mobile"] .stacked-values {
  gap: 1px;
  line-height: 1.18;
}

body[data-view-mode="mobile"] .stacked-values span {
  font-size: 12px;
}

body[data-view-mode="mobile"] .bazi-table tbody tr:nth-child(10) .stacked-values span {
  font-size: 11px;
}

body[data-view-mode="mobile"] .report-section h3 {
  font-size: 15px;
}

body[data-view-mode="mobile"] .report-section p,
body[data-view-mode="mobile"] .report-section li,
body[data-view-mode="mobile"] .message {
  font-size: 13px;
  line-height: 1.65;
}

body[data-view-mode="mobile"] .chat-log {
  min-height: 260px;
  max-height: 520px;
}

body[data-view-mode="desktop"] .app-shell {
  grid-template-columns: 320px minmax(0, 1fr);
  width: 100%;
  max-width: none;
}

body[data-view-mode="desktop"] .sidebar {
  border-right: 1px solid var(--line);
  border-bottom: 0;
  padding: 24px;
}

body[data-view-mode="desktop"] .workspace {
  padding: 28px;
}

body[data-view-mode="desktop"] .topbar {
  align-items: center;
  flex-direction: row;
}

body[data-view-mode="desktop"] .content-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

body[data-view-mode="desktop"] .bazi-table-wrap.original-table {
  min-width: 720px;
}

body[data-view-mode="desktop"] .bazi-table-wrap.transit-table {
  min-width: 520px;
}

.admin-body {
  background: #f4f7f2;
}

.admin-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.admin-header,
.admin-login,
.admin-panel,
.admin-stats article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  margin-bottom: 18px;
}

.admin-header h1,
.admin-header p {
  margin: 0;
}

.admin-login {
  display: grid;
  gap: 12px;
  max-width: 420px;
  padding: 18px;
}

.admin-login label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.admin-login input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.admin-project-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  overflow-x: auto;
  background: rgba(255, 250, 240, .82);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

.admin-project-tabs button {
  flex: 1 0 auto;
  min-height: 40px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 700;
}

.admin-project-tabs button.active {
  color: #fff8eb;
  background: #6f3129;
  border-color: #91483c;
}

.admin-stats article {
  padding: 16px;
}

.admin-stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.admin-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.admin-stat-button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.admin-activity {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 180px;
}

.admin-activity-bar {
  display: grid;
  align-content: end;
  gap: 6px;
  min-height: 150px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.admin-activity-bar span {
  display: block;
  min-height: 8px;
  border-radius: 6px 6px 0 0;
  background: var(--jade);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(280px, 1fr);
  gap: 14px;
}

.admin-create-panel {
  margin-bottom: 14px;
}

.admin-create-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.admin-create-form input,
.admin-create-form select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.admin-panel {
  min-width: 0;
  padding: 16px;
}

.admin-panel-wide {
  grid-column: 1 / -1;
}

.admin-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.admin-row {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.admin-row-main {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-delete {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.admin-row.active {
  border-color: var(--jade);
  background: var(--jade-soft);
}

.admin-row span,
.admin-row small,
.admin-message span {
  color: var(--muted);
  font-size: 13px;
}

.admin-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.admin-message header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-message p {
  margin: 0;
  color: #33423a;
  line-height: 1.65;
  white-space: pre-wrap;
}

.admin-message details { margin-top: 10px; }
.admin-message summary { color: #6f5335; cursor: pointer; }
.admin-message pre { max-height: 360px; margin: 10px 0 0; padding: 12px; overflow: auto; color: #e9dfcd; background: #2d261f; border-radius: 6px; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }

.message-delete {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .admin-shell {
    padding: 16px;
  }

  .admin-header,
  .admin-message header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-stats,
  .admin-grid,
  .admin-create-form {
    grid-template-columns: 1fr;
  }
}

/* 小诸葛管理台：独立的黑白宋体运营界面 */
.admin-body {
  --admin-ink: #111111;
  --admin-muted: #777777;
  --admin-faint: #a5a5a5;
  --admin-line: #dddddd;
  --admin-soft: #f6f6f6;
  --admin-panel: #ffffff;
  --admin-danger: #9d2e2e;
  min-width: 320px;
  background: #f7f7f7;
  color: var(--admin-ink);
  font-family: "Songti SC", SimSun, "STSong", "Noto Serif CJK SC", serif;
}

.admin-body [hidden] { display: none !important; }

.admin-body button,
.admin-body input,
.admin-body select {
  font-family: inherit;
}

.admin-body button:focus-visible,
.admin-body input:focus-visible,
.admin-body select:focus-visible,
.admin-body a:focus-visible,
.admin-body summary:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.admin-shell {
  width: min(1560px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 30px 48px;
}

.admin-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: -22px -30px 24px;
  padding: 16px 30px;
  border: 0;
  border-bottom: 1px solid var(--admin-line);
  border-radius: 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--admin-ink);
  text-decoration: none;
}

.admin-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #111;
  border-radius: 50%;
  font-size: 19px;
}

.admin-brand > span:last-child {
  display: grid;
  gap: 2px;
}

.admin-brand strong {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: .1em;
}

.admin-brand small,
.admin-current-user small {
  color: var(--admin-muted);
  font-size: 12px;
  letter-spacing: .08em;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-current-user {
  display: grid;
  margin-right: 6px;
  text-align: right;
}

.admin-refreshed {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-button,
.admin-row-actions button,
.admin-record footer button,
.admin-record footer a,
.admin-pagination button {
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid #bdbdbd;
  border-radius: 999px;
  background: #fff;
  color: var(--admin-ink);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.admin-button:hover,
.admin-row-actions button:hover,
.admin-record footer button:hover,
.admin-record footer a:hover,
.admin-pagination button:hover:not(:disabled) {
  border-color: #111;
}

.admin-button-primary {
  border-color: #111;
  background: #111;
  color: #fff;
}

.admin-button-primary:hover {
  background: #333;
}

.admin-button-quiet {
  border-color: transparent;
  background: var(--admin-soft);
}

.admin-button:disabled,
.admin-pagination button:disabled {
  cursor: not-allowed;
  opacity: .35;
}

.admin-login-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 160px);
  padding: 48px 16px;
}

.admin-login {
  display: grid;
  gap: 20px;
  width: min(460px, 100%);
  max-width: none;
  padding: 42px;
  border: 1px solid var(--admin-line);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .05);
}

.admin-login h1 {
  margin: 4px 0 10px;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 500;
}

.admin-login p {
  margin: 0;
  color: var(--admin-muted);
  line-height: 1.7;
}

.admin-login label,
.admin-form-grid label {
  display: grid;
  gap: 7px;
  color: #555;
  font-size: 13px;
}

.admin-login input,
.admin-form-grid input,
.admin-form-grid select,
.admin-search input {
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #cfcfcf;
  border-radius: 2px;
  background: #fff;
  color: var(--admin-ink);
  outline: none;
}

.admin-login input:focus,
.admin-form-grid input:focus,
.admin-form-grid select:focus,
.admin-search input:focus {
  border-color: #111;
}

.admin-kicker {
  margin: 0 0 4px;
  color: var(--admin-muted);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.admin-status {
  min-height: 22px;
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-status[data-tone="error"] { color: var(--admin-danger); }
.admin-status[data-tone="success"] { color: #235d40; }

.admin-dashboard-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-nav,
.admin-period {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar,
.admin-period::-webkit-scrollbar { display: none; }

.admin-nav button,
.admin-period button {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--admin-muted);
  cursor: pointer;
}

.admin-nav button.active,
.admin-period button.active {
  border-bottom-color: #111;
  color: #111;
}

.admin-period {
  padding-left: 12px;
  border-left: 1px solid var(--admin-line);
  font-size: 13px;
}

.admin-period > span {
  flex: 0 0 auto;
  color: var(--admin-muted);
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--admin-line);
  background: var(--admin-line);
}

.admin-kpi-grid > .admin-loading { grid-column: 1 / -1; }

.admin-kpi {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 18px;
  background: #fff;
}

.admin-kpi span,
.admin-kpi small {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-kpi strong {
  align-self: end;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 2vw, 34px);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

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

.admin-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--admin-line);
  border-radius: 2px;
  background: var(--admin-panel);
}

.admin-card-wide { grid-column: span 2; }

.admin-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.admin-card-heading h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 500;
}

.admin-chart-legend {
  display: flex;
  gap: 15px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-chart-legend span::before {
  display: inline-block;
  width: 15px;
  height: 2px;
  margin: 0 6px 3px 0;
  background: #111;
  content: "";
}

.admin-chart-legend .consult::before { background: #a2a2a2; }

.admin-trend {
  width: 100%;
  min-height: 280px;
}

.admin-trend svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.admin-chart-grid line { stroke: #ededed; stroke-width: 1; }
.admin-chart-grid text { fill: #8a8a8a; font-size: 10px; }
.admin-chart-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.active-line { stroke: #111; }
.consult-line { stroke: #a2a2a2; }
.active-point { fill: #111; }
.consult-point { fill: #fff; stroke: #8e8e8e; stroke-width: 2; }

.admin-distribution {
  display: grid;
  gap: 18px;
}

.admin-distribution-row {
  display: grid;
  gap: 7px;
}

.admin-distribution-row > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
}

.admin-distribution-row span i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #111;
}

.admin-distribution-row strong { font-weight: 500; }
.admin-distribution-row strong small { color: var(--admin-muted); font-weight: 400; }

.admin-meter {
  display: block;
  height: 5px;
  overflow: hidden;
  background: #ededed;
}

.admin-meter i {
  display: block;
  height: 100%;
  background: #111;
}

.admin-body [data-tone="1"] { opacity: .7; }
.admin-body [data-tone="2"] { opacity: .45; }
.admin-body [data-tone="3"] { opacity: .25; }

.admin-health {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--admin-line);
}

.admin-health > div {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: #fff;
}

.admin-health span { color: var(--admin-muted); font-size: 12px; }
.admin-health strong { font-size: 17px; font-weight: 500; }
.admin-health strong[data-health-tone="good"]::before,
.admin-health strong[data-health-tone="warn"]::before,
.admin-health strong[data-health-tone="bad"]::before,
.admin-health strong[data-health-tone="neutral"]::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 7px 2px 0;
  border-radius: 50%;
  background: #222;
  content: "";
}
.admin-health strong[data-health-tone="warn"]::before { background: #9c7a2b; }
.admin-health strong[data-health-tone="bad"]::before { background: var(--admin-danger); }
.admin-health strong[data-health-tone="neutral"]::before { background: #aaa; }

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

.admin-create-card { margin-bottom: 0; }

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.admin-form-grid-accounts {
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
}

.admin-form-grid .admin-button { height: 44px; }

.admin-list-heading { align-items: end; }

.admin-search input {
  width: min(320px, 42vw);
  border-radius: 999px;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--admin-line);
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: middle;
}

.admin-table th {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .08em;
}

.admin-table td {
  color: #333;
  font-size: 14px;
}

.admin-table td > strong,
.admin-table td > small {
  display: block;
}

.admin-table td > small {
  margin-top: 5px;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-badge {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #bdbdbd;
  border-radius: 999px;
  color: #555;
  font-size: 11px;
  white-space: nowrap;
}

.admin-badge.dark {
  border-color: #111;
  background: #111;
  color: #fff;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-row-actions button {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.admin-row-actions button.danger {
  border-color: #dec6c6;
  color: var(--admin-danger);
}

.admin-row-actions button:disabled,
.admin-role-select:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.admin-role-select {
  min-height: 34px;
  padding: 4px 28px 4px 9px;
  border: 1px solid #c9c9c9;
  border-radius: 2px;
  background: #fff;
  color: #222;
  font-family: inherit;
}

.admin-lock-note {
  display: block;
  max-width: 260px;
  margin-top: 7px;
  color: var(--admin-muted);
  font-size: 11px;
  line-height: 1.5;
}

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

.admin-record {
  padding: 18px;
  border: 1px solid var(--admin-line);
  background: #fff;
}

.admin-record > header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.admin-record > header > div {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.admin-record > header strong {
  font-size: 17px;
  font-weight: 500;
}

.admin-record time,
.admin-message-record time {
  flex: 0 0 auto;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-record-meta,
.admin-record-status {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  margin-top: 13px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-record-status {
  margin: 13px -18px 0;
  padding: 10px 18px;
  border-top: 1px solid #ededed;
  border-bottom: 1px solid #ededed;
  background: #fafafa;
}

.admin-record-status b { color: #222; font-weight: 500; }

.admin-record details {
  padding: 12px 0;
  border-bottom: 1px solid #ededed;
}

.admin-record summary {
  color: #444;
  cursor: pointer;
}

.admin-report-text {
  padding: 14px 2px 2px;
  color: #333;
  line-height: 1.85;
  white-space: pre-wrap;
}

.admin-record pre {
  max-height: 420px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 14px;
  border: 1px solid #333;
  background: #111;
  color: #f5f5f5;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-record footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
}

.admin-record footer button,
.admin-record footer a {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
}

.admin-file-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #dedede;
  background: #fafafa;
  color: var(--admin-muted);
  font-size: 12px;
  word-break: break-all;
}

.admin-message-record {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--admin-line);
}

.admin-message-role {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #111;
  border-radius: 50%;
}

.admin-message-role.assistant {
  background: #111;
  color: #fff;
}

.admin-message-record header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-message-record header strong { font-weight: 500; }

.admin-message-record p {
  margin: 8px 0;
  color: #333;
  line-height: 1.75;
  white-space: pre-wrap;
}

.admin-message-record small { color: var(--admin-muted); }

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-pagination > div { display: flex; gap: 7px; }
.admin-pagination button { min-height: 32px; padding: 4px 12px; }

.admin-nav-hint { display: none; }

.admin-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 24px;
  color: var(--admin-muted);
  text-align: center;
}

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

.admin-loading {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px 0;
}

.admin-loading i {
  display: block;
  width: 100%;
  height: 42px;
  background: linear-gradient(90deg, #f0f0f0 0%, #fafafa 45%, #f0f0f0 100%);
  background-size: 220% 100%;
  animation: admin-loading 1.25s linear infinite;
}

@keyframes admin-loading { to { background-position: -220% 0; } }

.admin-toast {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 18px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}

.admin-toast[data-tone="error"] {
  border-color: var(--admin-danger);
  background: var(--admin-danger);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1240px) {
  .admin-kpi-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .admin-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-form-grid-accounts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .admin-shell { padding: 14px 16px 36px; }
  .admin-header {
    align-items: center;
    flex-direction: row;
    margin: -14px -16px 18px;
    padding: 12px 16px;
  }
  .admin-brand small,
  .admin-refreshed,
  .admin-current-user { display: none; }
  .admin-header-actions { gap: 5px; }
  .admin-header-actions .admin-button { min-height: 34px; padding: 6px 10px; }
  .admin-dashboard-bar { align-items: stretch; flex-direction: column; }
  .admin-nav { margin: 0 -16px; padding: 0 16px; }
  .admin-period { align-self: flex-end; }
  .admin-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-overview-grid { grid-template-columns: 1fr; }
  .admin-card-wide { grid-column: auto; }
  .admin-form-grid,
  .admin-form-grid-accounts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-list-heading { align-items: stretch; flex-direction: column; }
  .admin-search input { width: 100%; }
  .admin-trend { min-height: 0; overflow: hidden; }
  .admin-trend svg { min-width: 0; width: 100%; }
}

@media (max-width: 560px) {
  .admin-brand strong { font-size: 17px; }
  .admin-brand-mark { width: 34px; height: 34px; }
  .admin-header-actions .admin-button-quiet { display: none; }
  .admin-login { padding: 28px 22px; }
  .admin-nav button { padding: 0 14px; }
  .admin-nav-hint {
    display: block;
    align-self: flex-start;
    margin-top: -13px;
    color: var(--admin-faint);
    font-size: 10px;
  }
  .admin-period { width: 100%; justify-content: flex-end; padding-left: 0; border-left: 0; }
  .admin-period button { padding: 0 11px; }
  .admin-kpi { min-height: 105px; padding: 14px; }
  .admin-card { padding: 16px; }
  .admin-card-heading { margin-bottom: 16px; }
  .admin-form-grid,
  .admin-form-grid-accounts { grid-template-columns: 1fr; }
  .admin-health { grid-template-columns: 1fr; }
  .admin-record > header,
  .admin-message-record header { flex-direction: column; gap: 8px; }
  .admin-record > header > div { display: grid; }
  .admin-record-status { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
  .admin-pagination { align-items: flex-start; flex-direction: column; }
  .admin-pagination > div { width: 100%; }
  .admin-pagination button { flex: 1; }
  .admin-toast { right: 16px; bottom: 16px; }
}

@media (max-width: 700px) {
  .admin-table-wrap {
    overflow: visible;
    border-top: 0;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .admin-table thead { display: none; }

  .admin-table tbody {
    display: grid;
    gap: 12px;
  }

  .admin-table tr {
    padding: 8px 14px;
    border: 1px solid var(--admin-line);
    background: #fff;
  }

  .admin-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 4px 10px;
    width: 100%;
    padding: 9px 0;
    border-bottom: 1px solid #ededed;
    word-break: break-word;
  }

  .admin-table td:last-child { border-bottom: 0; }

  .admin-table td::before {
    grid-column: 1;
    grid-row: 1 / span 4;
    color: var(--admin-muted);
    font-size: 12px;
    content: attr(data-label);
  }

  .admin-table td > * { grid-column: 2; }
  .admin-table td > .admin-row-actions { justify-content: flex-start; }
  .admin-lock-note { max-width: none; }
  .admin-chart-compact .admin-chart-grid text { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-loading i { animation: none; }
}
