:root {
  --burgundy: #6d1938;
  --burgundy-dark: #481025;
  --cream: #f6f2ec;
  --paper: #fffdf9;
  --ink: #261f1c;
  --muted: #7b716b;
  --line: #e5ddd4;
  --gold: #b68a4c;
  --green: #28714d;
  --red: #a92d47;
  --yellow: #8c6812;
  --shadow: 0 18px 50px rgba(56, 31, 38, .09);
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--cream); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.rail { position: fixed; inset: 0 auto 0 0; width: 248px; padding: 28px 18px; color: #fff; background: linear-gradient(165deg, var(--burgundy) 0%, var(--burgundy-dark) 100%); display: flex; flex-direction: column; z-index: 20; }
.brand-lockup { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-mark { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: var(--burgundy); background: #fff; font-family: Manrope, sans-serif; font-weight: 800; letter-spacing: -.04em; }
.brand-name { font: 800 15px/1.15 Manrope, sans-serif; letter-spacing: .13em; }
.brand-type { display: block; margin-top: 4px; color: rgba(255,255,255,.62); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: grid; gap: 7px; margin-top: 26px; }
.nav-button { width: 100%; min-height: 48px; border: 0; border-radius: 13px; padding: 0 13px; display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.74); background: transparent; text-align: left; font-weight: 700; }
.nav-button:hover, .nav-button.active { color: #fff; background: rgba(255,255,255,.12); }
.nav-icon { width: 25px; font-size: 18px; text-align: center; }
.rail-account { margin-top: auto; padding: 18px 12px 0; border-top: 1px solid rgba(255,255,255,.14); }
.rail-account strong, .rail-account span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-account span { margin-top: 4px; color: rgba(255,255,255,.65); font-size: 12px; }
.text-button { border: 0; padding: 8px 0; color: inherit; background: transparent; font-weight: 700; }

.main { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; min-height: 88px; padding: 18px clamp(24px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 22px; background: rgba(246,242,236,.93); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(109,25,56,.09); }
.hello { min-width: 0; }
.hello small { display: block; color: var(--burgundy); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hello strong { display: block; margin-top: 4px; max-width: 58vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 20px/1.2 Manrope, sans-serif; }
.basket-button { flex: 0 0 auto; min-width: 142px; border: 0; border-radius: 16px; padding: 11px 18px; color: #fff; background: var(--burgundy); box-shadow: 0 10px 24px rgba(109,25,56,.22); }
.basket-button span { display: block; font-size: 10px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.basket-button strong { display: block; margin-top: 2px; font: 800 22px/1 Manrope, sans-serif; }
.content { width: min(1320px, 100%); margin: 0 auto; padding: 46px clamp(24px, 4vw, 64px) 80px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font: 800 clamp(32px, 4vw, 52px)/1 Manrope, sans-serif; letter-spacing: -.045em; }
.lede { margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.search { position: relative; margin-bottom: 26px; }
.search input { width: 100%; min-height: 58px; padding: 0 52px 0 20px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--paper); box-shadow: 0 8px 30px rgba(49,31,25,.04); font-size: 16px; outline: none; }
.search input:focus { border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(109,25,56,.10); }
.search button { position: absolute; right: 8px; top: 8px; width: 42px; height: 42px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 22px; }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.product-card { min-width: 0; min-height: 178px; padding: 20px; display: grid; grid-template-columns: 86px minmax(0,1fr) auto; grid-template-rows: auto 1fr auto; gap: 6px 17px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 8px 28px rgba(64,35,42,.045); }
.product-card:hover { border-color: #d4c4b6; box-shadow: var(--shadow); transform: translateY(-1px); transition: .16s ease; }
.product-image { grid-row: 1 / 4; width: 86px; height: 116px; border: 0; border-radius: 16px; overflow: hidden; align-self: center; display: grid; place-items: center; color: var(--burgundy); background: #eee3d7; font: 800 30px Manrope, sans-serif; }
.product-image img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.category { align-self: start; color: #9c6637; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.heart { grid-column: 3; grid-row: 1; width: 35px; height: 35px; border: 0; color: #a79c95; background: transparent; font-size: 26px; line-height: 1; }
.heart.active { color: #d52f4b; }
.product-info { grid-column: 2 / 4; min-width: 0; }
.product-name { margin: 0; font: 800 18px/1.28 Manrope, sans-serif; }
.meta { margin-top: 6px; color: var(--muted); font-size: 13px; }
.stock { margin-top: 5px; color: var(--green); font-size: 13px; font-weight: 700; }
.product-footer { grid-column: 2 / 4; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.qty { display: flex; align-items: center; gap: 12px; }
.qty button { width: 38px; height: 38px; border: 1px solid #d8cec5; border-radius: 12px; color: var(--burgundy); background: #fff; font-size: 20px; font-weight: 800; }
.qty strong { min-width: 20px; text-align: center; }
.primary, .secondary, .danger { min-height: 44px; border-radius: 13px; padding: 0 18px; font-weight: 800; }
.primary { border: 0; color: #fff; background: var(--burgundy); }
.primary:hover { background: #57122d; }
.secondary { border: 1px solid #d8cec5; color: var(--burgundy); background: #fff; }
.danger { border: 1px solid #e1b9c2; color: var(--red); background: #fff7f8; }
.small { min-height: 36px; padding: 0 13px; font-size: 13px; }

.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.category-card { min-height: 112px; border: 1px solid var(--line); border-radius: 19px; padding: 18px; display: flex; align-items: center; gap: 16px; color: var(--ink); background: var(--paper); text-align: left; }
.category-card:hover { border-color: var(--burgundy); }
.letter { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; color: var(--burgundy); background: #eee3d7; font: 800 24px Manrope, sans-serif; }
.category-card strong { display: block; font: 800 18px Manrope, sans-serif; }
.category-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.category-card b { margin-left: auto; color: var(--burgundy); font-size: 24px; }

.panel, .empty { border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 10px 35px rgba(55,37,28,.04); }
.panel { padding: 24px; }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty h2 { margin: 0 0 8px; color: var(--ink); font: 800 22px Manrope, sans-serif; }
.basket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.basket-lines { display: grid; gap: 12px; }
.basket-line { padding: 17px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.basket-line:last-child { border-bottom: 0; }
.basket-line h3 { margin: 0; font: 800 16px Manrope, sans-serif; }
.summary { position: sticky; top: 112px; }
.summary-row { display: flex; justify-content: space-between; gap: 15px; padding: 9px 0; color: var(--muted); }
.summary-row.total { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink); font-size: 22px; font-weight: 800; }
.summary .primary { width: 100%; min-height: 54px; margin-top: 18px; }
.fine { color: var(--muted); font-size: 12px; line-height: 1.55; }

.history-list { display: grid; gap: 12px; }
.history-card { width: 100%; min-height: 92px; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--ink); background: #fff; text-align: left; }
.history-card strong { display: block; font: 800 18px Manrope, sans-serif; }
.history-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.history-card b { color: var(--burgundy); font: 800 18px Manrope, sans-serif; }
.history-card.order { background: #edf4f8; border-color: #bfd2dc; }
.history-card.paid { background: #e7f4e9; border-color: #b5d4bb; }
.history-card.part { background: #fff4cf; border-color: #e1ca7d; }
.history-card.unpaid { background: #fae8ec; border-color: #e4b3bf; }
.detail-lines { margin-top: 18px; border-top: 1px solid var(--line); }
.detail-line { padding: 14px 0; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.detail-line span { color: var(--muted); font-size: 13px; }

.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.account-grid .wide { grid-column: 1 / -1; }
.panel h2 { margin: 0 0 18px; font: 800 20px Manrope, sans-serif; }
.info-row { padding: 13px 0; display: flex; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field.wide { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 13px; background: #fff; outline: none; }
.field input:focus { border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(109,25,56,.09); }
.user-list { display: grid; gap: 10px; }
.user-row { padding: 13px 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }

.login { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, .8fr) minmax(520px, 1.2fr); background: var(--cream); }
.login-art { padding: clamp(42px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: radial-gradient(circle at 30% 20%, #8b3153 0, transparent 34%), linear-gradient(145deg, #6d1938, #3e0d20); }
.login-art .brand-mark { width: 72px; height: 72px; font-size: 24px; }
.login-art h1 { max-width: 680px; font-size: clamp(46px, 6vw, 78px); }
.login-art p { max-width: 580px; color: rgba(255,255,255,.7); font-size: 17px; line-height: 1.65; }
.login-form-wrap { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(480px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.login-card h2 { margin: 0; font: 800 34px Manrope, sans-serif; }
.login-card > p { color: var(--muted); line-height: 1.55; }
.login-card form { display: grid; gap: 14px; margin-top: 26px; }
.login-card .primary { min-height: 52px; margin-top: 6px; }
.login-links { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.link-button { border: 0; padding: 6px 0; color: var(--burgundy); background: transparent; font-weight: 800; }

.modal { position: fixed; inset: 0; z-index: 50; padding: 30px; display: grid; place-items: center; background: rgba(34,22,24,.66); }
.modal-card { position: relative; width: min(680px, 100%); max-height: calc(100vh - 60px); overflow: auto; padding: 28px; border-radius: 24px; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.24); }
.modal-card.image { width: min(760px, 100%); text-align: center; }
.modal-card.image img { width: 100%; max-height: 70vh; object-fit: contain; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; color: var(--burgundy); background: #f1e9e1; font-size: 24px; }
.loading { min-height: 70vh; display: grid; place-items: center; color: var(--burgundy); font-weight: 800; }
.spinner { width: 42px; height: 42px; border: 4px solid #eadbdc; border-top-color: var(--burgundy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translate(-50%, 20px); max-width: min(520px, calc(100vw - 30px)); padding: 13px 18px; border-radius: 13px; color: #fff; background: #2d2421; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 88px minmax(0,1fr); }
  .rail { width: 88px; padding-inline: 12px; }
  .brand-lockup { padding-inline: 8px; }
  .brand-name, .brand-type, .nav-button span:not(.nav-icon), .rail-account { display: none; }
  .nav-button { justify-content: center; padding: 0; }
  .nav-icon { width: auto; }
  .product-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .basket-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
}

@media (max-width: 720px) {
  .shell { display: block; padding-bottom: 76px; }
  .rail { inset: auto 0 0; width: 100%; height: 72px; padding: 7px 8px; flex-direction: row; background: #fff; border-top: 1px solid var(--line); }
  .brand-lockup, .rail-account { display: none; }
  .nav { width: 100%; margin: 0; grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .nav-button { min-height: 58px; display: grid; place-items: center; gap: 0; color: #90857e; font-size: 10px; }
  .nav-button span:not(.nav-icon) { display: block; }
  .nav-button.active { color: var(--burgundy); background: #f4ece6; }
  .nav-icon { font-size: 17px; }
  .main { grid-column: 1; }
  .topbar { min-height: 76px; padding: 13px 18px; }
  .hello small { font-size: 10px; }
  .hello strong { max-width: 48vw; font-size: 15px; }
  .basket-button { min-width: 105px; padding: 10px 12px; }
  .basket-button strong { font-size: 18px; }
  .content { padding: 30px 16px 48px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 34px; }
  .category-grid, .account-grid, .form-grid { grid-template-columns: 1fr; }
  .account-grid .wide, .field.wide { grid-column: auto; }
  .product-card { grid-template-columns: 68px minmax(0,1fr) auto; padding: 16px; gap: 5px 12px; }
  .product-image { width: 68px; height: 92px; }
  .product-name { font-size: 16px; }
  .login { display: block; }
  .login-art { min-height: 260px; padding: 34px 24px; }
  .login-art h1 { margin-top: 60px; font-size: 42px; }
  .login-art p { display: none; }
  .login-form-wrap { padding: 20px 14px 44px; margin-top: -34px; position: relative; }
  .login-card { padding: 26px 22px; }
}
