/* Mobile-only UX (max-width: 768px) — desktop styles unchanged */

:root {
    --header-height: 52px;
    --bottom-nav-height: 62px;
    --mobile-gap: 12px;
    --mobile-radius: 12px;
    --touch-min: 44px;
}

/* Safe areas & touch */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    line-height: 1.45;
    font-size: 14px;
}

body.has-mobile-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}

body.mobile-nav-open.has-mobile-bottom-nav {
    padding-bottom: 0;
}

body.has-mobile-bottom-nav .dashboard-main {
    padding-bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom, 0px));
}

/* Compact sticky header */
.site-header {
    padding: 0;
    min-height: var(--header-height);
}

.site-header .container {
    padding: 0 12px;
    max-width: 100%;
}

.header-content {
    min-height: var(--header-height);
}

.logo img {
    height: 22px;
}

.header-right {
    gap: 6px;
}

.profile-name {
    display: none !important;
}

.profile-toggle {
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    align-items: center;
    justify-content: center;
}

.profile-avatar {
    width: 32px;
    height: 32px;
}

.profile-avatar .profile-gender-icon,
.profile-avatar svg,
.gender-human-icon svg {
    width: 16px;
    height: 16px;
}

.profile-dropdown {
    position: fixed;
    top: auto;
    bottom: calc(var(--bottom-nav-height) + 8px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    min-width: 0;
    border-radius: var(--mobile-radius);
    box-shadow: var(--shadow-medium);
}

.profile-menu.open .profile-dropdown {
    display: block;
}

/* Drawer sidebar */
.dashboard-layout {
    padding-top: var(--header-height);
}

.sidebar {
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: min(280px, 88vw);
    padding-top: calc(var(--header-height) + 8px);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-backdrop {
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.sidebar-top {
    display: none;
}

.sidebar-nav li a {
    min-height: var(--touch-min);
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-nav li a:active {
    background: rgba(246, 197, 109, 0.25);
}

.sidebar-nav li a i {
    width: 20px;
    height: 20px;
}

/* Main content */
.dashboard-main {
    padding: 14px 12px 20px;
    max-width: 100%;
}

.container {
    padding: 0 12px;
}

.dashboard-header {
    margin-bottom: 14px;
}

.dashboard-header > div:first-child {
    gap: 0;
}

.dashboard-header h1 {
    font-size: 1.35rem;
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.dashboard-header p {
    font-size: 0.75rem;
    margin-top: 4px;
    line-height: 1.35;
    color: var(--text-muted);
}

/* Stats: swipeable strip */
.dashboard-stats {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 16px;
    padding: 2px 2px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    grid-template-columns: unset;
}

.dashboard-stats::-webkit-scrollbar {
    display: none;
}

.dashboard-stat-card {
    flex: 0 0 min(148px, 42vw);
    scroll-snap-align: start;
    padding: 14px;
    border-radius: var(--mobile-radius);
}

.dashboard-stat-card .stat-value {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

.dashboard-stat-card .stat-label {
    font-size: 0.65rem;
    line-height: 1.25;
}

.dashboard-stat-card .stat-change {
    font-size: 0.65rem;
    margin-top: 4px;
}

/* Sections */
.dashboard-section {
    padding: 14px;
    margin-bottom: 14px;
    border-radius: var(--mobile-radius);
}

.section-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
}

.section-title-row h2 {
    font-size: 1rem;
}

.section-title-row .btn {
    width: 100%;
    text-align: center;
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.section-subtitle {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* Sticky filters on list pages */
.bookings-page .section-title-row,
.invoice-page .section-title-row {
    position: sticky;
    top: var(--header-height);
    z-index: 40;
    background: var(--warm-ivory);
    margin-left: -14px;
    margin-right: -14px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-warm);
}

.booking-month-filter,
.month-filter {
    width: 100%;
}

.custom-month-dropdown-toggle {
    min-height: var(--touch-min);
    font-size: 0.875rem;
}

/* Buttons — finger-friendly */
.btn {
    min-height: var(--touch-min);
    padding: 10px 18px;
    font-size: 0.875rem;
    border-radius: 999px;
    -webkit-tap-highlight-color: transparent;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 0.75rem;
}

/* Forms — prevent iOS zoom on focus */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 10px;
    min-height: var(--touch-min);
}

.form-group textarea {
    min-height: 100px;
}

/* Tabs — horizontal scroll pills */
.edit-listing-tabs,
.kyc-sub-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.edit-listing-tabs::-webkit-scrollbar,
.kyc-sub-tabs::-webkit-scrollbar {
    display: none;
}

.edit-tab,
.kyc-sub-tab {
    flex-shrink: 0;
    min-height: 40px;
    padding: 10px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Tables → card list (labels via JS data-label) */
.listings-table,
.hours-table,
.director-summary-table {
    display: block;
    overflow: visible;
    border: none;
}

.listings-table thead,
.hours-table thead,
.director-summary-table thead {
    display: none;
}

.listings-table tbody,
.hours-table tbody,
.director-summary-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.listings-table tbody tr,
.hours-table tbody tr,
.director-summary-table tbody tr {
    display: block;
    background: #ffffff;
    border: 1px solid var(--border-warm);
    border-radius: var(--mobile-radius);
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
}

.listings-table tbody tr:active,
.director-summary-table .director-summary-row:active {
    background: rgba(246, 197, 109, 0.08);
}

.listings-table td,
.hours-table td,
.director-summary-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 7px 0;
    border: none;
    font-size: 0.8125rem;
    text-align: right;
}

.listings-table td::before,
.hours-table td::before,
.director-summary-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: left;
    flex: 0 0 38%;
    line-height: 1.4;
    padding-top: 1px;
}

.listings-table td:empty {
    display: none;
}

.client-detail-link {
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Booking cards — scannable layout */
.bookings-mobile-cards tbody tr.booking-row {
    position: relative;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
}

.bookings-mobile-cards tbody tr.booking-row td {
    padding-left: 14px;
    padding-right: 14px;
}

.bookings-mobile-cards tbody tr.booking-row td:first-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 14px;
    padding-right: 88px;
    background: var(--soft-cream);
    border-bottom: 1px solid var(--border-warm);
    font-weight: 700;
    font-size: 0.875rem;
    text-align: left;
}

.bookings-mobile-cards tbody tr.booking-row td:first-child::before {
    content: 'Booking ID';
    font-weight: 600;
    font-size: 0.625rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(7) {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
    padding: 0;
    display: block;
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(7)::before {
    display: none;
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(2) {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding-top: 12px;
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(2)::before {
    display: none;
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(2) .client-name {
    font-size: 0.9375rem;
    font-weight: 600;
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(6) {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(6)::before {
    content: 'Amount';
}

.bookings-mobile-cards tbody tr.booking-row td:nth-child(7) ~ td.booking-row-action,
.bookings-mobile-cards tbody tr.booking-row td.booking-row-action {
    display: block;
    padding: 0 14px 14px;
    border-top: none;
}

.bookings-mobile-cards tbody tr.booking-row td.booking-row-action::before {
    display: none;
}

.bookings-mobile-cards tbody tr.booking-row td.booking-row-action .btn {
    width: 100%;
}

/* Dashboard recent tables — simpler cards */
.dashboard-section .listings-table tbody tr {
    padding: 12px;
}

.dashboard-section .listings-table td:nth-child(1) {
    font-weight: 600;
    font-size: 0.875rem;
}

.dashboard-section .listings-table td:nth-child(1)::before {
    display: none;
}

.dashboard-section .listings-table td {
    padding: 5px 0;
}

/* Booking detail */
.booking-summary-bar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
    margin-bottom: 14px;
}

.booking-summary-item strong {
    font-size: 0.8125rem;
}

.detail-info-grid {
    grid-template-columns: 1fr;
    gap: 12px;
}

.detail-info-value {
    font-size: 0.875rem;
}

.director-summary-row {
    cursor: pointer;
}

.director-summary-name {
    flex-direction: column;
    align-items: flex-end !important;
    text-align: right;
}

.director-summary-name::before {
    align-self: flex-start;
}

/* Documents, leads, uploads */
.document-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
}

.document-info {
    flex-direction: column;
    align-items: flex-start;
}

.document-item .btn,
.document-upload-btn {
    width: 100%;
    min-height: 40px;
}

.lead-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
}

.lead-meta {
    text-align: left;
}

.upload-zone {
    padding: 28px 16px;
}

.invoice-upload-section {
    padding: 14px;
}

.image-upload-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Auth */
.auth-page {
    padding: calc(var(--header-height) + 20px) 12px 32px;
    align-items: flex-start;
}

.auth-card {
    padding: 24px 18px;
    border-radius: var(--mobile-radius);
}

.auth-header h1 {
    font-size: 1.35rem;
}

/* Bottom navigation */
.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 950;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    min-height: var(--bottom-nav-height);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
}

.mobile-bottom-nav a i,
.mobile-bottom-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mobile-bottom-nav a span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-bottom-nav a.active {
    color: var(--text-primary);
}

.mobile-bottom-nav a.active i,
.mobile-bottom-nav a.active svg {
    color: var(--warm-accent);
    stroke: var(--warm-accent);
}

.mobile-bottom-nav a:active {
    background: rgba(246, 197, 109, 0.12);
}

/* Hide bottom nav when sidebar or profile open */
body.mobile-nav-open .mobile-bottom-nav,
body.profile-open .mobile-bottom-nav {
    opacity: 0;
    pointer-events: none;
}

.status-badge {
    font-size: 0.625rem;
    padding: 4px 10px;
}

.invoice-status-btn {
    font-size: 0.625rem;
}

.settings-form .btn-primary {
    width: 100%;
    min-height: var(--touch-min);
}

.gender-options {
    flex-direction: column;
}

.gender-option {
    min-width: 0;
}

.gender-option-box {
    padding: 12px 14px;
    min-height: var(--touch-min);
}
