/* Spanish Tiles Marketing — design system
   Palette derived from spanishtiles.co.tz: warm off-white + terracotta + charcoal. */

/* Spanish Tiles brand: indigo blue + cool grey + clean white.
   Derived from the SPANISH TILES wordmark logo. */
:root {
  --bg:           #FAFBFC;
  --surface:      #FFFFFF;
  --surface-2:    #F2F2F6;
  --accent:       #2D1F8C;          /* logo indigo */
  --accent-dark:  #1E1463;          /* hover/active */
  --accent-soft:  #EAE7F5;          /* soft tint bg */
  --ink:          #1F1F1F;
  --ink-soft:     #6B6B6B;          /* logo "TILES" grey */
  --ink-faint:    #9C9CA8;
  --border:       #E0DEE7;
  --border-strong:#C2BFD0;
  --good:         #1F7A4D;
  --warn:         #8A5A1E;
  --bad:          #9B2F2F;
  --shadow-sm:    0 1px 2px rgba(31,31,31,.04);
  --shadow:       0 1px 2px rgba(31,31,31,.04), 0 8px 24px rgba(31,31,31,.05);
  --shadow-lg:    0 4px 12px rgba(31,31,31,.06), 0 24px 48px rgba(31,31,31,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* Typography */
.display { font-family: 'Fraunces', Georgia, serif; font-weight: 500; letter-spacing: -0.01em; }
.display-1 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.05; letter-spacing: -0.02em; }
.display-2 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; font-size: clamp(1.5rem, 3vw, 2.125rem); line-height: 1.1; letter-spacing: -0.015em; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; }

a { color: inherit; text-decoration: none; }
a.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a.link:hover { color: var(--accent-dark); }

/* Layout */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container-tight { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* App chrome */
.appbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.appbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.brand-mark {
  display: flex; align-items: center; gap: 10px; font-weight: 600;
}
.brand-mark .dot { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: white; display: grid; place-items: center; font-family: 'Fraunces', serif; font-weight: 600; font-size: 14px; }
.brand-mark .brand-logo { height: 40px; width: auto; display: block; }
.brand-mark .name { font-family: 'Fraunces', serif; font-weight: 500; letter-spacing: -0.01em; }
.brand-mark .name .light { color: var(--ink-soft); font-style: italic; }

/* Nav (left rail on desktop, hamburger sheet on mobile) */
.nav-tabs { display: flex; gap: 4px; }
.nav-tabs a { padding: 8px 14px; border-radius: 10px; color: var(--ink-soft); font-size: 0.9rem; font-weight: 500; }
.nav-tabs a:hover { background: var(--surface-2); color: var(--ink); }
.nav-tabs a.active { background: var(--accent-soft); color: var(--accent-dark); }

/* Hamburger button (mobile only) */
.appbar-menu-btn {
  display: none;
  width: 44px; height: 44px; padding: 0;
  background: transparent; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  -webkit-tap-highlight-color: transparent;
}
.appbar-menu-btn span {
  display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform .18s, opacity .18s;
}
.appbar-menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.appbar-menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.appbar-menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); }
.card-lg { padding: 28px; }
.card-md { padding: 20px; }
.card-sm { padding: 14px; }
.card-hover { transition: border .15s, box-shadow .15s, transform .15s; }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-link { display: block; cursor: pointer; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; font-size: 0.9rem; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; transition: background .12s, border .12s, color .12s; line-height: 1; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-soft { background: var(--accent-soft); color: var(--accent-dark); }
.btn-soft:hover { background: #F5D7C5; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.825rem; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 14px; }
.btn-danger { background: #C9402B; color: white; border-color: #B0331F; }
.btn-danger:hover { background: #B0331F; }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(216, 96, 47, 0.12); }
.input::placeholder { color: var(--ink-faint); }
.label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 6px; }
.help { font-size: 0.75rem; color: var(--ink-faint); margin-top: 6px; }

/* Pills / chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.8rem; color: var(--ink-soft);
  cursor: pointer; white-space: nowrap;
  transition: all .12s;
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip-soft { background: var(--accent-soft); color: var(--accent-dark); border-color: transparent; }

/* Stage pills (leads) */
.stage { font-size: 0.7rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.stage-enquired    { background: #FEF3C7; color: #92400E; }
.stage-quoted      { background: #DBEAFE; color: #1E40AF; }
.stage-negotiating { background: #E0E7FF; color: #3730A3; }
.stage-deposited   { background: #FCE7F3; color: #9D174D; }
.stage-sold        { background: #D1FAE5; color: #065F46; }
.stage-lost        { background: #F3F4F6; color: #6B7280; }

/* Mini divider */
.hr { border: none; height: 1px; background: var(--border); margin: 24px 0; }

/* Hero / cover band */
.hero {
  background:
    radial-gradient(1200px 400px at 20% -10%, rgba(216,96,47,.10), transparent 70%),
    radial-gradient(900px 400px at 100% 0%, rgba(216,96,47,.05), transparent 70%),
    var(--bg);
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border);
}

/* Section bands (logos / partners carousel) */
.scroll-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.scroll-row::-webkit-scrollbar { display: none; }
.brand-tile {
  min-width: 110px; height: 64px; padding: 12px 18px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-family: 'Fraunces', serif; color: var(--ink-soft); font-size: 0.95rem;
  flex-shrink: 0;
}

/* Product thumbnails (placeholder textures so it works offline) */
.thumb {
  aspect-ratio: 1; background: var(--surface-2);
  border-radius: 10px; overflow: hidden; position: relative;
}
.thumb-pattern-tile    { background: repeating-conic-gradient(#E8DCC8 0% 25%, #D4C5AC 0% 50%) 50% / 28px 28px; }
.thumb-pattern-granite { background: radial-gradient(circle at 20% 30%, #383028 1px, transparent 2px) 0 0/14px 14px, radial-gradient(circle at 60% 70%, #4A4036 1px, transparent 2px) 0 0/18px 18px, #2A241F; }
.thumb-pattern-wood    { background: linear-gradient(90deg, #A07045 0%, #B07F4E 8%, #A07045 16%, #B98C5D 24%, #A07045 32%, #B07F4E 100%); }
.thumb-pattern-wc      { background: #F2F0EC; }
.thumb-pattern-tap     { background: linear-gradient(135deg, #C0C5CB 0%, #8A9099 50%, #C0C5CB 100%); }
.thumb-pattern-hob     { background: #1B1B1B; }
.thumb-pattern-shower  { background: linear-gradient(180deg, #DCE6EE 0%, #B6C8D6 100%); }
.thumb-pattern-oven    { background: linear-gradient(180deg, #3C3A38 0%, #2A2826 100%); }

.thumb-label { position: absolute; top: 8px; left: 8px; font-size: 0.65rem; padding: 2px 6px; background: rgba(255,255,255,0.86); border-radius: 4px; color: var(--ink-soft); }

/* Empty state */
.empty { padding: 48px 24px; text-align: center; color: var(--ink-soft); }
.empty .icon { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface);
  padding: 12px 20px; border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem; z-index: 100;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Drawer (mobile bottom sheet) */
.drawer-bg { position: fixed; inset: 0; background: rgba(26,23,21,0.4); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .18s; }
.drawer-bg.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top-left-radius: 24px; border-top-right-radius: 24px; padding: 24px; z-index: 50; transform: translateY(100%); transition: transform .22s ease; max-height: 88vh; overflow-y: auto; }
.drawer.show { transform: translateY(0); }
@media (min-width: 720px) {
  .drawer { left: auto; right: auto; max-width: 480px; margin: 0 auto; bottom: auto; top: 64px; border-radius: 20px; transform: translateY(-10px); opacity: 0; }
  .drawer.show { transform: translateY(0); opacity: 1; }
}
.drawer-handle { width: 36px; height: 4px; background: var(--border-strong); border-radius: 4px; margin: 0 auto 16px; }

/* Form grid */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .row-2 { grid-template-columns: 1fr; } }

/* Grids */
.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.grid-cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-cards-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 720px) { .grid-cards-3 { grid-template-columns: 1fr 1fr; } .grid-cards-2 { grid-template-columns: 1fr; } }

/* Status dot */
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.dot-good { background: var(--good); }
.dot-warn { background: var(--warn); }
.dot-bad  { background: var(--bad); }

/* Tiny KPI */
.kpi { display: flex; align-items: baseline; gap: 6px; }
.kpi .num { font-family: 'Fraunces', serif; font-weight: 500; font-size: 2rem; line-height: 1; }
.kpi .lbl { color: var(--ink-soft); font-size: 0.85rem; }

/* Swiper (curate page) */
.swiper-stage { position: relative; height: min(70vh, 560px); user-select: none; }
.swipe-card {
  position: absolute; inset: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  cursor: grab;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .28s;
  will-change: transform;
}
.swipe-card.dragging { transition: none; cursor: grabbing; }
.swipe-card .photo { width: 100%; height: 70%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-faint); font-size: 14px; position: relative; overflow: hidden; }
.swipe-card .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.swipe-card .meta { padding: 20px 24px; }
.swipe-card .meta .sku { font-family: 'Fraunces', serif; font-size: 1.25rem; }
.swipe-card .meta .sub { color: var(--ink-soft); font-size: 0.85rem; margin-top: 4px; }

.swipe-overlay {
  position: absolute; top: 18px;
  padding: 6px 14px; border-radius: 999px;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase;
  opacity: 0; transition: opacity .12s;
  border: 2px solid;
}
.swipe-overlay.keep { right: 18px; color: var(--good); border-color: var(--good); transform: rotate(8deg); }
.swipe-overlay.skip { left: 18px; color: var(--bad); border-color: var(--bad); transform: rotate(-8deg); }
.swipe-card.show-keep .swipe-overlay.keep { opacity: 1; }
.swipe-card.show-skip .swipe-overlay.skip { opacity: 1; }

.swiper-controls { display: flex; gap: 16px; justify-content: center; margin-top: 28px; align-items: center; }
.swiper-btn { width: 60px; height: 60px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; font-size: 22px; cursor: pointer; transition: transform .12s, border-color .12s; }
.swiper-btn:hover { transform: scale(1.05); }
.swiper-btn-skip { color: var(--bad); }
.swiper-btn-skip:hover { border-color: var(--bad); }
.swiper-btn-keep { color: var(--good); }
.swiper-btn-keep:hover { border-color: var(--good); }
.swiper-btn-fav { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.swiper-btn-undo { width: 44px; height: 44px; font-size: 16px; color: var(--ink-soft); }

/* Progress bar */
.progress { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }

/* Avatars */
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.7rem; font-weight: 600; color: var(--surface); }
.avatar-amani { background: #7B4A2D; }
.avatar-neema { background: #4A6B3D; }
.avatar-garv  { background: var(--accent); }
.avatar-md { width: 36px; height: 36px; font-size: 0.85rem; }

/* Account avatar button + dropdown */
.user-avatar-btn { border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.user-avatar-btn:hover { filter: brightness(1.08); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(26,23,21,0.14);
  padding: 6px;
  z-index: 60;
  display: none;
}
.user-menu.show { display: block; }
.user-menu-head { padding: 14px 14px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-menu-name { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.user-menu-email { color: var(--muted, #6B6B6B); font-size: 0.8rem; margin-top: 2px; word-break: break-all; }
.user-menu-item {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; border: 0; background: transparent;
  cursor: pointer; border-radius: 8px; font-size: 0.9rem;
  font-family: inherit; color: var(--ink);
}
.user-menu-item:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* Stock + price pills (used in showroom + products) */
.chip-stock, .chip-price {
  display: inline-block;
  font-size: 0.7rem; padding: 2px 8px; border-radius: 999px;
  font-weight: 600; white-space: nowrap; line-height: 1.4;
}
.chip-stock.qty-good     { background: #D1FAE5; color: #065F46; }
.chip-stock.qty-low      { background: #FEF3C7; color: #92400E; }
.chip-stock.qty-out      { background: #FEE2E2; color: #991B1B; }
.chip-stock.nodata       { background: var(--surface-2); color: var(--ink-faint); }
.chip-stock.chip-instock   { background: #E5E7EB; color: #374151; }
.chip-stock.chip-committed { background: #FCE7F3; color: #9D174D; }
.chip-stock.chip-onorder   { background: #DBE9F4; color: #1E40AF; }
.chip-price              { background: #EAE7F5; color: #3730A3; }

/* Warehouse breakdown disclosure (kept available, currently unused) */
.wh-details { margin-top: 6px; }
.wh-details > summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--muted, #6B6B6B);
  padding: 4px 0;
  list-style: none;
  user-select: none;
}
.wh-details > summary::-webkit-details-marker { display: none; }
.wh-details > summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform .12s;
  margin-right: 4px;
  color: var(--muted, #6B6B6B);
}
.wh-details[open] > summary::before { transform: rotate(90deg); }
.wh-details > summary:hover { color: var(--ink); }
.wh-table { border-collapse: collapse; margin: 4px 0 8px 18px; font-size: 0.8rem; }
.wh-table td { padding: 2px 14px 2px 0; line-height: 1.4; }
.wh-table .wh-code { color: var(--ink); font-weight: 500; }
.wh-table .wh-qty  { font-variant-numeric: tabular-nums; color: var(--ink); }
.wh-table .wh-zero td { color: var(--muted, #888); }

/* Skeletons (so empty doesn't feel empty) */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, #ECE6DD 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: skel 1.4s infinite linear; border-radius: 8px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* === Mobile / Tablet === */
@media (max-width: 720px) {
  .input, .select, .textarea, input[type="text"], input[type="email"], input[type="tel"],
  input[type="number"], input[type="search"], input[type="date"], input[type="password"],
  textarea, select { font-size: 16px !important; }
}
@media (max-width: 720px) {
  .btn      { min-height: 44px; padding: 12px 18px; }
  .btn-sm   { min-height: 38px; }
  .btn-icon { min-width: 44px; min-height: 44px; }
  .chip     { min-height: 36px; padding: 8px 14px; }
}
@media (max-width: 860px) {
  .appbar-inner { padding: 10px 16px; }
  .appbar-menu-btn { display: flex; }
  .brand-mark .name { font-size: 0.95rem; }
  .brand-mark .brand-logo { height: 32px; }
  .nav-tabs {
    display: none;
    position: fixed; top: 64px; left: 0; right: 0;
    background: var(--surface); flex-direction: column;
    padding: 12px 16px calc(env(safe-area-inset-bottom, 12px) + 12px);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 25;
    gap: 2px;
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .nav-tabs.show { display: flex; }
  .nav-tabs a { padding: 14px 16px; font-size: 1rem; border-radius: 10px; }
}
@media (max-width: 600px) {
  .container, .container-tight { padding: 0 16px; }
  .card-lg { padding: 18px; }
  .card-md { padding: 16px; }
  .display-1 { font-size: 1.8rem; line-height: 1.1; }
  .display-2 { font-size: 1.35rem; line-height: 1.15; }
}
@media (max-width: 720px) {
  .grid-cards-3, .grid-cards-2 { grid-template-columns: 1fr !important; }
  .row-2 { grid-template-columns: 1fr !important; }
  .grid-products { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; gap: 10px; }
}
@media (max-width: 720px) {
  .drawer { left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
            max-width: 100% !important; margin: 0 !important;
            border-radius: 20px 20px 0 0 !important;
            padding: 16px 18px env(safe-area-inset-bottom, 20px); }
}
.stage { white-space: nowrap; }
@media (hover: none) {
  .card-hover:hover { box-shadow: var(--shadow-sm); border-color: var(--border); }
  .btn-ghost:hover  { border-color: var(--border); }
}

/* Utility */
.muted { color: var(--ink-soft); }
.tiny  { font-size: 0.75rem; }
.bold  { font-weight: 600; }
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mt-6{margin-top:24px}.mt-8{margin-top:32px}.mt-10{margin-top:40px}
.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-6{margin-bottom:24px}.mb-8{margin-bottom:32px}
.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-6{gap:24px}
.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}
.items-center{align-items:center}.items-baseline{align-items:baseline}.items-start{align-items:flex-start}
.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}
.w-full{width:100%}.text-center{text-align:center}.text-right{text-align:right}
.flex-wrap{flex-wrap:wrap}.flex-1{flex:1 1 0}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.min-w-0{min-width:0}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.relative{position:relative}
.divider-v { width: 1px; background: var(--border); }
