:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17231f;
  background: #f3f6f4;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f6f4; }
button, input, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(26, 113, 85, .25); outline-offset: 2px; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: #15231f; }
.login-panel { width: min(420px, 100%); padding: 36px; background: #fff; border: 1px solid #dbe3df; border-radius: 8px; box-shadow: 0 18px 48px rgba(0, 0, 0, .2); }
.app-mark { width: 48px; height: 48px; border-radius: 8px; display: block; margin-bottom: 22px; }
.eyebrow { margin: 0 0 6px; color: #1a7155; font-size: 11px; font-weight: 800; letter-spacing: 0; }
h1, h2 { margin: 0; letter-spacing: 0; }
.login-panel h1 { font-size: 28px; margin-bottom: 28px; }
.login-panel form { display: grid; gap: 14px; }
.login-panel label, .dialog-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: #4e5e58; }
input, select { width: 100%; min-height: 42px; border: 1px solid #cfd9d4; border-radius: 6px; background: #fff; color: #17231f; padding: 9px 11px; }
input:hover, select:hover { border-color: #9fb0a8; }
.form-message { min-height: 20px; margin: 14px 0 0; color: #b34334; font-size: 13px; }

.admin-shell { min-height: 100vh; padding-bottom: 48px; }
.topbar { height: 66px; padding: 0 max(24px, calc((100vw - 1440px) / 2)); background: #16241f; color: #fff; display: flex; align-items: center; justify-content: space-between; }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup img { width: 36px; height: 36px; border-radius: 6px; }
.brand-lockup div { display: grid; gap: 2px; }
.brand-lockup strong { font-size: 14px; }
.brand-lockup span { color: #9fb7ad; font-size: 11px; }
.topbar-actions { display: flex; gap: 8px; }
.distribution-mode { min-height: 30px; display: inline-flex; align-items: center; color: #b9d1c7; border: 1px solid #40534b; border-radius: 6px; padding: 5px 10px; font-size: 11px; font-weight: 750; }
.topbar .quiet { color: #d7e5df; border-color: #40534b; background: transparent; text-decoration: none; }
.topbar .quiet:hover { background: #22352e; }

.page-heading, .metrics, .tabs, .content-panel { width: min(1440px, calc(100% - 48px)); margin-inline: auto; }
.page-heading { display: flex; align-items: end; justify-content: space-between; padding: 34px 0 22px; }
.page-heading h1 { font-size: 27px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: #fff; border: 1px solid #dbe3df; border-radius: 8px; overflow: hidden; }
.metrics div { min-height: 92px; padding: 20px; display: grid; align-content: center; gap: 6px; border-right: 1px solid #e3e9e6; }
.metrics div:last-child { border-right: 0; }
.metrics span { color: #6b7973; font-size: 12px; }
.metrics strong { font-size: 25px; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 24px; margin-top: 26px; border-bottom: 1px solid #d4ded9; }
.tab { min-height: 44px; border: 0; border-bottom: 2px solid transparent; color: #67766f; background: transparent; padding: 0 2px; font-weight: 700; }
.tab.selected { color: #17664d; border-bottom-color: #17664d; }
.content-panel { padding-top: 18px; }
.toolbar { min-height: 64px; display: grid; grid-template-columns: minmax(260px, 1fr) 160px auto; align-items: end; gap: 12px; margin-bottom: 14px; }
.search-control, .select-control { display: grid; gap: 6px; color: #65736d; font-size: 11px; font-weight: 700; }
.table-wrap { overflow: hidden; background: #fff; border: 1px solid #dbe3df; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 42px; background: #edf2ef; color: #66756f; padding: 0 14px; text-align: left; font-size: 11px; font-weight: 800; }
td { min-height: 64px; padding: 13px 14px; border-top: 1px solid #e6ece9; vertical-align: middle; font-size: 13px; overflow-wrap: anywhere; }
td strong { display: block; margin-bottom: 3px; }
td small { color: #7b8983; }
th:nth-child(1), td:nth-child(1) { width: 18%; }
th:nth-child(2), td:nth-child(2) { width: 23%; }
th:nth-child(3), td:nth-child(3) { width: 10%; }
th:nth-child(4), td:nth-child(4) { width: 12%; }
th:nth-child(5), td:nth-child(5) { width: 8%; }
th:nth-child(6), td:nth-child(6) { width: 9%; }
th.actions-column, td.row-actions { width: 20%; text-align: right; }
.license-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.row-copy { min-height: 26px; margin-left: 7px; border: 1px solid #cbd6d1; border-radius: 5px; background: #f5f8f6; color: #365048; padding: 3px 7px; font-size: 11px; font-weight: 750; }
.row-copy:hover { background: #e6eeea; }
.status { display: inline-flex; min-width: 58px; min-height: 25px; align-items: center; justify-content: center; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 800; }
.status.active { color: #146047; background: #e3f2eb; }
.status.suspended { color: #a33d31; background: #fae7e3; }
.row-actions { white-space: normal; }
.row-actions button { border: 0; background: transparent; color: #17664d; padding: 5px 6px; font-size: 12px; font-weight: 700; }
.row-actions button:hover { color: #0d3f30; text-decoration: underline; }
.row-actions button.danger { color: #aa4034; }
.empty-state { min-height: 180px; display: grid; place-items: center; color: #7e8d86; font-size: 13px; }

.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; padding: 8px 14px; font-weight: 750; }
.button.primary { background: #17664d; color: #fff; }
.button.primary:hover { background: #0f523d; }
.button.quiet { background: #fff; color: #374841; border-color: #cdd8d3; }
.button.quiet:hover { background: #edf2ef; }

dialog { width: min(570px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 72px rgba(0, 0, 0, .26); }
dialog::backdrop { background: rgba(14, 25, 21, .58); }
.dialog-form { padding: 26px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.dialog-heading h2 { font-size: 21px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 5px; background: #edf2ef; color: #405049; font-size: 23px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 26px; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: min(400px, calc(100% - 44px)); transform: translateY(20px); opacity: 0; pointer-events: none; background: #17251f; color: #fff; border-radius: 6px; padding: 12px 15px; font-size: 13px; transition: .18s ease; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div { border-bottom: 1px solid #e3e9e6; }
  .toolbar { grid-template-columns: 1fr 150px; }
  .toolbar .button { grid-column: 1 / -1; justify-self: start; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 1050px; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 16px; }
  .brand-lockup span, .distribution-mode { display: none; }
  .page-heading, .metrics, .tabs, .content-panel { width: calc(100% - 28px); }
  .page-heading { align-items: start; gap: 18px; }
  .page-heading h1 { font-size: 23px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics div { min-height: 78px; padding: 14px; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .button { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .login-panel { padding: 27px; }
}
