:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e0e7;
  --paper: #ffffff;
  --soft: #f5f7fa;
  --brand: #126b63;
  --brand-dark: #0d4f49;
  --accent: #b9472d;
  --gold: #c48a25;
  font-family: "Times New Roman", Times, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
}

p,
td,
th,
label,
input,
select,
button,
a,
span,
small {
  font-family: "Times New Roman", Times, serif;
}

p {
  font-size: 12pt;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar,
.admin-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  padding: 16px clamp(18px, 4vw, 56px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: var(--brand);
  border-radius: 8px;
  color: white;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand-logo {
  display: block;
  max-height: 58px;
  max-width: 180px;
  object-fit: contain;
}

.brand small,
.muted,
.hint {
  color: var(--muted);
}

.brand span:last-child {
  display: grid;
  line-height: 1.2;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.button {
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  padding: 11px 16px;
}

.button.secondary {
  background: var(--accent);
}

.button.dark {
  background: #080808;
}

.button.light {
  background: #f1f1f1;
  color: #000000;
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--brand);
  color: var(--brand);
}

.button.small {
  min-height: 34px;
  padding: 8px 12px;
}

.hero {
  align-items: center;
  background: linear-gradient(135deg, #0d4f49, #183f5b 60%, #6c3b2f);
  color: white;
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  min-height: 76vh;
  padding: clamp(36px, 6vw, 82px) clamp(18px, 4vw, 56px);
}

.hero h1,
.product-hero h1 {
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.02;
  margin: 0;
  max-width: 850px;
}

.hero p,
.product-hero p {
  font-size: 18px;
  line-height: 1.7;
  max-width: 680px;
}

.eyebrow {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-panel {
  display: grid;
  gap: 14px;
}

.hero-panel div,
.metric,
.panel,
.product-card,
.report-card,
.login-box,
.access-results {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-panel div {
  color: var(--ink);
  padding: 22px;
}

.hero-panel strong,
.metric strong {
  display: block;
  font-size: 34px;
}

.hero-panel span,
.metric span,
.product-card span,
.report-card span {
  color: var(--muted);
}

.section,
.product-page {
  padding: clamp(28px, 5vw, 64px) clamp(18px, 4vw, 56px);
}

.section-heading {
  margin-bottom: 22px;
}

.section h2,
.panel h2,
.login-box h1 {
  margin: 0 0 12px;
}

.product-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.product-card,
.report-card {
  padding: 20px;
}

.product-card h3 {
  margin: 10px 0;
}

.product-card a {
  color: var(--brand);
  font-weight: 800;
}

.split {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 1.1fr);
}

.schema {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.schema span {
  background: white;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  font-weight: 800;
  padding: 18px;
}

.footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 56px);
}

.login-shell {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  padding: clamp(28px, 5vw, 64px) clamp(18px, 4vw, 56px);
}

.login-box,
.access-results,
.panel {
  padding: 22px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin: 16px 0;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 800;
  gap: 8px;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

.notice {
  border-radius: 8px;
  font-weight: 800;
  padding: 14px;
}

.notice.danger {
  background: #ffe8e4;
  color: #912b1d;
}

.notice.success {
  background: #dff6ea;
  color: #146c43;
}

.main-index-screen {
  background: #eef3f7;
  display: grid;
  grid-template-columns: 324px minmax(0, 1fr);
  min-height: calc(100vh - 74px);
}

.client-master-panel {
  background: #fff7f7;
  border-right: 1px solid #d3dce5;
  padding: 24px;
}

.company-logo {
  align-items: center;
  display: flex;
  gap: 12px;
}

.company-logo div {
  display: grid;
}

.company-logo small {
  color: var(--muted);
}

.panel-rule {
  background: #111111;
  height: 2px;
  margin: 18px 0;
}

.client-master-panel h2 {
  color: #850000;
  font-size: 18px;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.client-master-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.left-links {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
}

.left-links a {
  color: #850000;
  font-weight: 800;
}

.module-panel {
  padding: 18px;
}

.module-banner {
  background: linear-gradient(135deg, #8b0000, #ffffff 55%, #efe2d2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #311111;
  margin-bottom: 16px;
  min-height: 210px;
  padding: clamp(24px, 5vw, 56px);
}

.module-banner h1 {
  color: #7b0000;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
  margin: 0;
  text-transform: uppercase;
}

.module-banner p {
  font-size: 18px;
  max-width: 720px;
}

.module-list {
  display: grid;
  gap: 14px;
}

.module-card {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  padding: 18px;
}

.module-card h3,
.module-card p {
  margin: 4px 0;
}

.module-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.module-icon {
  align-items: center;
  background: #850000;
  border-radius: 8px;
  color: white;
  display: flex;
  font-size: 24px;
  font-weight: 900;
  height: 58px;
  justify-content: center;
  width: 58px;
}

.access-card,
.list-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  padding: 14px 0;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  padding: 5px 9px;
}

.status.active,
.status.paid {
  background: #dff6ea;
  color: #146c43;
}

.status.pending,
.status.due {
  background: #fff1d6;
  color: #8a5a00;
}

.status.expired,
.status.blocked,
.status.refunded {
  background: #ffe8e4;
  color: #912b1d;
}

.admin-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  min-height: 100vh;
  padding: 20px;
  position: sticky;
  top: 0;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.side-nav button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 42px;
  padding: 10px 12px;
  text-align: left;
}

.side-nav button.active,
.side-nav button:hover {
  background: #e8f4f2;
  color: var(--brand-dark);
}

.admin-main {
  padding: 28px;
}

.admin-header {
  margin-bottom: 24px;
}

.admin-header h1 {
  margin: 0;
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: block;
}

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 18px;
}

.metric {
  padding: 18px;
}

.two-column {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.panel-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.hidden {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.report-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.product-hero {
  background: linear-gradient(135deg, #0d4f49, #27384f);
  color: white;
  margin: calc(clamp(28px, 5vw, 64px) * -1) calc(clamp(18px, 4vw, 56px) * -1) 32px;
  padding: clamp(38px, 7vw, 86px) clamp(18px, 4vw, 56px);
}

.client-subscription-panel {
  background: white;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  margin: 0 auto;
  max-width: 1150px;
  padding: 18px;
}

.client-subscription-panel h1 {
  color: #850000;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  margin: 0 0 14px;
}

.subscription-entry-form {
  display: grid;
  gap: 12px 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subscription-entry-form label,
.saved-client-search label {
  color: #111111;
  font-size: 13px;
  font-weight: 700;
}

.subscription-entry-form input,
.subscription-entry-form select,
.saved-client-search input {
  border: 1px solid #c9d5e1;
  border-radius: 4px;
  font-weight: 700;
}

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

.admin-form-actions {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  margin-top: 2px;
}

.saved-client-search {
  margin: 18px 0 8px;
}

.client-subscription-panel table {
  min-width: 980px;
}

.client-subscription-panel th {
  background: #f1f4f7;
  color: #111111;
  font-size: 14px;
  text-transform: none;
}

.client-subscription-panel td {
  color: #111111;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

#clientsTable {
  min-width: 100%;
  table-layout: fixed;
}

#clientsTable th,
#clientsTable td {
  white-space: nowrap;
}

#clientsTable .button.small {
  min-height: 28px;
  padding: 4px 8px;
}

#clientsTable td:last-child {
  display: flex;
  gap: 5px;
}

#clientsTable th:nth-child(1),
#clientsTable td:nth-child(1) {
  width: 20%;
}

#clientsTable th:nth-child(2),
#clientsTable td:nth-child(2),
#clientsTable th:nth-child(3),
#clientsTable td:nth-child(3),
#clientsTable th:nth-child(5),
#clientsTable td:nth-child(5) {
  width: 13%;
}

#clientsTable th:nth-child(4),
#clientsTable td:nth-child(4) {
  width: 24%;
}

#clientsTable th:nth-child(6),
#clientsTable td:nth-child(6) {
  width: 16%;
}

#productForm {
  grid-template-columns: 1fr 5fr 1fr 1.25fr;
}

#productForm input[name="id"] {
  display: none;
}

#productsTable {
  table-layout: fixed;
}

#productsTable th:nth-child(1),
#productsTable td:nth-child(1),
#productsTable th:nth-child(3),
#productsTable td:nth-child(3) {
  width: 14%;
}

#productsTable th:nth-child(2),
#productsTable td:nth-child(2) {
  width: 70%;
}

#productsTable th:nth-child(4),
#productsTable td:nth-child(4) {
  width: 16%;
}

.client-pick-panel {
  border-top: 1px solid var(--line);
  margin: 14px 0;
  padding-top: 14px;
}

.client-pick-panel h3 {
  margin: 0 0 8px;
}

.client-pick-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 10px;
}

.client-pick-list button {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 8px 10px;
  text-align: left;
}

.client-pick-list button:hover {
  border-color: var(--brand);
}

.client-pick-list span {
  color: var(--muted);
  font-size: 11pt;
}

.field-label {
  align-self: center;
  color: var(--muted);
  font-weight: 800;
}

.admin-main {
  padding: 22px 20px;
}

.admin-main .panel {
  padding: 18px;
}

.admin-main table {
  min-width: 100%;
  table-layout: fixed;
}

.admin-main th,
.admin-main td {
  font-size: 11pt;
  padding: 7px 6px;
  white-space: nowrap;
}

.admin-main .button.small {
  font-size: 10pt;
  min-height: 24px;
  padding: 3px 6px;
}

#clientsTable th:nth-child(1),
#clientsTable td:nth-child(1) {
  width: 18%;
}

#clientsTable th:nth-child(2),
#clientsTable td:nth-child(2),
#clientsTable th:nth-child(3),
#clientsTable td:nth-child(3),
#clientsTable th:nth-child(5),
#clientsTable td:nth-child(5) {
  width: 12%;
}

#clientsTable th:nth-child(4),
#clientsTable td:nth-child(4) {
  width: 25%;
}

#clientsTable th:nth-child(6),
#clientsTable td:nth-child(6) {
  width: 21%;
}

#clientsTable td:last-child,
#productsTable td:last-child,
#subscriptionsTable td:last-child {
  display: flex;
  gap: 4px;
  justify-content: flex-start;
}

#clientsTable tbody tr,
#productsTable tbody tr,
#subscriptionsTable tbody tr {
  cursor: pointer;
}

#clientsTable tbody tr *,
#productsTable tbody tr *,
#subscriptionsTable tbody tr * {
  cursor: pointer;
}

#clientsTable button,
#productsTable button,
#productsTable a,
#subscriptionsTable button,
#subscriptionsTable a {
  cursor: pointer;
}

#productsTable td:last-child {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 4px;
  white-space: nowrap;
}

#productsTable th:last-child,
#productsTable td:last-child {
  width: 20%;
}

#productsTable th:first-child,
#productsTable td:first-child {
  width: 6%;
  text-align: center;
}

#productsTable input[type="checkbox"] {
  accent-color: var(--brand);
  min-height: auto;
  width: auto;
}

#productsTable {
  table-layout: fixed;
  width: 100%;
}

#productsTable th,
#productsTable td {
  vertical-align: top;
}

#productsTable th:nth-child(1),
#productsTable td:nth-child(1) {
  text-align: center;
  width: 6% !important;
}

#productsTable th:nth-child(2),
#productsTable td:nth-child(2) {
  width: 12% !important;
}

#productsTable th:nth-child(3),
#productsTable td:nth-child(3) {
  line-height: 1.15;
  overflow-wrap: anywhere;
  white-space: normal !important;
  width: 56% !important;
}

#productsTable th:nth-child(4),
#productsTable td:nth-child(4) {
  text-align: right;
  width: 12% !important;
}

#productsTable th:nth-child(5),
#productsTable td:nth-child(5) {
  width: 14% !important;
}

#productsTable td:nth-child(5) {
  align-items: flex-start;
  display: flex;
  gap: 4px;
  justify-content: flex-start;
}

#productsTable .button.small {
  font-size: 9.5pt;
  min-height: 22px;
  padding: 2px 7px;
}

#subscriptionsTable {
  table-layout: fixed;
}

#subscriptionsTable th,
#subscriptionsTable td {
  font-size: 11pt;
  vertical-align: top;
  white-space: nowrap;
}

#subscriptionsTable td {
  padding-top: 7px;
}

#subscriptionsTable td:last-child {
  align-items: flex-start;
}

#subscriptionsTable .status {
  align-items: flex-start;
  margin-top: 0;
}

#recentSubscriptions .list-row {
  align-items: flex-start;
}

#recentSubscriptions .status {
  margin-top: 0;
}

#subscriptionsTable th:nth-child(1),
#subscriptionsTable td:nth-child(1) {
  width: 13%;
}

#subscriptionsTable th:nth-child(2),
#subscriptionsTable td:nth-child(2) {
  line-height: 1.15;
  overflow-wrap: anywhere;
  white-space: normal;
  width: 29%;
}

#subscriptionsTable th:nth-child(3),
#subscriptionsTable td:nth-child(3) {
  width: 13%;
}

#subscriptionsTable th:nth-child(4),
#subscriptionsTable td:nth-child(4),
#subscriptionsTable th:nth-child(5),
#subscriptionsTable td:nth-child(5),
#subscriptionsTable th:nth-child(6),
#subscriptionsTable td:nth-child(6),
#subscriptionsTable th:nth-child(7),
#subscriptionsTable td:nth-child(7) {
  width: 10%;
}

#subscriptionsTable th:nth-child(8),
#subscriptionsTable td:nth-child(8) {
  width: 8%;
}

.product-module-panel {
  background: white;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  margin: 18px auto 0;
  max-width: 1288px;
  padding: 18px;
}

.product-module-panel h1 {
  color: #111111;
  font-family: "Times New Roman", Times, serif;
  font-size: 18pt;
  margin: 0 0 14px;
}

.product-module-panel p {
  margin: 0 0 4px;
}

.product-module-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-module-form label {
  color: #333333;
  font-size: 12pt;
  font-weight: 700;
}

.product-module-form input {
  border: 1px solid #c9d5e1;
  border-radius: 4px;
  color: #333333;
  min-height: 36px;
}

.module-save {
  background: #086b65;
}

.product-module-table {
  margin-top: 14px;
  min-width: 1080px;
}

.product-module-table th {
  background: #f2f5f6;
  color: #333333;
  font-size: 12pt;
  text-transform: none;
}

.product-module-table td {
  color: #000000;
  font-size: 12pt;
}

.product-module-table input[type="checkbox"] {
  accent-color: #7a158b;
  min-height: auto;
  width: auto;
}

.sidebar .brand {
  align-items: flex-start;
  display: grid;
  gap: 8px;
}

.sidebar .brand span:last-child {
  display: grid;
  line-height: 1.15;
}

.brand-logo {
  display: block;
  max-height: 76px;
  max-width: 190px;
  object-fit: contain;
}

@media (max-width: 860px) {
  .hero,
  .split,
  .login-shell,
  .admin-body,
  .main-index-screen {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  .side-nav {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .access-card,
  .list-row,
  .module-card,
  .subscription-entry-form,
  .product-module-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar,
  .admin-header,
  .footer,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
  }
}
