:root {
  --ink: #241f21;
  --muted: #6d6264;
  --line: #ded7d2;
  --paper: #fffdf9;
  --surface: #ffffff;
  --soft: #f5f0ea;
  --brand: #ef476f;
  --brand-dark: #b31f46;
  --mint: #2a9d8f;
  --blue: #315f8f;
  --amber: #b86b00;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(36, 31, 33, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.portal-active {
  background: var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background:
    linear-gradient(180deg, rgba(36, 31, 33, 0.9), rgba(36, 31, 33, 0.82)),
    url("assets/app-background-cookies.jpg") center/cover;
  color: #fff;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-block {
  display: grid;
  gap: 7px;
  justify-items: center;
  text-align: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--brand);
  border-radius: 50%;
  font-weight: 850;
}

.brand-logo {
  width: 172px;
  max-width: 88%;
  height: auto;
  display: block;
}

.brand-block h1 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
}

.brand-block p {
  margin: 0;
  color: #d9cfd0;
  font-size: 0.85rem;
}

.nav {
  display: grid;
  gap: 3px;
}

.nav button,
.ghost-button {
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.nav button {
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #f7eeee;
  font-size: 0.9rem;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.user-panel {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
}

.ghost-button {
  padding: 8px 0;
  color: #ffd6df;
}

.main {
  min-width: 0;
  background: var(--paper);
}

.topbar {
  min-height: 58px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.topbar h2 {
  margin: 0;
  font-size: 1.18rem;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.content {
  padding: 28px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background:
    linear-gradient(115deg, rgba(36, 31, 33, 0.78), rgba(36, 31, 33, 0.44)),
    url("assets/hero-cookies.jpg") center/cover;
}

.login-hero {
  color: #fff;
  padding: 7vw;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 520px;
}

.login-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 0.96;
}

.login-hero p {
  max-width: 640px;
  margin: 18px 0 0;
  font-size: 1.08rem;
  color: #fff3f5;
}

.login-logo {
  width: min(260px, 56vw);
  height: auto;
  display: block;
  margin-bottom: 28px;
}

.login-panel {
  background: rgba(255, 253, 249, 0.95);
  padding: clamp(28px, 6vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-box {
  width: min(100%, 460px);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.login-box h2 {
  margin: 0;
  font-size: 1.65rem;
}

.login-box p {
  margin: 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--ink);
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary,
.secondary,
.danger {
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: 42px;
  padding: 9px 14px;
  font-weight: 800;
}

.primary {
  color: #fff;
  background: var(--brand);
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  color: var(--ink);
  background: var(--soft);
  border-color: var(--line);
}

.danger {
  color: #fff;
  background: var(--danger);
}

.small-action {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.primary:disabled {
  background: #c8bfc1;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

.panel,
.metric,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel h3,
.table-header h3 {
  margin: 0;
  font-size: 1.02rem;
}

.panel > p {
  color: var(--muted);
}

.metric {
  padding: 17px;
  display: grid;
  gap: 7px;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.metric strong {
  font-size: 1.55rem;
}

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

.status-pill,
.tag,
.warning {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 9px;
}

.status-pill {
  color: var(--blue);
  background: #e8f1fb;
}

.status-submitted {
  color: var(--amber);
  background: #fff3d8;
}

.status-approved {
  color: var(--blue);
  background: #e8f1fb;
}

.status-packed {
  color: #6b4aa0;
  background: #f0eafb;
}

.status-shipped {
  color: var(--brand-dark);
  background: #ffe9ef;
}

.status-delivered {
  color: var(--mint);
  background: #e6f5f2;
}

.tag {
  color: var(--mint);
  background: #e6f5f2;
}

.warning {
  color: var(--danger);
  background: #fff0ed;
}

.table-wrap {
  overflow: hidden;
}

.table-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbf8f4;
}

td input,
td select {
  max-width: 130px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.number {
  text-align: right;
}

.suggested-low {
  color: var(--danger);
  font-weight: 850;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  background: var(--soft);
  border-top: 1px solid var(--line);
}

.summary-item {
  display: grid;
  gap: 3px;
}

.summary-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

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

.helper-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #fff7e8;
  color: var(--amber);
  border: 1px solid #f2d7a4;
  font-weight: 750;
}

.success {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #e8f6ee;
  color: #237047;
  border: 1px solid #bfe5cc;
  font-weight: 750;
}

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

.waybill-card {
  break-inside: avoid;
}

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

.signature-grid div {
  min-height: 58px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 8px;
  background: #fff;
}

.signature-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.hide {
  display: none;
}

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

  .sidebar {
    position: static;
    z-index: 10;
  }

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

  .grid.two,
  .grid.three,
  .grid.four,
  .summary-bar,
  .signature-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .content {
    padding: 18px;
  }


  .login-hero {
    min-height: 420px;
  }
}
