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

:root {
  --primary: #FF385C;
  --primary-dark: #E31C5F;
  --dark: #222222;
  --bg: #F7F7F7;
  --card: #FFFFFF;
  --text: #222222;
  --muted: #717171;
  --border: #DDDDDD;
  --green: #008A05;
  --red: #C13515;
  --yellow: #B45309;
  --blue: #1D4ED8;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html, body, #app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

/* ─── LAYOUT ─── */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ═══════════════════════════════════
   SIDEBAR — REDESIGNED COMPACT
   ═══════════════════════════════════ */

.sidebar {
  width: 220px;
  background: var(--dark);
  color: #fff;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  gap: 8px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-brand img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: contain;
}

.sidebar-brand span {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-username {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-role {
  font-size: 8px !important;
  padding: 2px 5px !important;
}

.sidebar-logout {
  padding: 4px 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}

.sidebar-logout:hover {
  background: rgba(255,56,92,0.3);
}

/* Desktop nav — vertical */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.12s;
  white-space: nowrap;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar-nav a.active {
  background: rgba(255,56,92,0.15);
  color: #fff;
  border-left-color: var(--primary);
}

.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 20px;
  max-width: 1100px;
  min-width: 0;
}

/* ═══════════════════════════════════
   MOBILE SIDEBAR — COMPACT TOP BAR
   ═══════════════════════════════════ */
@media (max-width: 768px) {

  .sidebar {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    width: 100% !important;
    height: auto !important;
    flex-direction: column !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .sidebar-top {
    padding: 8px 10px 6px;
  }

  .sidebar-brand span {
    font-size: 11px;
  }

  .sidebar-brand img {
    width: 20px;
    height: 20px;
  }

  .sidebar-username {
    font-size: 10px;
    max-width: 50px;
  }

  .sidebar-role {
    font-size: 7px !important;
    padding: 1px 4px !important;
  }

  .sidebar-logout {
    padding: 3px 5px;
    font-size: 11px;
  }

  /* Nav — horizontal scroll */
  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 4px !important;
    padding: 4px 8px 8px !important;
    flex: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }

  .sidebar-nav a {
    border-left: none !important;
    border-radius: 999px !important;
    padding: 6px 11px !important;
    min-height: 30px !important;
    font-size: 11px !important;
    flex-shrink: 0;
    gap: 4px;
  }

  .sidebar-nav a.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-left: none !important;
  }

  /* Main content below sidebar */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 12px !important;
    padding-top: 100px !important;
  }

  .wrap,
  .ca-wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding: 12px !important;
    padding-top: 100px !important;
  }
}

@media (max-width: 480px) {
  .main-content,
  .wrap,
  .ca-wrap {
    padding-top: 105px !important;
  }

  .sidebar-top {
    padding: 6px 8px 4px;
  }

  .sidebar-brand span {
    font-size: 10px;
  }
}

.sidebar h2 {
  font-size: 13px;
  padding: 16px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0;
  scrollbar-width: none;
}
.sidebar nav::-webkit-scrollbar { display: none; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar nav a.active {
  background: rgba(255,56,92,0.15);
  color: #fff;
  border-left-color: var(--primary);
}

.sidebar-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.sidebar .logout-link {
  padding: 9px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: #fff;
  margin-bottom: 8px;
  transition: background 0.2s;
}
.sidebar .logout-link:hover { background: rgba(255,56,92,0.35); }
.sidebar-credit { text-align: center; font-size: 10px; color: rgba(255,255,255,0.3); }

.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 20px;
  max-width: 1100px;
  min-width: 0;
}

.wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 30px 16px;
}

/* ─── CARDS ─── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 100%;
}

h1 { font-size: 20px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ─── STATS / METRICS ─── */
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}
.metric-row:last-child { border-bottom: none; }

.metric-label { font-size: 13px; color: #484848; flex: 1; }
.metric-value { font-size: 16px; font-weight: 700; color: var(--dark); text-align: right; }
.metric-value.warn { color: var(--red); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── FORM ─── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label, .form-label {
  font-size: 12px;
  font-weight: 600;
  color: #484848;
  margin-bottom: 4px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin: 0;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 42px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--dark);
}
input[type="file"] {
  padding: 8px;
  font-size: 12px;
  background: #fafafa;
  min-height: unset;
}
input[type="checkbox"] {
  width: auto;
  min-height: unset;
}
textarea {
  min-height: 74px;
  resize: vertical;
}

/* ─── SEARCH ─── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.search-bar input {
  border: none;
  padding: 0;
  min-height: unset;
  font-size: 14px;
}
.search-bar input:focus { outline: none; }
.search-icon { color: var(--muted); font-size: 16px; }

/* ─── BUTTONS ─── */
button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  width: auto;
  white-space: nowrap;
  min-height: 42px;
}
button:hover { background: var(--primary-dark); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary { background: #484848; }
button.secondary:hover { background: #333; }

button.danger { background: var(--red); }
button.danger:hover { background: #a02a0f; }

button.outline {
  background: transparent;
  color: var(--dark);
  border: 1.5px solid var(--border);
}
button.outline:hover {
  background: var(--bg);
  border-color: var(--dark);
}

button.green-btn { background: var(--green); }
button.green-btn:hover { background: #067a05; }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 34px;
  border-radius: 6px;
}
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.table-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── TABLES ─── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #FAFAFA;
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
td {
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
tr:last-child td { border-bottom: none; }

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.green  { background: #DEF7EC; color: #03543F; }
.badge.red    { background: #FDE8E8; color: #9B1C1C; }
.badge.yellow { background: #FDF6B2; color: #723B13; }
.badge.blue   { background: #EBF5FF; color: #1E429F; }

/* ─── MESSAGES ─── */
.error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  padding: 10px 12px;
  background: #FDE8E8;
  border-radius: 8px;
}
.success-msg {
  color: var(--green);
  font-size: 13px;
  margin-top: 8px;
  padding: 10px 12px;
  background: #DEF7EC;
  border-radius: 8px;
}
.loading {
  text-align: center;
  padding: 60px 20px;
  font-size: 15px;
  color: var(--muted);
}

code {
  background: #F3F4F6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
}

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-box {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  float: right;
  background: #eee;
  color: #333;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  min-height: unset;
  padding: 0;
  justify-content: center;
}
.modal-box h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

/* ─── ID CARDS ─── */
.id-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.id-card {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fafafa;
}
.id-card.done {
  border-style: solid;
  border-color: var(--green);
  background: #f0fff4;
}
.id-card-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.id-card-btns {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.id-card-btns button {
  flex: 1;
  padding: 6px 8px;
  min-height: 34px;
  font-size: 11px;
}
.file-info {
  font-size: 11px;
  color: var(--green);
  margin-top: 6px;
}

/* ─── FILTERS ─── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin: 6px 0 10px;
}
.filter-item { display: flex; flex-direction: column; }
.filter-item label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.filter-item input,
.filter-item select {
  min-width: 110px;
  min-height: 38px;
  padding: 8px 10px;
}

/* ─── CA PAGE ─── */
.ca-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
}
.ca-header {
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 12px;
}
.ca-header h1 { color: #fff; font-size: 18px; }
.ca-header .sub { color: rgba(255,255,255,0.75); }
.ca-logout {
  background: var(--red);
  margin-top: 12px;
}

/* ─── MOBILE FIRST PATCH ─── */
@media (max-width: 768px) {
  html, body, #app {
    overflow-x: hidden !important;
  }

  .app-container {
    display: block !important;
    overflow-x: hidden !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    width: 100% !important;
    height: auto !important;
    z-index: 500 !important;
  }

  .sidebar h2 {
    padding: 10px 12px 8px !important;
    font-size: 12px !important;
  }

  .sidebar nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 4px !important;
    padding: 6px 8px 8px !important;
    scrollbar-width: none;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }

  .sidebar nav a {
    border-left: none !important;
    border-radius: 999px !important;
    padding: 8px 12px !important;
    min-height: 36px !important;
    font-size: 12px !important;
    flex-shrink: 0;
  }

  .sidebar nav a.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-left: none !important;
  }

  .sidebar-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 10px 8px !important;
  }

  .sidebar .logout-link {
    margin: 0 !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    min-height: 32px !important;
  }

  .sidebar-credit {
    font-size: 9px !important;
    line-height: 1.2;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px !important;
    padding-top: 150px !important;
  }

  .wrap,
  .ca-wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding: 12px !important;
    padding-top: 150px !important;
  }

  .card {
    padding: 14px !important;
    margin-bottom: 10px !important;
    border-radius: 12px !important;
  }

  .form-grid,
  .id-grid,
  .stat-grid {
    grid-template-columns: 1fr !important;
  }

  input, select, textarea {
    font-size: 16px !important;
    min-height: 46px !important;
  }

  button {
    min-height: 42px !important;
    font-size: 13px !important;
  }

  .btn-sm {
    min-height: 34px !important;
    font-size: 11px !important;
  }

  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .filter-item {
    width: 100% !important;
  }

  .filter-item input,
  .filter-item select,
  .search-bar input {
    width: 100% !important;
    min-width: 0 !important;
  }

  .table-wrap {
    margin: 0 -14px !important;
    padding: 0 14px !important;
    overflow-x: auto !important;
  }

  table {
    min-width: 760px !important;
    width: max-content !important;
  }

  .modal-box {
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
  }
}

@media print {
  .sidebar, .sidebar-footer, .btn-row, button, .btn-sm,
  .filter-bar, .search-bar, .modal-overlay, .stat-grid,
  nav, .logout-link, .sidebar-credit, #logoutBtn {
    display: none !important;
  }
  .app-container {
    display: block !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 10px !important;
    max-width: 100% !important;
  }
  .card {
    break-inside: avoid;
    border: 1px solid #ddd;
    box-shadow: none;
    margin-bottom: 8px;
    page-break-inside: avoid;
  }
  body {
    background: #fff;
    font-size: 12px;
  }
  table { font-size: 11px; }
  th, td { padding: 6px 8px; white-space: normal; }
  h1 { font-size: 16px; }
  .metric-value { font-size: 14px; }
}


/* ─── CALENDAR (Google/Apple Style) ─── */
.cal-cell {
  border-radius: 10px;
  padding: 2px 1px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: default;
  transition: all 0.12s;
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  letter-spacing: -0.2px;
  position: relative;
}

.cal-cell.booked {
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

.cal-cell.booked:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.cal-cell.booked:active {
  transform: scale(0.95);
}

.cal-cell.today {
  border: 2.5px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(255,56,92,0.15);
  font-weight: 800;
}

.cal-cell .cal-date {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.cal-cell .cal-guest {
  font-size: 6.5px;
  font-weight: 700;
  line-height: 1;
  color: rgba(0,0,0,0.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 95%;
  letter-spacing: -0.3px;
  margin-top: 1px;
}

@media (max-width: 768px) {
  html, body, #app {
    overflow-x: hidden !important;
  }

  .app-container {
    display: flex !important;
    flex-direction: column !important;
    overflow-x: hidden !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    width: 100% !important;
    height: auto !important;
    max-height: 50vh;
    z-index: 500 !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .sidebar nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 4px !important;
    padding: 4px 8px 6px !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }

  .sidebar nav a {
    border-left: none !important;
    border-radius: 999px !important;
    padding: 6px 12px !important;
    min-height: 32px !important;
    font-size: 12px !important;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .sidebar nav a.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-left: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 12px !important;
    padding-top: 120px !important;
  }

  .wrap,
  .ca-wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding: 12px !important;
    padding-top: 120px !important;
  }

  .card {
    padding: 14px !important;
    margin-bottom: 10px !important;
    border-radius: 12px !important;
  }

  .form-grid,
  .id-grid,
  .stat-grid {
    grid-template-columns: 1fr !important;
  }

  input, select, textarea {
    font-size: 16px !important;
    min-height: 46px !important;
  }

  button {
    min-height: 42px !important;
    font-size: 13px !important;
  }

  .btn-sm {
    min-height: 34px !important;
    font-size: 11px !important;
  }

  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .filter-item {
    width: 100% !important;
  }

  .filter-item input,
  .filter-item select,
  .search-bar input {
    width: 100% !important;
    min-width: 0 !important;
  }

  .table-wrap {
    margin: 0 -14px !important;
    padding: 0 14px !important;
    overflow-x: auto !important;
  }

  table {
    min-width: 760px !important;
    width: max-content !important;
  }

  .modal-box {
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
  }
}

@media (max-width: 480px) {
  .main-content,
  .wrap,
  .ca-wrap {
    padding-top: 126px !important;
  }

  .card { padding: 12px !important; }
  h1 { font-size: 16px !important; }
  .stat-card .stat-num { font-size: 24px !important; }
}

/* ─── PHOTO VIEWER (Full Screen) ─── */
.photo-viewer-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.92);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.photo-viewer-overlay img {
  max-width: 92%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.5);
  background: #fff;
}

.photo-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.95);
  color: #333;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: unset;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.photo-viewer-info {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  margin-top: 12px;
  text-align: center;
}

.photo-viewer-nav {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.photo-viewer-nav button {
  background: rgba(255,255,255,0.95);
  color: #333;
  border: none;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.photo-viewer-nav button:hover {
  background: #fff;
}



/* ═══════════════════════════════════
   FINAL MOBILE OVERRIDE v21
   ═══════════════════════════════════ */

@media (max-width: 768px) {
  /* Force sidebar compact */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    z-index: 999 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--dark) !important;
  }

  .sidebar-top {
    padding: 6px 10px 4px !important;
    gap: 6px !important;
    min-height: 36px;
  }

  .sidebar-brand img {
    width: 18px !important;
    height: 18px !important;
  }

  .sidebar-brand span {
    font-size: 10px !important;
  }

  .sidebar-username {
    font-size: 9px !important;
    max-width: 45px !important;
  }

  .sidebar-role {
    font-size: 7px !important;
    padding: 1px 4px !important;
  }

  .sidebar-logout {
    padding: 3px 5px !important;
    font-size: 10px !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 3px !important;
    padding: 3px 6px 5px !important;
    flex: none !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none !important;
  }

  .sidebar-nav a {
    border-left: none !important;
    border-radius: 999px !important;
    padding: 5px 10px !important;
    min-height: 28px !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
    gap: 3px !important;
    white-space: nowrap !important;
  }

  .sidebar-nav a.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-left: none !important;
  }

  /* Main content push down — sidebar ~70px */
  .main-content {
    margin-left: 0 !important;
    margin-top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 10px !important;
    padding-top: 82px !important;
  }

  .wrap, .ca-wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding: 10px !important;
    padding-top: 82px !important;
  }

  /* Cards compact */
  .card {
    padding: 12px !important;
    margin-bottom: 8px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }

  h1 { font-size: 16px !important; }
  h2 { font-size: 14px !important; }

  /* Grids single column */
  .form-grid, .id-grid, .stat-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  /* Stat cards compact */
  .stat-card {
    padding: 10px !important;
  }
  .stat-card .stat-num {
    font-size: 22px !important;
  }
  .stat-card .stat-label {
    font-size: 11px !important;
  }

  /* Form elements bigger touch */
  input, select, textarea {
    font-size: 16px !important;
    min-height: 44px !important;
  }

  button {
    min-height: 40px !important;
    font-size: 13px !important;
  }

  .btn-sm {
    min-height: 32px !important;
    font-size: 11px !important;
    padding: 5px 8px !important;
  }

  /* Filter bar */
  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .filter-item {
    width: 100% !important;
  }

  /* Tables */
  .table-wrap {
    margin: 0 -12px !important;
    padding: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 700px !important;
    font-size: 12px !important;
  }

  th, td {
    padding: 6px 8px !important;
  }

  /* Modal bottom sheet */
  .modal-overlay {
    align-items: flex-end !important;
  }

  .modal-box {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 14px 14px 0 0 !important;
    max-height: 85vh !important;
  }

  /* Metric */
  .metric-value {
    font-size: 14px !important;
  }

  /* Section title */
  .section-title {
    font-size: 10px !important;
  }

  /* Photo viewer */
  .photo-viewer-overlay img {
    max-width: 95% !important;
    max-height: 70vh !important;
  }

  /* Calendar cells */
  .cal-cell {
    height: 34px !important;
    font-size: 10px !important;
  }

  .cal-cell .cal-date {
    font-size: 10px !important;
  }

  .cal-cell .cal-guest {
    font-size: 5px !important;
  }

  /* Body overflow */
  html, body, #app {
    overflow-x: hidden !important;
  }

  .app-container {
    display: flex !important;
    flex-direction: column !important;
    overflow-x: hidden !important;
  }
}

@media (max-width: 380px) {
  .main-content, .wrap, .ca-wrap {
    padding-top: 86px !important;
  }

  .sidebar-brand span {
    display: none !important;
  }

  .card {
    padding: 10px !important;
  }
}