/* ==========================================================================
   AMEKKAN / BELIKAN — shared design system
   Mobile-first, built for a WebView shell. Single type family (Manrope),
   two distinct service accents (AMEKKAN = motion teal, BELIKAN = warm
   amber) so the two services stay visually legible apart everywhere they
   appear side by side.
   ========================================================================== */

:root {
  /* -- palette -- */
  --ink: #12171c;
  --ink-soft: #1b232b;
  --ink-line: #2a333c;
  --paper: #f6f4ee;
  --card: #ffffff;
  --border: #e6e1d3;
  --text: #1b2127;
  --text-dim: #6c7680;
  --text-on-ink: #eef1f3;
  --text-on-ink-dim: #93a0aa;

  --amekkan: #0fa89a;
  --amekkan-deep: #0c8377;
  --amekkan-tint: #e3f5f2;
  --belikan: #e08a2c;
  --belikan-deep: #b56a1c;
  --belikan-tint: #fbeedc;

  --ok: #4c9a6a;
  --ok-tint: #e7f3ec;
  --warn: #c98a1c;
  --warn-tint: #faf1de;
  --danger: #c1493e;
  --danger-tint: #fbeae8;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shell-max: 480px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-padding-top: var(--safe-top); }

body {
  margin: 0;
  font-family: 'Manrope', -apple-system, 'Segoe UI', sans-serif;
  background: var(--ink);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* App shell: centers a phone-width column even on wide viewports, full
   bleed on an actual phone / WebView. */
.app-shell {
  max-width: var(--shell-max);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 60px rgba(0,0,0,0.35);
}
@media (min-width: 540px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border-radius: var(--radius-lg); overflow: hidden; }
}

/* -- top bar -- */
.topbar {
  background: var(--ink);
  color: var(--text-on-ink);
  padding: calc(14px + var(--safe-top)) 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.1px;
  flex: 1;
}
.topbar .back,
.topbar .action {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--text-on-ink);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
}
.topbar .back:active, .topbar .action:active { background: rgba(255,255,255,0.16); }
.topbar .subtitle { font-size: 12px; color: var(--text-on-ink-dim); font-weight: 500; margin-top: 2px; }

/* -- main content area -- */
.content {
  flex: 1;
  padding: 18px 18px calc(24px + var(--safe-bottom));
  overflow-y: auto;
}
.content.no-pad { padding: 0 0 calc(24px + var(--safe-bottom)); }

/* -- bottom tab bar -- */
.tabbar {
  display: flex;
  background: var(--ink);
  border-top: 1px solid var(--ink-line);
  padding: 8px 6px calc(8px + var(--safe-bottom));
  flex-shrink: 0;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-on-ink-dim);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 0;
  border-radius: 10px;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.active { color: var(--amekkan); }
.tabbar a .dot {
  position: absolute;
  margin-left: 12px;
  margin-top: -2px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

/* -- typography helpers -- */
h2.section-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; color: var(--text); }
p.muted, span.muted { color: var(--text-dim); font-size: 13px; }
.eyebrow-free-label { color: var(--text-dim); font-size: 12.5px; font-weight: 600; margin: 0 0 6px; }

/* -- cards -- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }

/* -- service tiles (AMEKKAN / BELIKAN entry points) -- */
.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.service-tile {
  border-radius: var(--radius);
  padding: 18px 14px;
  color: #fff;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 30px;
  min-height: 118px;
  position: relative;
  overflow: hidden;
}
.service-tile.amekkan { background: linear-gradient(155deg, var(--amekkan) 0%, var(--amekkan-deep) 100%); }
.service-tile.belikan { background: linear-gradient(155deg, var(--belikan) 0%, var(--belikan-deep) 100%); }
.service-tile .name { font-size: 16px; font-weight: 800; }
.service-tile .tagline { font-size: 12px; opacity: 0.9; font-weight: 500; }
.service-tile svg { width: 26px; height: 26px; opacity: 0.9; }

/* -- badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge.amekkan { background: var(--amekkan-tint); color: var(--amekkan-deep); }
.badge.belikan { background: var(--belikan-tint); color: var(--belikan-deep); }
.badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.danger { background: var(--danger-tint); color: var(--danger); }
.badge.neutral { background: var(--border); color: var(--text-dim); }

/* -- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.12s ease;
}
.btn:active { filter: brightness(0.92); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.amekkan { background: var(--amekkan); color: #fff; }
.btn.belikan { background: var(--belikan); color: #fff; }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn.danger-ghost { background: transparent; color: var(--danger); border: 1.5px solid var(--danger-tint); }
.btn.sm { padding: 9px 14px; font-size: 13px; width: auto; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* -- forms -- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.field .hint-text { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }
input, select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amekkan);
}
textarea { resize: vertical; min-height: 80px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.locate-row { display: flex; gap: 8px; align-items: flex-end; }
.locate-row .field { flex: 1; margin-bottom: 0; }

/* -- order status timeline (a genuine sequence, so numbered treatment fits) -- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex; gap: 12px;
  padding-bottom: 18px;
  position: relative;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: 10px; top: 22px; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1;
}
.timeline li.done .dot { background: var(--ok); }
.timeline li.current .dot { background: var(--amekkan); box-shadow: 0 0 0 4px var(--amekkan-tint); }
.timeline .dot svg { width: 11px; height: 11px; }
.timeline .label { font-size: 13.5px; font-weight: 700; color: var(--text); }
.timeline li:not(.done):not(.current) .label { color: var(--text-dim); font-weight: 600; }
.timeline .time { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* -- empty states -- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 14px; opacity: 0.4; }
.empty-state p { font-size: 13.5px; margin: 0; }

/* -- list rows (orders, notifications, addresses) -- */
.row-list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  text-decoration: none;
  color: inherit;
}
.row-item .row-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.row-item .row-icon svg { width: 18px; height: 18px; }
.row-item .row-main { flex: 1; min-width: 0; }
.row-item .row-title { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .row-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .row-meta { font-size: 11px; color: var(--text-dim); text-align: right; flex-shrink: 0; }
.row-item.unread { border-left: 3px solid var(--amekkan); }

/* -- chat bubbles -- */
.chat-scroll { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; }
.bubble { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; }
.bubble.mine { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble .time { display: block; font-size: 10px; opacity: 0.6; margin-top: 4px; }
.chat-input-bar { display: flex; gap: 8px; padding: 10px 14px calc(10px + var(--safe-bottom)); background: var(--card); border-top: 1px solid var(--border); }
.chat-input-bar input { flex: 1; }
.chat-input-bar button { width: 44px; flex-shrink: 0; padding: 0; }

/* -- toasts -- */
#toast-host {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: 100%; max-width: calc(var(--shell-max) - 40px); pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* -- loading skeleton -- */
.skel { background: linear-gradient(90deg, var(--border) 25%, #f0ede2 37%, var(--border) 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; border-radius: 8px; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* -- auth pages -- */
.auth-wrap { padding: 40px 26px; }
.auth-wrap .brand { font-size: 22px; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.auth-wrap .brand span.a { color: var(--amekkan); }
.auth-wrap .brand span.b { color: var(--belikan); }
.auth-wrap .brand-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 30px; }
.role-switch { display: flex; background: var(--border); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 20px; }
.role-switch button { flex: 1; background: none; border: none; padding: 9px; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--text-dim); border-radius: 7px; cursor: pointer; }
.role-switch button.active { background: var(--card); color: var(--text); }
.auth-switch-link { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-dim); }
.auth-switch-link a { color: var(--amekkan-deep); font-weight: 700; text-decoration: none; }

/* -- misc -- */
.divider { height: 1px; background: var(--border); margin: 16px 0; border: none; }
.spacer-32 { height: 32px; }
.center-col { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; padding: 20px; }
