:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f2f7fb;
  --line: #dbe4ec;
  --line-strong: #c9d6e2;
  --text: #20323c;
  --muted: #637381;
  --accent: #0a6e9d;
  --accent-dark: #075276;
  --teal: #00a0b0;
  --gold: #edbf85;
  --danger: #b42318;
  --warning: #b7791f;
  --success-bg: #e8f5ee;
  --success-text: #175c36;
  --control-height: 44px;
  --control-radius: 8px;
  --focus-ring: 0 0 0 3px rgba(10, 110, 157, 0.16);
  --shadow: 0 18px 45px rgba(15, 43, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  min-height: 56px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  gap: 10px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  border-radius: 8px;
  height: 32px;
  width: 32px;
}

.brand span {
  display: grid;
  line-height: 1.05;
}

.brand strong {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.topbar nav {
  align-items: center;
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.topbar nav a {
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.topbar form {
  margin: 0;
}

.page {
  margin: 0 auto;
  max-width: 1320px;
  padding: 30px 24px 52px;
}

.page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  color: #102a3a;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.button,
button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 600;
  min-height: 36px;
  padding: 7px 12px;
  align-items: center;
  justify-content: center;
}

.button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

button:hover {
  background: var(--accent-dark);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button-secondary {
  background: #ffffff;
  border-color: var(--line-strong);
  color: #244253;
}

.button-secondary:hover {
  background: #f4f8fb;
  color: #102a3a;
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  min-height: auto;
  padding: 0;
  font-size: 13px;
}

.link-button:hover {
  background: transparent;
  text-decoration: underline;
}

.dashboard-hero {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  min-height: 132px;
  overflow: hidden;
  padding: 24px;
  position: relative;
}

.dashboard-hero::before {
  background: var(--gold);
  content: "";
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 5px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  margin: 0 0 7px;
  text-transform: uppercase;
}

.hero-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin: 8px 0 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.customer-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.customer-license-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: block;
  min-height: 108px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.metric-card:hover,
.metric-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(15, 43, 61, 0.08);
  text-decoration: none;
  transform: translateY(-1px);
}

.metric-selected {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(10, 110, 157, 0.12);
}

.metric-card::before {
  background: var(--line-strong);
  content: "";
  height: 3px;
  left: 16px;
  position: absolute;
  right: 16px;
  top: 0;
}

.metric-card span {
  color: var(--text);
  display: block;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 12px;
}

.metric-card .metric-value-small {
  font-size: 18px;
  line-height: 1.2;
}

.metric-card strong {
  color: var(--muted);
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-strip {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin: -16px -16px 14px;
  padding: 12px 16px;
}

.filter-strip span {
  color: var(--muted);
}

.search-bar {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  margin-bottom: 14px;
}

.metric-primary::before {
  background: var(--accent);
}

.metric-success::before {
  background: #25a56a;
}

.metric-warning::before {
  background: var(--warning);
}

.metric-danger::before {
  background: var(--danger);
}

.metric-teal::before {
  background: var(--teal);
}

.split {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.dashboard-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
}

.dashboard-side {
  display: grid;
  gap: 18px;
}

.dashboard-main {
  display: grid;
  gap: 18px;
}

.attention-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.summary-panel,
.activity-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(15, 43, 61, 0.05);
  padding: 16px;
}

.activity-panel {
  min-width: 0;
}

.selected-customer-panel {
  margin-bottom: 18px;
}

.selected-customer-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.selected-customer-grid div {
  border-top: 1px solid var(--line);
  min-width: 0;
  padding: 10px 0 0;
}

.selected-customer-grid strong {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.selected-customer-grid span {
  overflow-wrap: anywhere;
}

.attention-list {
  display: grid;
  gap: 8px;
}

.attention-item {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid #e3edf4;
  border-radius: 8px;
  color: var(--text);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 12px;
}

.attention-item:hover,
.attention-item:focus-visible {
  border-color: var(--accent);
  text-decoration: none;
}

.attention-warning {
  background: #fffaf0;
  border-color: #f4d7a1;
}

.attention-critical {
  background: #fff4f2;
  border-color: #f2b8b5;
}

.attention-item span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attention-item strong {
  color: #102a3a;
  font-size: 13px;
}

.attention-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.empty-state {
  color: var(--muted);
  margin: 0;
  min-height: 48px;
  padding: 12px 0;
}

.activity-primary {
  grid-column: 2;
  grid-row: span 2;
}

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

.panel-heading h2 {
  margin: 0;
}

.panel-heading a {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.state-list {
  display: grid;
  gap: 8px;
}

.state-list div {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid #e3edf4;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr auto;
  min-height: 42px;
  padding: 9px 10px;
}

.state-list strong {
  color: #2c4351;
  font-size: 13px;
}

.state-list em {
  color: #102a3a;
  font-style: normal;
  font-weight: 800;
}

.timeline-list {
  display: grid;
  gap: 8px;
}

.timeline-item {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid #e3edf4;
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 54px;
  padding: 10px 12px;
}

.timeline-item:hover,
.timeline-item:focus-visible {
  border-color: var(--accent);
  text-decoration: none;
}

.timeline-item span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.timeline-item span:last-child {
  text-align: right;
}

.timeline-item strong {
  color: #102a3a;
}

.timeline-item em,
.timeline-item time {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.state-dot {
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.state-active {
  background: #25a56a;
}

.state-expired {
  background: var(--warning);
}

.state-suspended {
  background: #7c8a99;
}

.state-revoked {
  background: var(--danger);
}

.quick-actions {
  display: grid;
  gap: 8px;
}

.quick-actions a {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #244253;
  display: flex;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 12px;
}

.quick-actions a:hover {
  background: var(--surface-soft);
  color: var(--accent);
  text-decoration: none;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f6fa;
  color: #344054;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.table-title {
  display: block;
  font-weight: 800;
}

.table-muted {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  white-space: nowrap;
}

code {
  background: #eef5f8;
  border-radius: 4px;
  padding: 2px 5px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

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

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
}

.panel,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.panel {
  max-width: 820px;
  width: 100%;
}

label {
  color: #344054;
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  box-shadow: inset 0 1px 0 rgba(15, 43, 61, 0.03);
  color: var(--text);
  font: inherit;
  outline: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  width: 100%;
}

input:not([type="checkbox"]):not([type="file"]),
select {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 14px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23637381' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
  padding-right: 44px;
}

input[type="file"] {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 5px;
}

input[type="file"]::file-selector-button {
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: #244253;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  height: 32px;
  margin-right: 12px;
  padding: 0 12px;
}

input[type="file"]::file-selector-button:hover {
  background: #e8f1f7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring), inset 0 1px 0 rgba(15, 43, 61, 0.03);
}

textarea {
  height: auto;
  min-height: 104px;
  padding: 12px 14px;
  resize: vertical;
}

textarea[readonly] {
  background: #f8fbfd;
  color: #244253;
}

.form-hint {
  color: var(--muted);
  font-size: 12px;
  margin: -6px 0 0;
}

.login-page {
  align-items: center;
  background:
    radial-gradient(circle at top, #ffffff 0%, #f7f9fc 44%, #eef5fb 100%);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  box-shadow: var(--shadow);
  width: min(420px, calc(100vw - 32px));
}

.login-brand {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand img {
  border-radius: 12px;
  height: 48px;
  width: 48px;
}

.login-brand .eyebrow {
  margin-bottom: 3px;
}

.login-brand h1 {
  font-size: 24px;
}

.alert {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  border-radius: 6px;
  color: var(--danger);
  padding: 10px 12px;
}

.success {
  background: var(--success-bg);
  border: 1px solid #b7dfc6;
  border-radius: 8px;
  color: var(--success-text);
  margin-bottom: 18px;
  padding: 12px 14px;
}

.created-key-card {
  display: grid;
  gap: 8px;
}

.created-key-card strong {
  color: #0f5130;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.created-key-row {
  align-items: center;
  background: #d9efdf;
  border: 1px solid #9ccdad;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(23, 92, 54, 0.08);
  display: inline-flex;
  max-width: 100%;
  padding: 5px;
  width: fit-content;
}

.created-key {
  align-items: center;
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #102a3a;
  display: inline-flex;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  min-height: 34px;
  overflow-wrap: anywhere;
  padding: 5px 10px;
}

.copy-button {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  justify-content: center;
  margin-left: 4px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.copy-button[data-copy-state="copied"] {
  background: #175c36;
  border-color: #175c36;
  color: #ffffff;
}

.copy-icon {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 17px;
}

.copy-button[data-copy-state="copied"] .copy-icon {
  display: none;
}

.copy-button[data-copy-state="copied"]::before {
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  content: "";
  height: 12px;
  margin-top: -2px;
  transform: rotate(45deg);
  width: 6px;
}

.notice-text {
  display: block;
}

.license-instructions {
  margin-bottom: 18px;
}

.license-instructions textarea {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  min-height: 190px;
  resize: vertical;
}

.copy-text-button {
  min-height: 32px;
  padding: 5px 10px;
}

.detail-grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(15, 43, 61, 0.05);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 18px;
}

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

.detail-grid strong {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

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

.actions-panel {
  margin-bottom: 28px;
}

.form-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 880px;
  padding: 20px;
}

.customer-edit-shell {
  margin-bottom: 18px;
}

.panel-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
}

.status-active {
  background: #e8f5ee;
  color: #175c36;
}

.status-valid {
  background: #e8f5ee;
  color: #175c36;
}

.status-invalid {
  background: #fff1f0;
  color: var(--danger);
}

.status-suspended {
  background: #fff7e6;
  color: #8a4b00;
}

.status-revoked,
.status-expired {
  background: #fff1f0;
  color: var(--danger);
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
  }

  .topbar nav,
  .page-header,
  .split,
  .dashboard-hero,
  .timeline-item {
    align-items: flex-start;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .timeline-item span:last-child {
    text-align: left;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .metrics,
  .customer-metrics,
  .customer-license-metrics,
  .dashboard-grid,
  .attention-grid,
  .selected-customer-grid,
  .form-grid,
  .search-bar {
    grid-template-columns: 1fr;
  }

  .activity-primary {
    grid-column: auto;
    grid-row: auto;
  }

  .topbar nav {
    flex-wrap: wrap;
    margin-left: 0;
  }

  .page {
    padding: 20px 16px 36px;
  }
}
