:root {
  --bg: #f3f3f3;
  --paper: #ffffff;
  --paper-soft: #fcfaf6;
  --ink: #212121;
  --ink-soft: #6e737c;
  --line: #ded7cc;
  --line-strong: #343434;
  --accent: #177a63;
  --accent-soft: #d8ede7;
  --danger: #b63b2c;
  --shadow: 0 16px 34px rgba(28, 31, 35, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
}

.auth-brand {
  padding: 48px;
  border-radius: 32px;
  background: linear-gradient(145deg, #153634 0%, #0f4e49 54%, #b9761d 100%);
  color: #fff7eb;
  box-shadow: var(--shadow);
}

.auth-brand h1,
.page-header h1,
.brand-name,
.hero-card h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  letter-spacing: -0.03em;
}

.auth-brand h1 {
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: 0.95;
  margin-top: 14px;
  max-width: 8ch;
}

.auth-form {
  align-self: center;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: rgb(255 255 255 / 90%);
  border-bottom: 1px solid rgba(33, 33, 33, 0.08);
  backdrop-filter: blur(14px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

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

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #0e5b4a);
  color: white;
  font-weight: 800;
}

.brand-name {
  font-size: 1.55rem;
}

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

.top-nav a {
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

.top-nav a.active,
.top-nav a:hover {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

.account-summary {
  list-style: none;
  cursor: pointer;
}

.account-summary::-webkit-details-marker {
  display: none;
}

.account-avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #232a35;
  color: white;
  font-weight: 800;
}

.account-dropdown {
  position: relative;
}

.account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  display: grid;
  gap: 10px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid rgba(33, 33, 33, 0.08);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.account-panel a {
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.account-panel a:hover {
  background: #f2f4f7;
}

.page-shell {
  width: 100%;
  padding: 28px;
}

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

.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.7rem);
}

.eyebrow,
.muted,
.section-head p,
.field small,
small {
  color: var(--ink-soft);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(33, 33, 33, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.highlight-card {
  background: linear-gradient(135deg, rgba(23, 122, 99, 0.96), rgba(18, 91, 75, 0.92));
  color: #f4fff9;
  margin-bottom: 24px;
}

.highlight-card .muted,
.highlight-card .section-head p {
  color: rgba(244, 255, 249, 0.82);
}

.secret-box {
  display: block;
  margin-top: 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  overflow-wrap: anywhere;
}

.stats-grid,
.grid-two {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

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

.stat-card {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid rgba(33, 33, 33, 0.06);
  box-shadow: var(--shadow);
}

.stat-card.accent {
  background: linear-gradient(145deg, rgba(23, 122, 99, 0.92), rgba(33, 161, 123, 0.84));
  color: white;
}

.stat-card span,
.stat-card p {
  display: block;
}

.stat-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 2.3rem;
  line-height: 1;
}

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

.section-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

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

.stack-row {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(33, 33, 33, 0.14);
}

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

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

.toolbar-filters {
  display: grid;
  grid-template-columns: minmax(320px, 1.55fr) minmax(280px, 1.2fr) minmax(180px, 0.55fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.toolbar-actions {
  display: flex;
  justify-content: flex-end;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  padding: 0 10px 12px 0;
  border-bottom: 2px solid var(--line-strong);
}

.admin-table .filters-row th {
  padding: 14px 10px 14px 0;
  border-bottom: 1px solid var(--line);
}

.admin-table .filters-row input,
.admin-table .filters-row select {
  width: 100%;
}

tbody td {
  padding: 16px 10px 16px 0;
  border-bottom: 1px solid rgba(33, 33, 33, 0.08);
  vertical-align: middle;
}

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

.filters,
.form-stack,
.filter-bar {
  display: grid;
  gap: 16px;
}

.filters {
  grid-template-columns: minmax(280px, 1.6fr) minmax(150px, 0.55fr) minmax(160px, 0.65fr) minmax(190px, 0.8fr) auto;
  align-items: end;
}

.filter-bar {
  grid-template-columns: minmax(280px, 1fr) auto auto;
  align-items: end;
  margin-bottom: 18px;
}

.filter-bar label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.field input,
.field select,
.field textarea,
.filters input,
.filters select,
.filter-bar input,
.filter-bar select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(33, 33, 33, 0.14);
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
  color: var(--ink);
}

.field.compact {
  min-width: 150px;
}

.field.grow,
.field.wide {
  min-width: 240px;
}

.form-row {
  display: grid;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.inline-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.toggle-field input {
  width: auto;
}

.permissions-box {
  padding: 18px;
  border-radius: 16px;
  background: #f8f8fb;
  border: 1px solid #d8dceb;
}

.permissions-head {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: #e0e6ff;
  color: #25315e;
}

.permissions-table th,
.permissions-table td {
  padding-right: 16px;
}

.permissions-table td:last-child {
  width: 120px;
}

.permissions-table input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.permissions-actions {
  margin-top: 16px;
}

.actions-col {
  width: 116px;
  text-align: right;
}

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

.inline-form {
  margin: 0;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(33, 33, 33, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2630;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
  border-color: rgba(33, 33, 33, 0.2);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

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

.toggle-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.toggle-all input {
  width: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), #0d6f66);
  color: white;
}

.button.secondary {
  background: rgba(33, 33, 33, 0.08);
  color: var(--ink);
}

.button.dark {
  background: #232323;
  color: white;
}

.button.slim {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.switch-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  background: rgba(33, 33, 33, 0.08);
  color: var(--ink);
}

.switch-button.on {
  background: rgba(23, 122, 99, 0.16);
  color: var(--accent);
}

.switch-button.off {
  background: rgba(182, 59, 44, 0.12);
  color: var(--danger);
}

.switch-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(23, 122, 99, 0.1);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

.badge.dark {
  background: rgba(33, 33, 33, 0.08);
  color: var(--ink);
}

.badge.success {
  background: rgba(23, 122, 99, 0.14);
  color: var(--accent);
}

.badge.warning {
  background: rgba(193, 139, 28, 0.14);
  color: #9c6200;
}

.badge.danger {
  background: rgba(182, 59, 44, 0.12);
  color: var(--danger);
}

.compact-details {
  margin-top: 20px;
}

.mono {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.96rem;
}

.product-cell,
.code-cell {
  display: grid;
  gap: 6px;
}

.product-cell small,
.code-cell small,
tbody td small {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.badge-row,
.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.details {
  display: grid;
  gap: 14px;
  margin: 0;
}

.details div {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(33, 33, 33, 0.14);
}

.details div:last-child {
  border-bottom: 0;
}

.details dt {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.details dd {
  margin: 0;
  font-weight: 600;
}

.detail-header,
.messages {
  margin-bottom: 24px;
}

.hero-card {
  padding: 28px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 22px;
  align-items: center;
}

.hero-media {
  display: flex;
  justify-content: center;
}

.product-preview,
.media-thumb {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid rgba(33, 33, 33, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.media-thumb {
  max-width: 180px;
  margin-bottom: 12px;
}

.media-grid {
  display: grid;
  gap: 12px;
}

.media-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(33, 33, 33, 0.12);
  background: rgba(255, 255, 255, 0.7);
}

.rich-preview {
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(33, 33, 33, 0.12);
}

.message {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(33, 33, 33, 0.1);
  background: rgba(255, 255, 255, 0.78);
}

.message.success {
  border-color: rgba(23, 122, 99, 0.22);
}

.message.error {
  border-color: rgba(182, 59, 44, 0.22);
}

.error-text {
  color: var(--danger);
}

.pagination {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pagination a {
  color: var(--accent);
  font-weight: 700;
}

.pagination-detailed {
  padding-top: 18px;
  border-top: 1px solid rgba(33, 33, 33, 0.1);
}

.pagination-jump,
.pagination-form,
.pagination-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-form label,
.pagination-size label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.pagination-form input,
.pagination-size select {
  height: 42px;
  border: 1px solid rgba(33, 33, 33, 0.18);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.pagination-form input:focus,
.pagination-size select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 172, 193, 0.14);
}

.pagination-form input {
  width: 72px;
  padding: 0 12px;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
}

.pagination-size select {
  min-width: 104px;
  padding: 0 12px;
}

.pagination-form button {
  height: 42px;
  border: 0;
  border-radius: 0;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.18s ease, transform 0.18s ease;
}

.pagination-form button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.pagination-summary {
  color: var(--ink);
  font-weight: 600;
}

.pagination-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 42px;
  color: #8aa4ad;
  font-size: 2rem;
  line-height: 1;
  text-decoration: none;
  font-weight: 300;
}

.pagination-arrow:hover {
  color: var(--accent);
}

.pagination-arrow.disabled {
  color: rgba(33, 33, 33, 0.18);
  pointer-events: none;
}

.pagination-total-pages {
  color: #647f88;
  font-weight: 600;
  min-width: 86px;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .auth-panel,
  .stats-grid,
  .grid-two,
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .app-header,
  .brand-row {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-filters {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

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

  .inline-action {
    grid-template-columns: 1fr;
  }
}
