:root {
    --brand-primary: #15803d;
    --brand-primary-dark: #166534;
    --brand-wa: #25d366;
    --brand-surface: #f4f6f5;
    --brand-ink: #111827;
    --brand-muted: #4b5563;
    --brand-border: #e5e7eb;
}

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

body {
    background-color: var(--brand-surface);
    color: var(--brand-ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mobile-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

.app-shell {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 6.75rem;
}

.app-shell-admin {
    padding-bottom: 2rem;
}

.app-topbar {
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--brand-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-topbar-inner {
    max-width: 520px;
    margin: 0 auto;
}

.auth-card {
    border: 0;
    border-radius: 1.25rem;
    box-shadow: 0 10px 30px rgba(20, 45, 32, 0.08);
}

.brand-badge {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    background-color: var(--brand-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.btn-touch {
    min-height: 3rem;
    font-weight: 600;
    border-radius: 0.85rem;
}

.btn-wa-action {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
    min-height: 3rem;
    font-weight: 700;
    border-radius: 0.85rem;
}

.btn-wa-action:hover,
.btn-wa-action:focus {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    color: #ffffff;
}

.btn-secondary-touch {
    min-height: 2.75rem;
    font-weight: 600;
    border-radius: 0.75rem;
}

.btn-support-wa {
    background-color: #ecfdf5;
    border: 1px solid #86efac;
    color: #15803d;
    font-weight: 700;
    padding: 0.42rem 0.78rem;
    min-height: 2.25rem;
}

.btn-support-wa:hover,
.btn-support-wa:focus {
    background-color: #15803d;
    border-color: #15803d;
    color: #ffffff;
}

.form-control-lg,
.form-select-lg {
    border-radius: 0.75rem;
    font-size: 1rem;
}

.input-group-lg > .input-group-text {
    border-radius: 0.75rem 0 0 0.75rem;
    font-weight: 600;
}

.input-group-lg > .form-control {
    border-radius: 0 0.75rem 0.75rem 0;
}

/* KPI cards */
.kpi-card {
    border: 1px solid var(--brand-border);
    border-radius: 1rem;
    background-color: #ffffff;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.04);
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* Segmented Tabs */
.radar-tabs {
    background-color: #e5e7eb;
    border-radius: 0.9rem;
    padding: 0.25rem;
}

.radar-tabs .nav-link {
    border-radius: 0.7rem;
    color: var(--brand-muted);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.65rem 0.5rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.radar-tabs .nav-link.active {
    background-color: #ffffff;
    color: var(--brand-ink);
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.08);
}

/* Reminder Action Card */
.reminder-card {
    border: 1px solid var(--brand-border);
    border-radius: 1.1rem;
    background-color: #ffffff;
    box-shadow: 0 4px 16px rgba(17, 24, 39, 0.04);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.reminder-card-removing {
    opacity: 0;
    transform: translateY(-6px);
}

.reminder-note {
    background-color: #f8fafc;
    border-left: 3px solid #cbd5e1;
    border-radius: 0.45rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.84rem;
    color: var(--brand-muted);
}

.status-pill-overdue {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.status-pill-today {
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.status-pill-upcoming {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.status-pill-sent {
    background-color: #ecfdf5;
    color: #15803d;
    border: 1px solid #a7f3d0;
}

/* Client autocomplete results */
.client-search-results {
    max-height: 13.5rem;
    overflow-y: auto;
    border: 1px solid var(--brand-border);
    border-radius: 0.8rem;
    background-color: #ffffff;
}

.client-search-item {
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background-color: #ffffff;
    padding: 0.7rem 0.85rem;
    min-height: 3rem;
}

.client-search-item:last-child {
    border-bottom: 0;
}

.client-search-item:hover,
.client-search-item:focus {
    background-color: #f0fdf4;
}

.selected-client-chip {
    background-color: #ecfdf5;
    border: 1px solid #86efac;
    border-radius: 0.85rem;
    padding: 0.75rem 0.9rem;
}

/* Bottom Navigation Bar */
.app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1025;
    background-color: #ffffff;
    border-top: 1px solid var(--brand-border);
    box-shadow: 0 -4px 18px rgba(17, 24, 39, 0.06);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-bottom-nav-inner {
    max-width: 520px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

.app-bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 3.85rem;
    text-decoration: none;
    color: var(--brand-muted);
    font-size: 0.7rem;
    font-weight: 600;
}

.app-bottom-link i {
    font-size: 1.25rem;
    line-height: 1;
}

.app-bottom-link.active {
    color: var(--brand-primary);
}

/* Floating Action Button (+) */
.app-fab-anchor {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(4.65rem + env(safe-area-inset-bottom, 0px));
    z-index: 1030;
    pointer-events: none;
}

.app-fab-anchor-staff {
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.app-fab-container {
    max-width: 520px;
    margin: 0 auto;
    padding-right: 1rem;
    display: flex;
    justify-content: flex-end;
}

.app-fab {
    pointer-events: auto;
    width: 3.65rem;
    height: 3.65rem;
    border-radius: 999px;
    background-color: var(--brand-ink);
    color: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.app-fab:hover,
.app-fab:focus {
    background-color: var(--brand-primary);
    color: #ffffff;
    transform: scale(1.04);
}

/* Mobile-friendly Bottom Sheet Modals */
@media (max-width: 575.98px) {
    .modal-bottom-sheet .modal-dialog {
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
    }

    .modal-bottom-sheet .modal-content {
        border-radius: 1.35rem 1.35rem 0 0;
        border: 0;
        max-height: 92vh;
        overflow-y: auto;
    }
}

.toast-wrapper {
    position: fixed;
    top: 4.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    width: calc(100% - 1.5rem);
    max-width: 460px;
}

.template-preview-box {
    background-color: #dcf8c6;
    border: 1px solid #bbf7d0;
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
    color: var(--brand-ink);
    white-space: pre-wrap;
}

.period-pills-scroll {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    -webkit-overflow-scrolling: touch;
}

.period-pill {
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 600;
    padding: 0.42rem 0.85rem;
}
