/* ================================================
   Cleaning Management System — app.css
   ================================================ */

/* ── Reset & variables ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand:        #2F5897;
    --brand-light:  #e8eef6;
    --brand-dark:   #1e3d6b;
    --green:        #2F5897;
    --green-light:  #e8eef6;
    --green-dark:   #1e3d6b;
    --status-green:       #2d7a4f;
    --status-green-light: #e8f5ee;
    --status-green-dark:  #1a5235;
    --blue:         #1a6fad;
    --orange:       #e07b39;
    --red:          #c0392b;
    --gray-50:      #f8f9fa;
    --gray-100:     #f1f3f5;
    --gray-200:     #e9ecef;
    --gray-300:     #dee2e6;
    --gray-500:     #adb5bd;
    --gray-600:     #6c757d;
    --gray-800:     #343a40;
    --white:        #ffffff;
    --radius:       8px;
    --radius-lg:    12px;
    --shadow:       0 2px 8px rgba(0,0,0,.10);
    --shadow-lg:    0 4px 20px rgba(0,0,0,.15);
    --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --header-h:     60px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Header ───────────────────────────────────── */
.app-header {
    position: sticky; top: 0; z-index: 200;
    background: var(--green);
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    /* Auto-expand for iOS notch / Dynamic Island */
    height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
}
.header-inner {
    max-width: 1280px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px;
    height: var(--header-h); padding: 0 20px;
}
.app-logo {
    font-size: 1.1rem; font-weight: 800;
    color: #fff; text-decoration: none; white-space: nowrap;
    letter-spacing: -.01em;
    display: flex; align-items: center; gap: 6px;
}
.app-logo-icon {
    height: 28px; width: auto;
    filter: brightness(0) invert(1);
}
.app-logo-text {
    font-size: 1.05rem; font-weight: 800; letter-spacing: .06em;
}
.app-badge {
    font-size: .65rem; font-weight: 700; letter-spacing: .04em;
    background: rgba(255,255,255,.22); color: #fff;
    padding: 2px 8px; border-radius: 4px;
    text-transform: uppercase;
    text-decoration: none; white-space: nowrap;
    transition: background .15s;
}
.app-badge:hover { background: rgba(255,255,255,.35); color: #fff; text-decoration: none; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a {
    padding: 7px 13px; border-radius: var(--radius);
    color: rgba(255,255,255,.85); text-decoration: none;
    font-size: .88rem; font-weight: 500;
    transition: background .15s, color .15s;
}
.main-nav a:hover, .main-nav a.active {
    background: rgba(255,255,255,.18); color: #fff;
}
/* ── Admin dropdown ────────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 13px; border-radius: var(--radius);
    color: rgba(255,255,255,.85); text-decoration: none;
    font-size: .88rem; font-weight: 500;
    transition: background .15s, color .15s;
    background: none; border: none; cursor: pointer;
    font-family: var(--font);
}
.nav-dropdown-toggle:hover, .nav-dropdown-toggle.active {
    background: rgba(255,255,255,.18); color: #fff;
}
.nav-dropdown-toggle.open { background: rgba(255,255,255,.22); color: #fff; }
.nav-dropdown-chevron {
    transition: transform .2s;
}
.nav-dropdown-toggle.open .nav-dropdown-chevron {
    transform: rotate(180deg);
}
.nav-dropdown-menu {
    display: none;
    position: absolute; top: calc(100% + 6px); left: 0;
    background: var(--white); border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06);
    min-width: 220px; padding: 6px 0;
    z-index: 300;
}
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu .nav-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px; font-size: .86rem; font-weight: 500;
    color: var(--gray-800); text-decoration: none;
    transition: background .12s;
}
.nav-dropdown-menu .nav-dropdown-item:hover { background: var(--gray-50); color: var(--gray-800); }
.nav-dropdown-menu .nav-dropdown-item.current {
    background: var(--brand-light); color: var(--brand-dark); font-weight: 600;
}
.nav-dropdown-icon {
    font-size: .92rem; width: 22px; text-align: center; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.nav-dropdown-icon svg {
    width: 16px; height: 16px; stroke: var(--gray-600); flex-shrink: 0;
}
.nav-dropdown-item:hover .nav-dropdown-icon svg,
.nav-dropdown-item.current .nav-dropdown-icon svg {
    stroke: var(--brand);
}
.nav-dropdown-divider {
    height: 1px; background: var(--gray-200); margin: 4px 12px;
}
.nav-dropdown-section {
    padding: 8px 16px 4px;
    font-size: .68rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-top: 1px solid var(--gray-200);
    margin-top: 4px;
}

.header-right {
    display: flex; align-items: center; gap: 14px;
    margin-left: auto;
}

/* ── Service switcher pill ─────────────────────── */
.svc-switch {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px 4px 8px; border-radius: 20px;
    font-size: .78rem; font-weight: 600; letter-spacing: .02em;
    text-decoration: none; transition: all .15s ease;
    white-space: nowrap;
}
.svc-switch-icon { font-size: .85rem; line-height: 1; }
.svc-switch-label { line-height: 1; }
.svc-switch--aicom {
    background: rgba(59,130,246,.15); color: #93bbfc;
    border: 1px solid rgba(59,130,246,.25);
}
.svc-switch--aicom:hover {
    background: rgba(59,130,246,.25); color: #fff;
    text-decoration: none;
}
.svc-switch-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 10px; font-size: .62rem; font-weight: 700;
    line-height: 1; background: #ef4444; color: #fff;
    margin-left: 2px;
}
.svc-switch--cleaning {
    background: rgba(16,185,129,.15); color: #6ee7b7;
    border: 1px solid rgba(16,185,129,.25);
}
.svc-switch--cleaning:hover {
    background: rgba(16,185,129,.25); color: #fff;
    text-decoration: none;
}

/* ── Service pill (cross-service switcher) ────── */
.svc-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 4px;
    font-size: .78rem; font-weight: 600; letter-spacing: .02em;
    text-decoration: none; white-space: nowrap;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.18);
    transition: all .15s ease;
    line-height: 1.4;
}
.svc-pill:hover {
    background: rgba(255,255,255,.22);
    color: #fff;
    text-decoration: none;
}

/* ── User dropdown ─────────────────────────────── */
.user-dropdown-menu { right: 0; left: auto; min-width: 240px; }
.user-dropdown-header {
    padding: 12px 16px 10px; display: flex; flex-direction: column; gap: 2px;
}
.user-dropdown-name { font-weight: 700; font-size: .92rem; color: var(--gray-800); }
.user-dropdown-role { font-size: .76rem; color: var(--gray-500); }
.user-dropdown-lang {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px;
}
.user-dropdown-lang-btns { display: flex; gap: 4px; margin-left: auto; }
.lang-chip {
    display: inline-block; padding: 3px 9px; border-radius: 4px;
    font-size: .74rem; font-weight: 700; cursor: pointer;
    background: var(--gray-100); color: var(--gray-600);
    border: 1px solid var(--gray-200); transition: background .15s;
    font-family: var(--font);
}
.lang-chip:hover { background: var(--gray-200); }
.lang-chip--active {
    background: var(--brand); color: #fff; border-color: var(--brand);
    cursor: default;
}
.user-dropdown-logout { color: var(--red); }
.user-dropdown-logout:hover { background: #fef2f2; }

/* ── Admin breadcrumb ─────────────────────────── */
.admin-breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: .82rem; color: var(--gray-500);
    margin-bottom: 4px;
}
.admin-breadcrumb a {
    color: var(--brand); text-decoration: none; font-weight: 500;
}
.admin-breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--gray-400); }
.breadcrumb-current { color: var(--gray-600); font-weight: 500; }

/* ── Flash messages ───────────────────────────── */
.flash {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; font-size: .9rem;
    border-left: 4px solid transparent;
}
.flash-success { background: #d4edda; color: #155724; border-color: #28a745; }
.flash-error   { background: #f8d7da; color: #721c24; border-color: var(--red); }
.flash-warning { background: #fff3cd; color: #856404; border-color: #ffc107; }
.flash-info    { background: #d1ecf1; color: #0c5460; border-color: var(--blue); }
.flash-close {
    background: none; border: none; font-size: 1.2rem;
    cursor: pointer; color: inherit; opacity: .6; padding: 0 4px;
}
.flash-close:hover { opacity: 1; }

/* ── Main layout ──────────────────────────────── */
.main-content { max-width: 1280px; margin: 24px auto; padding: 0 20px; }
.app-footer { text-align: center; padding: 24px; color: var(--gray-500); font-size: .8rem; }

/* -- Mobile bottom tabs (hidden on desktop) -- */
.btm-tabs { display: none; }

/* ── Page header ──────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.page-title { font-size: 1.4rem; font-weight: 700; }

/* ── Cards ────────────────────────────────────── */
.card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}
.card-title { font-size: 1rem; font-weight: 700; }

/* ── Stat cards ───────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 20px; text-align: center;
}
.stat-value { font-size: 2.2rem; font-weight: 800; color: var(--green); }
.stat-label { font-size: .8rem; color: var(--gray-600); margin-top: 4px; }

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    font-size: .88rem; font-weight: 600; cursor: pointer;
    border: none; text-decoration: none;
    transition: filter .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover { filter: brightness(.9); }
.btn:active { filter: brightness(.8); }
.btn-primary   { background: var(--green); color: #fff; }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-warning   { background: #fbbf24; color: #78350f; }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 5px;
    font-size: .86rem; font-weight: 600;
}
.form-group input:not([type=checkbox]),
.form-group select,
.form-group textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: .9rem; font-family: var(--font);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(45,122,79,.15);
}
.form-group small { display: block; margin-top: 4px; color: var(--gray-600); font-size: .78rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Tables ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead { background: var(--gray-50); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-200); }
th { font-weight: 700; color: var(--gray-600); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr:hover { background: var(--gray-50); }
.table-actions { display: flex; gap: 6px; }

/* ── Mobile card layout (R7: replaces tables on small screens) ── */
.m-card {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
}
.m-card:last-child { border-bottom: none; }
.m-card-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
    margin-bottom: 8px;
}
.m-card-body { margin-bottom: 8px; }
.m-card-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 0; font-size: .84rem;
}
.m-card-label { color: var(--gray-500); font-size: .78rem; }
.m-card-actions {
    display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px;
    border-top: 1px solid var(--gray-100);
}

/* ── Badges ───────────────────────────────────── */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
}
.badge-not_assigned       { background: #fee2e2; color: #991b1b; }  /* red — needs attention */
.badge-pending_acceptance { background: #fef3c7; color: #92400e; }  /* amber — waiting */
.badge-assigned           { background: #dbeafe; color: #1e40af; }  /* blue — assigned */
.badge-in_progress        { background: #ede9fe; color: #5b21b6; }  /* purple — active work */
.badge-completed          { background: var(--status-green-light); color: var(--status-green-dark); }  /* green — done */
.badge-cancelled          { background: var(--gray-200); color: var(--gray-600); }  /* grey */
/* Guest status badges (occupancy layer) */
.badge-guest-checked_in   { background: #fef3c7; color: #92400e; }  /* amber — guests in room */
.badge-guest-checked_out  { background: #d1fae5; color: #065f46; }  /* green — room vacated */

/* Quick guest-status toggle buttons */
.btn-guest-toggle {
    display: inline-block; padding: 4px 10px; font-size: .78rem; font-weight: 600;
    border: 1px solid; border-radius: 6px; cursor: pointer; background: transparent;
    transition: background .15s, opacity .15s;
}
.btn-guest-checkin  { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.btn-guest-checkin:hover  { background: #fef3c7; }
.btn-guest-checkout { color: #065f46; border-color: #86efac; background: #f0fdf4; }
.btn-guest-checkout:hover { background: #d1fae5; }
.badge-admin   { background: #fde8e8; color: #922b21; }
.badge-manager { background: #fef9c3; color: #7d6608; }
.badge-cleaner { background: var(--brand-light); color: var(--brand-dark); }
.badge-reported           { background: #fee2e2; color: #991b1b; }  /* red — needs triage */
.badge-rule    { background: #ede9fe; color: #5b21b6; }
.badge-day_of_week { background: #dbeafe; color: #1e40af; }
.badge-room    { background: #fef3c7; color: #92400e; }
.badge-date_range { background: #d1fae5; color: #065f46; }
.badge-overflow { background: #fee2e2; color: #991b1b; }

/* ── Today filter bar (admin/manager) ─────── */
.today-filter-bar {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 12px; padding: 0 2px;
}
.today-filter-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px; border-radius: 20px;
    font-size: .78rem; font-weight: 600;
    background: var(--white); color: var(--gray-600);
    border: 1px solid var(--gray-300); cursor: pointer;
    transition: all .15s; font-family: var(--font);
}
.today-filter-chip:hover { background: var(--gray-50); border-color: var(--brand); color: var(--brand); }
.today-filter-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.today-filter-chip--warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.today-filter-chip--warn:hover { border-color: #f59e0b; }
.today-filter-chip--warn.active { background: #d97706; color: #fff; border-color: #d97706; }
.today-filter-count {
    font-size: .68rem; font-weight: 700; opacity: .7;
}

/* ── Task cards (cleaner view) ────────────────── */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.task-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    border-left: 5px solid var(--gray-300);
}
.task-card.status-not_assigned       { border-left-color: #dc2626; }  /* red */
.task-card.status-pending_acceptance { border-left-color: #d97706; }  /* amber */
.task-card.status-assigned           { border-left-color: #2563eb; }  /* blue */
.task-card.status-in_progress        { border-left-color: #7c3aed; }  /* purple */
.task-card.status-completed          { border-left-color: var(--status-green); opacity: .8; }  /* green */
.task-card.status-cancelled          { border-left-color: var(--gray-500); opacity: .6; }  /* grey */
.task-card-header {
    padding: 14px 16px 10px;
    display: flex; align-items: flex-start; justify-content: space-between;
}
.task-room { font-weight: 700; font-size: 1.05rem; }
.task-card-body { padding: 0 16px 14px; }
.task-times { display: flex; gap: 20px; margin-bottom: 10px; }
.task-time-item .time-label { color: var(--gray-600); font-size: .75rem; display: block; }
.task-time-item .time-value { font-weight: 700; font-size: 1.1rem; }
.task-meta { font-size: .84rem; color: var(--gray-600); margin-bottom: 4px; }
.task-card-footer {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--gray-100);
    display: flex; gap: 8px; flex-wrap: wrap;
}

/* ── Calendar grid ────────────────────────────── */
.cal-grid { border-radius: var(--radius); overflow: hidden; }
.cal-header {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--green); color: #fff;
}
.cal-dow {
    text-align: center; padding: 10px 4px;
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
}
.cal-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
    border-right: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    min-height: 110px; padding: 6px;
    background: var(--white);
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell--empty { background: var(--gray-50); }
.cal-cell--today { background: #fffbea; }
.cal-day-num {
    display: flex; align-items: center; gap: 5px; margin-bottom: 4px;
}
.cal-day-link {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .88rem; font-weight: 700; color: var(--gray-800);
    text-decoration: none;
}
.cal-day-link:hover { background: var(--gray-200); }
.cal-day-link.today { background: var(--green); color: #fff; }
.cal-task-count {
    font-size: .7rem; font-weight: 700;
    background: var(--gray-200); color: var(--gray-600);
    padding: 1px 5px; border-radius: 10px;
}
.cal-pill {
    display: block; font-size: .72rem; padding: 3px 6px;
    border-radius: 4px; text-decoration: none; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-left: 3px solid transparent; cursor: pointer;
    transition: filter .1s;
}
.cal-pill:hover { filter: brightness(.93); }
.cal-pill-more { color: var(--gray-600); background: var(--gray-100); }
.pill-not_assigned       { background: #fee2e2; border-left-color: #dc2626; }  /* red */
.pill-pending_acceptance { background: #fef3c7; border-left-color: #d97706; }  /* amber */
.pill-assigned           { background: #dbeafe; border-left-color: #2563eb; }  /* blue */
.pill-in_progress        { background: #ede9fe; border-left-color: #7c3aed; }  /* purple */
.pill-completed          { background: var(--status-green-light); border-left-color: var(--status-green); }  /* green */
.pill-cancelled          { background: var(--gray-100); border-left-color: var(--gray-500); }  /* grey */

/* ── Week grid ────────────────────────────────── */
.week-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden;
}
.week-col { border-right: 1px solid var(--gray-200); min-height: 160px; }
.week-col:last-child { border-right: none; }
.week-col-header {
    padding: 8px 10px 6px; border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50); display: flex; align-items: center; gap: 6px;
}
.week-col--today .week-col-header { background: var(--green-light); }
.week-dow { font-size: .7rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; }
.week-day-num { font-size: .88rem; font-weight: 700; }
.week-day-link { text-decoration: none; color: var(--gray-800); }
.week-today-badge {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--green); color: #fff; font-size: .82rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.week-tasks { padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.week-pill {
    font-size: .73rem; padding: 4px 7px; border-radius: 5px;
    cursor: pointer; line-height: 1.4; border-left: 3px solid transparent;
    transition: filter .1s;
}
.week-pill:hover { filter: brightness(.92); }
.week-pill .pill-room { display: block; font-weight: 700; }
.week-pill .pill-meta { display: block; color: var(--gray-600); font-size: .68rem; }

/* ── Modal ────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
    max-height: 90vh; display: flex; flex-direction: column;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
    position: sticky; top: 0; background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title { font-weight: 700; font-size: 1.05rem; }
.modal-close {
    background: none; border: none; font-size: 1.3rem;
    cursor: pointer; color: var(--gray-500); padding: 2px 8px;
    border-radius: 4px; line-height: 1;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-800); }
.modal-body { padding: 20px; overflow-y: auto; }

/* ── Detail rows (inside modal) ───────────────── */
.detail-row { display: flex; gap: 10px; margin-bottom: 10px; font-size: .9rem; }
.detail-label { font-weight: 600; color: var(--gray-600); min-width: 130px; flex-shrink: 0; }
.detail-divider { border: none; border-top: 1px solid var(--gray-200); margin: 14px 0; }

/* ── Filters bar ──────────────────────────────── */
.filters {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
    padding: 14px 16px; background: var(--white);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.filter-group { display: flex; flex-direction: column; gap: 3px; }
.filter-group label { font-size: .78rem; font-weight: 700; color: var(--gray-600); }
.filter-group input,
.filter-group select {
    padding: 6px 10px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: .86rem; font-family: var(--font); background: var(--white);
}
.filter-group input:focus, .filter-group select:focus {
    outline: none; border-color: var(--green);
}

/* ── Nav tabs ─────────────────────────────────── */
.tab-nav { display: flex; gap: 4px; margin-bottom: 16px; }
.tab-btn {
    padding: 7px 14px; border-radius: var(--radius);
    font-size: .86rem; font-weight: 600; cursor: pointer;
    background: var(--gray-200); color: var(--gray-800); border: none;
    text-decoration: none; transition: background .15s;
}
.tab-btn.active, .tab-btn:hover { background: var(--green); color: #fff; }

/* ── Alert ────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: .9rem; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-info  { background: #d1ecf1; color: #0c5460; }

/* ── Login page ───────────────────────────────── */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: var(--white); border-radius: var(--radius-lg);
    padding: 40px 36px; box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 8px; }
.login-logo-img { height: 48px; width: auto; }
.login-title { font-size: 1.4rem; font-weight: 800; text-align: center; color: var(--green-dark); margin-bottom: 4px; }
.login-lang { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.login-form { margin-top: 20px; }

/* ── Responsive ───────────────────────────────── */

/* ── Hamburger menu ──────────────────────────── */
.hamburger {
    display: none; background: none; border: none; cursor: pointer;
    padding: 8px; margin-left: auto; z-index: 210;
}
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: #fff; margin: 5px 0;
    transition: transform .2s, opacity .2s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

.nav-collapse {
    display: flex; align-items: center; flex: 1; gap: 12px;
}

/* ── Medium screens: compact header items ────── */
@media (max-width: 1100px) {
    .sync-badge-label { display: none; }
    .plan-pill { font-size: .68rem; padding: 2px 6px; }
    .plan-pill-trial { font-size: .6rem; }
    .header-right { gap: 8px; }
    .svc-pill { padding: 3px 8px; font-size: .72rem; }
}

@media (max-width: 768px) {
    .hamburger { display: block; }

    .nav-collapse {
        display: none;
        position: fixed;
        top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
        left: 0; right: 0;
        background: var(--green-dark); flex-direction: column;
        padding: 16px 20px; gap: 12px; z-index: 200;
        box-shadow: 0 4px 12px rgba(0,0,0,.3);
        max-height: calc(100vh - var(--header-h) - env(safe-area-inset-top, 0px));
        overflow-y: auto;
    }
    .nav-collapse.open { display: flex; }

    .main-nav { flex-direction: column; width: 100%; gap: 2px; }
    .main-nav a {
        padding: 12px 16px; font-size: 1rem;
        border-radius: var(--radius); min-height: 44px;
        display: flex; align-items: center;
    }

    /* Admin dropdown: inline expand on mobile */
    .nav-dropdown { width: 100%; }
    .nav-dropdown-toggle {
        width: 100%; padding: 12px 16px; font-size: 1rem;
        min-height: 44px; justify-content: space-between;
    }
    .nav-dropdown-menu {
        position: static; box-shadow: none;
        background: rgba(0,0,0,.15); border-radius: var(--radius);
        margin: 2px 0 0; padding: 4px 0;
    }
    .nav-dropdown-menu .nav-dropdown-item {
        color: rgba(255,255,255,.9); padding: 10px 20px;
        font-size: .92rem; min-height: 42px;
    }
    .nav-dropdown-menu .nav-dropdown-item:hover { background: rgba(255,255,255,.1); }
    .nav-dropdown-menu .nav-dropdown-item.current {
        background: rgba(255,255,255,.15); color: #fff;
    }
    .nav-dropdown-divider { background: rgba(255,255,255,.15); margin: 4px 16px; }

    .header-right { width: 100%; flex-direction: column; gap: 12px; align-items: stretch; }
    .svc-switch { justify-content: center; padding: 10px 16px; font-size: .9rem; border-radius: var(--radius); }
    .svc-pill { justify-content: center; padding: 8px 16px; font-size: .88rem; border-radius: var(--radius); }

    /* User dropdown: inline expand on mobile (like admin dropdown) */
    #userDropdown { width: 100%; }
    #userDropdown .nav-dropdown-toggle {
        width: 100%; padding: 12px 16px; font-size: 1rem;
        min-height: 44px; justify-content: flex-start;
    }
    #userDropdown .nav-dropdown-toggle svg:first-child { margin-right: 4px; }
    .user-dropdown-menu.open {
        position: static; box-shadow: none;
        background: rgba(0,0,0,.15); border-radius: var(--radius);
        margin: 2px 0 0; padding: 4px 0; min-width: 0;
    }
    .user-dropdown-header {
        padding: 10px 20px; color: rgba(255,255,255,.9);
    }
    .user-dropdown-name { color: #fff; }
    .user-dropdown-role { color: rgba(255,255,255,.6); }
    .user-dropdown-lang {
        padding: 8px 20px;
    }
    .user-dropdown-lang .nav-dropdown-icon { color: rgba(255,255,255,.9); }
    .user-dropdown-menu .nav-dropdown-item {
        color: rgba(255,255,255,.9); padding: 10px 20px;
        font-size: .92rem; min-height: 42px;
    }
    .user-dropdown-menu .nav-dropdown-item:hover { background: rgba(255,255,255,.1); }
    .user-dropdown-logout { color: #fca5a5 !important; }
    .user-dropdown-logout:hover { background: rgba(255,255,255,.1) !important; }
    .user-dropdown-menu .nav-dropdown-divider { background: rgba(255,255,255,.15); margin: 4px 16px; }
    .lang-chip { background: rgba(255,255,255,.15); color: rgba(255,255,255,.9); border-color: rgba(255,255,255,.2); }
    .lang-chip:hover { background: rgba(255,255,255,.25); }
    .lang-chip--active { background: #fff; color: var(--brand); border-color: #fff; }

    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .task-grid { grid-template-columns: 1fr; }

    /* Calendar: simplified on mobile */
    .cal-cell { min-height: 60px; padding: 3px; }
    .cal-pill { font-size: .62rem; padding: 2px 4px; }
    .cal-dow { padding: 6px 2px; font-size: .65rem; }
    .cal-day-link { width: 22px; height: 22px; font-size: .78rem; }

    /* Week grid: stack vertically on mobile */
    .week-grid { grid-template-columns: 1fr; }

    .filters { flex-direction: column; align-items: stretch; }
    .login-card { padding: 28px 20px; }

    /* Task detail: single column on mobile */
    .task-detail-layout { grid-template-columns: 1fr !important; }

    /* Ensure buttons are touch-friendly (min 44px) */
    .btn { min-height: 44px; padding: 10px 16px; }
    .btn-sm { min-height: 38px; padding: 8px 12px; }
    .form-group input, .form-group select, .form-group textarea { min-height: 44px; font-size: 16px; }

    /* Page header stack on mobile */
    .page-header { flex-direction: column; align-items: flex-start; }

    /* Table: improve scrollability */
    .table-wrap { -webkit-overflow-scrolling: touch; }

    /* R7: Mobile card layout for admin tables */
    .hide-mobile-card { display: none !important; }
    .show-mobile-card { display: block !important; }

    .modal { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
    .modal-backdrop { align-items: flex-end; }

    /* Bottom tabs: visible on mobile */
    .btm-tabs {
        display: flex;
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--white);
        box-shadow: 0 -1px 8px rgba(0,0,0,.12);
        z-index: 190;
        padding-bottom: env(safe-area-inset-bottom, 0);
        border-top: 1px solid var(--gray-200);
    }
    .btm-tab {
        flex: 1;
        display: flex; flex-direction: column; align-items: center;
        justify-content: center; gap: 2px;
        padding: 8px 4px 6px;
        text-decoration: none;
        color: var(--gray-500);
        font-size: .65rem; font-weight: 600;
        transition: color .15s;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }
    .btm-tab:active { background: var(--gray-50); }
    .btm-tab--active {
        color: var(--brand);
    }
    .btm-tab-icon {
        width: 22px; height: 22px;
    }
    .btm-tab-label {
        line-height: 1;
    }
    .btm-tab-badge {
        position: absolute; top: 2px; right: calc(50% - 18px);
        background: #ef4444; color: #fff;
        font-size: .58rem; font-weight: 700;
        min-width: 16px; height: 16px;
        border-radius: 8px; padding: 0 4px;
        display: flex; align-items: center; justify-content: center;
        line-height: 1;
    }

    /* Add bottom padding so content isn't hidden behind tabs */
    .main-content { padding-bottom: 72px; }
    .app-footer { padding-bottom: 72px; }

}

/* ── Small phones ──────────────────────────────── */
@media (max-width: 480px) {
    .main-content { padding: 0 10px; margin: 12px auto; }
    .stats-grid { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    .app-logo { font-size: .95rem; }
    .page-title { font-size: 1.15rem; }
}

/* ── Error pages ──────────────────────────────── */
.error-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    padding: 20px; text-align: center;
}
.error-page-inner { max-width: 400px; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--green); margin: 8px 0; }
.error-message { color: var(--gray-600); margin-bottom: 8px; }
.error-detail { color: var(--gray-500); font-size: .88rem; margin-bottom: 24px; }

/* ── (former Print styles location — now moved below) ─────────────────────────────── */
/* ══════════════════════════════════════════════════
   UX Enhancement: Prominent card actions + mobile (1st copy — inside old @media print, now freed)
   ══════════════════════════════════════════════════ */

/* Done cards: faded */
.task-card--done { opacity: .55; }
.task-card--done:hover { opacity: .75; }

/* Primary action: full-width prominent button */
.task-action-primary { width: 100%; margin-bottom: 6px; }

/* Complete button: green (distinct from brand blue) */
.btn-complete { background: #16a34a; color: #fff; }
.btn-complete:hover { filter: brightness(.9); }

/* Secondary actions row */
.task-action-secondary {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; gap: 12px;
}

/* Text-style link buttons (replace bulky btn-secondary for details/reject) */
.btn-link {
    background: none; border: none; color: var(--brand);
    font-size: .82rem; font-weight: 600; cursor: pointer;
    padding: 2px 0; text-decoration: none; font-family: var(--font);
}
.btn-link:hover { text-decoration: underline; }
.btn-link--danger { color: var(--red); }
.btn-link--danger:hover { color: #991b1b; }

/* Assign form inline layout */
.task-action-assign {
    display: flex; gap: 6px; align-items: center;
    width: 100%; margin-bottom: 6px;
}
.assign-select {
    flex: 1; padding: 6px 10px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: .84rem; font-family: var(--font); background: var(--white);
}

/* Mobile: collapse card body for cleaners, expand on tap */
@media (max-width: 600px) {
    .role-cleaner .task-card-body.task-card-expand { display: none; }
    .role-cleaner .task-card-body.task-card-expand.expanded { display: block; }
    .role-cleaner .task-card-header { cursor: pointer; }
    .role-cleaner .task-card-header::after {
        content: '▸'; font-size: .75rem; color: var(--gray-500);
        margin-left: auto; padding-left: 8px; transition: transform .2s;
    }
    .role-cleaner .task-card-header.expanded::after { transform: rotate(90deg); }
}

/* Mobile: responsive table for list views */
@media (max-width: 768px) {
    .task-list-responsive thead { display: none; }
    .task-list-responsive tbody tr {
        display: flex; flex-wrap: wrap; gap: 4px 12px;
        padding: 12px; border-bottom: 1px solid var(--gray-200); align-items: center;
    }
    .task-list-responsive tbody td { border: none; padding: 2px 0; font-size: .88rem; }
    .task-list-responsive tbody td:first-child { width: 100%; font-size: 1rem; }
    .task-list-responsive .td-hide-mobile { display: none; }
}

/* Calendar pill quick-action button (shown on hover) */
.cal-pill-wrap { position: relative; }
.cal-pill-action {
    display: none; position: absolute; right: 2px; top: 50%;
    transform: translateY(-50%); background: var(--brand); color: #fff;
    border: none; border-radius: 4px; font-size: .6rem; font-weight: 700;
    padding: 2px 5px; cursor: pointer; z-index: 5; font-family: var(--font);
}
.cal-pill-wrap:hover .cal-pill-action { display: inline-block; }
.cal-pill-action:hover { filter: brightness(.85); }
.cal-pill-action--green { background: #16a34a; }

/* ── Manager: My Tasks section ── */
.my-tasks-section {
    background: var(--blue-50, #eff6ff);
    border: 2px solid var(--brand, #2F5897);
    border-radius: var(--radius-lg, 12px);
    padding: 12px 16px 16px;
    margin-bottom: 20px;
}
.my-tasks-label {
    color: var(--brand, #2F5897) !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    margin-bottom: 4px !important;
    padding-bottom: 0 !important;
}
.my-tasks-progress {
    margin-bottom: 12px;
}
.team-section-label {
    color: var(--gray-600) !important;
    font-weight: 600 !important;
    font-size: .95rem !important;
    margin-top: 8px !important;
    margin-bottom: 8px !important;
    padding-bottom: 4px !important;
    border-bottom: 1px solid var(--gray-200);
}

/* Manager bottom tab: report issue button (same as cleaner) */
.role-manager .btm-tab-report .btm-tab-icon { stroke-width: 2.5; }

/* ═══════════════════════════════════════════════════
   Tier 2: Toast Notifications
   ═══════════════════════════════════════════════════ */
#toast-container {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    z-index: 99999; display: flex; flex-direction: column-reverse;
    align-items: center; gap: 8px; pointer-events: none; width: 90%; max-width: 380px;
}
.toast {
    background: #1e293b; color: #fff; padding: 10px 20px;
    border-radius: 10px; font-size: .88rem; font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    opacity: 0; transform: translateY(12px) scale(.95);
    transition: opacity .25s, transform .25s;
    pointer-events: auto; text-align: center;
    line-height: 1.4;
}
.toast--visible {
    opacity: 1; transform: translateY(0) scale(1);
}
.toast--exit {
    opacity: 0; transform: translateY(-8px) scale(.95);
}
.toast--success { background: #16a34a; }
.toast--error   { background: #dc2626; }
.toast--info    { background: var(--brand, #2F5897); }

@media (min-width: 769px) {
    #toast-container { bottom: 32px; }
}

/* ═══════════════════════════════════════════════════
   Tier 2: Pull-to-Refresh
   ═══════════════════════════════════════════════════ */
#ptr-indicator {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%) translateY(-60px);
    z-index: 99998; display: flex; align-items: center; gap: 8px;
    background: var(--brand, #2F5897); color: #fff;
    padding: 8px 20px; border-radius: 0 0 12px 12px;
    font-size: .82rem; font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    opacity: 0; transition: transform .15s ease-out, opacity .15s;
    pointer-events: none;
}
.ptr-arrow {
    font-size: 1.1rem; transition: transform .2s;
}
#ptr-indicator.ptr--ready .ptr-arrow {
    transform: rotate(180deg);
}
#ptr-indicator.ptr--loading .ptr-arrow {
    animation: syncSpin .6s linear infinite;
}

/* ═══════════════════════════════════════════════════
   Tier 2: AJAX task card transitions
   ═══════════════════════════════════════════════════ */
.task-card {
    transition: opacity .3s, box-shadow .3s;
}
.task-card[data-submitting] {
    opacity: .6; pointer-events: none;
}

/* ══════════════════════════════════════════════════
   TIER 1 — Mobile UX Improvements
   ══════════════════════════════════════════════════ */

/* ── 1. Today progress bar ─────────────────────── */
.today-header { margin-bottom: 12px; }
.today-header-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; flex-wrap: wrap;
}
.today-header-actions { display: flex; gap: 6px; }
.today-date-sub {
    font-size: .75em; font-weight: 400; color: var(--gray-600);
}
.today-progress {
    margin-top: 10px;
}
.today-progress-bar {
    height: 8px; background: var(--gray-200); border-radius: 8px;
    overflow: hidden;
}
.today-progress-fill {
    height: 100%; border-radius: 8px;
    background: linear-gradient(90deg, var(--brand) 0%, #4a8ad4 100%);
    transition: width .6s ease;
    min-width: 2px;
}
.today-progress-fill.today-progress-complete {
    background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
}
.today-progress-stats {
    display: flex; gap: 12px; margin-top: 6px;
    font-size: .78rem; color: var(--gray-600);
}
.today-stat { display: inline-flex; align-items: center; gap: 3px; }
.today-stat-done { color: var(--status-green); font-weight: 700; }
.today-stat-active { color: #7c3aed; font-weight: 600; }
.today-stat-remaining { margin-left: auto; }

/* ── 2. Compact mobile task cards ──────────────── */
@media (max-width: 600px) {
    /* Tighter task card spacing */
    .task-grid { gap: 8px; }

    .task-card { border-left-width: 4px; }
    .task-card-header { padding: 10px 12px 6px; }
    .task-room { font-size: .95rem; }
    .task-card-body { padding: 0 12px 8px; }
    .task-meta { font-size: .8rem; margin-bottom: 2px; }
    .task-card-footer { padding: 8px 12px 10px; }

    /* Badge smaller on mobile */
    .task-card .badge { font-size: .68rem; padding: 1px 7px; }

    /* Compact action buttons */
    .task-action-primary .btn { min-height: 40px; font-size: .88rem; padding: 8px 14px; }

    /* Done cards more compact */
    .task-card--done .task-card-body { display: none; }
    .task-card--done .task-card-footer { padding: 4px 12px 8px; border-top: none; }

    /* Issue cards compact */
    .issue-card .task-card-body { padding: 0 12px 6px; }
}

/* ── 3. Compact page header on mobile ─────────── */
@media (max-width: 600px) {
    .today-header { margin-bottom: 8px; }
    .today-header-top { flex-wrap: nowrap; }
    .page-title { font-size: 1.1rem; }
    .today-date-sub { font-size: .7em; }

    /* Hide button labels, keep emoji only */
    .hide-mobile-label .btn-label-desktop { display: none; }
    .hide-mobile-label { min-width: 38px; justify-content: center; padding: 5px 8px; }

    /* Hide section labels on mobile (progress bar replaces them) */
    .hide-mobile { display: none; }

    /* Progress bar tighter */
    .today-progress { margin-top: 8px; }
    .today-progress-bar { height: 6px; }
    .today-progress-stats { font-size: .72rem; margin-top: 4px; }
}

/* ── 4. Enhanced bottom tabs ──────────────────── */
@media (max-width: 768px) {
    /* Report issue tab for cleaners */
    .btm-tab-report .btm-tab-icon {
        width: 22px; height: 22px;
    }

    /* Pending count badge on Today tab */
    .btm-tab .btm-tab-pending {
        position: absolute; top: 2px; right: calc(50% - 20px);
        background: var(--brand); color: #fff;
        font-size: .58rem; font-weight: 700;
        min-width: 16px; height: 16px;
        border-radius: 8px; padding: 0 4px;
        display: flex; align-items: center; justify-content: center;
        line-height: 1;
    }
}

/* ── 5. Mobile calendar: vertical day strips ──── */
@media (max-width: 600px) {
    /* Week grid: vertical stack with horizontal day strips */
    .week-grid {
        grid-template-columns: 1fr !important;
        gap: 0;
        border: none;
        border-radius: var(--radius);
        overflow: hidden;
    }
    .week-col {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        min-height: auto;
    }
    .week-col:last-child { border-bottom: none; }
    .week-col-header {
        padding: 10px 12px 8px;
        display: flex; align-items: center; gap: 8px;
        background: var(--gray-50);
        position: sticky; top: 59px; z-index: 10;
    }
    .week-col--today .week-col-header {
        background: var(--brand-light);
        border-left: 3px solid var(--brand);
    }
    .week-dow { font-size: .75rem; min-width: 30px; }
    .week-day-num { font-size: .95rem; }
    .week-today-badge { width: 26px; height: 26px; font-size: .85rem; }
    .week-tasks { padding: 6px 8px 10px; }

    /* Week pill: full-width horizontal layout */
    .week-pill {
        display: flex; align-items: center; gap: 8px;
        padding: 8px 10px; border-radius: var(--radius);
        border-left-width: 4px; font-size: .84rem;
    }
    .week-pill .pill-room { display: inline; font-size: .88rem; }
    .week-pill .pill-meta { display: inline; font-size: .76rem; margin-left: auto; }

    /* Calendar pill action visible on mobile too (bigger tap targets) */
    .cal-pill-action {
        display: inline-block; position: static; transform: none;
        padding: 4px 10px; font-size: .72rem; border-radius: var(--radius);
        margin-left: auto;
    }
    .cal-pill-wrap {
        display: flex; align-items: center;
    }

    /* Month grid: hide on very small screens, show list instead */
    .cal-grid .cal-body { grid-template-columns: repeat(7, 1fr); }
    .cal-cell { min-height: 48px; padding: 2px; }
    .cal-pill { font-size: .58rem; padding: 1px 3px; }
    .cal-day-link { width: 20px; height: 20px; font-size: .72rem; }
    .cal-day-num { flex-wrap: wrap; gap: 2px; }
    .cal-task-count { font-size: .58rem; padding: 0 3px; }

    /* Calendar page header compact */
    .view-toggle { gap: 2px; margin-bottom: 10px; }
    .view-toggle .tab-btn { font-size: .78rem; padding: 6px 10px; }

    /* Calendar nav compact */
    .cal-nav-row { flex-wrap: nowrap; }
}

/* ── 6. Sticky action bar on task detail ─────── */
.task-detail-sticky-actions {
    display: none;
}

@media (max-width: 600px) {
    .task-detail-sticky-actions {
        display: block;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--white);
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -2px 12px rgba(0,0,0,.12);
        z-index: 195;
    }
    .task-detail-sticky-actions .btn {
        width: 100%; justify-content: center;
        min-height: 48px; font-size: 1rem;
    }

    /* Hide bottom tabs on task detail page when sticky action is visible */
    .page-has-sticky-action .btm-tabs { display: none; }
    .page-has-sticky-action .main-content { padding-bottom: 80px; }

    /* Hide inline action buttons when sticky bar is present */
    .page-has-sticky-action .task-card-footer .task-action-primary { display: none; }

    /* Task detail page: hide the in-card buttons on mobile (use sticky instead) */
    .task-detail-inline-actions { display: none; }
}

/* ══════════════════════════════════════════════════════
   MOBILE UX TIER 1 — Progress bar, compact cards,
   compact header, bottom tabs, calendar, sticky actions
   ══════════════════════════════════════════════════════ */

/* ── 1. Today progress bar ─────────────────────── */
.today-header { margin-bottom: 12px; }
.today-header-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; flex-wrap: wrap;
}
.today-header-actions { display: flex; gap: 8px; }
.today-date-sub {
    font-size: .82rem; font-weight: 400; color: var(--gray-500);
    margin-left: 4px;
}
.today-progress {
    margin-top: 10px;
}
.today-progress-bar {
    height: 8px; background: var(--gray-200); border-radius: 8px;
    overflow: hidden;
}
.today-progress-fill {
    height: 100%; border-radius: 8px;
    background: var(--brand);
    transition: width .6s ease;
}
.today-progress-complete {
    background: #16a34a;
}
.today-progress-stats {
    display: flex; gap: 12px; margin-top: 6px;
    font-size: .78rem; font-weight: 600;
}
.today-stat-done { color: var(--status-green); }
.today-stat-active { color: #7c3aed; }
.today-stat-remaining { color: var(--gray-500); margin-left: auto; }

/* ── 4. Better bottom tabs ─────────────────────── */
.btm-tab-report {
    position: relative;
}
.btm-tab-report .btm-tab-icon {
    width: 24px; height: 24px;
}

/* ── 6. Sticky action bar on task detail ───────── */
.task-detail-sticky-actions {
    display: none;
}

/* ── Helper: hide on mobile ────────────────────── */
.hide-mobile { display: block; }

/* ── Mobile day-list for calendar ──────────────── */
.mobile-day-list { display: none; }

/* ══════════════════════════════════════════════════
   MOBILE OVERRIDES (≤768px)
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── 1. Progress bar: slightly bigger on mobile ── */
    .today-progress-bar { height: 10px; }
    .today-progress-stats { font-size: .82rem; }

    /* ── 2. Compact mobile task cards ─────────────── */
    .task-card-header {
        padding: 10px 12px 6px;
    }
    .task-room { font-size: .95rem; }
    .task-card-body { padding: 0 12px 8px; }
    .task-card-footer { padding: 8px 12px 10px; }
    .task-meta { font-size: .8rem; margin-bottom: 2px; }
    .badge { font-size: .68rem; padding: 2px 7px; }

    /* Completed/cancelled cards: super compact */
    .task-card--done .task-card-body { display: none; }
    .task-card--done .task-card-header { padding: 8px 12px; }
    .task-card--done .task-card-footer { padding: 4px 12px 8px; border-top: none; }

    /* ── 3. Compact page header ───────────────────── */
    .today-header { margin-bottom: 8px; }
    .today-header-top { flex-wrap: nowrap; }
    .page-title { font-size: 1.1rem; }
    .today-date-sub { font-size: .78rem; }
    .hide-mobile-label .btn-label-desktop { display: none; }
    .hide-mobile-label { padding: 5px 8px; min-height: 36px; }
    .hide-mobile { display: none !important; }

    /* ── 4. Bottom tabs with report issue ────────── */
    .btm-tabs {
        justify-content: space-around;
    }
    .btm-tab-report .btm-tab-icon {
        width: 22px; height: 22px;
    }

    /* ── 5. Mobile calendar: vertical day list ────── */
    .mobile-day-list { display: block; }
    .desktop-calendar { display: none !important; }

    .mobile-day-strip {
        background: var(--white);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        margin-bottom: 8px;
        overflow: hidden;
    }
    .mobile-day-strip--today {
        border-left: 4px solid var(--brand);
    }
    .mobile-day-strip--empty {
        opacity: .5;
    }
    .mobile-day-strip-header {
        display: flex; align-items: center; gap: 8px;
        padding: 10px 14px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-day-strip-header .day-name {
        font-weight: 700; font-size: .88rem;
        min-width: 36px;
    }
    .mobile-day-strip-header .day-date {
        font-size: .82rem; color: var(--gray-600);
    }
    .mobile-day-strip-header .day-counts {
        margin-left: auto; display: flex; gap: 6px;
    }
    .mobile-day-strip-header .day-count-pill {
        font-size: .7rem; font-weight: 700;
        padding: 2px 8px; border-radius: 10px;
        background: var(--gray-100); color: var(--gray-600);
    }
    .mobile-day-strip-header .day-count-pill--tasks {
        background: var(--brand-light); color: var(--brand-dark);
    }
    .mobile-day-strip-header .day-count-pill--issues {
        background: #fff7ed; color: #9a3412;
    }
    .mobile-day-strip-tasks {
        padding: 0 14px 10px;
    }
    .mobile-day-strip-tasks .mobile-task-row {
        display: flex; align-items: center; gap: 8px;
        padding: 8px 0;
        border-top: 1px solid var(--gray-100);
        text-decoration: none; color: inherit;
    }
    .mobile-task-row .task-status-dot {
        width: 10px; height: 10px; border-radius: 50%;
        flex-shrink: 0;
    }
    .task-status-dot.dot-not_assigned       { background: #dc2626; }
    .task-status-dot.dot-pending_acceptance { background: #d97706; }
    .task-status-dot.dot-assigned           { background: #2563eb; }
    .task-status-dot.dot-in_progress        { background: #7c3aed; }
    .task-status-dot.dot-completed          { background: var(--status-green); }
    .task-status-dot.dot-cancelled          { background: var(--gray-400); }
    .mobile-task-row .task-row-name {
        font-weight: 600; font-size: .88rem;
        flex: 1; min-width: 0;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .mobile-task-row .task-row-meta {
        font-size: .75rem; color: var(--gray-500);
        white-space: nowrap;
    }
    .mobile-task-row .task-row-chevron {
        color: var(--gray-400); font-size: .75rem;
        flex-shrink: 0;
    }

    /* ── 6. Sticky action bar on task detail ────── */
    .task-detail-sticky-actions {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--white);
        padding: 10px 16px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
        box-shadow: 0 -2px 12px rgba(0,0,0,.12);
        z-index: 180;
        gap: 8px;
    }
    .task-detail-sticky-actions .btn {
        flex: 1;
    }
    .task-detail-sticky-actions .btn-link {
        flex: 0;
        padding: 10px 14px;
        font-size: .84rem;
    }
    /* Hide the inline action buttons when sticky bar is shown */
    .task-detail-inline-actions {
        display: none;
    }
    /* Padding so content isn't hidden behind sticky bar */
    .task-detail-layout { padding-bottom: 80px; }

    /* Hide btm-tabs on task detail (sticky actions replace them) */
    .page-task-detail .btm-tabs { display: none; }
    .page-task-detail .main-content { padding-bottom: 80px; }
    .page-task-detail .app-footer { padding-bottom: 80px; }

    /* ── Calendar page header: more compact ─────── */
    .calendar-header-nav {
        display: flex; align-items: center; gap: 6px;
        flex-wrap: wrap;
    }
    .calendar-header-nav .btn-sm { padding: 5px 8px; font-size: .78rem; min-height: 34px; }
    .calendar-date-range {
        font-size: .78rem; color: var(--gray-600);
        width: 100%; order: 10;
    }
    .calendar-date-picker { display: none; }
    .view-toggle { margin-bottom: 10px; }
    .view-toggle .tab-btn { font-size: .78rem; padding: 6px 10px; }
}

/* ── Print styles ──────────────────────────────────── */
@media print {
    /* Hide UI chrome */
    .app-header, .app-footer, .flash, .filters,
    .btn, .hamburger, .lang-switcher, .user-menu,
    .task-card-footer, .modal-backdrop, .tab-nav,
    .no-print, .btm-tabs,
    form[action*="sync"], form[action*="status"] {
        display: none !important;
    }

    /* Clean backgrounds */
    body { background: #fff; color: #000; font-size: 11pt; }
    .main-content { max-width: 100%; margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .stat-card { box-shadow: none; border: 1px solid #ccc; }

    /* Calendar print-friendly */
    .cal-grid { page-break-inside: avoid; }
    .cal-cell { min-height: 60px; border: 1px solid #aaa; }
    .cal-header { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .cal-pill { font-size: 8pt; border-left-width: 2px; }
    .badge { border: 1px solid #999; }

    /* Week grid */
    .week-grid { grid-template-columns: repeat(7, 1fr); }

    /* Task cards for print */
    .task-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .task-card { border: 1px solid #aaa; box-shadow: none; }

    /* Page breaks */
    .page-header { margin-bottom: 8px; }
    h1 { font-size: 14pt; }

    /* Links: no decoration */
    a { color: inherit; text-decoration: none; }

    /* Ensure status colors print */
    .badge-pending, .badge-assigned, .badge-in_progress,
    .badge-completed, .badge-cancelled,
    .pill-pending, .pill-assigned, .pill-in_progress,
    .pill-completed, .pill-cancelled {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ── Issue cards and UI ───────────────────────── */
.task-card.issue-card {
    border-left: 5px solid var(--orange);
    background: #fffbf5;
}
.task-card.issue-card .issue-type-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .72rem; font-weight: 600;
    color: var(--orange); text-transform: uppercase;
    letter-spacing: 0.5px; margin-right: 8px;
}

/* Priority dots & badges */
.priority-dot {
    width: 10px; height: 10px; border-radius: 50%;
    display: inline-block; margin-left: 6px; vertical-align: middle;
}
.priority-dot.low    { background: #22c55e; }
.priority-dot.normal { background: #eab308; }
.priority-dot.high   { background: #f97316; }
.priority-dot.urgent { background: #ef4444; }

.priority-badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
}
.priority-low    { background: #dcfce7; color: #166534; }
.priority-normal { background: #fef9c3; color: #854d0e; }
.priority-high   { background: #ffedd5; color: #9a3412; }
.priority-urgent { background: #fee2e2; color: #991b1b; }

/* Issue-specific status badges */
.badge-issue-reported           { background: #fee2e2; color: #991b1b; }
.badge-issue-pending_acceptance { background: #fef3c7; color: #92400e; }
.badge-issue-assigned           { background: #dbeafe; color: #1e40af; }
.badge-issue-in_progress        { background: #ede9fe; color: #5b21b6; }
.badge-issue-completed          { background: var(--status-green-light); color: var(--status-green-dark); }
.badge-issue-cancelled          { background: var(--gray-200); color: var(--gray-600); }

.day-section-label {
    font-size: .98rem; font-weight: 700;
    color: var(--orange); margin: 18px 0 8px 0;
    letter-spacing: 0.2px;
    display: flex; align-items: center; gap: 6px;
}
.pill-issue {
    background: #fffbf5;
    border-left: 3px solid var(--orange);
    color: var(--orange); font-weight: 600;
}

/* Issue title link in tables */
.issue-title-link {
    color: var(--brand); text-decoration: none; font-weight: 600;
}
.issue-title-link:hover { text-decoration: underline; }

/* Issue detail grid */
.issue-detail-grid {
    display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px;
}
@media (max-width: 768px) {
    .issue-detail-grid { grid-template-columns: 1fr; }
}

/* Issue photo thumbnail */
.issue-photo-thumb {
    max-width: 280px; border-radius: var(--radius);
    cursor: pointer; transition: opacity .15s;
    box-shadow: var(--shadow);
}
.issue-photo-thumb:hover { opacity: .85; }

/* Issue status timeline */
.issue-timeline-card { padding: 16px 20px; }
.issue-timeline {
    display: flex; align-items: flex-start; gap: 6px;
    overflow-x: auto; padding-bottom: 4px;
}
.timeline-step {
    display: flex; flex-direction: column; align-items: center;
    min-width: 80px; text-align: center;
}
.timeline-icon {
    font-size: 1.3rem; margin-bottom: 4px;
    opacity: .35; transition: opacity .2s;
}
.timeline-done .timeline-icon,
.timeline-current .timeline-icon { opacity: 1; }
.timeline-label {
    font-size: .72rem; font-weight: 600;
    color: var(--gray-500);
}
.timeline-done .timeline-label { color: var(--gray-800); }
.timeline-current .timeline-label {
    color: var(--brand); font-weight: 700;
}
.timeline-date {
    font-size: .65rem; color: var(--gray-500); margin-top: 2px;
}
.timeline-arrow {
    color: var(--gray-300); font-size: 1.1rem;
    margin-top: 6px; flex-shrink: 0;
}
@media (max-width: 480px) {
    .timeline-step { min-width: 60px; }
    .timeline-label { font-size: .65rem; }
}

/* ── Nav badge (issue count) ──────────── */
.nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 10px;
    padding: 0 5px; margin-left: 4px; line-height: 1;
}

/* ── Superadmin badges ──────────────────── */
.badge-sa-plan      { background: var(--brand-light); color: var(--brand-dark); }
.badge-sa-active    { background: var(--status-green-light); color: var(--status-green-dark); }
.badge-sa-trialing  { background: #fef3c7; color: #92400e; }
.badge-sa-pastdue   { background: #ffedd5; color: #9a3412; }
.badge-sa-cancelled { background: var(--gray-200); color: var(--gray-600); }
.badge-sa-none      { background: var(--gray-100); color: var(--gray-500); }

/* ═══════════════ Subscription Page ═══════════════ */

/* Plan banner */
.sub-plan-banner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-radius: 12px 12px 0 0;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border: 1px solid var(--gray-200);
    margin-bottom: 0;
}
.sub-plan-banner-left { display: flex; align-items: center; gap: 16px; }
.sub-plan-badge {
    font-size: .72rem; font-weight: 700; letter-spacing: 1.5px;
    padding: 6px 14px; border-radius: 6px;
    background: var(--brand); color: #fff;
}
.sub-plan-banner-info { display: flex; flex-direction: column; gap: 2px; }
.sub-plan-price { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.sub-plan-price small { font-size: .82rem; font-weight: 400; color: var(--gray-500); }
.sub-plan-tagline { font-size: .85rem; color: var(--gray-600); }

/* Status pills */
.sub-status-pill {
    font-size: .78rem; font-weight: 600; padding: 5px 14px;
    border-radius: 20px; white-space: nowrap;
}
.sub-status-active   { background: #dcfce7; color: #166534; }
.sub-status-trial    { background: #dbeafe; color: #1e40af; }
.sub-status-pastdue  { background: #ffedd5; color: #9a3412; }
.sub-status-cancelled{ background: var(--gray-200); color: var(--gray-600); }
.sub-status-expired  { background: #fecaca; color: #991b1b; }

/* Info rows (trial, billing date, cancel) */
.sub-info-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; font-size: .88rem; color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}
.sub-info-row:last-child { border-bottom: none; }
.sub-info-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.sub-info-warn { color: #b45309; }

/* Usage bars */
.sub-usage-row { margin-bottom: 18px; }
.sub-usage-row:last-of-type { margin-bottom: 0; }
.sub-usage-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .88rem; margin-bottom: 6px;
}
.sub-usage-count { font-size: .82rem; color: var(--gray-600); }
.sub-limit-badge {
    display: inline-block; font-size: .68rem; font-weight: 600;
    padding: 2px 8px; border-radius: 10px;
    background: #fecaca; color: #991b1b; margin-left: 6px;
}
.sub-usage-bar {
    height: 10px; background: var(--gray-200); border-radius: 10px;
    overflow: hidden;
}
.sub-usage-fill {
    height: 100%; border-radius: 10px;
    transition: width .5s ease;
}
.sub-usage-fill.bar-ok   { background: var(--green); }
.sub-usage-fill.bar-warn { background: #f59e0b; }
.sub-usage-fill.bar-full { background: var(--red); }
.sub-upgrade-hint {
    font-size: .82rem; color: var(--brand); margin-top: 14px;
    padding: 10px 14px; background: #eef2ff; border-radius: 8px;
}

/* Plan comparison grid */
.sub-plans-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.sub-plan-col {
    border: 2px solid var(--gray-200); border-radius: 12px;
    padding: 20px 16px; text-align: center; position: relative;
    transition: border-color .2s, box-shadow .2s;
}
.sub-plan-col:hover { border-color: var(--gray-300); }
.sub-plan-current {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
}
.sub-plan-popular {
    border-color: #f59e0b;
}
.sub-plan-current-tag,
.sub-plan-popular-tag {
    position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
    font-size: .68rem; font-weight: 700; letter-spacing: .5px;
    padding: 3px 12px; border-radius: 10px; white-space: nowrap;
}
.sub-plan-current-tag { background: var(--brand); color: #fff; }
.sub-plan-popular-tag { background: #f59e0b; color: #fff; }
.sub-plan-name { font-size: 1.1rem; font-weight: 700; margin: 8px 0 4px; }
.sub-plan-price-block { margin-bottom: 12px; }
.sub-plan-price-lg { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); }
.sub-plan-price-period { font-size: .82rem; color: var(--gray-500); }
.sub-plan-limits { display: flex; justify-content: center; gap: 16px; margin-bottom: 14px; }
.sub-plan-limit-item {
    font-size: .82rem; color: var(--gray-600);
    padding: 4px 10px; background: var(--gray-50); border-radius: 6px;
}
.sub-plan-limit-item strong { color: var(--gray-900); }

/* Feature list in plan cards */
.sub-plan-features {
    list-style: none; padding: 0; margin: 0 0 16px;
    text-align: left; font-size: .82rem;
}
.sub-plan-features li {
    padding: 5px 0; display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--gray-50);
}
.sub-plan-features li:last-child { border: none; }
.feat-icon { font-size: .85rem; width: 18px; text-align: center; flex-shrink: 0; }
.feat-yes .feat-icon { color: var(--green); }
.feat-no  .feat-icon { color: var(--gray-300); }
.feat-no { color: var(--gray-400); }
.sub-plan-action { margin-top: auto; }

/* Manage section */
.sub-manage-grid { display: flex; flex-direction: column; gap: 0; }
.sub-manage-item {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}
.sub-manage-item:last-child { border-bottom: none; }
.sub-manage-icon { font-size: 1.4rem; width: 36px; text-align: center; flex-shrink: 0; }
.sub-manage-item div:nth-child(2) { flex: 1; }
.sub-manage-item p { font-size: .82rem; color: var(--gray-500); margin: 2px 0 0; }
.sub-manage-item strong { font-size: .92rem; }
.sub-manage-danger { opacity: .85; }
.sub-manage-danger:hover { opacity: 1; }

.btn-danger {
    background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
}
.btn-danger:hover { background: #fecaca; }

@media (max-width: 768px) {
    .sub-plan-banner { flex-direction: column; gap: 12px; text-align: center; }
    .sub-plan-banner-left { flex-direction: column; }
    .sub-plans-grid { grid-template-columns: 1fr; }
    .sub-manage-item { flex-wrap: wrap; }
    .sub-manage-item form { width: 100%; }
    .sub-manage-item form .btn { width: 100%; }
}

/* ═══ Plan pill in navigation ═══ */
.plan-pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: .68rem; font-weight: 700; letter-spacing: .8px;
    padding: 3px 10px; border-radius: 10px;
    text-decoration: none; white-space: nowrap;
    transition: opacity .2s;
}
.plan-pill:hover { opacity: .85; }
.plan-pill-starter  { background: #e0e7ff; color: #3730a3; }
.plan-pill-pro      { background: #fef3c7; color: #92400e; }
.plan-pill-business { background: #d1fae5; color: #065f46; }
.plan-pill-custom { background: #ede9fe; color: #5b21b6; }
.plan-pill-trial {
    font-size: .58rem; font-weight: 600;
    padding: 1px 5px; border-radius: 6px;
    background: rgba(0,0,0,.12); color: inherit;
}

/* ═══ Subscription status banners ═══ */
.sub-banner {
    padding: 0; font-size: .85rem;
}
.sub-banner-inner {
    max-width: 1200px; margin: 0 auto;
    padding: 10px 20px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.sub-banner-trial     { background: #fef3c7; color: #92400e; }
.sub-banner-past_due  { background: #fee2e2; color: #991b1b; }
.sub-banner-cancelling { background: #fed7aa; color: #9a3412; }
.sub-banner-expired   { background: #fecaca; color: #7f1d1d; }
.sub-banner-btn {
    font-size: .78rem; font-weight: 600;
    padding: 5px 14px; border-radius: 6px;
    text-decoration: none; white-space: nowrap;
    background: rgba(0,0,0,.12); color: inherit;
    transition: background .2s;
}
.sub-banner-btn:hover { background: rgba(0,0,0,.2); }

/* ═══ Subscription summary card (config page) ═══ */
.sub-summary-card {
    border-left: 4px solid var(--brand);
}
.sub-summary-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.sub-summary-plan {
    display: flex; align-items: center; gap: 10px;
}
.sub-summary-plan-badge {
    font-size: .78rem; font-weight: 700; letter-spacing: .8px;
    padding: 4px 14px; border-radius: 8px;
}
.plan-color-starter  { background: #e0e7ff; color: #3730a3; }
.plan-color-pro      { background: #fef3c7; color: #92400e; }
.plan-color-business { background: #d1fae5; color: #065f46; }
.plan-color-custom { background: #ede9fe; color: #5b21b6; }
.sub-summary-status {
    font-size: .78rem; font-weight: 600;
    padding: 3px 10px; border-radius: 8px;
}
.sub-status-trialing { background: #fef3c7; color: #92400e; }
.sub-status-active   { background: #d1fae5; color: #065f46; }
.sub-status-past_due { background: #fee2e2; color: #991b1b; }
.sub-status-cancelled,
.sub-status-expired  { background: #f3f4f6; color: #6b7280; }

.sub-summary-usage {
    display: flex; gap: 20px; margin-top: 14px;
    padding-top: 14px; border-top: 1px solid var(--gray-100);
    flex-wrap: wrap;
}
.sub-summary-meter {
    display: flex; flex-direction: column; gap: 2px;
}
.sub-summary-meter-label {
    font-size: .72rem; color: var(--gray-500); text-transform: uppercase;
    letter-spacing: .5px;
}
.sub-summary-meter-value {
    font-size: .92rem; font-weight: 600; color: var(--gray-800);
}

/* Alert warning style */
.alert-warning {
    background: #fef3c7; color: #92400e;
    border: 1px solid #fde68a; border-radius: 8px;
    padding: 12px 16px; font-size: .88rem;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .plan-pill { display: none; } /* hide in mobile nav to save space */
    .sub-summary-top { flex-direction: column; align-items: flex-start; }
    .sub-summary-usage { flex-direction: column; gap: 10px; }
}

/* ═══ Assignment Rules UI ═══ */

/* Condition tags in the rules table */
.rule-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: .76rem;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
}
.rule-tag-room { background: #dbeafe; color: #1e40af; }
.rule-tag-day  { background: #ede9fe; color: #5b21b6; }
.rule-tag-date { background: #fef3c7; color: #92400e; }

/* Conditions fieldset in modals */
.rule-conditions-fieldset {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px 16px 10px;
    margin: 8px 0 0;
    background: var(--gray-50);
}
.rule-conditions-fieldset legend {
    font-size: .82rem;
    font-weight: 700;
    color: var(--gray-600);
    padding: 0 6px;
}

/* Room checkbox grid */
.rule-checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.rule-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: .82rem;
    cursor: pointer;
    background: var(--white);
    border: 1px solid var(--gray-300);
    transition: background .12s, border-color .12s;
    user-select: none;
}
.rule-chip:hover { border-color: var(--brand); }
.rule-chip.checked,
.rule-chip:has(input:checked) {
    background: var(--brand-light);
    border-color: var(--brand);
    color: var(--brand-dark);
}
.rule-chip input[type=checkbox] {
    width: 14px; height: 14px;
    accent-color: var(--brand);
    margin: 0;
}

/* Day-of-week toggle chips */
.rule-days-grid {
    display: flex;
    gap: 4px;
}
.rule-day-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    transition: background .12s, border-color .12s, color .12s;
    user-select: none;
    text-align: center;
}
.rule-day-chip:hover { border-color: var(--brand); }
.rule-day-chip.checked,
.rule-day-chip:has(input:checked) {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.rule-day-chip input[type=checkbox] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}

/* Quick-set buttons (Weekdays / Weekends / Clear) */
.rule-quick-btn {
    background: none;
    border: none;
    color: var(--brand);
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font);
}
.rule-quick-btn:hover {
    background: var(--brand-light);
}

@media (max-width: 768px) {
    .rule-days-grid {
        gap: 3px;
    }
    .rule-day-chip {
        width: 36px; height: 36px;
        font-size: .76rem;
    }
    .rule-checkbox-grid {
        gap: 4px;
    }
    .rule-chip {
        font-size: .78rem;
        padding: 4px 8px;
    }
}

/* ── Superadmin badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .72rem; font-weight: 600; line-height: 1.5; }
.badge-sa-plan { background: var(--brand, #2F5897); color: #fff; }
.badge-sa-active { background: #dcfce7; color: #166534; }
.badge-sa-trialing { background: #fef9c3; color: #854d0e; }
.badge-sa-pastdue { background: #fee2e2; color: #991b1b; }
.badge-sa-cancelled { background: var(--gray-200, #e5e7eb); color: var(--gray-600, #4b5563); }
.badge-sa-none { background: var(--gray-100, #f3f4f6); color: var(--gray-500, #6b7280); }

/* Superadmin detail rows */
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--gray-100, #f3f4f6); font-size: .88rem; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--gray-500, #6b7280); font-size: .82rem; min-width: 120px; }

/* ══════════════════════════════════════════════════
   UX Enhancement: Prominent card actions + mobile
   ══════════════════════════════════════════════════ */

/* Done cards: faded */
.task-card--done { opacity: .55; }
.task-card--done:hover { opacity: .75; }

/* Primary action: full-width prominent button */
.task-action-primary { width: 100%; margin-bottom: 6px; }
.btn-full { display: block; width: 100%; text-align: center; padding: 10px 16px; font-size: .95rem; }

/* Complete button: green (distinct from brand blue) */
.btn-complete { background: #16a34a; color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font-family: var(--font); font-weight: 600; }
.btn-complete:hover { filter: brightness(.9); }

/* Secondary actions row */
.task-action-secondary {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; gap: 12px;
}

/* Text-style link buttons (replace bulky btn-secondary for details/reject) */
.btn-link {
    background: none; border: none; color: var(--brand);
    font-size: .82rem; font-weight: 600; cursor: pointer;
    padding: 2px 0; text-decoration: none; font-family: var(--font);
}
.btn-link:hover { text-decoration: underline; }
.btn-link--danger { color: var(--red); }
.btn-link--danger:hover { color: #991b1b; }

/* Assign form inline layout */
.task-action-assign {
    display: flex; gap: 6px; align-items: center;
    width: 100%; margin-bottom: 6px;
}
.assign-select {
    flex: 1; padding: 6px 10px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: .84rem; font-family: var(--font); background: var(--white);
}

/* Mobile: collapse card body for cleaners, expand on tap */
@media (max-width: 600px) {
    .role-cleaner .task-card-body.task-card-expand { display: none; }
    .role-cleaner .task-card-body.task-card-expand.expanded { display: block; }
    .role-cleaner .task-card-header { cursor: pointer; }
    .role-cleaner .task-card-header::after {
        content: '▸'; font-size: .75rem; color: var(--gray-500);
        margin-left: auto; padding-left: 8px; transition: transform .2s;
    }
    .role-cleaner .task-card-header.expanded::after { transform: rotate(90deg); }
}

/* Mobile: responsive table for list views */
@media (max-width: 768px) {
    .task-list-responsive thead { display: none; }
    .task-list-responsive tbody tr {
        display: flex; flex-wrap: wrap; gap: 4px 12px;
        padding: 12px; border-bottom: 1px solid var(--gray-200); align-items: center;
    }
    .task-list-responsive tbody td { border: none; padding: 2px 0; font-size: .88rem; }
    .task-list-responsive tbody td:first-child { width: 100%; font-size: 1rem; }
    .task-list-responsive .td-hide-mobile { display: none; }
}

/* Calendar pill quick-action button (shown on hover) */
.cal-pill-wrap { position: relative; }
.cal-pill-action {
    display: none; position: absolute; right: 2px; top: 50%;
    transform: translateY(-50%); background: var(--brand); color: #fff;
    border: none; border-radius: 4px; font-size: .6rem; font-weight: 700;
    padding: 2px 5px; cursor: pointer; z-index: 5; font-family: var(--font);
}
.cal-pill-wrap:hover .cal-pill-action { display: inline-block; }
.cal-pill-action:hover { filter: brightness(.85); }
.cal-pill-action--green { background: #16a34a; }
