/* Dalam Bali — Mini App
   Palette A: Cream & Espresso
   All text pairs pass WCAG AA (4.5:1 minimum) */

:root {
  --bg: #FBF7F0;
  --card: #FFFFFF;
  --text: #2C1810;
  --text-secondary: #5C4033;
  --text-muted: #6E5F50;
  --accent: #8B6914;
  --accent-surface: #F5E6C8;
  --danger: #A63D40;
  --danger-surface: #FDF0F0;
  --border: #E8DFD3;
  --divider: #F0EAE1;
  --shadow: rgba(44, 24, 16, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 0 16px 80px;
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ───────────────────────────────── */

.nav {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  margin: 0 -16px;
  padding: 0 16px;
}

.nav a {
  flex: 1;
  text-align: center;
  padding: 14px 0 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── Page Count ────────────────────────── */

.page-count {
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 0 12px;
  letter-spacing: 0.1px;
}

/* ── Listing Cards ─────────────────────── */

.listing-card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px var(--shadow);
}

.listing-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.listing-area {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.listing-price {
  font-size: 15px;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-left: 12px;
}

.listing-detail {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.listing-take {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--accent-surface);
}

.listing-note {
  font-size: 13px;
  background: var(--divider);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.listing-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 4px;
}

.listing-actions a {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.listing-actions button {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}

.listing-actions button:active { opacity: 0.5; }

/* ── Share All Button ──────────────────── */

.btn-share-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: var(--card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-share-all:active { background: var(--divider); }

/* ── Search Profile ────────────────────── */

.profile-card {
  background: var(--card);
  border-radius: 12px;
  padding: 4px 16px;
  margin-top: 16px;
  box-shadow: 0 1px 3px var(--shadow);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
}

.profile-row:last-child { border-bottom: none; }

.profile-label {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.profile-value {
  font-weight: 600;
  text-align: right;
  color: var(--text);
  max-width: 60%;
  word-break: break-word;
}

.profile-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.profile-update-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ── Section Labels ────────────────────── */

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-top: 32px;
  margin-bottom: 10px;
}

/* ── Agent Card ────────────────────────── */

.agent-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px 16px;
  box-shadow: 0 1px 3px var(--shadow);
}

.agent-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.agent-avatar {
  position: relative;
  flex-shrink: 0;
}

.agent-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-surface);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  border: 2px solid var(--accent);
}

.agent-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card);
}

.agent-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.agent-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.agent-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.agent-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.btn-primary {
  flex: 1;
  padding: 12px 16px;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:active { opacity: 0.7; }

.btn-text {
  padding: 12px 16px;
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-text:active { opacity: 0.5; }

.agent-trust-link {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Toggle ────────────────────────────── */

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 3px var(--shadow);
}

.toggle-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.toggle-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle-switch {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle-switch.active { background: var(--accent); }

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch.active::after { transform: translateX(20px); }

/* ── Forget ────────────────────────────── */

.spacer-lg { height: 40px; }

.btn-forget {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--danger-surface);
  color: var(--danger);
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-forget:active { opacity: 0.6; }

.forget-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-bottom: 24px;
}

/* ── Empty State ───────────────────────── */

.empty-state {
  text-align: center;
  padding: 56px 24px 40px;
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 16px;
  opacity: 0.35;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Toast ─────────────────────────────── */

.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show { opacity: 1; }

/* ── Bottom Sheet ──────────────────────── */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 24, 16, 0.35);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet-overlay.open {
  display: flex;
}

.sheet {
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding: 8px 16px 24px;
  width: 100%;
  max-width: 420px;
  animation: sheetUp 0.25s ease-out;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 4px auto 16px;
}

.sheet-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sheet-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}

.sheet-option:last-of-type { border-bottom: none; }

.sheet-option svg { color: var(--text-muted); flex-shrink: 0; }

.sheet-option:active { opacity: 0.5; }

.sheet-cancel {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: var(--divider);
  color: var(--text-secondary);
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.sheet-cancel:active { opacity: 0.7; }

/* ── Brief Preview ─────────────────────── */

.brief-preview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin: 12px 0 0;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.5;
}

/* ── Dialog ────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 24, 16, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
}

.dialog {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  max-width: 300px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(44, 24, 16, 0.15);
}

.dialog h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.dialog p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.dialog-actions {
  display: flex;
  gap: 10px;
}

.dialog-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.dialog-actions button:active { opacity: 0.7; }

.btn-cancel {
  background: var(--divider);
  color: var(--text);
}

.btn-confirm-danger {
  background: var(--danger);
  color: white;
}

/* ── Loading ───────────────────────────── */

.loading {
  text-align: center;
  padding: 56px;
  color: var(--text-muted);
  font-size: 14px;
}
