/* Grante DemoLIVE — shared design system */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --green: #08BC37;
  --green-600: #07A230;
  --green-700: #068528;
  --green-50: #E8F8ED;
  --green-100: #C9F0D5;
  --teal: #005050;
  --teal-800: #003E3E;
  --teal-900: #002B2B;
  --teal-600: #0B6464;
  --teal-50: #E7F1F1;
  --teal-100: #CBE0E0;
  --bg: #F3F6F5;
  --surface: #FFFFFF;
  --surface-2: #F8FAF9;
  --text: #102A2A;
  --muted: #5E7472;
  --faint: #93A5A3;
  --border: #E1E8E7;
  --border-strong: #CBD6D4;
  --danger: #DC3B3F;
  --danger-50: #FDECEC;
  --warn: #E08A00;
  --warn-50: #FFF4E0;
  --info: #2F6FDE;
  --info-50: #EAF1FD;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 43, 43, .06);
  --shadow: 0 1px 2px rgba(0, 43, 43, .05), 0 4px 16px rgba(0, 43, 43, .06);
  --shadow-lg: 0 12px 40px rgba(0, 43, 43, .16);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Montserrat', 'Inter', -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--teal-900); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
h4 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--teal); }
code { font-size: 12.5px; background: var(--teal-50); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
img { max-width: 100%; }
button { font: inherit; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.center { text-align: center; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; }
.row-top { display: flex; align-items: flex-start; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 20px; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- icons ---------- */
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, box-shadow .15s, transform .05s, color .15s, border-color .15s;
  background: var(--surface); color: var(--teal-900); user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--green-100); outline-offset: 1px; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(8, 188, 55, .28); }
.btn-primary:hover:not(:disabled) { background: var(--green-600); }
.btn-dark { background: var(--teal); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--teal-800); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); }
.btn-outline:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-50); }
.btn-ghost { background: transparent; color: var(--teal); }
.btn-ghost:hover:not(:disabled) { background: var(--teal-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-50); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { min-height: 54px; font-size: 16.5px; border-radius: 16px; padding: 0 24px; }
.btn-xl { min-height: 64px; font-size: 18px; border-radius: 18px; padding: 0 28px; font-family: var(--font-display); font-weight: 700; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 12px; }
.btn-icon.btn-sm { width: 34px; min-height: 34px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span, .label { display: block; font-size: 13px; font-weight: 600; color: var(--teal-800); margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field .error, .error-text { font-size: 12.5px; color: var(--danger); margin-top: 5px; font-weight: 500; }
.req::after { content: ' *'; color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: 16px var(--font); outline: none;
  transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235E7472' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-50); }
.input.has-error, .has-error .input { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-50); }
.input.input-sm, select.input.input-sm { min-height: 38px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
select.input.input-sm { padding-right: 34px; background-position: right 8px center; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 42px; }
.input-prefix { position: relative; }
.input-prefix > b { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.input-prefix .input { padding-left: 30px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }

.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: .2s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(18px); }

/* chips / segmented */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 99px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--teal-900); font-weight: 500; font-size: 14px;
  cursor: pointer; user-select: none; transition: .15s;
}
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.on.good { background: var(--green); border-color: var(--green); }
.chip.on.bad { background: var(--danger); border-color: var(--danger); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--teal-50); padding: 4px; border-radius: 14px; }
.seg button { border: 0; background: transparent; min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--teal-800); cursor: pointer; padding: 0 6px; }
.seg button.on { background: var(--teal); color: #fff; box-shadow: 0 2px 6px rgba(0, 80, 80, .25); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid rgba(0, 80, 80, .04); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-head h3 { margin: 0; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--teal-50); color: var(--teal); white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-50); color: var(--green-700); }
.badge.red { background: var(--danger-50); color: var(--danger); }
.badge.amber { background: var(--warn-50); color: #A86400; }
.badge.blue { background: var(--info-50); color: var(--info); }
.badge.gray { background: #EEF2F1; color: var(--muted); }
.badge.live::before { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* avatar */
.avatar {
  --size: 40px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: calc(var(--size) * .38); font-family: var(--font-display); overflow: hidden;
  position: relative; background: var(--teal); letter-spacing: .02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .emoji { position: absolute; right: -2px; bottom: -2px; font-size: calc(var(--size) * .42); line-height: 1; }
.avatar-wrap { position: relative; display: inline-block; flex: none; }
.avatar-wrap .emoji-badge { position: absolute; right: -4px; bottom: -4px; font-size: calc(var(--size, 40px) * .42); line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }

/* list rows */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, button.list-item:hover { background: var(--surface-2); }
button.list-item { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: transparent; cursor: pointer; }

/* empty state */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--teal-100); margin-bottom: 8px; }
.empty h4 { color: var(--teal-800); margin-bottom: 4px; }

/* alerts */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--info-50); color: #1D4A9A; font-size: 14px; align-items: flex-start; }
.notice .icon { margin-top: 1px; }
.notice.warn { background: var(--warn-50); color: #8A5300; }
.notice.error { background: var(--danger-50); color: #9B1C1F; }
.notice.success { background: var(--green-50); color: var(--green-700); }

/* spinner & skeleton */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(0, 80, 80, .15); border-top-color: var(--green); animation: spin .7s linear infinite; display: inline-block; }
.btn .spinner { width: 18px; height: 18px; border-width: 2.5px; border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.btn-outline .spinner, .btn-ghost .spinner { border-color: rgba(0,80,80,.2); border-top-color: var(--teal); }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #EAF0EF 25%, #F4F7F6 50%, #EAF0EF 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.page-loader { display: grid; place-items: center; min-height: 50vh; }

/* toast */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-bottom)); z-index: 3000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--teal-900); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; display: flex; gap: 10px; align-items: center; animation: toastIn .25s ease-out; pointer-events: auto; }
.toast.error { background: #8E1B1E; }
.toast.success .icon { color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* modal & sheet */
.overlay { position: fixed; inset: 0; background: rgba(0, 30, 30, .45); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s ease-out; }
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 4px 20px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation: sheetIn .22s ease-out; padding-bottom: var(--safe-bottom); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: .6; } }
}

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0, 12, 12, .92); z-index: 2500; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 94vw; max-height: 86vh; border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox .lb-close { position: absolute; top: calc(12px + var(--safe-top)); right: 12px; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox .lb-prev { left: 12px; } .lightbox .lb-next { right: 12px; }
.lightbox .lb-cap { position: absolute; bottom: calc(18px + var(--safe-bottom)); left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; }
.lightbox .btn { background: rgba(255,255,255,.14); color: #fff; }

/* photo grid */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--teal-50); cursor: zoom-in; border: 0; padding: 0; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .tag { position: absolute; left: 6px; bottom: 6px; background: rgba(0,43,43,.8); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }

/* map */
.map { width: 100%; height: 260px; border-radius: 16px; overflow: hidden; background: var(--teal-50); z-index: 0; }
.leaflet-container { font: inherit; }
.pin { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; background: var(--green); transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.25); display: grid; place-items: center; }
.pin::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.pin.teal { background: var(--teal); }
.pin.red { background: var(--danger); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2F6FDE; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,111,222,.2), 0 2px 6px rgba(0,0,0,.3); }

/* stars */
.stars { display: inline-flex; gap: 2px; color: #F5B400; }
.stars .icon { fill: currentColor; stroke: none; }
.stars .off { color: #DDE4E3; }

/* tables (admin) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--teal); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; }
.kpi .kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi-value, .kpi .kpi-value { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--teal-900); margin-top: 4px; line-height: 1.1; }
.kpi .kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi .kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--green-50); color: var(--green-700); }
.kpi .kpi-icon .icon { width: 17px; height: 17px; }

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid var(--border); break-inside: avoid; }
}
.icon-xl { width: 40px; height: 40px; }

/* "Designed by" credit */
.credit { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 0; color: var(--faint); font-size: 11.5px; font-weight: 600;
  text-decoration: none; letter-spacing: .02em; opacity: .85; transition: opacity .15s; }
.credit:hover { opacity: 1; }
.credit img { height: 30px; width: auto; display: block; }
.credit.dark { color: #7E9C99; }

/* product photos */
.pthumb { max-width: none; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--border); flex: none; display: inline-grid; place-items: center; color: var(--faint); vertical-align: middle; }
.pthumb.empty { background: var(--surface-2); overflow: hidden; padding: 0; text-align: initial; }
.pthumb.empty svg { width: 18px; height: 18px; }
.pthumb.clickable { cursor: pointer; }
.pthumb.clickable:hover { outline: 2px solid var(--green); outline-offset: 1px; }

/* ---------- place type-ahead */
.place-search { position: relative; }
.place-search .ps-spin { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; }
.ps-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1200; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.15)); overflow: hidden; max-height: 300px; overflow-y: auto; }
.ps-opt { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; font: inherit; cursor: pointer; border-bottom: 1px solid var(--border); color: inherit; }
.ps-opt:last-child { border-bottom: 0; }
.ps-opt.hi { background: var(--green-50); }
.ps-opt b { display: block; font-size: 14px; color: var(--teal-900); }
.ps-opt .grow span { display: block; font-size: 12.5px; color: var(--muted); }
.ps-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--teal-50); color: var(--teal); display: grid; place-items: center; flex: none; margin-top: 1px; }
.ps-empty { padding: 12px 14px; font-size: 13px; color: var(--muted); }
