:root {
    --ink: #14213d;
    --muted: #667085;
    --line: #d9e2ec;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --page: #eef7ff;
    --teal: #0f9f8f;
    --teal-dark: #08796f;
    --blue: #2563eb;
    --indigo: #4f46e5;
    --rose: #e11d48;
    --orange: #f97316;
    --gold: #d97706;
    --green: #16a34a;
    --danger: #dc2626;
    --shadow: 0 16px 40px rgba(15, 23, 42, .10);
    --shadow-soft: 0 8px 22px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background:
        linear-gradient(135deg, rgba(14, 165, 233, .16), rgba(34, 197, 94, .10) 34%, rgba(249, 115, 22, .12) 68%, rgba(225, 29, 72, .10)),
        var(--page);
    color: var(--ink);
    font-family: "Noto Sans Gujarati", "Noto Sans", Inter, system-ui, -apple-system, Segoe UI, sans-serif;
    font-size: 16px;
}
a { color: var(--teal); text-decoration: none; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, #102a43 0%, #0f766e 46%, #7c2d12 100%);
    color: #fff;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 12px 0 35px rgba(15, 23, 42, .18);
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background:
        radial-gradient(circle at 28% 22%, rgba(253, 230, 138, .50), transparent 24%),
        linear-gradient(135deg, #111827 0%, #0f766e 50%, #92400e 100%);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .22);
}
.advocate-logo {
    position: relative;
    border: 1px solid rgba(253, 230, 138, .55);
    color: #fde68a;
    font-size: 19px;
    overflow: hidden;
}
.advocate-logo i {
    transform: translateY(-4px);
}
.advocate-logo em {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 4px;
    color: #fff7ed;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
    line-height: 1;
    text-align: center;
}
.advocate-logo::after {
    content: "";
    position: absolute;
    left: 9px;
    right: 9px;
    bottom: 16px;
    height: 1px;
    background: rgba(253, 230, 138, .72);
}
.brand-image {
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(253, 230, 138, .55);
}
.brand-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.brand strong { letter-spacing: .2px; }
.brand small { display: block; color: #dbeafe; font-size: 12px; }
.sidebar nav { display: grid; gap: 6px; margin-top: 28px; }
.sidebar a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #edf6ff;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background .18s ease, transform .18s ease, border-color .18s ease;
}
.sidebar a i { width: 18px; color: #fde68a; text-align: center; }
.sidebar a:hover {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.22);
    color: #fff;
    transform: translateX(3px);
}
.sidebar a.active {
    background: rgba(255,255,255,.20);
    border-color: rgba(255,255,255,.28);
    color: #fff;
}
.main { padding: 24px; min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    padding: 18px;
    background: rgba(255, 255, 255, .86);
    border: 1px solid rgba(255, 255, 255, .88);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 16px;
    z-index: 20;
}
.topbar h1 { margin: 0; font-size: 26px; font-weight: 900; color: #102a43; }
.topbar p { margin: 3px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mobile-menu-btn {
    display: none;
    border: 0;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--teal), var(--blue));
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .20);
}
.icon-btn {
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #ecfeff);
    color: var(--blue);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    position: relative;
    box-shadow: 0 8px 16px rgba(37, 99, 235, .12);
}
#notificationCount {
    position: absolute;
    top: -5px;
    right: -5px;
    display: none;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 18px;
    text-align: center;
}
.notification-wrap { position: relative; }
.notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, .18);
    z-index: 60;
    overflow: hidden;
}
.notification-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #ecfeff, #eff6ff);
    border-bottom: 1px solid #dbeafe;
}
.notification-head strong { font-size: 15px; color: #102a43; }
.notification-head button {
    border: 0;
    background: transparent;
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 900;
}
.notification-list { max-height: 360px; overflow-y: auto; }
.notification-item {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #edf2f7;
    background: #fff;
    text-align: left;
}
.notification-item:hover { background: #f8fbff; }
.notification-item.unread { background: #fff7ed; }
.notification-item strong { color: #0f172a; font-size: 14px; }
.notification-item span { color: #475569; font-size: 13px; line-height: 1.35; }
.notification-item small { color: #94a3b8; font-size: 11px; }
.notification-empty { margin: 0; padding: 18px 14px; color: var(--muted); text-align: center; }
.user-chip {
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 14px;
    font-weight: 700;
}
.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: transform .18s ease, box-shadow .18s ease;
}
.profile-chip:hover {
    color: #7c2d12;
    box-shadow: 0 8px 16px rgba(249, 115, 22, .12);
    transform: translateY(-1px);
}
.profile-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(15, 159, 143, .92), rgba(37, 99, 235, .84)),
        #0f766e;
    color: #fff;
    box-shadow: var(--shadow-soft);
}
.profile-avatar {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.55);
    background: rgba(255,255,255,.18);
    font-size: 32px;
    font-weight: 900;
}
.profile-hero h2 { margin: 0; font-size: 28px; font-weight: 900; }
.profile-hero p { margin: 4px 0 0; color: rgba(255,255,255,.86); }
.profile-hero .section-kicker {
    margin: 0 0 4px;
    color: #fde68a;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.grid { display: grid; gap: 16px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.metric, .panel {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(255, 255, 255, .92);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}
.metric {
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.metric::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--teal), var(--blue), var(--orange), var(--rose));
}
.metric:nth-child(2n)::before { background: linear-gradient(90deg, var(--orange), var(--rose), var(--indigo)); }
.metric:nth-child(3n)::before { background: linear-gradient(90deg, var(--green), var(--teal), var(--blue)); }
.metric span { display: block; color: var(--muted); font-size: 14px; font-weight: 700; }
.metric strong { font-size: 34px; line-height: 1.15; color: #0f172a; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 16px; }
.panel { padding: 18px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: #102a43;
}
.panel-head h2::after {
    content: "";
    display: block;
    width: 54px;
    height: 3px;
    margin-top: 6px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--teal), var(--orange));
}
.task-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.task-row:first-of-type { border-top: 0; }
.task-row small { display: block; color: var(--muted); margin-top: 3px; }
.dashboard-task-row { cursor: pointer; }
.dashboard-task-row:hover strong { color: var(--teal); text-decoration: underline; }
.task-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.task-detail-link { display: block; color: var(--ink); }
.task-detail-link:hover strong { color: var(--teal); text-decoration: underline; }
.task-detail-link small { display: block; color: var(--muted); margin-top: 3px; }
.assignee-line { display: block; color: #334155; font-size: 13px; line-height: 1.35; }
.assignee-line + .assignee-line { margin-top: 4px; }
.assignee-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
}
.co-assignee-select { min-height: 122px; }
.stack-form { display: grid; gap: 10px; }
.priority { text-transform: capitalize; color: var(--gold); font-weight: 700; }
.badge {
    text-transform: capitalize;
    border-radius: 999px;
    padding: .45em .72em;
    font-weight: 800;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-accepted, .status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-follow_up { background: #f3e8ff; color: #7e22ce; }
.status-verified { background: #ccfbf1; color: #0f766e; }
.status-shortlisted { background: #fef3c7; color: #a16207; }
.status-rejected, .status-overdue { background: #ffe4e6; color: var(--danger); }
.status-completed { background: #dcfce7; color: #166534; }
.task-calendar-panel { margin-top: 16px; }
.calendar-panel-head { align-items: flex-start; }
.calendar-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.calendar-view-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.calendar-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 12px;
    align-items: end;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fbff, #ecfeff);
}
.calendar-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.calendar-filter-actions .btn { flex: 1 1 86px; }
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
}
.calendar-legend span::before {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 999px;
}
.legend-pending::before { background: #facc15; }
.legend-progress::before { background: #2563eb; }
.legend-completed::before { background: #16a34a; }
.legend-overdue::before { background: #dc2626; }
.legend-high::before { background: #7f1d1d; }
.task-calendar {
    min-height: 520px;
    padding: 10px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
}
.task-calendar .fc {
    color: var(--ink);
    font-family: inherit;
}
.task-calendar .fc-toolbar-title {
    color: #102a43;
    font-size: 20px;
    font-weight: 900;
}
.task-calendar .fc-button {
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    background: #f8fbff !important;
    color: #334155 !important;
    font-weight: 800 !important;
    box-shadow: none !important;
}
.task-calendar .fc-button:hover,
.task-calendar .fc-button:focus {
    background: #ecfeff !important;
    color: var(--teal-dark) !important;
}
.task-calendar .fc-daygrid-day-number,
.task-calendar .fc-col-header-cell-cushion { color: #334155; font-weight: 800; }
.task-calendar .fc-day-today { background: #fff7ed !important; }
.task-calendar .fc-event {
    border: 0 !important;
    border-radius: 8px !important;
    padding: 2px 5px;
    font-weight: 800;
    cursor: pointer;
}
.calendar-status-pending { background: #facc15 !important; color: #713f12 !important; }
.calendar-status-accepted,
.calendar-status-in_progress,
.calendar-status-follow_up { background: #2563eb !important; color: #fff !important; }
.calendar-status-completed { background: #16a34a !important; color: #fff !important; }
.calendar-status-overdue,
.calendar-status-rejected { background: #dc2626 !important; color: #fff !important; }
.calendar-priority-high {
    box-shadow: inset 4px 0 0 #fca5a5;
}
.calendar-priority-high:not(.calendar-status-completed) {
    background: #7f1d1d !important;
    color: #fff !important;
}
.calendar-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, .52);
    backdrop-filter: blur(4px);
}
.calendar-modal[hidden] { display: none; }
.calendar-modal-card {
    position: relative;
    width: min(520px, 100%);
    padding: 20px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #dbeafe;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}
.calendar-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 22px;
    line-height: 1;
}
.calendar-modal-type {
    display: inline-flex;
    margin-bottom: 8px;
    padding: 5px 8px;
    border-radius: 8px;
    background: #ecfeff;
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 900;
}
.calendar-modal-card h3 {
    margin: 0 38px 14px 0;
    color: #102a43;
    font-size: 22px;
    font-weight: 900;
}
.calendar-modal-details {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
}
.calendar-modal-details div {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #edf2f7;
}
.calendar-modal-details dt { color: #475569; font-weight: 900; }
.calendar-modal-details dd { margin: 0; color: #0f172a; overflow-wrap: anywhere; }
.report-scoreboard { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.report-content-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); }
.today-report-stack { display: grid; gap: 10px; }
.mini-stat {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fbff, #ecfeff);
}
.mini-stat span { color: var(--muted); font-weight: 800; }
.mini-stat strong { color: #102a43; font-size: 18px; }
.subsection-title {
    margin: 18px 0 10px;
    font-size: 16px;
    font-weight: 900;
    color: #102a43;
}
.report-profile-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}
.report-profile-line span {
    padding: 8px 10px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
}
.billing-form { display: grid; grid-template-columns: 110px 100px minmax(140px, 1fr) auto; gap: 8px; align-items: center; }
.billing-form.compact { grid-template-columns: 100px minmax(120px, 1fr) auto; }
.billing-expense-edit { display: grid; grid-template-columns: 140px 160px 120px minmax(180px, 1fr) auto; gap: 8px; align-items: center; }
.bill-items-panel { background: #f8fbff; box-shadow: none; }
.bill-items-list { display: grid; gap: 10px; }
.bill-item-row { display: grid; grid-template-columns: minmax(220px, 1fr) 160px auto; gap: 10px; align-items: center; }
.pdf-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.report-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; align-items: end; }
.report-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.report-filter-actions .btn { min-width: 110px; }
.employee-report-link { font-weight: 800; }
.report-table th, .report-table td { vertical-align: top; white-space: nowrap; }
.detail-report-table th:nth-child(6), .detail-report-table td:nth-child(6),
.detail-report-table th:last-child, .detail-report-table td:last-child { min-width: 220px; white-space: normal; }
.report-subtitle { font-size: 16px; font-weight: 800; margin: 18px 0 10px; }
.toast-area { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 10px; }
.app-toast { background: linear-gradient(135deg, #0f172a, #0f766e); color: #fff; padding: 12px 14px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.16); }
.sidebar-backdrop { display: none; }
.bottom-nav { display: none; }

.table { --bs-table-bg: transparent; --bs-table-striped-bg: #f8fbff; margin-bottom: 0; }
.table thead th {
    background: linear-gradient(135deg, #e0f2fe, #ecfdf5);
    color: #102a43;
    border-bottom: 1px solid #bae6fd;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 900;
}
.table tbody tr { border-color: #edf2f7; }
.table tbody tr:hover { background: #fff7ed; }

.form-control, .form-select {
    border-color: #cbd5e1;
    border-radius: 8px;
    background-color: #fbfdff;
    box-shadow: none;
}
.form-control:focus, .form-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 .2rem rgba(15, 159, 143, .16);
}
.form-label { color: #334155; font-weight: 800; }

.btn {
    border-radius: 8px;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
    min-height: 40px;
}
.btn-success {
    background: linear-gradient(135deg, #16a34a, #0f9f8f);
    border-color: #0f9f8f;
}
.btn-success:hover { background: linear-gradient(135deg, #15803d, #08796f); border-color: #08796f; }
.btn-primary, .btn-outline-primary:hover { background: linear-gradient(135deg, #2563eb, #4f46e5); border-color: #2563eb; }
.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border-color: #f97316;
    color: #fff;
}
.btn-outline-success { border-color: #0f9f8f; color: #08796f; }
.btn-outline-success:hover { background: #0f9f8f; border-color: #0f9f8f; color: #fff; }
.btn-outline-danger { border-color: #fb7185; color: #be123c; }
.btn-outline-danger:hover { background: #e11d48; border-color: #e11d48; color: #fff; }
.btn-outline-secondary { border-color: #94a3b8; color: #475569; }
.btn-outline-secondary:hover { background: #475569; color: #fff; }
.alert { border-radius: 8px; border: 0; box-shadow: var(--shadow-soft); }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #ffe4e6; color: #be123c; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #e0f2fe, #ecfdf5 45%, #fff7ed);
}
.login-panel {
    width: min(430px, 100%);
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .92);
    border-radius: 8px;
    padding: 26px;
    box-shadow: var(--shadow);
}
.print-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.bill-print-page {
    width: min(794px, 100%);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: var(--shadow-soft);
}
.bill-print-head, .bill-print-grid, .bill-signature {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}
.bill-print-head { border-bottom: 2px solid #0f766e; padding-bottom: 16px; margin-bottom: 18px; }
.bill-print-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
.bill-print-grid { margin: 16px 0; }
.bill-print-grid > div { flex: 1; }
.bill-print-grid h3 { font-size: 15px; font-weight: 900; color: #102a43; }
.bill-print-table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.bill-print-table th, .bill-print-table td { border: 1px solid #cbd5e1; padding: 10px; text-align: left; }
.bill-print-table th { background: #ecfeff; }
.bill-print-table td:last-child, .bill-print-table th:last-child { text-align: right; }
.bill-signature { margin-top: 56px; }
.bill-signature span { border-top: 1px solid #334155; min-width: 180px; padding-top: 8px; text-align: center; }

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: sticky; height: auto; }
    .sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .content-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
    .report-filter-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    body { padding-bottom: 78px; }
    body.sidebar-open { overflow: hidden; }
    .app-shell { display: block; min-height: 100vh; }
    .main { padding: 12px; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        width: min(84vw, 320px);
        height: 100dvh;
        transform: translateX(-105%);
        transition: transform .22s ease;
        overflow-y: auto;
        padding-bottom: 28px;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar nav { grid-template-columns: 1fr; margin-top: 22px; }
    .sidebar a { min-height: 46px; font-size: 15px; }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(15, 23, 42, .46);
        backdrop-filter: blur(3px);
    }
    .sidebar-backdrop[hidden] { display: none; }
    .topbar {
        top: 0;
        margin: -12px -12px 14px;
        border-radius: 0 0 8px 8px;
        padding: 12px;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) auto;
        align-items: center;
    }
    .mobile-menu-btn { display: inline-grid; place-items: center; }
    .topbar h1 { font-size: 20px; line-height: 1.2; }
    .topbar p { display: none; }
    .top-actions { gap: 6px; justify-content: flex-end; }
    .top-actions .user-chip { display: none; }
    .top-actions .btn { min-height: 38px; padding: 7px 10px; }
    .icon-btn { width: 40px; height: 40px; }
    .panel, .metric, .login-panel {
        border-radius: 8px;
        box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
    }
    .panel { padding: 14px; margin-bottom: 12px; }
    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .panel-head .btn, .panel-head a.btn { width: 100%; }
    .content-grid, .stats-grid, .grid { grid-template-columns: 1fr; gap: 12px; }
    .metric { padding: 16px; }
    .metric strong { font-size: 28px; }
    .row.g-2, .row.g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
    .form-control, .form-select {
        min-height: 46px;
        font-size: 16px;
    }
    textarea.form-control { min-height: 108px; }
    .btn {
        min-height: 44px;
        padding: 9px 12px;
        font-size: 15px;
    }
    .btn-sm {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 14px;
    }
    .pdf-actions, .report-filter-actions, .top-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }
    .pdf-actions .btn, .report-filter-actions .btn { width: 100%; }
    .report-filter-grid { grid-template-columns: 1fr; }
    .calendar-view-controls, .calendar-filter-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
    .calendar-filters { grid-template-columns: 1fr; padding: 10px; }
    .task-calendar { min-height: 0; padding: 8px; }
    .task-calendar .fc-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .task-calendar .fc-toolbar-chunk { display: flex; justify-content: center; flex-wrap: wrap; }
    .task-calendar .fc-toolbar-title { font-size: 18px; text-align: center; }
    .task-calendar .fc-list-event-title,
    .task-calendar .fc-list-event-time { font-size: 14px; }
    .calendar-modal-details div { grid-template-columns: 1fr; gap: 3px; }
    .billing-form, .billing-form.compact, .billing-expense-edit, .bill-item-row { grid-template-columns: 1fr; }
    .table-responsive { overflow: visible; }
    .table {
        display: block !important;
        width: 100% !important;
        max-width: 100%;
        table-layout: fixed;
        border-collapse: separate;
        border-spacing: 0;
    }
    .table thead { display: none; }
    .table tbody { display: grid; gap: 12px; width: 100%; max-width: 100%; }
    .table tr {
        display: block;
        width: 100%;
        max-width: 100%;
        background: #fff;
        border: 1px solid #dbeafe;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, .07);
    }
    .table tbody tr:hover { background: #fff; }
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        border: 0;
        border-bottom: 1px solid #edf2f7;
        padding: 9px 2px;
        white-space: normal !important;
        text-align: right;
        overflow-wrap: anywhere;
    }
    .table td:last-child { border-bottom: 0; }
    .table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: #475569;
        font-weight: 900;
        text-align: left;
        text-transform: uppercase;
        font-size: 12px;
    }
    .table td:empty::after { content: "-"; color: var(--muted); }
    .table td.text-end {
        display: grid;
        grid-template-columns: 1fr;
        text-align: stretch !important;
    }
    .table td.text-end::before { margin-bottom: 6px; }
    .table td .btn, .table td .form-select, .table td form, .table td .status-select {
        width: 100%;
        min-width: 0;
    }
    .table td form.d-flex {
        display: grid !important;
        grid-template-columns: 1fr;
    }
    .task-detail-link { text-align: left; width: 100%; }
    .detail-report-table th:nth-child(6), .detail-report-table td:nth-child(6),
    .detail-report-table th:last-child, .detail-report-table td:last-child { min-width: 0; }
    .bottom-nav {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 45;
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 4px;
        padding: 8px;
        border-radius: 8px;
        background: rgba(255, 255, 255, .94);
        border: 1px solid rgba(203, 213, 225, .9);
        box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
        backdrop-filter: blur(12px);
    }
    .bottom-nav a, .bottom-nav button {
        display: grid;
        place-items: center;
        gap: 3px;
        min-width: 0;
        min-height: 54px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #475569;
        font-size: 11px;
        font-weight: 800;
    }
    .bottom-nav i { font-size: 17px; color: var(--teal); }
    .bottom-nav a.active {
        background: linear-gradient(135deg, #ecfeff, #eff6ff);
        color: #0f172a;
    }
    .bottom-nav a.active i { color: var(--blue); }
    .login-page { padding: 14px; align-items: stretch; }
    .login-panel { align-self: center; padding: 20px; }
    .bill-print-page { padding: 16px; }
    .bill-print-head, .bill-print-grid, .bill-signature { flex-direction: column; gap: 12px; }
    .bill-signature span { width: 100%; }
}

@media (max-width: 640px) {
    .main { padding: 16px; }
    .topbar { align-items: center; }
    .sidebar nav, .content-grid, .stats-grid { grid-template-columns: 1fr; }
    .task-row { align-items: flex-start; flex-direction: column; }
    .task-row-actions { justify-content: flex-start; }
    .billing-form, .billing-form.compact { grid-template-columns: 1fr; }
    .report-filter-grid { grid-template-columns: 1fr; }
    .report-filter-actions .btn { flex: 1 1 140px; }
}

@media (max-width: 420px) {
    body { font-size: 15px; }
    .main { padding: 10px; }
    .topbar {
        margin: -10px -10px 12px;
        padding: 10px;
        grid-template-columns: 42px minmax(0, 1fr) auto;
    }
    .topbar h1 { font-size: 18px; }
    .top-actions { width: auto; grid-template-columns: auto auto; }
    .top-actions .btn { font-size: 0; width: 40px; padding: 0; }
    .top-actions .btn::before {
        content: "\f2f5";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        font-size: 15px;
    }
    .panel { padding: 12px; }
    .pdf-actions, .report-filter-actions { grid-template-columns: 1fr; }
    .table td {
        display: grid;
        grid-template-columns: 1fr;
        text-align: left;
    }
    .table td::before { flex-basis: auto; }
    .bottom-nav {
        left: 8px;
        right: 8px;
        bottom: 8px;
        padding: 6px;
    }
    .bottom-nav a, .bottom-nav button { min-height: 50px; font-size: 10px; }
    .profile-hero { align-items: flex-start; padding: 16px; }
    .profile-avatar { width: 58px; height: 58px; flex-basis: 58px; font-size: 26px; }
    .profile-hero h2 { font-size: 22px; }
}

@media print {
    @page { size: A4; margin: 12mm; }
    .sidebar, .topbar, .btn, .bottom-nav, .sidebar-backdrop, .print-toolbar { display: none !important; }
    .app-shell { display: block; }
    body { background: #fff; }
    .main { padding: 0; }
    .bill-print-page { width: 100%; box-shadow: none; border: 0; padding: 0; }
    .panel { box-shadow: none; border: 0; }
}
