/* ==========================================================================
   Respo Minder app design system — mobile-first, brand navy/orange.
   Loaded after Bootstrap; overrides/extends it.
   ========================================================================== */

:root {
    --rm-navy: #123a6b;
    --rm-navy-600: #1b4b86;
    --rm-navy-050: #eaf0f8;
    --rm-orange: #f2871f;
    --rm-orange-050: #fef2e5;

    --rm-bg: #f3f6fb;
    --rm-surface: #ffffff;
    --rm-border: #e6eaf1;
    --rm-text: #1e293b;
    --rm-muted: #6b7280;

    --rm-up: #0ea5e9;   /* upcoming */
    --rm-due: #f59e0b;  /* due today */
    --rm-over: #ef4444; /* overdue */
    --rm-paid: #10b981; /* paid */
    --rm-gray: #94a3b8;

    --rm-radius: 16px;
    --rm-radius-sm: 12px;
    --rm-shadow: 0 2px 10px rgba(18, 58, 107, .06), 0 1px 3px rgba(18, 58, 107, .08);
    --rm-shadow-lg: 0 12px 34px rgba(18, 58, 107, .16);
    --rm-bottom-nav-h: 62px;
}

body {
    background: var(--rm-bg);
    color: var(--rm-text);
    -webkit-font-smoothing: antialiased;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* Room for the mobile bottom nav so content never hides behind it */
@media (max-width: 991.98px) {
    body.app-shell {
        padding-bottom: calc(var(--rm-bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    }
}

h1, h2, h3, h4, h5 { color: var(--rm-navy); font-weight: 700; }

/* ---------- Top app bar ---------- */
.app-topbar {
    background: linear-gradient(120deg, var(--rm-navy), var(--rm-navy-600) 60%, var(--rm-orange) 160%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 12px rgba(18, 58, 107, .18);
}
/* The wordmark carries navy lettering and a dark tagline, so it needs a light
   backing to stay legible against the navy topbar gradient. */
.app-topbar .rm-brand {
    display: inline-flex; align-items: center; text-decoration: none;
    background: #fff; padding: 5px 12px; border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.16);
}
.app-topbar .rm-brand img { height: 34px; width: auto; display: block; }
@media (max-width: 575.98px) {
    .app-topbar .rm-brand { padding: 4px 9px; }
    .app-topbar .rm-brand img { height: 27px; }
}
.app-topbar .btn-icon {
    background: rgba(255,255,255,.14); border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 12px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 1.15rem;
}
.app-topbar .btn-icon:hover { background: rgba(255,255,255,.26); }

/* Desktop horizontal nav inside the topbar */
.rm-desktop-nav .nav-link {
    color: rgba(255,255,255,.86); font-weight: 600; border-radius: 10px; padding: 6px 14px;
}
.rm-desktop-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.14); }
.rm-desktop-nav .nav-link.active { color: #fff; background: rgba(255,255,255,.22); }

/* ---------- Bottom tab nav (mobile) ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
    background: var(--rm-surface);
    border-top: 1px solid var(--rm-border);
    display: flex; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(18, 58, 107, .08);
}
.bottom-nav a {
    flex: 1; text-align: center; text-decoration: none;
    color: var(--rm-muted); font-size: .68rem; font-weight: 600;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 4px 0; border-radius: 12px;
}
.bottom-nav a .bi, .bottom-nav a .rm-ic { font-size: 1.3rem; line-height: 1; }
.bottom-nav a.active { color: var(--rm-navy); }
.bottom-nav a.active .rm-ic { transform: translateY(-1px); }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    box-shadow: var(--rm-shadow);
    background: var(--rm-surface);
}
.card-header {
    background: transparent; border-bottom: 1px solid var(--rm-border);
    font-weight: 700; color: var(--rm-navy); border-radius: var(--rm-radius) var(--rm-radius) 0 0 !important;
}

/* ---------- Stat tiles ---------- */
.stat-tile {
    border-radius: var(--rm-radius);
    padding: 16px;
    color: #fff;
    display: flex; flex-direction: column; gap: 2px;
    box-shadow: var(--rm-shadow);
    position: relative; overflow: hidden;
    min-height: 92px;
}
.stat-tile .stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-tile .stat-label { font-size: .8rem; opacity: .95; font-weight: 600; }
.stat-tile .stat-ic { position: absolute; right: 10px; top: 10px; font-size: 1.6rem; opacity: .35; }
.stat-due   { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat-up    { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.stat-over  { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-paid  { background: linear-gradient(135deg, #10b981, #059669); }

/* ---------- Buttons ---------- */
.btn { border-radius: 12px; font-weight: 600; }
.btn-primary {
    background: var(--rm-navy); border-color: var(--rm-navy);
}
.btn-primary:hover, .btn-primary:focus { background: var(--rm-navy-600); border-color: var(--rm-navy-600); }
.btn-accent { background: var(--rm-orange); border-color: var(--rm-orange); color: #fff; }
.btn-accent:hover { background: #db7715; border-color: #db7715; color: #fff; }
.btn-success { background: var(--rm-paid); border-color: var(--rm-paid); }
/* Comfortable touch targets on mobile */
@media (max-width: 991.98px) {
    .btn { min-height: 42px; }
    .btn-sm { min-height: 36px; }
}

/* ---------- Forms ---------- */
.form-label { font-weight: 600; color: #334155; margin-bottom: .3rem; }
.form-control, .form-select {
    border-radius: 12px; border-color: var(--rm-border); padding: .6rem .8rem;
    min-height: 46px; font-size: 1rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--rm-navy-600);
    box-shadow: 0 0 0 .2rem rgba(18, 58, 107, .12);
}
textarea.form-control { min-height: auto; }

/* ---------- Badges / status ---------- */
.badge { font-weight: 600; border-radius: 999px; padding: .38em .7em; }
.rm-status { display: inline-flex; align-items: center; gap: 5px; }
.rm-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-Upcoming   { background: rgba(14,165,233,.12);  color: #0369a1; }
.st-DueToday   { background: rgba(245,158,11,.15);  color: #b45309; }
.st-Overdue    { background: rgba(239,68,68,.12);   color: #b91c1c; }
.st-Processing { background: rgba(139,92,246,.15);  color: #6d28d9; }
.st-Done       { background: rgba(16,185,129,.14);  color: #047857; }
.st-Paid       { background: rgba(16,185,129,.14);  color: #047857; }
.st-Cancelled  { background: rgba(148,163,184,.18); color: #475569; }
.st-Suspended  { background: rgba(30,41,59,.10);    color: #334155; }

/* Handler line in the Action column */
.rc-handler { font-size: .78rem; font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; }
.rc-handler.processing { color: #6d28d9; }
.rc-handler.done { color: #047857; }

/* ---------- Filter chips ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto; border: 1px solid var(--rm-border); background: var(--rm-surface);
    color: #475569; border-radius: 999px; padding: 7px 14px; font-size: .82rem; font-weight: 600;
    text-decoration: none; white-space: nowrap;
}
.chip.active { background: var(--rm-navy); color: #fff; border-color: var(--rm-navy); }

/* ---------- Reminder cards (mobile list) ---------- */
.reminder-card {
    background: var(--rm-surface); border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius); box-shadow: var(--rm-shadow);
    padding: 14px; margin-bottom: 12px; position: relative;
    border-left: 5px solid var(--rm-gray);
}
.reminder-card.rc-Upcoming   { border-left-color: var(--rm-up); }
.reminder-card.rc-DueToday   { border-left-color: var(--rm-due); }
.reminder-card.rc-Overdue    { border-left-color: var(--rm-over); }
.reminder-card.rc-Processing { border-left-color: #8b5cf6; }
.reminder-card.rc-Done       { border-left-color: var(--rm-paid); }
.reminder-card.rc-Paid       { border-left-color: var(--rm-paid); }
.reminder-card .rc-title { font-weight: 700; color: var(--rm-navy); font-size: 1.02rem; text-decoration: none; }
.reminder-card .rc-meta { color: var(--rm-muted); font-size: .8rem; margin-top: 2px; }
.reminder-card .rc-amt { font-weight: 800; font-size: 1.05rem; }
.reminder-card .rc-amt.out { color: #b91c1c; }
.reminder-card .rc-amt.in { color: #047857; }
.reminder-card .rc-actions { display: flex; gap: 8px; margin-top: 12px; }
.reminder-card .rc-actions .btn { flex: 1; }

/* ---------- Floating action button ---------- */
.fab {
    position: fixed; right: 18px;
    bottom: calc(var(--rm-bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
    z-index: 1035;
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--rm-orange); color: #fff; border: none;
    font-size: 1.7rem; line-height: 1;
    box-shadow: 0 8px 22px rgba(242,135,31,.5);
    display: flex; align-items: center; justify-content: center;
}
.fab:hover { background: #db7715; color: #fff; }
@media (min-width: 992px) { .fab { display: none; } }

/* ---------- Responsive table → card (Group/User/Report lists) ---------- */
@media (max-width: 767.98px) {
    table.rm-responsive thead { display: none; }
    table.rm-responsive, table.rm-responsive tbody, table.rm-responsive tr, table.rm-responsive td {
        display: block; width: 100%;
    }
    table.rm-responsive tr {
        background: var(--rm-surface); border: 1px solid var(--rm-border);
        border-radius: var(--rm-radius-sm); box-shadow: var(--rm-shadow);
        margin-bottom: 12px; padding: 6px 4px;
    }
    table.rm-responsive td {
        border: none; padding: 8px 14px; text-align: right;
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
    }
    table.rm-responsive td::before {
        content: attr(data-label); font-weight: 600; color: var(--rm-muted);
        text-align: left; font-size: .82rem;
    }
    table.rm-responsive td:empty { display: none; }
}

/* ---------- Section headers ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h3 { margin: 0; }

/* ---------- Calendar ----------
   Mobile: a compact dot grid; tapping a day opens its agenda underneath, because reminder
   titles are unreadable in a 50px-wide phone cell. Desktop: titles inline in the cells. */
.cal-toolbar {
    display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px;
}
.cal-period {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.cal-period h3 { margin: 0; font-size: 1.15rem; }
.cal-arrows { display: flex; gap: 6px; flex: 0 0 auto; }
.cal-arrows .btn { width: 40px; min-height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.cal-views { display: flex; gap: 6px; }
.cal-views .chip { flex: 1 1 0; text-align: center; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
    text-align: center; font-size: .66rem; font-weight: 700; letter-spacing: .04em;
    color: var(--rm-muted); text-transform: uppercase; padding: 2px 0 6px;
}
.cal-cell {
    background: var(--rm-surface); border: 1px solid var(--rm-border);
    border-radius: 10px; min-height: 48px; padding: 4px 2px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.cal-cell.is-out { background: transparent; border-color: transparent; }
.cal-cell.is-out .cal-daynum { color: var(--rm-gray); font-weight: 500; }
.cal-cell.is-today { border-color: var(--rm-orange); border-width: 2px; }
.cal-cell.is-selected { background: var(--rm-navy); border-color: var(--rm-navy); }
.cal-cell.is-selected .cal-daynum { color: #fff; }
.cal-daynum { font-size: .82rem; font-weight: 700; line-height: 1.5; color: var(--rm-text); }

.cal-dots { display: flex; gap: 3px; min-height: 6px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rm-gray); }
.cal-dot.s-Upcoming { background: var(--rm-up); }
.cal-dot.s-DueToday { background: var(--rm-due); }
.cal-dot.s-Overdue { background: var(--rm-over); }
.cal-dot.s-Processing { background: #8b5cf6; }
.cal-dot.s-Done, .cal-dot.s-Paid { background: var(--rm-paid); }
/* Hollow, not filled: a parked reminder shouldn't read as a live one at a glance. */
.cal-dot.s-Suspended, .cal-dot.s-Cancelled {
    background: transparent; border: 1.5px solid var(--rm-gray);
}
.cal-cell.is-selected .cal-dot { box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }

/* Titles inside cells: desktop only */
.cal-items { display: none; width: 100%; }
.cal-item {
    display: block; font-size: .72rem; font-weight: 600; border-radius: 6px;
    padding: 1px 5px; margin-top: 2px; text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-more { font-size: .68rem; color: var(--rm-muted); padding-left: 5px; }
.cal-item.st-Suspended, .cal-item.st-Cancelled { text-decoration: line-through; opacity: .7; }

/* Agenda: mobile only, the payoff for tapping a day */
.cal-agenda { margin-top: 14px; }
.cal-agenda-day { display: none; }
.cal-agenda-day.is-active { display: block; }
.cal-agenda-head {
    font-weight: 700; color: var(--rm-navy); font-size: .95rem;
    margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.cal-agenda-head .cal-today-pill {
    background: var(--rm-orange-050); color: #b45309; border-radius: 999px;
    font-size: .68rem; padding: 2px 8px; font-weight: 700;
}
.cal-ag-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--rm-surface); border: 1px solid var(--rm-border);
    border-left: 4px solid var(--rm-gray);
    border-radius: var(--rm-radius-sm); box-shadow: var(--rm-shadow);
    padding: 11px 13px; margin-bottom: 8px; text-decoration: none;
}
.cal-ag-item.rc-Upcoming { border-left-color: var(--rm-up); }
.cal-ag-item.rc-DueToday { border-left-color: var(--rm-due); }
.cal-ag-item.rc-Overdue { border-left-color: var(--rm-over); }
.cal-ag-item.rc-Processing { border-left-color: #8b5cf6; }
.cal-ag-item.rc-Done, .cal-ag-item.rc-Paid { border-left-color: var(--rm-paid); }
/* Suspended still shows on the date (you may want to know it's parked there) but must never
   read as a live commitment: muted, and the status badge in the row names it. */
.cal-ag-item.rc-Suspended, .cal-ag-item.rc-Cancelled {
    border-left-color: var(--rm-gray); opacity: .6; background: var(--rm-bg);
}
.cal-ag-item.rc-Suspended .cal-ag-title, .cal-ag-item.rc-Cancelled .cal-ag-title {
    color: var(--rm-muted); text-decoration: line-through;
}
.cal-ag-item.rc-Suspended .cal-ag-amt, .cal-ag-item.rc-Cancelled .cal-ag-amt { color: var(--rm-muted); }
.cal-ag-title { font-weight: 700; color: var(--rm-navy); font-size: .92rem; }
.cal-ag-meta { color: var(--rm-muted); font-size: .74rem; margin-top: 2px; }
.cal-ag-amt { font-weight: 800; font-size: .95rem; white-space: nowrap; }
.cal-ag-amt.out { color: #b91c1c; }
.cal-ag-amt.in { color: #047857; }
.cal-empty {
    text-align: center; color: var(--rm-muted); font-size: .86rem;
    padding: 18px; background: var(--rm-surface);
    border: 1px dashed var(--rm-border); border-radius: var(--rm-radius-sm);
}

/* Week/Day list */
.cal-daycard-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .86rem;
}
.cal-daycard-head .cal-cnt { color: var(--rm-muted); font-weight: 600; font-size: .76rem; }

@media (min-width: 768px) {
    .cal-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
    .cal-views { flex: 0 0 auto; }
    .cal-views .chip { flex: 0 0 auto; }
    .cal-grid { gap: 6px; }
    .cal-cell {
        min-height: 108px; align-items: stretch; padding: 6px; cursor: default;
        justify-content: flex-start;
    }
    .cal-daynum { text-align: left; }
    .cal-dots { display: none; }
    .cal-items { display: block; }
    .cal-cell.is-selected { background: var(--rm-surface); border-color: var(--rm-border); }
    .cal-cell.is-selected .cal-daynum { color: var(--rm-text); }
    .cal-cell.is-today { border-color: var(--rm-orange); }
    .cal-agenda { display: none; }
}

/* ---------- Misc ---------- */
.footer.rm-footer { background: transparent; color: var(--rm-muted); }
a { color: var(--rm-navy-600); }
.list-group-item { border-color: var(--rm-border); }
