@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@500;600;700&family=Tajawal:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --terra: #a44a3f;
  --terra-dark: #873b32;
  --cream: #f3e9dc;
  --paper: #fffdf9;
  --ink: #302722;
  --muted: #81756a;
  --line: #e7ddd2;
  --green: #52755e;
  --soft-green: #eaf0e8;
  --danger: #a54338;
  font-family: 'Tajawal', sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #faf7f2; color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.topbar { height: 76px; padding: 0 max(28px, calc((100vw - 1180px) / 2)); background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 34px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--terra); text-decoration: none; font: 700 23px 'Cairo', sans-serif; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px 12px 4px 12px; background: var(--terra); color: white; font-size: 19px; }
.topbar-note { color: var(--muted); font-size: 14px; margin-inline-end: auto; }
.main-nav { display: flex; align-items: center; gap: 8px; }
.nav-button, .cart-shortcut { border: 0; background: transparent; color: var(--muted); padding: 10px 15px; border-radius: 9px; font-weight: 600; }
.nav-button.active { color: var(--terra); background: #f7eee7; }
.cart-shortcut { color: var(--ink); border: 1px solid var(--line); padding: 8px 12px; }
.cart-shortcut span { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 20px; margin-inline-start: 5px; color: white; background: var(--terra); font-size: 12px; }
main { max-width: 1180px; margin: 0 auto; padding: 30px 28px 56px; }
.store-hero { min-height: 230px; background: var(--cream); position: relative; overflow: hidden; padding: 36px 42px; display: flex; align-items: center; justify-content: space-between; border-radius: 4px 26px 4px 4px; }
.store-hero::after { content: ''; position: absolute; left: -58px; bottom: -110px; width: 290px; height: 290px; border: 1px solid rgba(164,74,63,.2); border-radius: 50%; box-shadow: 0 0 0 22px rgba(164,74,63,.025), 0 0 0 48px rgba(164,74,63,.025); }
.hero-copy { position: relative; z-index: 1; max-width: 700px; }
.eyebrow { display: inline-block; color: var(--terra); font-size: 13px; font-weight: 700; letter-spacing: .2px; }
h1, h2, h3, p { margin-top: 0; }
.store-hero h1 { margin: 8px 0 6px; font: 700 clamp(30px, 4vw, 42px) 'Cairo', sans-serif; color: var(--ink); }
.store-hero p { margin-bottom: 18px; color: #66594e; font-size: 16px; }
.hero-meta { display: flex; align-items: center; gap: 9px; color: #655a50; font-size: 13px; }
.open-dot { width: 8px; height: 8px; background: #65906d; border-radius: 50%; }
.meta-divider { color: #b4a696; }
.hero-stamp { position: relative; z-index: 1; margin-inline-end: 46px; width: 120px; height: 120px; border: 1px solid rgba(164,74,63,.42); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--terra); transform: rotate(-9deg); }
.hero-stamp span { font-size: 13px; }
.hero-stamp strong { font: 700 25px 'Cairo', sans-serif; }
.store-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 32px; align-items: start; margin-top: 38px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 16px; }
.section-heading h2, .cart-panel h2 { font: 700 25px 'Cairo', sans-serif; margin: 3px 0 0; }
.search-box { height: 42px; width: min(230px, 45%); display: flex; align-items: center; gap: 7px; background: white; border: 1px solid var(--line); padding: 0 12px; color: #927e6e; border-radius: 8px; }
.search-box span { font-size: 23px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.category-strip { display: flex; gap: 9px; margin-bottom: 18px; }
.category-chip { border: 1px solid var(--line); background: white; color: var(--muted); font-size: 12px; border-radius: 22px; padding: 6px 12px; }
.category-chip.selected { color: white; background: var(--terra); border-color: var(--terra); }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.product-card { background: var(--paper); border: 1px solid var(--line); padding: 12px; display: flex; gap: 13px; align-items: center; min-height: 114px; position: relative; }
.product-art { width: 82px; height: 82px; flex: 0 0 82px; display: grid; place-items: center; background: #f4e8db; border-radius: 3px 18px 3px 3px; font-size: 37px; }
.product-copy { flex: 1; min-width: 0; }
.product-copy h3 { font: 700 16px 'Cairo', sans-serif; margin: 0 0 4px; }
.product-copy p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0 0 8px; }
.product-price { font-weight: 700; color: var(--terra); font-size: 14px; }
.add-button { position: absolute; left: 11px; bottom: 11px; width: 29px; height: 29px; border: 0; border-radius: 8px; color: white; background: var(--terra); font-size: 20px; line-height: 1; }
.add-button:hover, .button-primary:hover { background: var(--terra-dark); }
.product-unavailable { opacity: .52; }
.unavailable-label { color: var(--muted); font-size: 11px; }
.cart-panel { background: var(--paper); border: 1px solid var(--line); padding: 20px; position: sticky; top: 20px; }
.cart-panel-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.cart-icon { display: grid; place-items: center; width: 37px; height: 37px; background: var(--cream); color: var(--terra); font-size: 22px; border-radius: 50%; }
.cart-panel h2 { font-size: 22px; }
.cart-empty { padding: 14px 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 13px 0; border-bottom: 1px solid #f0e9e1; }
.cart-line-name { font-size: 13px; font-weight: 700; }
.cart-line-price { color: var(--muted); font-size: 12px; }
.quantity-controls { display: flex; align-items: center; gap: 9px; align-self: center; }
.quantity-controls button { width: 23px; height: 23px; border: 1px solid var(--line); background: white; color: var(--terra); border-radius: 5px; }
.quantity-controls span { min-width: 12px; text-align: center; font-size: 12px; }
.cart-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 0 14px; font-size: 14px; }
.cart-total strong { font: 700 20px 'Cairo', sans-serif; color: var(--terra); }
.checkout-form { border-top: 1px solid var(--line); padding-top: 13px; }
.checkout-form label, .settings-form label, .product-form label { display: block; font-size: 12px; color: #665b51; font-weight: 600; margin-bottom: 11px; }
.checkout-form input, .checkout-form textarea, .settings-form input, .product-form input:not([type=checkbox]), .product-form select { width: 100%; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 6px; padding: 10px 11px; margin-top: 5px; outline: 0; font-size: 13px; }
.checkout-form input:focus, .checkout-form textarea:focus, .settings-form input:focus, .product-form input:focus, .product-form select:focus { border-color: var(--terra); box-shadow: 0 0 0 2px rgba(164,74,63,.09); }
.checkout-form textarea { resize: vertical; }
.optional { color: #a09285; font-weight: 400; }
.button { min-height: 42px; border: 1px solid transparent; border-radius: 7px; padding: 9px 15px; font-weight: 700; font-size: 13px; }
.button-primary { color: white; background: var(--terra); }
.button-outline { color: var(--terra); border-color: #d9b9ad; background: transparent; }
.button-quiet { color: var(--muted); background: transparent; }
.checkout-button { width: 100%; margin-top: 3px; }
.checkout-button span { margin-inline-start: 4px; }
.privacy-note, .helper-text { color: #958779; font-size: 11px; line-height: 1.65; margin: 9px 0 0; }
.view { display: none; }
.view.active-view { display: block; }
.seller-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 0 25px; border-bottom: 1px solid var(--line); }
.seller-header h1 { font: 700 32px 'Cairo', sans-serif; margin: 4px 0; }
.seller-header p { color: var(--muted); margin: 0; }
.seller-mode-note { max-width: 255px; padding: 12px 16px; background: #fbefe5; border-inline-start: 3px solid var(--terra); }
.seller-mode-note span { color: var(--terra); font-size: 12px; font-weight: 700; }
.seller-mode-note p { font-size: 12px; line-height: 1.5; margin-top: 4px; }
.seller-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.seller-tab { padding: 14px 2px 11px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: none; font-weight: 700; }
.seller-tab.active { color: var(--terra); border-color: var(--terra); }
.seller-tab span { background: var(--cream); color: var(--terra); font-size: 11px; padding: 2px 7px; border-radius: 14px; margin-inline-start: 3px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-heading h2 { font: 700 21px 'Cairo', sans-serif; margin: 0 0 3px; }
.panel-heading p { font-size: 13px; color: var(--muted); margin: 0; }
.small-count { color: var(--muted); font-size: 12px; }
.orders-list, .seller-products-list { display: grid; gap: 10px; }
.order-card, .seller-product-row { border: 1px solid var(--line); background: var(--paper); padding: 16px; display: flex; align-items: center; gap: 14px; }
.order-icon, .seller-product-art { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 44px; background: var(--cream); border-radius: 12px; font-size: 22px; }
.order-main, .seller-product-info { flex: 1; min-width: 0; }
.order-main h3, .seller-product-info h3 { font: 700 15px 'Cairo', sans-serif; margin: 0 0 4px; }
.order-main p, .seller-product-info p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.6; }
.order-side { text-align: left; }
.order-side strong { display: block; color: var(--terra); font-size: 14px; margin-bottom: 7px; }
.order-side select { border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; background: white; color: var(--ink); font-size: 11px; }
.row-actions { display: flex; gap: 7px; }
.row-actions button { border: 1px solid var(--line); color: var(--terra); background: white; border-radius: 5px; padding: 6px 9px; font-size: 12px; }
.row-actions .delete-button { color: var(--danger); }
.seller-empty { padding: 48px 20px; text-align: center; border: 1px dashed #d8c8ba; color: var(--muted); }
.seller-empty h3 { font: 700 19px 'Cairo', sans-serif; color: var(--ink); margin: 10px 0 5px; }
.seller-empty p { font-size: 13px; margin-bottom: 16px; }
.empty-illustration { color: var(--terra); font-size: 34px; }
.product-form, .settings-form { max-width: 690px; margin: 24px 0; border: 1px solid var(--line); background: var(--paper); padding: 22px; }
.form-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 17px; }
.form-title-row h3 { font: 700 19px 'Cairo', sans-serif; margin: 2px 0 0; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 27px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
.full-field { grid-column: 1 / -1; }
.availability-field { display: flex !important; align-items: center; gap: 8px; margin-top: 24px !important; }
.availability-field input { accent-color: var(--terra); width: 17px; height: 17px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.settings-form { padding: 24px; }
.settings-form label { margin-bottom: 17px; font-size: 13px; }
.settings-form input { padding: 12px; }
.local-warning { margin: 21px 0 0; padding: 13px; background: #fbefe5; color: #76564b; font-size: 12px; line-height: 1.7; }
.site-footer { max-width: 1180px; margin: 0 auto; padding: 16px 28px 25px; border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; font-size: 12px; }
.site-footer i { color: var(--terra); font-style: normal; margin: 0 5px; }
.site-footer button { border: 0; background: transparent; color: var(--terra); font-size: 12px; text-decoration: underline; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #342b25; color: white; padding: 12px 18px; border-radius: 8px; font-size: 13px; z-index: 5; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.hidden { display: none !important; }
.firebase-connection-notice { margin: 0 0 18px; padding: 12px 15px; border: 1px solid #e6cbbd; background: #fbefe5; color: #76564b; font-size: 13px; line-height: 1.6; }
.firebase-connection-notice[data-tone="success"] { border-color: #c5d7c3; background: #eef4ec; color: #47604c; }
.firebase-connection-notice[data-tone="error"] { border-color: #e3b9b2; background: #fbefed; color: #853d34; }
.firebase-auth-panel { display: flex; justify-content: space-between; align-items: end; gap: 22px; padding: 18px; margin: 20px 0; border: 1px solid var(--line); background: var(--paper); }
.firebase-auth-copy { flex: 1; }
.firebase-auth-copy p { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 5px 0 0; }
.firebase-login-form { display: flex; align-items: end; gap: 10px; }
.firebase-login-form label { color: var(--muted); font-size: 11px; }
.firebase-login-form input { display: block; width: 190px; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 6px; padding: 9px 10px; margin-top: 4px; outline: 0; font-size: 13px; }
.firebase-login-form input:focus { border-color: var(--terra); }
.seller-tab:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 850px) {
  .topbar { height: auto; min-height: 68px; padding: 10px 18px; gap: 14px; flex-wrap: wrap; }
  .topbar-note { display: none; }
  .main-nav { margin-inline-start: auto; gap: 2px; }
  .nav-button, .cart-shortcut { padding: 9px 10px; font-size: 12px; }
  main { padding: 20px 18px 38px; }
  .store-hero { min-height: 190px; padding: 27px 24px; }
  .hero-stamp { margin-inline-end: 6px; width: 92px; height: 92px; flex: 0 0 92px; }
  .store-layout { grid-template-columns: 1fr; gap: 24px; margin-top: 28px; }
  .cart-panel { position: static; }
  .product-grid { gap: 11px; }
  .product-card { align-items: flex-start; padding: 10px; }
  .product-art { width: 65px; height: 65px; flex-basis: 65px; font-size: 30px; }
  .seller-header { align-items: flex-start; gap: 14px; }
  .seller-mode-note { max-width: 205px; }
  .firebase-auth-panel { align-items: stretch; flex-direction: column; }
  .firebase-login-form { align-items: stretch; flex-direction: column; }
  .firebase-login-form input { width: 100%; }
}
@media (max-width: 520px) {
  .topbar { padding: 9px 12px; }
  .brand { font-size: 20px; gap: 7px; }
  .brand-mark { width: 31px; height: 31px; }
  .nav-button, .cart-shortcut { padding: 8px 8px; }
  main { padding: 14px 12px 30px; }
  .store-hero { min-height: 174px; padding: 22px 17px; }
  .store-hero p { font-size: 14px; max-width: 245px; line-height: 1.55; }
  .hero-stamp { width: 67px; height: 67px; flex-basis: 67px; margin-inline-end: 0; }
  .hero-stamp span { font-size: 10px; }
  .hero-stamp strong { font-size: 18px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .search-box { width: 100%; }
  .category-strip { overflow-x: auto; padding-bottom: 4px; }
  .category-chip { white-space: nowrap; }
  .product-grid { grid-template-columns: 1fr; }
  .product-card { min-height: 97px; }
  .seller-header { flex-direction: column; }
  .seller-mode-note { max-width: none; width: 100%; }
  .seller-tabs { gap: 17px; }
  .panel-heading { align-items: flex-start; }
  .order-card, .seller-product-row { gap: 9px; padding: 12px 9px; }
  .order-side select { max-width: 100px; }
  .order-side strong { font-size: 12px; }
  .row-actions { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .availability-field { margin-top: 4px !important; }
  .product-form, .settings-form { padding: 16px 13px; }
  .site-footer { padding-inline: 13px; }
}
