:root {
  color-scheme: light;
  --ink: #172923;
  --muted: #52645d;
  --paper: #f4f5f1;
  --surface: #ffffff;
  --surface-soft: #eaf0ea;
  --line: #d7e0d8;
  --brand: #245e52;
  --brand-deep: #17473e;
  --brand-soft: #dcebe3;
  --accent: #db8a5c;
  --danger: #9c302c;
  --danger-soft: #f9e9e5;
  --success: #1f604a;
  --shadow: 0 22px 56px rgb(26 53 42 / 9%);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:disabled { cursor: wait; opacity: .68; }
a { color: var(--brand-deep); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #bd6138;
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--brand-deep);
  color: #fff;
  padding: 12px 16px;
}
.skip-link:focus { transform: translateY(0); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: rgb(250 251 248 / 94%);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px 12px 12px 4px;
  background: var(--brand);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 15px; letter-spacing: -.02em; }
.brand-copy small { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .18em; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.environment-tag { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.environment-tag > span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.side-navigation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 34px 18px 22px 28px;
  border-right: 1px solid var(--line);
  background: #eff2ed;
}
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.nav-item[aria-current="page"] { background: #dce8df; color: var(--brand-deep); }
.nav-glyph { color: #52645d; font-size: 10px; letter-spacing: .08em; }
.side-note { max-width: 160px; margin: 8px 4px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.side-footer { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 13px 4px 2px; color: var(--muted); font-size: 11px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #49956e; box-shadow: 0 0 0 4px #d9e9dd; }
.main-content { min-width: 0; padding: clamp(24px, 4vw, 54px) clamp(18px, 5vw, 72px) 72px; }
.app-root { width: min(100%, 1120px); margin: 0 auto; }

.auth-layout { display: grid; min-height: calc(100vh - 200px); grid-template-columns: minmax(260px, .9fr) minmax(340px, 1.1fr); align-items: center; gap: clamp(36px, 8vw, 110px); }
.auth-intro { max-width: 470px; padding: 28px 0; }
.kicker { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 22px; color: var(--brand-deep); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.kicker::before { width: 22px; height: 2px; background: var(--accent); content: ""; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin-top: 0; }
.auth-intro h1 { max-width: 420px; margin-bottom: 18px; font-family: Georgia, "Songti SC", serif; font-size: clamp(38px, 5vw, 66px); font-weight: 500; letter-spacing: -.045em; line-height: 1.05; }
.auth-intro > p { max-width: 390px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.intro-rule { width: 72px; height: 1px; margin: 34px 0 17px; background: var(--line); }
.intro-footnote { color: var(--muted); font-size: 11px; line-height: 1.7; }
.auth-card, .panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.auth-card { padding: clamp(24px, 4vw, 42px); }
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { margin: 0 0 7px; font-size: 22px; letter-spacing: -.025em; }
.auth-card-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; margin-bottom: 24px; border-radius: 10px; background: #f0f3ef; }
.mode-switch button { min-height: 39px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.mode-switch button[aria-pressed="true"] { background: var(--surface); color: var(--brand-deep); box-shadow: 0 2px 8px rgb(24 52 40 / 8%); }
.stack { display: grid; gap: 17px; }
.field { display: grid; gap: 7px; }
.asset-upload-field { display: grid; gap: 12px; min-width: 0; }
.asset-upload-control { display: grid; gap: 8px; padding: 12px; border: 1px dashed #aebdb1; border-radius: 10px; background: #fbfcf9; }
.asset-upload-control > label { font-size: 11px; font-weight: 750; }
.asset-upload-control input[type="file"] { width: 100%; min-height: 42px; padding: 7px; border: 1px solid #bccbc0; border-radius: 8px; background: #fff; color: var(--ink); font-size: 11px; }
.asset-apply-button { justify-self: start; min-height: 38px; }
.asset-upload-field { display: grid; gap: 12px; min-width: 0; }
.asset-upload-control { display: grid; gap: 8px; padding: 12px; border: 1px dashed #aebdb1; border-radius: 10px; background: #fbfcf9; }
.asset-upload-control > label { font-size: 11px; font-weight: 750; }
.asset-upload-control input[type="file"] { width: 100%; min-height: 42px; padding: 7px; border: 1px solid #bccbc0; border-radius: 8px; background: #fff; color: var(--ink); font-size: 11px; }
.asset-apply-button { justify-self: start; min-height: 38px; }
.field label { font-size: 12px; font-weight: 750; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid #bccbc0;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}
.field input::placeholder, .field textarea::placeholder { color: #6b7b73; opacity: 1; }
.field textarea { min-height: 88px; padding: 12px 13px; resize: vertical; }
.field select { min-height: 48px; padding: 0 13px; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); }
.field-label { font-size: 12px; font-weight: 750; }
.readonly-value { display: block; min-height: 44px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: #f5f7f4; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; }
.field-error { margin: 0; color: var(--danger); font-size: 11px; font-weight: 650; line-height: 1.5; }
.field-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .16s ease, transform .16s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); background: var(--brand-deep); }
.button-primary { width: 100%; margin-top: 4px; }
.button-secondary { border-color: #9db5a6; background: transparent; color: var(--brand-deep); }
.button-secondary:hover:not(:disabled) { background: var(--brand-soft); }
.button-quiet { min-height: 38px; border-color: var(--line); background: transparent; color: var(--brand-deep); }
.button-quiet:hover:not(:disabled) { background: var(--surface-soft); }
.text-button { border: 0; background: none; color: var(--brand-deep); font-size: 12px; font-weight: 750; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.message { margin: 0 0 17px; padding: 12px 14px; border: 1px solid #b7d3c2; border-radius: 9px; background: #edf6ef; color: #194d38; font-size: 12px; line-height: 1.55; }
.message[role="alert"] { border-color: #e7b8ad; background: var(--danger-soft); color: #792622; }
.message[role="status"] { border-color: #b7d3c2; background: #edf6ef; color: #194d38; }
.form-footer { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading .kicker { margin-bottom: 12px; }
.page-heading h1 { margin: 0 0 8px; font-family: Georgia, "Songti SC", serif; font-size: clamp(31px, 4vw, 48px); font-weight: 500; letter-spacing: -.04em; line-height: 1.1; }
.page-heading p { max-width: 650px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.summary-strip { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1px; overflow: hidden; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.summary-cell { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; padding: 14px 18px; background: #fbfcf9; }
.summary-label { color: var(--muted); font-size: 11px; }
.summary-value { color: var(--brand-deep); font-size: 12px; font-weight: 800; }
.panel { padding: clamp(18px, 2.8vw, 28px); box-shadow: 0 8px 28px rgb(26 53 42 / 5%); }
.panel + .panel { margin-top: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.02em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.tenant-list { display: grid; gap: 10px; }
.tenant-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}
.tenant-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 11px; margin-bottom: 6px; }
.tenant-title strong { font-size: 14px; }
.tenant-key { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tenant-meta { display: flex; flex-wrap: wrap; gap: 11px; color: var(--muted); font-size: 10px; }
.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-deep); font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge-muted { background: #e8ece8; color: #3c4b43; }
.badge-warning { background: #fff0dc; color: #744719; }
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; }
.page-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.pagination-actions { display: flex; gap: 8px; }
.empty-state { padding: 28px 18px; border: 1px dashed #aebdb1; border-radius: 11px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.7; }
.form-panel { max-width: 620px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .85fr); gap: 18px; align-items: start; }
.detail-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #eff2ed; }
.detail-tabs .nav-item { min-height: 42px; padding: 0 14px; }
.detail-tabs .nav-item[aria-pressed="true"] { background: #dce8df; color: var(--brand-deep); }
.configuration-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.configuration-layout > .panel:first-child { min-width: 0; }
.form-section { display: grid; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.form-section > .panel-heading { margin: 0; }
.form-section h3 { margin: 0 0 5px; font-size: 15px; }
.form-section h4 { margin: 12px 0 0; font-size: 13px; }
.form-section .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-field { display: flex; align-items: flex-start; gap: 10px; min-height: 48px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcf9; }
.check-field input, .product-select input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.check-field label { font-size: 12px; font-weight: 700; cursor: pointer; }
.product-list { display: grid; gap: 10px; }
.product-card { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; }
.product-select { display: flex; align-items: flex-start; gap: 10px; }
.product-select label { display: grid; gap: 4px; cursor: pointer; }
.product-select strong { font-size: 13px; }
.product-select span { color: var(--muted); font-size: 10px; }
.product-fields { display: grid; gap: 13px; margin: 16px 0 0 29px; }
.published-summary { display: grid; gap: 12px; margin: 0; }
.published-summary > div { display: grid; gap: 5px; }
.published-summary dt { color: var(--muted); font-size: 10px; font-weight: 750; }
.published-summary dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.hash-value { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 10px !important; }
.confirmation-dialog { width: min(calc(100% - 32px), 520px); padding: 24px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: 0 24px 80px rgb(13 32 23 / 28%); }
.confirmation-dialog::backdrop { background: rgb(16 34 27 / 54%); backdrop-filter: blur(2px); }
.confirmation-dialog h2 { margin: 0; font-size: 20px; }
.confirmation-dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-item { display: grid; gap: 6px; min-width: 0; }
.detail-item dt { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .06em; }
.detail-item dd { margin: 0; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.status-explainer { margin-top: 14px; padding: 13px 14px; border-left: 3px solid var(--accent); background: #fff8ef; color: #624729; font-size: 12px; line-height: 1.65; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; margin: 5px 0 17px; }
.account-appid { max-width: 100%; overflow-wrap: anywhere; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 13px; }
.section-divider { height: 1px; margin: 19px 0; background: var(--line); }
.back-row { margin-bottom: 19px; }
.loading-state { display: flex; align-items: center; gap: 11px; padding: 20px 0; color: var(--muted); font-size: 12px; }
.spinner { width: 17px; height: 17px; border: 2px solid #c8d7cc; border-top-color: var(--brand); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side-navigation { flex-direction: row; align-items: center; gap: 9px; padding: 9px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-navigation .eyebrow, .side-note, .side-footer { display: none; }
  .nav-item { min-height: 40px; padding: 0 12px; }
  .nav-glyph { display: none; }
  .main-content { padding: 26px 18px 50px; }
  .auth-layout { min-height: auto; grid-template-columns: 1fr; gap: 20px; max-width: 590px; margin: 0 auto; }
  .auth-intro { padding: 16px 0 0; }
  .auth-intro h1 { max-width: 550px; font-size: clamp(38px, 9vw, 54px); }
  .auth-intro > p { max-width: 520px; }
  .intro-rule, .intro-footnote { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .configuration-layout { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .topbar { min-height: 64px; padding: 0 16px; }
  .brand-mark { width: 34px; height: 34px; }
  .environment-tag { display: none; }
  .form-section .form-grid, .check-grid { grid-template-columns: 1fr; }
  .heading-actions .button { width: 100%; }
  .button-quiet { min-height: 36px; padding: 0 12px; }
  .main-content { padding: 22px 14px 42px; }
  .auth-card { padding: 22px 18px; border-radius: 14px; }
  .page-heading { display: grid; align-items: start; gap: 15px; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .summary-strip { grid-template-columns: 1fr; }
  .summary-cell { min-height: 52px; }
  .tenant-card { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tenant-card .button { width: 100%; }
  .panel { padding: 17px 14px; }
  .panel-heading { display: grid; }
  .form-grid, .detail-fields { grid-template-columns: 1fr; }
  .list-footer { align-items: flex-start; flex-direction: column; }
  .pagination-actions { width: 100%; }
  .pagination-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
