:root {
  --ink: #001f4f;
  --ink-dark: #00122d;
  --gold: #d99a16;
  --gold-dark: #b67908;
  --black: #000;
  --paper: #fff;
  --soft: #f3f4f6;
  --line: #c8d3df;
  --danger: #9d1f1f;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 5vw;
  color: var(--paper);
  background: var(--black);
  border-bottom: 4px solid var(--gold);
}

body:not(.admin-shell) .topbar {
  min-height: 49px;
  padding: 0 5vw;
  border-bottom: 0;
}

body:not(.admin-shell) .topbar h1 {
  color: var(--gold);
  font-family: "Times New Roman", Times, serif;
  font-size: 18pt;
  font-weight: 700;
  line-height: 49px;
}

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

.admin-shell .topbar {
  position: sticky;
  top: 0;
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 26px 22px;
  border-right: 4px solid var(--gold);
  border-bottom: 0;
}

.admin-shell nav {
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
}

.admin-shell nav a {
  justify-content: flex-start;
  width: 100%;
}

.admin-shell .admin-home,
.admin-shell .admin-page {
  min-width: 0;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  color: var(--gold);
  font-size: 20pt;
}

.eyebrow {
  color: #fff;
  font-size: 12pt;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

nav a,
button,
.summary-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

nav a[aria-current="page"],
button:hover,
.summary-card a:hover {
  background: var(--gold-dark);
}

.secondary {
  background: var(--black);
}

.danger {
  background: var(--black);
}

.member-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 85px);
}

.access-panel {
  padding: 10px 8px;
  background: #e5e5e5;
  border-right: 1px solid var(--line);
}

.panel-block,
.form-card,
.table-card,
.summary-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.panel-block {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 4px;
}

h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 12pt;
}

h3 {
  margin: 12px 0 8px;
  color: var(--ink);
  font-size: 12pt;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  font-weight: 700;
}

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

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.access-callout {
  margin-bottom: 12px;
  padding: 10px 11px;
  color: #fff;
  background: var(--ink);
  border-radius: 4px;
  font-weight: 700;
  line-height: 1.25;
}

.purchase-line {
  display: grid;
  grid-template-columns: 1fr 134px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12pt;
}

.products-zone,
.admin-page,
.admin-home {
  padding: 28px 5vw;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  color: #fff;
  background: var(--ink);
  border-left: 6px solid var(--gold);
}

.product-section {
  margin-bottom: 26px;
  background: #fff;
  border: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--black);
}

.section-title h2,
.section-title span {
  margin: 0;
  color: var(--gold);
}

.product-list {
  display: grid;
  gap: 1px;
  background: #ddd;
}

.product-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
}

.product-code {
  color: var(--gold-dark);
  font-weight: 700;
}

.price {
  text-align: right;
  font-weight: 700;
}

.summary-hero {
  margin-bottom: 22px;
  padding: 30px;
  color: #fff;
  background: var(--ink);
  border-bottom: 5px solid var(--gold);
}

.summary-hero h2,
.summary-hero p {
  margin: 0;
  color: #fff;
}

.summary-hero p {
  margin-top: 8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.summary-card {
  padding: 18px;
}

.summary-card span {
  color: var(--gold-dark);
  font-size: 24pt;
  font-weight: 700;
}

.summary-card h3 {
  margin: 8px 0;
  color: var(--ink);
}

.admin-page {
  display: grid;
  gap: 18px;
}

.form-card,
.table-card {
  padding: 18px;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.compact-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.product-form {
  grid-template-columns: 150px minmax(360px, 1fr) 150px;
  align-items: end;
  max-width: 780px;
}

.product-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  grid-column: 1 / -1;
}

.search-label {
  margin-bottom: 0;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.product-table th:nth-child(1),
.product-table td:nth-child(1) {
  width: 140px;
}

.product-table th:nth-child(2),
.product-table td:nth-child(2) {
  width: auto;
}

.product-table th:nth-child(3),
.product-table td:nth-child(3) {
  width: 130px;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4) {
  width: 160px;
}

th {
  padding: 11px 12px;
  color: var(--gold);
  background: var(--black);
  text-align: left;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #ddd;
  vertical-align: middle;
}

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

.row-actions button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 10pt;
}

.lookup-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 2px;
}

.lookup-panel h3 {
  margin-top: 0;
}

.lookup-list {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
  padding: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.lookup-item {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 120px 100px;
  justify-content: start;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--ink-dark);
  background: #fff;
  border: 1px solid var(--line);
  text-align: left;
  font-size: 10pt;
  font-weight: 400;
}

.lookup-item:hover {
  color: #fff;
  background: var(--ink);
}

.product-row {
  grid-template-columns: 90px minmax(180px, 1fr) 90px;
}

#clientRows tr {
  cursor: pointer;
}

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

@media (max-width: 900px) {
  .admin-shell {
    display: block;
  }

  .admin-shell .topbar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 4px solid var(--gold);
  }

  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  .member-layout {
    grid-template-columns: 1fr;
  }

  .access-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-grid,
  .admin-form,
  .compact-form,
  .product-item,
  .lookup-panel,
  .lookup-item,
  .product-row {
    grid-template-columns: 1fr;
  }

  .price {
    text-align: left;
  }
}
