:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --girls: #e11d48;
  --girls-soft: #ffe4e6;
  --boys: #2563eb;
  --boys-soft: #dbeafe;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 3px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans Myanmar', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  font-size: 14.5px;
  min-height: 100dvh;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

.hidden {
  display: none !important;
}

/* Top Navigation Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.25);
}

.brand-text { min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text span {
  display: block;
  font-size: 10.5px;
  color: var(--ink-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 34px;
  white-space: nowrap;
}

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

.nav-btn-publish.has-changes {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: #92400e;
  animation: pulseGlow 2s infinite;
}

.nav-btn-lang {
  background: var(--surface-2);
  font-weight: 700;
  padding: 6px 9px;
}

.badge {
  background: var(--amber);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(217, 119, 6, 0); }
}

/* Draft Banner */
.draft-banner {
  background: var(--amber-soft);
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.banner-action {
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* Search & Minimal Filter Bar */
.controls-bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 9px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls-row-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13.5px;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  padding: 7px 32px 7px 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--surface-2);
  color: var(--ink-muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
}

.view-switcher {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  flex-shrink: 0;
}

.view-tab {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
}

.view-tab.active {
  background: var(--primary);
  color: #fff;
}

.filter-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.filter-strip::-webkit-scrollbar { display: none; }

.filter-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 2px;
}

.pill-btn, .filter-chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}

.pill-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.pill-btn.pill-girls.active {
  background: var(--girls);
  border-color: var(--girls);
}

.pill-btn.pill-boys.active {
  background: var(--boys);
  border-color: var(--boys);
}

.filter-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Main Content & 2-Card Mobile Grid */
.main-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4px 10px 32px;
}

.results-meta {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 600;
  margin: 4px 2px 8px;
}

.hostel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 720px) {
  .hostel-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (min-width: 1080px) {
  .hostel-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.hostel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.hostel-card:active {
  transform: scale(0.985);
}

.card-media {
  position: relative;
  height: 116px;
  background: linear-gradient(135deg, #e0e7ff, #fae8ff);
  overflow: hidden;
}

@media (min-width: 720px) {
  .card-media { height: 148px; }
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-media-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

.card-badges-top {
  position: absolute;
  top: 7px;
  left: 7px;
  right: 7px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;
}

.gender-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
}

.gender-tag.girls { background: var(--girls); }
.gender-tag.boys { background: var(--boys); }

.draft-tag {
  background: var(--amber);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.draft-tag.new { background: var(--emerald); }

.price-overlay {
  position: absolute;
  bottom: 7px;
  left: 7px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.card-body {
  padding: 9px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-phone {
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: auto;
}

.card-meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Map View */
.map-view {
  position: relative;
  height: calc(100dvh - 155px);
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: #e2e8f0;
}

.main-map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-floating-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  gap: 6px;
}

.map-float-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.map-preview-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}

.map-preview-img {
  width: 66px;
  height: 66px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.map-preview-info {
  flex: 1;
  min-width: 0;
}

.map-preview-info h4 {
  margin: 0 0 2px;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-preview-sub {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.map-preview-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.price-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  white-space: nowrap;
}

.price-marker.girls { background: var(--girls); }
.price-marker.boys { background: var(--boys); }
.price-marker.campus {
  background: var(--emerald);
  font-size: 11.5px;
  padding: 4px 10px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--ink); border-color: var(--border); }
.btn-danger { background: #fee2e2; color: var(--danger); border-color: #fecaca; }
.btn-call { background: var(--emerald-soft); color: #065f46; border-color: #a7f3d0; }

/* Bottom Sheet Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 700px) {
  .modal-backdrop { align-items: center; padding: 20px; }
}

.sheet-modal {
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: 92dvh;
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 700px) {
  .sheet-modal { border-radius: 20px; max-height: 88dvh; }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 8px auto 0;
  flex-shrink: 0;
}

@media (min-width: 700px) { .sheet-handle { display: none; } }

.sheet-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sheet-header h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

.sheet-body {
  padding: 14px 16px 24px;
  overflow-y: auto;
  flex: 1;
}

/* Detail Priority Cards: Phone -> Location -> Price */
.priority-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.priority-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.priority-card.phone-card {
  background: var(--emerald-soft);
  border-color: #a7f3d0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.priority-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.priority-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.detail-gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin-bottom: 14px;
}

.detail-gallery img {
  height: 165px;
  width: 220px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 12px;
  scroll-snap-align: start;
  cursor: zoom-in;
  background: var(--surface-2);
}

.detail-section { margin-bottom: 14px; }
.detail-section h3 { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; color: var(--primary-dark); }
.detail-list { margin: 0; padding-left: 18px; font-size: 13px; }
.detail-list li { margin-bottom: 4px; }

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.mini-tag { background: var(--surface-2); color: var(--ink); font-size: 11.5px; padding: 2px 8px; border-radius: 6px; }

/* Community Rules */
.rules-box {
  background: var(--primary-soft);
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  padding: 14px;
}

.rules-intro {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 600;
}

.rules-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

/* Senior Manage List: Photo + Name + Edit */
.manage-add-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.manage-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.manage-info {
  flex: 1;
  min-width: 0;
}

.manage-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manage-sub {
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* Form Styles */
.priority-field {
  background: var(--emerald-soft);
  border: 1px solid #a7f3d0;
  padding: 10px;
  border-radius: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

@media (min-width: 560px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.form-group label { font-size: 12.5px; font-weight: 700; }

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
}

.optional-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--surface-2);
}

.optional-details summary {
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.optional-inner {
  margin-top: 10px;
}

.service-toggle-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.svc-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.svc-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.map-link-row { display: flex; gap: 6px; flex-wrap: wrap; }
.map-link-row input { flex: 1; min-width: 140px; }

.picker-map {
  height: 190px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-top: 6px;
  z-index: 1;
}

.coords-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.form-footer-right { display: flex; gap: 8px; margin-left: auto; }

/* Publish Diffs */
.diff-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.diff-action {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 3px;
}
.diff-action.add { background: var(--emerald-soft); color: #065f46; }
.diff-action.update { background: var(--amber-soft); color: #92400e; }
.diff-action.delete { background: #fee2e2; color: var(--danger); }

.history-meta { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }

.empty-state { text-align: center; padding: 36px 16px; }
.empty-icon { font-size: 36px; margin-bottom: 8px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  place-items: center;
  padding: 16px;
}

.lightbox img { max-width: 100%; max-height: 90dvh; border-radius: 10px; object-fit: contain; }
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  text-align: center;
}
