:root {
  --bg: #f4f1ec;
  --ink: #1e1f23;
  --muted: #5c5f66;
  --accent: #c46a3a;
  --accent-dark: #9e4d27;
  --card: #ffffff;
  --line: rgba(30, 31, 35, 0.08);
  --shadow: 0 18px 45px rgba(30, 31, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: "Playfair Display", "Georgia", serif;
  margin: 0 0 0.5rem;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(196, 106, 58, 0.18), transparent 45%),
              radial-gradient(circle at 20% 20%, rgba(55, 82, 102, 0.18), transparent 40%),
              radial-gradient(circle at 80% 20%, rgba(232, 206, 180, 0.5), transparent 50%);
  z-index: -1;
}

.site-header {
  position: sticky;
  top: 0;
  background: rgba(244, 241, 236, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-link {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.1rem;
}

.brand-sub {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav a {
  font-weight: 600;
}

.inline-form {
  display: inline;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent-dark);
  font-weight: 600;
  cursor: pointer;
}

.link-button.danger {
  color: #a73535;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.header-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.card-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.subtitle {
  color: var(--muted);
  margin-top: 0.5rem;
}

.primary, .secondary, .ghost {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 0.7rem 1.4rem;
  font-weight: 600;
}

.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 25px rgba(196, 106, 58, 0.25);
}

.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--accent-dark);
}

.ghost {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.ghost.small {
  padding: 0.3rem 0.6rem;
}

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 1.8rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  animation: lift 0.5s ease;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

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

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid label {
  display: grid;
  gap: 0.5rem;
  font-weight: 600;
}

input, textarea, select {
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(196, 106, 58, 0.3);
  border-color: var(--accent);
}

.error {
  color: #a73535;
  font-size: 0.85rem;
}

.flash-stack {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-weight: 600;
}

.flash-success {
  background: rgba(59, 130, 87, 0.1);
  color: #2b5a3c;
}

.flash-error {
  background: rgba(167, 53, 53, 0.1);
  color: #a73535;
}

.status {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

.status-draft { background: rgba(98, 116, 138, 0.15); color: #4c5a6a; }
.status-submitted { background: rgba(196, 106, 58, 0.2); color: #8b4b28; }
.status-reviewed { background: rgba(58, 101, 196, 0.2); color: #344b8b; }
.status-confirmed { background: rgba(59, 130, 87, 0.2); color: #2b5a3c; }
.status-cancelled { background: rgba(167, 53, 53, 0.2); color: #a73535; }
.status-open { background: rgba(98, 116, 138, 0.15); color: #4c5a6a; }
.status-under_review { background: rgba(196, 106, 58, 0.2); color: #8b4b28; }
.status-closed { background: rgba(120, 120, 120, 0.15); color: #5b5b5b; }

.builder-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}

.product-grid {
  display: grid;
  gap: 1rem;
}

.product-card {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 140px);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.product-card label {
  justify-self: end;
  max-width: 140px;
}

.product-card input {
  width: 100%;
  max-width: 100%;
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
}

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

.link {
  color: var(--accent-dark);
  font-weight: 600;
}

.summary {
  position: sticky;
  top: 120px;
  align-self: start;
}

.summary-card {
  display: grid;
  gap: 0.8rem;
  background: #fff;
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.summary-line, .summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.summary-total {
  font-size: 1.1rem;
}

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

.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 0;
  text-align: left;
}

.auth-card {
  max-width: 520px;
  margin: 4rem auto;
  background: #fff;
  padding: 2.5rem;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.helper {
  margin-top: 1rem;
}

.date-group {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.info-row {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.notes {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

.note {
  padding: 0.8rem;
  border-radius: 14px;
  background: rgba(196, 106, 58, 0.08);
}

@media (max-width: 980px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }
  .summary {
    position: static;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    gap: 1rem;
  }
  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .product-card {
    grid-template-columns: 1fr;
  }
  .date-row {
    grid-template-columns: 1fr;
  }
}
