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

:root {
  --bg: #0f1419;
  --bg-shell: #ffffff;
  --surface: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --accent: #6366f1;
  --warning: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  --header-grad: linear-gradient(135deg, #0d9488 0%, #0f766e 50%, #115e59 100%);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.15);
  --radius: 14px;
  --radius-sm: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-shell);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Layout wrappers */
.app-layout {
  width: 100%;
  height: 100%;
  height: 100dvh;
}

.app-main {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  background: var(--bg-shell);
  box-shadow: none;
  position: relative;
}

.mobile-only {}
.desktop-only { display: none !important; }

/* Hide desktop sidebar on mobile */
.site-aside { display: none; }

/* Header */
.app-header {
  flex: 0 0 auto;
  background: var(--header-grad);
  padding: 14px 16px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  position: relative;
  z-index: 10;
}

.header-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.app-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.5px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.header-center h1 {
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.header-center .subtitle {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
  font-weight: 400;
}

.profile-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-btn:active {
  transform: scale(0.95);
}

.profile-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.profile-btn .key-icon svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
}

.profile-btn .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #fff;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.notify-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background 0.2s, transform 0.15s;
}

.notify-btn.hidden {
  display: none;
}

.notify-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.notify-btn:active {
  transform: scale(0.95);
}

.notify-btn svg {
  width: 20px;
  height: 20px;
}

.notify-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary);
  line-height: 1;
}

.notify-badge.hidden {
  display: none;
}

/* Toolbar (mobile + desktop) */
.content-toolbar {
  flex: 0 0 auto;
  padding: 12px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.search-input::placeholder {
  color: #94a3b8;
}

.toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.med-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.region-select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 500;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  max-width: 180px;
}

.region-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Body */
.app-body {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: var(--surface);
}

.price-grid-header {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 2px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 2;
}

.price-grid-header .col-price {
  text-align: right;
  min-width: 100px;
}

.price-list-scroll {
  height: calc(100% - 38px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.price-list-scroll::-webkit-scrollbar {
  display: none;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  transition: background 0.15s;
  animation: fadeRow 0.3s ease backwards;
  width: 100%;
  border: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.price-row:hover {
  background: #f0fdfa;
}

.price-row + .price-row {
  border-top: 1px solid var(--border);
}

.verify-result {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f8fafc;
  margin-bottom: 16px;
}

.verify-result.genuine {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.verify-result.fake,
.verify-result.unrecognized {
  background: #fff7ed;
  border-color: #fdba74;
}

.verify-result h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.verify-result p {
  margin: 0 0 6px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
}

.verify-result .verify-msg {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.modal--nearby > h3,
.modal--nearby > .modal-desc,
.modal--nearby > .modal-handle {
  flex-shrink: 0;
}

#verifyStepList,
#verifyStepResult {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#verifyStepList.hidden,
#verifyStepResult.hidden {
  display: none !important;
}

.nearby-status {
  flex-shrink: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.4;
}

.nearby-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 120px;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 0 12px;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

.nearby-empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* One pharmacy block: card on top, directions under it */
.np-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  float: none;
  clear: both;
}

.np-card {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  float: none;
}

.np-card:hover,
.np-card:focus {
  outline: none;
  border-color: #99f6e4;
  background: #f0fdfa;
}

.np-card h4 {
  margin: 0 0 6px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.np-card p {
  margin: 0 0 4px;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.np-card p strong {
  color: var(--text);
  font-weight: 700;
}

.np-tags {
  display: block;
  margin-top: 10px;
  overflow: hidden;
}

.np-tags span {
  display: inline-block;
  margin: 0 8px 0 0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  vertical-align: middle;
}

.np-dist {
  color: #0f766e;
  background: #ccfbf1;
}

.np-stock {
  color: #0f766e;
  background: #ecfdf5;
}

.np-stock.is-out {
  color: #c2410c;
  background: #ffedd5;
}

.np-dir {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  margin: 8px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  font-family: inherit;
  cursor: pointer;
  float: none;
  clear: both;
}

.np-dir:hover {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #99f6e4;
}

.np-dir svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.nearby-dir-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.nearby-dir-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.modal.modal--map {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  height: min(88vh, 720px);
  max-height: min(88vh, 720px);
  padding: 0;
  overflow: hidden;
}

#mapOverlay {
  z-index: 120;
}

.map-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.map-modal-header h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.map-modal-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.map-close-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.map-close-btn:hover {
  background: var(--surface-hover);
}

.map-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: #e2e8f0;
}

.map-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.pharmacy-detail-head {
  flex-shrink: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  margin-bottom: 12px;
}

.pharmacy-detail-head h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.pharmacy-detail-head p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.pharmacy-meds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 0 12px;
  -webkit-overflow-scrolling: touch;
}

.pharmacy-med-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.pharmacy-med-row.is-focus {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.pharmacy-med-row h5 {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-weight: 600;
  word-break: break-word;
}

.pharmacy-med-row .med-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pharmacy-med-price {
  text-align: right;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.pharmacy-med-limit {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

#verifyStepList > .modal-actions,
#verifyResultActions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  padding-top: 4px;
  clear: both;
}

#verifyStepList > .modal-actions .btn,
#verifyResultActions .btn,
#verifyResultActions a.btn {
  flex: 1 1 120px;
  min-width: 0;
  text-align: center;
  text-decoration: none;
}

@keyframes fadeRow {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.price-row:nth-child(even) {
  background: #fafbfc;
}

.price-row:hover,
.price-row:active {
  background: var(--primary-light);
}

.med-info {
  min-width: 0;
  padding-right: 12px;
}

.med-name {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.med-feature {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

.med-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.med-price.unavailable {
  color: #cbd5e1;
  font-weight: 500;
}

.scroll-fab {
  position: absolute;
  right: 12px;
  width: 36px;
  height: 36px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.15s;
  z-index: 5;
}

.scroll-fab.visible {
  opacity: 1;
  pointer-events: auto;
}

.scroll-fab:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.scroll-fab:active {
  transform: scale(0.92);
}

.scroll-fab.top { top: 48px; }
.scroll-fab.bottom { bottom: 12px; }

.scroll-fab svg {
  width: 16px;
  height: 16px;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: #cbd5e1;
  margin-bottom: 12px;
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

/* Footer */
.app-footer {
  flex: 0 0 auto;
  padding: 14px 16px 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  background: #fff;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-note {
  margin: 0 0 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.footer-note::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--header-grad);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  width: 100%;
  justify-content: center;
}

.comment-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.comment-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

.comment-btn:active {
  transform: translateY(0);
}

/* Modals */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 24px 24px 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal.modal--nearby {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 720px);
  overflow: hidden;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

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

.modal-handle {
  width: 40px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.modal .modal-desc {
  margin: 0 0 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-bottom: 16px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.modal select:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.modal .label-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85em;
}

.comment-location-hint {
  display: block;
  width: 100%;
  margin: -4px 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 400;
  color: #0f766e;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.comment-location-hint:hover {
  background: #ccfbf1;
  border-color: #5eead4;
}

.comment-location-hint strong {
  font-weight: 600;
}

.comment-location-hint-action {
  color: #0f766e;
  opacity: 0.75;
  font-size: 0.82em;
}

.hidden {
  display: none !important;
}

.modal--inbox {
  max-width: 420px;
  width: min(420px, calc(100% - 24px));
  padding: 0;
  overflow: hidden;
  background: #fff;
  max-height: min(90vh, 720px);
}

.inbox-sheet {
  display: flex;
  flex-direction: column;
  max-height: min(78vh, 640px);
}

.inbox-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fffe 0%, #fff 100%);
}

.inbox-toolbar-text {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.inbox-toolbar-text h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.inbox-toolbar-text p {
  margin: 3px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.inbox-toolbar-text p.hidden {
  display: none !important;
}

.inbox-icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.inbox-icon-btn:hover {
  background: var(--surface-hover);
  border-color: #cbd5e1;
}

.inbox-icon-btn svg {
  width: 18px;
  height: 18px;
}

.inbox-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
}

.inbox-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  max-height: none;
}

.inbox-empty {
  margin: 28px 12px;
  padding: 28px 20px;
  text-align: center;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: var(--text-muted);
}

.inbox-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.inbox-empty-icon svg {
  width: 24px;
  height: 24px;
}

.inbox-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.95rem;
}

.inbox-empty p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.inbox-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.inbox-item:hover {
  border-color: #99f6e4;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.1);
}

.inbox-item:active {
  transform: scale(0.99);
}

.inbox-item.unread {
  border-color: #99f6e4;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.12);
}

.inbox-item-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--header-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.inbox-item-main {
  min-width: 0;
  grid-column: 2;
}

.inbox-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.inbox-item-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-item-pill {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.inbox-item-message {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.inbox-item-time {
  grid-column: 3;
  grid-row: 1;
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
  padding-top: 2px;
}

.inbox-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
}

.thread-subject {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.thread-subject-label {
  display: inline-block;
  max-width: 100%;
  padding: 4px 9px;
  margin-bottom: 6px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: rgba(204, 251, 241, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #0f766e;
  line-height: 1.3;
}

.thread-subject time {
  display: block;
  margin-top: 6px;
  font-size: 0.74rem;
  color: #94a3b8;
}

.thread-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.thread-bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.thread-bubble--you {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
}

.thread-bubble--admin {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: linear-gradient(160deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.25);
}

.thread-bubble-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.thread-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
}

.thread-avatar--you {
  background: #e2e8f0;
  color: #334155;
}

.thread-avatar--admin {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.thread-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.8;
}

.thread-bubble--you .thread-name {
  color: var(--text-muted);
}

.thread-bubble p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread-bubble--you p {
  color: var(--text);
}

.thread-bubble--admin p {
  color: #fff;
}

.inbox-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
}

.inbox-actions.hidden {
  display: none !important;
}

.inbox-actions .btn {
  padding: 11px 10px;
  font-size: 0.84rem;
}

.btn-appeal {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.btn-appeal:hover {
  background: #ffedd5;
}

.inbox-actions-done {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 4px 0;
}

@media (min-width: 768px) {
  .modal--inbox {
    max-width: 460px;
    border-radius: 18px;
  }

  .inbox-sheet {
    max-height: min(72vh, 680px);
  }
}

.modal textarea {
  min-height: 110px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.modal-actions .btn {
  flex: 1;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.otp-step { display: none; }
.otp-step.active { display: block; }

/* Toasts */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(400px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.35s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.info { background: var(--accent); }
.toast.warning { background: var(--warning); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.toast button {
  background: rgba(255, 255, 255, 0.22);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Install banner */
.install-banner {
  display: none;
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius);
  z-index: 150;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow-lg);
  width: min(400px, calc(100% - 32px));
  font-size: 0.88rem;
}

.install-banner.visible {
  display: flex;
}

.install-banner button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.85rem;
}

.install-banner .close-install {
  background: transparent;
  font-size: 20px;
  padding: 0 4px;
  color: #94a3b8;
}

/* Offline badge */
.offline-badge {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: #fff;
  text-align: center;
  padding: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 300;
  display: none;
}

.offline-badge.visible {
  display: block;
}

/* Profile menu */
.profile-menu {
  display: none;
  position: absolute;
  top: 62px;
  right: 16px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  min-width: 180px;
  overflow: hidden;
  border: 1px solid var(--border);
  animation: menuIn 0.2s ease;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-menu.active {
  display: block;
}

.profile-menu .phone-display {
  padding: 12px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.profile-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
}

.profile-menu button:hover {
  background: #f1f5f9;
}

.profile-menu #logoutBtn,
.profile-menu .logout-desktop {
  color: var(--danger);
}

.profile-menu #logoutBtn:hover,
.profile-menu .logout-desktop:hover {
  background: #fef2f2;
}

@media (min-width: 768px) {
  html,
  body {
    background: var(--bg);
    overflow: hidden;
  }

  .mobile-only { display: none !important; }

  .desktop-only { display: block !important; }
  .desktop-topbar.desktop-only { display: flex !important; }
  .district-bar.desktop-only { display: flex !important; }

  .app-layout {
    display: flex;
    flex-direction: row;
    height: 100dvh;
  }

  /* Sidebar — 30% brand, flex middle, footer */
  .site-aside {
    display: flex;
    flex-direction: column;
    width: 280px;
    min-width: 260px;
    max-width: 320px;
    height: 100dvh;
    background: linear-gradient(180deg, #0f766e 0%, #115e59 40%, #134e4a 100%);
    color: #fff;
    flex-shrink: 0;
  }

  .aside-brand {
    flex: 0 0 30%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .aside-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 14px;
    letter-spacing: -1px;
  }

  .aside-title {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
  }

  .aside-tagline {
    margin: 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.45;
    max-width: 220px;
  }

  .aside-regions {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 12px;
    min-height: 0;
  }

  .aside-nav-label {
    margin: 0 0 12px;
    padding: 0 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
  }

  .region-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .region-list li button {
    width: 100%;
    padding: 11px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .region-list li button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .region-list li button.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #fff;
  }

  .region-list .region-num {
    font-size: 0.75rem;
    opacity: 0.65;
    font-weight: 600;
    min-width: 22px;
  }

  .aside-footer {
    flex: 0 0 auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
  }

  .aside-footer p {
    margin: 0;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
  }

  /* Main content area */
  .app-main {
    flex: 1 1 auto;
    min-width: 0;
    height: 100dvh;
    max-width: none;
    box-shadow: none;
  }

  .desktop-topbar {
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: relative;
  }

  .desktop-topbar-info h2 {
    margin: 0 0 4px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
  }

  .desktop-topbar-info p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
  }

  .desktop-topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .desktop-med-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
  }

  .desktop-profile-btn {
    background: var(--surface);
    border: 1px solid var(--border);
  }

  .desktop-profile-btn .key-icon svg {
    stroke: var(--text-muted);
  }

  .desktop-notify-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
  }

  .desktop-notify-btn:hover {
    background: #f1f5f9;
  }

  .desktop-notify-btn .notify-badge {
    border-color: #fff;
  }

  .desktop-profile-menu {
    top: 72px;
    right: 28px;
  }

  .content-toolbar {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    background: #fff;
  }

  .content-toolbar .search-wrap {
    flex: 1 1 320px;
    max-width: 480px;
  }

  .district-bar {
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
  }

  .district-bar-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
  }

  .district-scroll-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
  }

  .district-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 36px;
    min-width: 0;
    flex: 1 1 auto;
    scroll-behavior: smooth;
  }

  .district-chips::-webkit-scrollbar {
    display: none;
  }

  .district-scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, color 0.15s, border-color 0.15s;
    padding: 0;
  }

  .district-scroll-arrow.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .district-scroll-arrow:hover {
    color: var(--primary);
    border-color: var(--primary);
  }

  .district-scroll-arrow:active {
    transform: translateY(-50%) scale(0.92);
  }

  .district-scroll-arrow.left {
    left: 0;
  }

  .district-scroll-arrow.right {
    right: 0;
  }

  .district-scroll-arrow svg {
    width: 14px;
    height: 14px;
  }

  .district-chip {
    flex-shrink: 0;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
  }

  .district-chip:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
  }

  .district-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
  }

  .district-placeholder {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
  }

  .app-body {
    background: var(--surface);
  }

  .price-grid-header {
    padding: 12px 28px;
    font-size: 0.75rem;
  }

  .price-list-scroll {
    height: calc(100% - 42px);
  }

  .price-row {
    padding: 16px 28px;
  }

  .app-footer {
    padding: 16px 28px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .footer-note {
    margin: 0;
  }

  .comment-btn {
    width: auto;
    padding: 10px 22px;
  }

  .overlay {
    align-items: center;
    padding: 16px;
  }

  .modal {
    border-radius: var(--radius);
    animation: modalIn 0.25s ease;
  }

  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
  }
}
