:root {
  --ink: #0d2438;
  --muted: #5b6c7d;
  --line: #dce7ef;
  --soft: #f4f8fb;
  --blue: #0d69a8;
  --navy: #14365c;
  --green: #138b63;
  --amber: #b77514;
  --red: #b14848;
  --paper: #ffffff;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background: #f7fafc;
}

button,
input,
select {
  font: inherit;
}

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

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: white;
}

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

.admin-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.admin-brand strong,
.admin-brand span {
  display: block;
}

.admin-brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.admin-sidebar nav {
  display: grid;
  gap: 6px;
}

.admin-sidebar a {
  padding: 11px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.admin-sidebar a:hover {
  color: var(--blue);
  background: var(--soft);
}

.quiet-button {
  margin-top: auto;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.admin-main {
  padding: 28px;
}

.admin-header,
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

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

.admin-status {
  min-height: 20px;
  margin: -12px 0 18px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
}

.admin-header h1,
.panel h2 {
  margin: 0 0 6px;
}

.admin-header p,
.panel p {
  margin: 0;
  color: var(--muted);
}

.primary-button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.login-gate {
  display: grid;
  min-height: calc(100vh - 110px);
  place-items: center;
}

.login-box {
  display: grid;
  gap: 16px;
  width: min(360px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.login-box img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.login-box h2 {
  margin: 0;
}

.login-box label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 800;
}

.login-box input,
.panel select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}

.login-box p {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.dashboard-content {
  display: grid;
  gap: 20px;
}

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

.kpi {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.kpi span,
.stack-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

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

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

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

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

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

.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status.pending {
  color: var(--amber);
  background: #fff6e8;
}

.status.paid,
.status.shipped {
  color: var(--green);
  background: #eaf8f2;
}

.status.none {
  color: var(--muted);
  background: var(--soft);
}

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

.row-actions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.row-actions .danger-button {
  min-width: 32px;
  color: var(--red);
  border-color: #efcaca;
  background: #fff7f7;
  font-size: 13px;
  line-height: 1;
}

.order-row {
  cursor: pointer;
}

.order-row:hover td {
  background: #f7fbff;
}

.order-detail-row td {
  padding: 0 10px 16px;
  background: #fbfdff;
}

.order-detail-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.order-detail-card h3 {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  text-transform: uppercase;
}

.order-detail-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.order-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.order-detail-item {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.order-detail-item:last-child {
  border-bottom: 0;
}

.order-detail-item strong {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.order-detail-item small {
  color: var(--muted);
  line-height: 1.45;
}

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

.stack-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.stack-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.stack-row:last-child {
  border-bottom: 0;
}

.stack-row strong {
  display: block;
  margin-bottom: 4px;
}

.prices-editor {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.price-edit-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(110px, 150px));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
}

.price-edit-row strong,
.price-edit-row small {
  display: block;
}

.price-edit-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.price-edit-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.price-edit-row input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.visits-chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 180px;
  margin-top: 18px;
}

.visit-bar {
  display: grid;
  align-content: end;
  gap: 8px;
  height: 180px;
}

.visit-bar span {
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #65b6e5, var(--blue));
  min-height: 4px;
}

.visit-bar small {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: sticky;
    z-index: 5;
    height: auto;
    max-height: 55vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-sidebar nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .quiet-button {
    margin-top: 0;
  }

  .kpi-grid,
  .split-grid,
  .order-detail-grid {
    grid-template-columns: 1fr;
  }

  .price-edit-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-main {
    padding: 18px;
  }

  .admin-header,
  .panel-head,
  .stack-row {
    flex-direction: column;
  }

  .admin-sidebar nav {
    grid-template-columns: 1fr 1fr;
  }
}
