:root {
  color: #171a1f;
  background: #f3f0e8;
  font-family:
    Inter, "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
    sans-serif;
  font-synthesis: none;
  --paper: #f3f0e8;
  --surface: #faf8f2;
  --ink: #171a1f;
  --muted: #75766f;
  --line: #d8d3c7;
  --teal: #176b68;
  --teal-soft: #e1ece8;
  --coral: #d45845;
  --coral-soft: #f7e4de;
  --shadow: 0 12px 32px rgba(23, 26, 31, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  min-height: 100vh;
  background: var(--paper);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.eyebrow,
.section-index {
  margin: 0;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 520px;
  min-height: 100vh;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 72px;
  color: var(--surface);
  background: var(--ink);
}

.login-brand h1 {
  margin: 10px 0 8px;
  font-size: clamp(64px, 7vw, 110px);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.login-brand > p:last-child {
  margin: 14px 0 0;
  color: #c9c7c0;
  font-size: 18px;
}

.login-panel {
  align-self: center;
  width: 380px;
  margin: auto;
  padding: 38px;
  border: 1px solid var(--line);
  background: rgba(250, 248, 242, 0.94);
  box-shadow: var(--shadow);
}

.login-panel header {
  margin-bottom: 30px;
}

.login-panel h2,
.panel h2,
.modal h2 {
  margin: 6px 0 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.login-panel header p,
.panel-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 8px;
}

label > span,
fieldset legend {
  color: #555850;
  font-size: 12px;
  font-weight: 700;
}

.login-panel label + label {
  margin-top: 18px;
}

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid #c9c4b8;
  border-radius: 3px;
  outline: none;
  color: var(--ink);
  background: #fffefa;
}

input,
textarea {
  padding: 10px 12px;
}

select {
  padding: 0 34px 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 107, 104, 0.12);
}

.form-error {
  min-height: 20px;
  margin: 10px 0;
  color: var(--coral);
  font-size: 12px;
}

.button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-weight: 750;
  transition:
    transform 120ms ease,
    background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.button.primary {
  color: #fff;
  background: var(--teal);
}

.button.primary:hover {
  background: #0f5b58;
}

.button.secondary {
  border-color: #bdb8ad;
  color: var(--ink);
  background: transparent;
}

.button.danger {
  color: #fff;
  background: var(--coral);
}

.button.full {
  width: 100%;
}

.button.small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 12px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: #f7f4ec;
  background: var(--ink);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 94px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.wordmark img {
  width: 38px;
  height: 38px;
  object-fit: cover;
}

.wordmark div {
  display: grid;
  gap: 3px;
}

.wordmark span {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.wordmark small {
  color: #8f948d;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.sidebar nav {
  display: grid;
  gap: 5px;
  padding: 20px 12px;
}

.nav-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 2px;
  text-align: left;
  color: #b9bbb7;
  background: transparent;
}

.nav-item span {
  color: #6f746e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  border-left-color: #55a29d;
  color: #fff;
  background: rgba(23, 107, 104, 0.38);
}

.nav-item.active span {
  color: #83beb9;
}

.sidebar-footer {
  display: grid;
  gap: 14px;
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
}

.sidebar-footer div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c4c7c1;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #69a69e;
  box-shadow: 0 0 0 3px rgba(105, 166, 158, 0.12);
}

.sidebar-footer button {
  padding: 0;
  border: 0;
  text-align: left;
  color: #8e918c;
  background: transparent;
}

.main {
  min-width: 0;
  padding: 0 32px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 94px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 27px;
  letter-spacing: -0.045em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #6f716c;
  font-size: 12px;
}

.divider {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.view {
  display: none;
  padding-top: 26px;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  background: rgba(250, 248, 242, 0.76);
}

.metric {
  position: relative;
  display: grid;
  min-height: 132px;
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  color: #656861;
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  align-self: end;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  font-weight: 500;
  line-height: 1;
}

.metric small {
  margin-top: 6px;
  color: #92928d;
  font-size: 10px;
}

.metric.alert::after {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  content: "";
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.78fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(250, 248, 242, 0.9);
  box-shadow: 0 7px 20px rgba(23, 26, 31, 0.035);
}

.generator-panel,
.inventory-panel {
  min-height: 304px;
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.secure-label {
  padding: 6px 9px;
  color: var(--teal);
  border: 1px solid #a8c9c5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

fieldset {
  margin: 24px 0 18px;
  padding: 0;
  border: 0;
}

fieldset legend {
  margin-bottom: 8px;
}

.plan-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid #c9c4b8;
  background: #f4f0e7;
}

.plan-switch label {
  display: block;
}

.plan-switch label + label {
  border-left: 1px solid #c9c4b8;
}

.plan-switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.plan-switch span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 15px;
  color: #50534c;
  font-size: 13px;
}

.plan-switch small {
  color: #99998f;
  font-size: 10px;
}

.plan-switch input:checked + span {
  color: #fff;
  background: var(--teal);
}

.plan-switch input:checked + span small {
  color: #c9e0dc;
}

.form-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
}

.generator-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
}

.generator-footer p {
  max-width: 430px;
  margin: 0;
  color: #7e7f79;
  font-size: 11px;
  line-height: 1.6;
}

.inventory-list {
  display: grid;
  margin-top: 25px;
  border-top: 1px solid var(--line);
}

.inventory-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.inventory-list span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5d605a;
  font-size: 12px;
}

.inventory-list strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 500;
}

.plan-mark {
  width: 3px;
  height: 18px;
}

.plan-mark.teal {
  background: var(--teal);
}

.plan-mark.black {
  background: var(--ink);
}

.plan-mark.coral {
  background: var(--coral);
}

.inventory-note {
  margin: 16px 0 0;
  color: #8a8a84;
  font-size: 10px;
  line-height: 1.55;
}

.table-panel {
  margin-top: 18px;
}

.full-panel {
  min-height: calc(100vh - 160px);
  margin-top: 0;
}

.table-panel > .panel-heading {
  min-height: 76px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.text-button {
  align-self: center;
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid var(--teal);
  color: var(--teal);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: #777871;
  background: rgba(240, 236, 226, 0.64);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

td {
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid #e4e0d6;
  color: #454842;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.56);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  height: 120px;
  text-align: center;
  color: #989891;
}

.mono {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  letter-spacing: -0.02em;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 750;
}

.status.unused {
  border-color: #b8b4aa;
  color: #656861;
}

.status.active {
  border-color: #9ac1bc;
  color: var(--teal);
  background: var(--teal-soft);
}

.status.redeemed,
.status.expired {
  border-color: #ccbfa7;
  color: #89714a;
  background: #f2eadb;
}

.status.revoked {
  border-color: #dda99d;
  color: var(--coral);
  background: var(--coral-soft);
}

.row-actions {
  display: flex;
  gap: 10px;
}

.row-action {
  padding: 0;
  border: 0;
  border-bottom: 1px solid #9fa099;
  color: #5f625c;
  background: transparent;
  font-size: 11px;
}

.row-action.danger {
  border-color: #d9a197;
  color: var(--coral);
}

.filter-heading {
  align-items: center;
}

.filters {
  display: flex;
  gap: 8px;
}

.filters input {
  width: 210px;
}

.filters input,
.filters select {
  min-height: 36px;
  font-size: 11px;
}

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

.system-card {
  min-height: 200px;
  padding: 24px;
}

.system-card h2 {
  margin-top: 12px;
}

.system-card strong {
  display: block;
  margin-top: 36px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 500;
}

.system-card p {
  overflow-wrap: anywhere;
  margin: 10px 0 0;
  color: #81827c;
  font-size: 11px;
  line-height: 1.5;
}

.state-ok {
  color: var(--teal);
}

.system-detail {
  display: grid;
  grid-template-columns: 0.45fr 1fr;
  gap: 50px;
  margin-top: 18px;
  padding: 26px;
}

.system-detail ul {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #656760;
  font-size: 12px;
}

.system-detail li {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.modal {
  width: min(760px, calc(100vw - 48px));
  padding: 0;
  border: 1px solid #aaa69d;
  border-radius: 3px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(23, 26, 31, 0.25);
}

.modal::backdrop {
  background: rgba(18, 21, 25, 0.64);
}

.modal-inner {
  padding: 26px;
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.close-button {
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid #a7a49c;
  color: #73746e;
  background: transparent;
  font-size: 11px;
}

.warning-box {
  margin: 22px 0 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--coral);
  color: #814d43;
  background: var(--coral-soft);
  font-size: 12px;
}

.generated-summary {
  margin: 14px 0 8px;
  color: #666862;
  font-size: 11px;
}

#generated-cards {
  width: 100%;
  height: 310px;
  resize: none;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.action-modal {
  width: 500px;
}

.action-modal p {
  margin: 22px 0;
  color: #666862;
  font-size: 13px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: 360px;
  padding: 13px 16px;
  border-left: 3px solid var(--teal);
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-left-color: var(--coral);
}

@media (max-width: 1260px) {
  .main {
    padding-right: 22px;
    padding-left: 22px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(250px, 0.7fr);
  }

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