:root {
  --paper: #f2efe5;
  --ink: #17231d;
  --muted: #677169;
  --green: #0c6948;
  --green-dark: #074932;
  --line: #cbc8bc;
  --white: #fffdf8;
  --signal: #d8573f;
  --font: "Avenir Next", Avenir, "PingFang SC", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: var(--font); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { min-height: 44px; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(216, 87, 63, .4); outline-offset: 3px; }

header {
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--white);
  background: var(--ink);
}
header a { color: inherit; font-weight: 800; text-decoration: none; }
header span { color: #bfc8c1; font-size: 13px; }

main { width: min(1180px, calc(100% - 48px)); margin: 56px auto; }
.login-panel { max-width: 640px; margin: 12vh auto 0; padding: 48px; background: var(--white); box-shadow: 0 24px 70px rgba(23,35,29,.12); }
.login-panel h1, .dashboard-head h1 { margin: 10px 0 8px; font-family: "Songti SC", serif; font-size: 40px; letter-spacing: -.04em; }
.login-panel > p:not(.kicker) { margin: 0 0 30px; color: var(--muted); line-height: 1.7; }
.kicker, .panel-index { margin: 0; color: var(--green); font: 700 12px/1 var(--mono); letter-spacing: .13em; }
label { display: block; margin: 16px 0 8px; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 50px; padding: 0 14px; color: var(--ink); background: transparent; border: 1px solid #9c9f97; border-radius: 8px; }
textarea { padding-top: 12px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 4px rgba(12,105,72,.08); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

form button, .secondary-button {
  min-height: 50px;
  padding: 0 20px;
  color: var(--white);
  background: var(--green);
  border: 0;
  border-radius: 8px;
  font-weight: 750;
}
button:disabled { cursor: not-allowed; opacity: .5; }
form button:hover { background: var(--green-dark); }
.secondary-button { min-height: 44px; color: var(--ink); background: transparent; border: 1px solid rgba(255,255,255,.3); }
.text-button { padding: 0 8px; color: var(--green); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 4px; }

.dashboard-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; }
.cost-strip { display: grid; grid-template-columns: repeat(3, 1fr) auto; align-items: center; gap: 1px; color: var(--white); background: #405048; }
.cost-strip > div { min-height: 104px; display: flex; flex-direction: column; justify-content: center; padding: 18px 22px; background: var(--ink); }
.cost-strip small { color: #aeb8b1; font-size: 11px; }
.cost-strip strong { margin-top: 7px; font: 700 22px/1 var(--mono); }
.cost-strip button { margin: 0 18px; }

.admin-grid { margin-top: 24px; display: grid; grid-template-columns: .75fr 1.25fr; gap: 24px; }
.panel, .table-panel { padding: 30px; background: var(--white); border: 1px solid rgba(82,91,84,.16); }
.panel h2, .table-panel h2 { margin: 8px 0 24px; font-family: "Songti SC", serif; font-size: 25px; letter-spacing: -.025em; }
.generator-panel form { display: grid; }
.generator-panel form button { margin-top: 24px; }
.tier-settings-panel { margin-top: 24px; }
.panel-note { max-width: 520px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; text-align: right; }
.tier-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tier-form { padding: 24px; background: var(--paper); border: 1px solid var(--line); }
.tier-form.high-tier { color: var(--white); background: var(--ink); border-color: var(--ink); }
.tier-form.high-tier label { color: #d2dad4; }
.tier-form.high-tier input, .tier-form.high-tier textarea { color: var(--white); border-color: #758078; }
.tier-form button { width: 100%; margin-top: 20px; }
.tier-heading { display: flex; align-items: center; gap: 12px; }
.tier-heading h3 { margin: 0; font-family: "Songti SC", serif; font-size: 23px; }
.tier-badge { padding: 6px 8px; color: var(--green-dark); background: #d8e9de; border-radius: 999px; font: 700 10px/1 var(--mono); letter-spacing: .08em; }
.tier-badge.high { color: #40291c; background: #efd5ab; }
.tier-chip { display: inline-block; padding: 5px 8px; color: var(--green-dark); background: #d8e9de; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tier-chip.high { color: #40291c; background: #efd5ab; }
.panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.empty-output { min-height: 260px; display: grid; place-items: center; color: var(--muted); background: var(--paper); font-size: 13px; }
.code-list { max-height: 300px; margin: 0; padding: 0; overflow: auto; list-style: none; border-top: 1px solid var(--line); }
.code-list li { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); font: 13px/1 var(--mono); }
.code-list button { padding: 0 8px; color: var(--green); background: transparent; border: 0; font: 12px/1 var(--font); }

.table-panel { margin-top: 24px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 10px; color: var(--muted); border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; }
td { padding: 16px 10px; border-bottom: 1px solid #dfddd4; }
td:first-child { font-family: var(--mono); font-weight: 700; }
.status { display: inline-block; padding: 5px 8px; color: var(--green-dark); background: #d8e9de; border-radius: 999px; font-size: 11px; }
.status.usage-unused { color: #535d56; background: #e7e7e1; }
.status.usage-acquiring, .status.activation-acquiring { color: #704513; background: #f4dfba; }
.status.usage-in_use, .status.activation-waiting { color: var(--green-dark); background: #d8e9de; }
.status.usage-used, .status.activation-success { color: var(--white); background: var(--green); }
.status.usage-disabled, .status.activation-cancelled,
.status.activation-expired, .status.activation-provider_error { color: #7b3024; background: #f4d9cf; }
.live-indicator { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.live-indicator span { width: 8px; height: 8px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 5px rgba(12,105,72,.1); }
.activation-table { min-width: 980px; }
.table-panel table:not(.activation-table) { min-width: 760px; }
.mono-value { font-family: var(--mono); white-space: nowrap; }
.sms-code-value { color: var(--green); font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.table-action { min-height: 36px; padding: 0 8px; color: var(--green); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.notice { position: fixed; right: 24px; bottom: 24px; max-width: 420px; padding: 14px 16px; color: var(--white); background: var(--signal); box-shadow: 0 14px 40px rgba(23,35,29,.2); font-size: 13px; }
.notice.success { background: var(--green); }

@media (max-width: 900px) {
  .cost-strip { grid-template-columns: repeat(2, 1fr); }
  .cost-strip button { margin: 14px 18px; }
  .admin-grid { grid-template-columns: 1fr; }
  .tier-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  main { width: min(100% - 28px, 1180px); margin: 32px auto; }
  .login-panel, .panel, .table-panel { padding: 24px 20px; }
  .login-panel { margin-top: 8vh; }
  .row { grid-template-columns: 1fr; }
  .cost-strip { grid-template-columns: 1fr 1fr; }
  .cost-strip > div { min-height: 90px; padding: 14px; }
  .cost-strip strong { font-size: 18px; }
  .cost-strip button { grid-column: 1 / -1; }
  .panel-note { display: none; }
  .live-indicator { font-size: 11px; }
}
