:root {
  --ink: #25231f;
  --muted: #746f66;
  --paper: #f4f0e7;
  --panel: #fffdf8;
  --line: #d9d1c2;
  --accent: #8a6a3f;
  --accent-dark: #66502f;
  --danger: #9b352f;
  --shadow: 0 22px 70px rgba(45, 39, 30, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Georgia, serif; font-weight: 400; }
h1 { font-size: clamp(2rem, 5vw, 4.25rem); line-height: 1; margin-bottom: 12px; }
h2 { font-size: 1.65rem; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.error { min-height: 20px; color: var(--danger); }
.form-message { min-height: 20px; color: var(--accent-dark); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); padding: 11px 12px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(138, 106, 63, 0.22); outline-offset: 2px; }
.primary-button, .secondary-button, .basket-button {
  border: 1px solid var(--accent); border-radius: 4px; padding: 11px 15px; cursor: pointer; font-weight: 700;
}
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button, .basket-button { background: transparent; color: var(--accent-dark); }
.secondary-button:hover, .basket-button:hover { background: rgba(138, 106, 63, 0.08); }
.text-button { border: 0; background: transparent; color: var(--accent-dark); cursor: pointer; padding: 0; text-decoration: underline; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); display: grid; gap: 14px; padding: clamp(28px, 7vw, 54px); background: var(--panel); box-shadow: var(--shadow); }
.login-card img { width: min(240px, 75%); margin: 0 auto 16px; }
.login-card > p, .login-card > a { color: var(--muted); line-height: 1.6; }
.login-card > a { text-align: center; font-size: 0.82rem; }

.portal-app { min-height: 100vh; }
.portal-app > header {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px clamp(18px, 5vw, 72px); background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 18px; text-decoration: none; font-family: Georgia, serif; letter-spacing: 0.08em; }
.brand img { width: 170px; max-height: 55px; object-fit: contain; }
.brand span { border-left: 1px solid var(--line); padding-left: 18px; }
.account-heading { display: grid; justify-items: end; gap: 3px; }
.account-heading small { color: var(--muted); }
.portal-nav { display: flex; gap: 6px; padding: 12px clamp(18px, 5vw, 72px); background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.portal-nav button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 9px 12px; white-space: nowrap; cursor: pointer; }
.portal-nav button.active { border-color: var(--accent); color: var(--ink); }
.portal-view { display: none; padding: clamp(28px, 6vw, 72px); }
.portal-view.active { display: block; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.section-head p:not(.eyebrow) { color: var(--muted); }
.basket-button strong { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: 6px; border-radius: 50%; background: var(--accent); color: #fff; }
.catalogue-controls { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card { display: flex; flex-direction: column; background: var(--panel); box-shadow: 0 12px 36px rgba(45, 39, 30, 0.08); }
.product-image { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: #e5ded0; }
.product-image-placeholder { display: grid; place-items: center; color: var(--muted); }
.product-copy { display: grid; gap: 10px; flex: 1; padding: 16px; }
.product-copy h3 { font-size: 1.25rem; margin-bottom: 4px; }
.product-copy p { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.product-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.75rem; }
.product-price { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-top: auto; }
.product-price strong { font-family: Georgia, serif; font-size: 1.35rem; }
.empty-state { grid-column: 1 / -1; padding: 50px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); }
.quote-list { display: grid; gap: 10px; }
.quote-row { display: grid; grid-template-columns: minmax(160px, 1fr) repeat(3, auto); gap: 20px; align-items: center; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); }
.quote-row small { display: block; color: var(--muted); margin-top: 4px; }
.status-pill { border-radius: 999px; background: rgba(138, 106, 63, 0.12); color: var(--accent-dark); padding: 6px 10px; font-size: 0.75rem; font-weight: 700; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { padding: 24px; background: var(--panel); border: 1px solid var(--line); }
.panel dl { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel dt { color: var(--muted); font-size: 0.75rem; margin-bottom: 4px; }
.panel dd { margin: 0; }
.panel form, form.panel { display: grid; gap: 14px; }

dialog { width: min(700px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; background: transparent; }
dialog::backdrop { background: rgba(30, 27, 22, 0.58); }
.dialog-card { position: relative; max-height: calc(100vh - 28px); overflow-y: auto; padding: clamp(24px, 6vw, 44px); background: var(--panel); box-shadow: var(--shadow); }
.close-button { position: absolute; right: 18px; top: 14px; border: 0; background: transparent; font-size: 2rem; cursor: pointer; }
#basket-items { display: grid; gap: 10px; margin: 20px 0; }
.basket-item { display: grid; grid-template-columns: 1fr 90px auto; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.basket-item small { display: block; color: var(--muted); margin-top: 3px; }
.basket-item button { border: 0; background: transparent; color: var(--danger); cursor: pointer; }
#quote-request-form { display: grid; gap: 14px; }
.dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; }

@media (max-width: 860px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalogue-controls, .account-grid { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .portal-app > header, .section-head { align-items: flex-start; }
  .portal-app > header, .section-head { flex-direction: column; }
  .account-heading { justify-items: start; }
  .brand span { display: none; }
  .product-grid { grid-template-columns: 1fr; }
  .quote-row { grid-template-columns: 1fr 1fr; }
  .quote-row > :first-child { grid-column: 1 / -1; }
  .basket-item { grid-template-columns: 1fr 74px; }
  .basket-item button { grid-column: 1 / -1; justify-self: start; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
}
