:root {
  --bg: #f5efe8;
  --bg-strong: #eadfce;
  --surface: rgba(255, 252, 248, 0.92);
  --surface-strong: #fffaf4;
  --text: #2f2218;
  --muted: #6f5a4b;
  --line: rgba(88, 58, 28, 0.14);
  --brand: #9b6a2f;
  --brand-deep: #6d4317;
  --accent: #004d40;
  --danger: #9e2a2b;
  --shadow: 0 20px 50px rgba(83, 50, 18, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(214, 177, 122, 0.35), transparent 28%),
    radial-gradient(circle at top right, rgba(0, 77, 64, 0.18), transparent 25%),
    linear-gradient(180deg, #f7f0e8 0%, #efe4d4 100%);
}

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

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

.shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.shell-centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.hero-card,
.auth-card,
.panel,
.stats-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow);
}

.hero-card,
.auth-card {
  width: min(560px, 100%);
  padding: 28px;
  border-radius: var(--radius-xl);
}

.auth-card {
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(245, 234, 219, 0.94));
}

.accent-auth,
.accent-card {
  position: relative;
  overflow: hidden;
}

.accent-auth::after,
.accent-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -50px auto;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  background: rgba(0, 77, 64, 0.1);
}

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

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 0.95;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.6rem);
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.hero-copy,
.auth-copy,
.dashboard-subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.save-message {
  margin: -4px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  background: rgba(55, 111, 46, 0.12);
  color: #376f2e;
  border: 1px solid rgba(55, 111, 46, 0.18);
}

.save-message.is-error {
  background: rgba(158, 42, 43, 0.1);
  color: var(--danger);
  border-color: rgba(158, 42, 43, 0.18);
}

.save-message.is-info {
  background: rgba(0, 77, 64, 0.1);
  color: var(--accent);
  border-color: rgba(0, 77, 64, 0.16);
}

.form-save-message {
  margin: 0 0 12px;
}

.portal-grid {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.portal-card {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.portal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(83, 50, 18, 0.12);
}

.portal-card strong {
  font-size: 1.25rem;
}

.portal-tag,
.chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(155, 106, 47, 0.12);
  color: var(--brand-deep);
}

.back-link {
  display: inline-flex;
  margin-bottom: 20px;
  color: var(--muted);
}

.auth-form,
.order-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

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

.auth-form label,
.order-form label,
.filters label {
  display: grid;
  gap: 8px;
}

.compact-field input {
  padding: 12px 12px;
}

.auth-form span,
.order-form span,
.filters span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.field-help {
  color: var(--muted);
  font-size: 0.8rem;
}

.urgent-toggle {
  align-content: end;
}

.urgent-toggle input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 6px 0 0;
  accent-color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.button-primary,
.button-secondary,
.button-ghost {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.button-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #c08a42 100%);
  color: white;
}

.button-secondary {
  background: rgba(47, 34, 24, 0.08);
  color: var(--text);
}

.button-ghost {
  background: rgba(0, 77, 64, 0.1);
  color: var(--accent);
}

.form-message {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.92rem;
  color: var(--danger);
}

.dashboard-shell {
  display: grid;
  gap: 14px;
}

.dashboard-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.stats-card {
  padding: 12px;
  border-radius: var(--radius-lg);
}

.stats-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 20px;
}

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

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

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.full-span {
  grid-column: 1 / -1;
}

.filters {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.create-section {
  display: grid;
}

.orders-section {
  display: grid;
  gap: 18px;
}

.orders-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pagination-copy {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

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

.customer-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
}

.customer-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.customer-group-title {
  display: grid;
  gap: 4px;
}

.customer-group-title strong {
  font-size: 1.1rem;
}

.customer-group-title span {
  color: var(--muted);
  font-size: 0.88rem;
}

.order-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
}

.order-card-top,
.order-meta,
.order-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.order-card-top {
  margin-bottom: 12px;
}

.order-title {
  display: grid;
  gap: 4px;
}

.order-title strong {
  font-size: 1.08rem;
}

.order-id {
  color: var(--muted);
  font-size: 0.84rem;
}

.order-summary {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
}

.order-inline {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

.order-inline strong {
  color: var(--text);
}

.order-notes {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.55;
  font-size: 1rem;
  font-weight: 700;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.photo-card {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  aspect-ratio: 1 / 1;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.metric {
  display: grid;
  gap: 2px;
}

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

.status-new {
  background: rgba(191, 125, 39, 0.12);
}

.status-in-production {
  background: rgba(0, 77, 64, 0.12);
  color: var(--accent);
}

.status-ready {
  background: rgba(55, 111, 46, 0.12);
  color: #376f2e;
}

.status-delivered {
  background: rgba(66, 94, 166, 0.12);
  color: #425ea6;
}

.urgent-chip {
  background: rgba(158, 42, 43, 0.12);
  color: var(--danger);
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .order-form,
  .filters,
  .order-grid {
    grid-template-columns: 1fr;
  }

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

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-topbar,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .orders-pagination,
  .customer-group-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 16px, 1120px);
    padding: 16px 0 28px;
  }

  .hero-card,
  .auth-card,
  .panel,
  .stats-card {
    border-radius: 22px;
  }

  .hero-card,
  .auth-card,
  .panel {
    padding: 18px;
  }

  h1 {
    font-size: 2.6rem;
  }

  .button-primary,
  .button-secondary,
  .button-ghost {
    width: 100%;
  }

  .date-row {
    gap: 10px;
  }

  .compact-field input {
    padding: 10px 10px;
    font-size: 0.92rem;
  }

  .order-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }
}
