:root {
  --bg: #fff7f2;
  --panel: #fffaf7;
  --panel-strong: #ffffff;
  --text: #3a1e0b;
  --muted: #8f4f22;
  --line: #f7d4bd;
  --accent: #ff6a00;
  --accent-dark: #e14f00;
  --accent-soft: #ffe8d8;
  --secondary: #ff8c3a;
  --shadow: 0 18px 40px rgba(255, 106, 0, 0.18);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(255, 106, 0, 0.08), transparent 38%),
    linear-gradient(135deg, #fff8f3, #fffefd 50%, #fff1e6);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-hidden,
.hidden { display: none !important; }

.login-screen.hidden {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: rgba(255, 252, 249, 0.97);
  border: 1px solid rgba(247, 212, 189, 0.95);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 34px 30px;
  text-align: center;
}

.login-card h1 {
  margin: 18px 0 8px;
  font-family: "Arial Black", Arial, sans-serif;
  font-size: 1.8rem;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.login-card .form-actions {
  justify-content: center;
}

.login-logo {
  width: min(320px, 100%);
  height: auto;
  display: block;
  margin: 0 auto 10px;
  border-radius: 12px;
}

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

.topbar {
  padding: 20px 32px;
  background: linear-gradient(180deg, rgba(255, 250, 246, 0.98), rgba(255, 236, 223, 0.96));
  border-bottom: 1px solid rgba(225, 79, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-logo {
  width: 280px;
  max-width: 36vw;
  height: auto;
  display: block;
  border-radius: 10px;
}

.brand-block h1,
.hero-card h2,
.panel-header h2,
.card h3,
.modal-card h3,
.embedded-card h4 {
  font-family: "Arial Black", Arial, sans-serif;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--accent-dark);
}

.hero-card p,
.panel-header p,
.dashboard-card small {
  color: var(--muted);
  line-height: 1.6;
}

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

.menu {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-menu { position: relative; }
.settings-submenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: #fffaf6;
  border: 1px solid var(--accent-soft);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.settings-submenu button { width: 100%; text-align: left; }
.backup-card { width: min(560px, 95vw); padding: 28px; }
.backup-card p { line-height: 1.6; }
.backup-note { color: var(--muted); font-size: .9rem; }
#backup-progress-area { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
#backup-progress-area.hidden { display: none; }
#backup-progress { width: 100%; height: 20px; accent-color: var(--accent); }
button:disabled { opacity: .6; cursor: wait; }

.menu-button,
.primary,
.secondary,
.ghost,
.icon-button {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.menu-button {
  text-align: center;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  font-weight: 700;
}

.menu-button.active,
.menu-button:hover {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 106, 0, 0.28);
}

.content {
  padding: 28px 32px 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: rise 0.25s ease;
}

.hero-card,
.card,
.modal-card,
.embedded-card {
  background: rgba(255, 252, 249, 0.94);
  border: 1px solid rgba(247, 212, 189, 0.95);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-card {
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-card.compact {
  padding: 24px;
}

.home-stack {
  display: grid;
  gap: 20px;
}

.home-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.home-left-stack {
  display: grid;
  gap: 16px;
}

.home-actions-card {
  padding: 14px 16px;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.dashboard-card {
  background: rgba(255, 251, 248, 0.95);
  border: 1px solid rgba(247, 212, 189, 0.92);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 8px;
}

.dashboard-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dashboard-card strong {
  font-family: "Arial Black", Arial, sans-serif;
  font-size: 2rem;
  color: var(--accent-dark);
}

.ranking-card {
  padding: 16px;
  height: 100%;
}

.ranking-total-row td {
  font-family: "Arial Black", Arial, sans-serif;
  color: var(--accent-dark);
  background: rgba(255, 245, 238, 0.96);
}

.hero-actions,
.action-grid,
.toolbar,
.form-actions,
.card-title-row,
.modal-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.hero-actions {
  flex-wrap: wrap;
}

.large {
  padding: 18px 24px;
  font-size: 1rem;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.secondary {
  background: rgba(255, 140, 58, 0.22);
  color: #b54100;
}

.ghost,
.icon-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(225, 79, 0, 0.24);
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.icon-button:hover,
.menu-button:hover {
  transform: translateY(-1px);
}

.panel-header {
  margin-bottom: 22px;
}

.action-grid {
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.action-grid.shipments button {
  flex: 1 1 220px;
}

.toolbar {
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar.filters {
  align-items: end;
}

.toolbar input {
  flex: 1 1 360px;
}

.filter-field {
  min-width: 180px;
}

.filter-field select,
.filter-field input {
  min-width: 180px;
}

.card,
.embedded-card {
  padding: 22px;
}

.view-card {
  box-shadow: none;
}

.view-modal-card {
  max-height: min(90vh, 920px);
  display: flex;
  flex-direction: column;
}

.form-modal-card {
  max-height: min(90vh, 920px);
  display: flex;
  flex-direction: column;
}

.view-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  padding-bottom: 12px;
}

.form-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  padding-bottom: 12px;
}

.view-modal-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.form-modal-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.view-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--panel);
  padding-top: 16px;
  margin-top: 16px;
}

.form-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--panel);
  padding-top: 16px;
  margin-top: 16px;
}

.volume-counter {
  margin-left: auto;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(225, 79, 0, 0.24);
  background: rgba(255, 255, 255, 0.76);
  color: var(--accent-dark);
  font-weight: 700;
  white-space: nowrap;
}

.view-report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.view-report-logo-wrap {
  width: 42%;
}

.view-report-logo {
  width: 260px;
  max-width: 100%;
  display: block;
}

.view-report-meta {
  width: 58%;
  line-height: 1.8;
  color: var(--text);
}

.group-title-row td {
  background: rgba(255, 233, 218, 0.92);
}

.group-total-row td {
  background: rgba(255, 245, 238, 0.96);
}

.view-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.view-info-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 240, 230, 0.72);
}

.view-info-box strong {
  display: block;
  margin-top: 6px;
  font-family: "Arial Black", Arial, sans-serif;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.badge {
  margin-left: auto;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.radio-cell {
  width: 36px;
}

.radio-cell input {
  transform: scale(1.2);
}

.details-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(47, 36, 29, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.modal.hidden,
.toast.hidden {
  display: none;
}

.modal-card {
  width: min(640px, 100%);
  padding: 24px;
}

.modal-card.wide {
  width: min(980px, 100%);
}

.form-layout,
.form-grid {
  display: grid;
  gap: 16px;
}

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

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

input,
select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(119, 102, 90, 0.24);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #2f241d;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 30;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

  .brand-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-logo {
    width: 220px;
    max-width: 70vw;
  }

  .content {
    padding: 20px;
  }

  .dashboard-grid,
  .form-grid,
  .view-info-grid {
    grid-template-columns: 1fr;
  }

  .view-report-header {
    flex-direction: column;
  }

  .view-report-logo-wrap,
  .view-report-meta {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
