:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #5b616e;
  --line: #d8dde8;
  --strong-line: #8e98aa;
  --brand: #f4a000;
  --brand-dark: #a46500;
  --surface: #ffffff;
  --danger: #b42318;
  --expired: #6f1010;
  --warning: #d97706;
  --success: #167044;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0, #edf1f7 100%);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  align-items: center;
  background: #161a22;
  color: #fff;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 22px clamp(16px, 4vw, 48px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-button,
.primary-button,
.secondary-button,
.text-button,
.icon-button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

.nav-button {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-button.active,
.primary-button {
  background: var(--brand);
  color: #111;
  font-weight: 700;
}

.secondary-button {
  background: #e7ebf1;
  color: var(--ink);
}

.text-button {
  background: transparent;
  color: var(--brand-dark);
  font-weight: 700;
  padding: 0;
}

.icon-button {
  background: #eef1f6;
  min-width: 40px;
  padding: 0;
}

main {
  padding: 28px clamp(14px, 4vw, 48px) 56px;
}

.expiry-alerts {
  display: grid;
  gap: 10px;
  max-width: min(440px, calc(100vw - 28px));
  position: fixed;
  right: 18px;
  top: 94px;
  width: 440px;
  z-index: 10;
}

.expiry-alert {
  align-items: center;
  background: #fff;
  border: 2px solid var(--warning);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.expiry-alert strong {
  display: block;
}

.expiry-alert p {
  color: var(--muted);
  margin-top: 3px;
}

.expiry-alert.red {
  border-color: var(--danger);
}

.expiry-alert.expired {
  border-color: var(--expired);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.section-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.tools-row {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.search-field,
.filter-field {
  display: grid;
  gap: 6px;
  max-width: 360px;
  min-width: min(100%, 240px);
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  min-height: 42px;
  padding: 0 11px;
  width: 100%;
}

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

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

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

th {
  background: var(--brand);
  color: #111;
  font-weight: 700;
}

tbody tr:hover {
  background: #fff8e8;
}

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

.small-button {
  align-items: center;
  background: #eef1f6;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #1c2430;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  text-decoration: none;
}

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

.status-pill {
  border-radius: 7px;
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 8px;
}

.status-empty {
  background: #eef1f6;
  color: var(--muted);
}

.expiry-badge {
  border-radius: 7px;
  display: inline-block;
  font-weight: 700;
  padding: 4px 8px;
}

.expiry-normal {
  background: #e8f6ef;
  color: var(--success);
}

.expiry-orange {
  background: #fff4df;
  color: var(--warning);
}

.expiry-red {
  background: #ffe8e3;
  color: var(--danger);
}

.expiry-expired {
  background: #6f1010;
  color: #fff;
}

tr.expiry-orange {
  background: #fff8e8;
}

tr.expiry-red {
  background: #fff0ed;
}

tr.expiry-expired {
  background: #ffe1e1;
}

.account-grid > div.expiry-orange {
  background: #fff4df;
}

.account-grid > div.account-unsubscribed {
  background: #fff4df;
  color: var(--warning);
  font-weight: 700;
}

.account-unsubscribed {
  background: #fff4df;
  color: var(--warning);
}

.account-grid > div.expiry-red {
  background: #ffe8e3;
}

.account-grid > div.expiry-expired {
  background: #6f1010;
  color: #fff;
}

.accounts-list {
  display: grid;
  gap: 22px;
}

.account-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.account-sheet-unsubscribed {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px #fff4df;
}

.account-grid {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr);
}

.account-grid > div {
  border-bottom: 1px dashed var(--strong-line);
  border-right: 1px dashed var(--strong-line);
  min-height: 34px;
  padding: 7px 10px;
}

.account-grid .label-cell,
.account-grid .heading {
  background: var(--brand);
  color: #111;
  font-weight: 700;
}

.account-grid .full-span {
  grid-column: span 3;
}

.account-grid .heading {
  text-align: center;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

.help-form {
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.5fr) auto;
  margin-bottom: 18px;
  padding: 16px;
}

.help-form label {
  display: grid;
  gap: 6px;
}

.help-list {
  display: grid;
  gap: 12px;
}

.help-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 14px;
}

.help-link-button {
  color: var(--brand-dark);
  font-weight: 700;
}

.profile-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  margin-top: 18px;
}

.profile-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.subscription-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.subscription-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.detail-list div {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 10px;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  text-align: right;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  max-width: 520px;
  width: min(calc(100vw - 28px), 520px);
}

dialog::backdrop {
  background: rgba(14, 18, 27, 0.58);
}

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

.modal-form label {
  display: grid;
  gap: 6px;
}

.modal-form .checkbox-field {
  align-items: center;
  display: flex;
  gap: 10px;
}

.modal-form .checkbox-field input {
  min-height: auto;
  width: auto;
}

.modal-heading,
.modal-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.modal-actions {
  justify-content: flex-end;
}

.form-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.form-warning {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 20px;
}

.empty-state {
  background: #fff;
  border: 1px dashed var(--strong-line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

@media (max-width: 760px) {
  .topbar,
  .section-heading,
  .profile-layout,
  .help-form {
    align-items: stretch;
    display: grid;
  }

  .help-form {
    grid-template-columns: 1fr;
  }

  .account-grid {
    grid-template-columns: 128px repeat(3, minmax(150px, 1fr));
    overflow-x: auto;
  }

  .expiry-alerts {
    left: 14px;
    right: 14px;
    top: 118px;
    width: auto;
  }
}
