/* ?? Reset & Base ??????????????????????????????????????????????????????? */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
    line-height: 1.5;
}

a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ?? Layout ????????????????????????????????????????????????????????????? */
body > header {
    background: #2c3e50;
    color: #fff;
    padding: 0 1rem;
}

.navbar {
  display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}

.navbar-brand a {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
}

.navbar-menu a,
.navbar-menu button {
    color: #ccc;
    margin-left: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.navbar-menu a:hover,
.navbar-menu button:hover { color: #fff; text-decoration: none; }

/* ?? Grouped navigation (Profile / Reminders / Psychological Tests) ????? */
.navbar-menu {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.nav-group {
    position: relative;
    margin-left: 1rem;
    /* Padding instead of margin so the hover area extends below the label
       and overlaps the dropdown — prevents accidental :hover loss. */
    padding-bottom: 4px;
}

.nav-group-label {
    color: #ccc;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 0.4rem 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 4px;
}

.nav-group-label .caret { font-size: 10px; opacity: 0.7; }

.nav-group:hover > .nav-group-label,
.nav-group:focus-within > .nav-group-label {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 1000;
}

.nav-group:hover > .nav-dropdown,
.nav-group:focus-within > .nav-dropdown { display: block; }

.nav-dropdown a {
    display: block;
    color: #e5e7eb;
    padding: 8px 14px;
    margin: 0;
    font-size: 14px;
    white-space: nowrap;
    text-decoration: none;
}

.nav-dropdown a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.navbar-logout {
    margin-left: auto;
    display: inline;
}

.navbar-logout button {
    color: #ccc;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 13px;
}

.navbar-logout button:hover {
    color: #fff;
    border-color: #fff;
}

.navbar-toggle {
    display: none;
    color: #fff;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 18px;
    cursor: pointer;
}

@media (max-width: 800px) {
    .navbar { flex-wrap: wrap; align-items: flex-start; height: auto; padding: 8px 0; }
    .navbar-toggle { display: inline-block; margin-left: auto; }
    .navbar-menu {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        margin-top: 8px;
    }
    .navbar-menu.open { display: flex; }
    .nav-group { margin: 0; }
    .nav-group-label { width: 100%; justify-content: space-between; }
    .nav-dropdown {
        position: static;
        display: block;
        background: transparent;
        border: none;
        box-shadow: none;
        padding-left: 1rem;
    }
    .navbar-logout { margin: 8px 0 0; }
}

.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

footer {
    text-align: center;
    padding: 1rem;
    color: #888;
    font-size: 12px;
    margin-top: 2rem;
}

/* ?? Typography ????????????????????????????????????????????????????????? */
h1 { font-size: 1.8rem; margin-bottom: 1rem; color: #2c3e50; }
h2 { font-size: 1.3rem; margin: 1.2rem 0 0.6rem; color: #34495e; }

/* ?? Alerts / Messages ?????????????????????????????????????????????????? */
.success {
    background: #d4edda; border: 1px solid #c3e6cb; color: #155724;
    padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem;
}
.error {
    background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24;
    padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem;
}
.notice {
    background: #d1ecf1; border: 1px solid #bee5eb; color: #0c5460;
    padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem;
}
.text-danger { color: #dc3545; font-size: 12px; }

/* ?? Buttons ???????????????????????????????????????????????????????????? */
.btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    color: #333;
    margin-right: 0.3rem;
}
.btn:hover { background: #f0f0f0; text-decoration: none; }
.btn-primary { background: #0066cc; border-color: #0055aa; color: #fff; }
.btn-primary:hover { background: #0055aa; color: #fff; }
.btn-danger { background: #dc3545; border-color: #c82333; color: #fff; }
.btn-danger:hover { background: #c82333; color: #fff; }
.btn-secondary { background: #6c757d; border-color: #5a6268; color: #fff; }

/* ?? Forms ?????????????????????????????????????????????????????????????? */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.form-control {
    display: block; width: 100%; max-width: 480px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc; border-radius: 4px;
    font-size: 14px;
}
.form-control:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 2px rgba(0,102,204,.25); }
textarea.form-control { resize: vertical; }

/* ?? Grid / Tables ?????????????????????????????????????????????????????? */
.grid {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    margin-bottom: 1rem;
}

.grid th {
    background: #1f2d3d;
    color: #fff;
 text-align: left;
    padding: 0.6rem 0.8rem;
    font-weight: 700;
    border-bottom: 2px solid #ffb84d;
    white-space: nowrap;
}

.grid th a {
    color: #fff;
    text-decoration: none;
    display: inline-block;
}

.grid th a:hover {
    text-decoration: underline;
    color: #ffd699;
}

.grid th .sort-indicator {
    margin-left: 4px;
    color: #ffb84d;
    font-size: 0.85em;
}

.grid td { padding: 0.5rem 0.8rem; border-bottom: 1px solid #eee; }
.grid tr:last-child td { border-bottom: none; }
.grid tr:hover td { background: #f8f9fa; }

/* Action icons — use bi icons via web font; fall back to text */
.grid .action-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    text-align: center;
    color: #0066cc;
    font-size: 16px;
    text-decoration: none;
}

.grid .action-icon:hover { color: #0055aa; }

/* View-mode form: read-only field display */
.view-mode .form-control[readonly],
.view-mode .form-control:read-only {
    background: #f0f3f6;
  color: #333;
    border-color: #d8dde3;
    cursor: default;
}

.view-mode .form-control[type="checkbox"] { pointer-events: none; }

/* ?? Hero (home page) ??????????????????????????????????????????????????? */
.hero {
    background: #fff;
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    margin-bottom: 1.5rem;
}
.hero h1 { font-size: 2rem; }
.hero p { color: #555; margin: 0.8rem 0 1.2rem; }

/* ?? Features ??????????????????????????????????????????????????????????? */
.features { background: #fff; border-radius: 6px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.features ul { list-style: disc; padding-left: 1.5rem; }
.features li { margin-bottom: 0.4rem; }

/* ?? Survey Questions ??????????????????????????????????????????????????? */
.survey-question { background: #fff; border: 1px solid #ddd; border-radius: 4px; padding: 1rem; margin-bottom: 0.8rem; }
.survey-options label { display: block; margin: 0.2rem 0; }
.assessment-list { list-style: none; padding: 0; }
.assessment-list li { margin-bottom: 0.6rem; }

/* ?? Appointment card ??????????????????????????????????????????????????? */
.appointment-card {
    background: #fff; border: 1px solid #ddd; border-radius: 6px;
    padding: 1.5rem; max-width: 500px;
}

/* Status colours for Completed Reminders grid */
.status-confirmed { color: #2d7a2d; font-weight: bold; }
.status-voicemail  { color: #2d7a2d; }
.status-canceled   { color: #c0392b; }
.status-failed { color: #8b0000; }
/* Survey score severity colours */
.score-mild     { color: #b8860b; font-weight: bold; }
.score-moderate { color: #c0392b; font-weight: bold; }
.score-severe   { color: #8b0000; font-weight: bold; background-color: #fff0f0; }

/* ???????????????????????????????????????????????????????????????????????
   Beautification layer — modern palette, Inter typography, gradients,
   refined shadows, smoother interactions. Appended last so it overrides
   the legacy styles above without removing them.
   ??????????????????????????????????????????????????????????????????????? */

:root {
    --c-bg:           #f4f6fb;
    --c-surface:      #ffffff;
    --c-surface-alt:  #f8fafc;
    --c-border:       #e2e8f0;
    --c-text:         #0f172a;
    --c-text-muted:   #64748b;
    --c-primary:      #2563eb;
    --c-primary-700:  #1d4ed8;
    --c-accent:       #0ea5e9;
    --c-success:      #10b981;
    --c-danger:       #ef4444;
    --c-warning:      #f59e0b;
    --c-nav-from:     #0f172a;
    --c-nav-to:       #1e293b;
    --c-nav-accent:   #38bdf8;
    --shadow-sm:      0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md:      0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg:      0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
    --radius:         8px;
    --radius-lg:      12px;
    --t-fast:         150ms cubic-bezier(.4,0,.2,1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c-primary); transition: color var(--t-fast); }
a:hover { color: var(--c-primary-700); text-decoration: none; }

/* ?? Header / navbar ??????????????????????????????????????????????????? */
body > header {
    background: linear-gradient(135deg, var(--c-nav-from) 0%, var(--c-nav-to) 100%);
    box-shadow: var(--shadow-md);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.navbar { height: 60px; }

.navbar-brand a {
    background: linear-gradient(90deg, #ffffff 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.nav-group-label {
    color: rgba(255,255,255,0.78);
    font-weight: 500;
    transition: color var(--t-fast), background var(--t-fast);
}

.nav-group:hover > .nav-group-label,
.nav-group:focus-within > .nav-group-label {
    color: #ffffff;
    background: rgba(56, 189, 248, 0.15);
}

.nav-dropdown {
    background: #ffffff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    /* Top padding via transparent border keeps the hover bridge continuous
       so moving the mouse from the trigger to the menu doesn't close it. */
    margin-top: 0;
    border-top: 4px solid transparent;
    background-clip: padding-box;
    min-width: 220px;
    animation: nav-fade-in 140ms ease-out;
}

.nav-dropdown a {
    color: var(--c-text);
    border-radius: 6px;
    padding: 9px 12px;
    font-weight: 500;
    transition: background var(--t-fast), color var(--t-fast);
}

.nav-dropdown a:hover {
    background: linear-gradient(90deg, rgba(37,99,235,0.08) 0%, rgba(14,165,233,0.08) 100%);
    color: var(--c-primary-700);
}

@keyframes nav-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.navbar-logout button {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.18);
    font-weight: 500;
    transition: all var(--t-fast);
}

.navbar-logout button:hover {
    background: rgba(239,68,68,0.18);
    border-color: rgba(239,68,68,0.55);
    color: #ffffff;
}

/* ?? Page container ???????????????????????????????????????????????????? */
.container { max-width: 1180px; padding: 0 1.5rem; margin: 2rem auto; }

main.container { animation: page-in 220ms ease-out; }
@keyframes page-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ?? Typography ???????????????????????????????????????????????????????? */
h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--c-text);
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--c-border);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--c-text);
    letter-spacing: -0.01em;
    margin: 1.5rem 0 0.75rem;
}

h3 { font-size: 1.05rem; font-weight: 600; color: var(--c-text); margin: 1rem 0 0.5rem; }

p { color: var(--c-text); }
small, .muted { color: var(--c-text-muted); }

/* ?? Buttons ??????????????????????????????????????????????????????????? */
.btn, button.btn, a.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-text);
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast);
    cursor: pointer;
    line-height: 1.2;
}

.btn:hover {
    background: var(--c-surface-alt);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-primary {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-700) 100%);
    border-color: var(--c-primary-700);
    color: #ffffff;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--c-primary-700) 0%, #1e40af 100%);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--c-danger) 0%, #dc2626 100%);
    border-color: #b91c1c;
    color: #ffffff;
}
.btn-danger:hover { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color: #ffffff; }

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border-color: #334155;
    color: #ffffff;
}

/* ?? Forms ????????????????????????????????????????????????????????????? */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    color: var(--c-text);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.form-control {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    font-size: 0.9rem;
}

.form-control:hover { border-color: #cbd5e1; }

.form-control:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #ffffff;
}

input[type="text"], input[type="tel"], input[type="email"],
input[type="password"], input[type="date"], input[type="number"],
select, textarea {
    font-family: inherit;
}

/* ?? Alerts ???????????????????????????????????????????????????????????? */
.success, .error, .notice {
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    box-shadow: var(--shadow-sm);
    border-left-width: 4px;
}

.success { background: #ecfdf5; border-color: var(--c-success); color: #065f46; border-left-color: var(--c-success); }
.error   { background: #fef2f2; border-color: var(--c-danger);  color: #991b1b; border-left-color: var(--c-danger);  }
.notice  { background: #eff6ff; border-color: var(--c-accent);  color: #1e40af; border-left-color: var(--c-accent);  }

/* ?? Tables / grids ???????????????????????????????????????????????????? */
.grid {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--c-border);
}

.grid th {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--c-accent);
    padding: 0.75rem 1rem;
}

.grid th a:hover { color: var(--c-accent); }

.grid td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--c-text);
}

.grid tbody tr:nth-child(even) td { background: var(--c-surface-alt); }
.grid tbody tr:hover td {
    background: linear-gradient(90deg, rgba(37,99,235,0.06) 0%, rgba(14,165,233,0.04) 100%);
}

/* ?? Hero (home page) ?????????????????????????????????????????????????? */
.hero {
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(56,189,248,0.25) 0%, transparent 70%);
    pointer-events: none;
}

.hero h1 {
    font-size: 2.5rem;
    border-bottom: none;
    padding-bottom: 0;
    background: linear-gradient(90deg, var(--c-primary) 0%, var(--c-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.hero p { font-size: 1.05rem; color: var(--c-text-muted); }

/* ?? Features card ????????????????????????????????????????????????????? */
.features {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow-md);
}
.features li { color: var(--c-text); margin-bottom: 0.5rem; }
.features li::marker { color: var(--c-primary); }

/* ?? Cards / panels ???????????????????????????????????????????????????? */
.appointment-card, .survey-question {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.appointment-card:hover, .survey-question:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* ?? Footer ???????????????????????????????????????????????????????????? */
footer {
    color: var(--c-text-muted);
    border-top: 1px solid var(--c-border);
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    background: var(--c-surface-alt);
}

/* ?? Status / score colours (refresh existing) ????????????????????????? */
.status-confirmed { color: var(--c-success); font-weight: 600; }
.status-voicemail { color: #0d9488; }
.status-canceled  { color: var(--c-danger); font-weight: 600; }
.status-failed    { color: #7f1d1d; font-weight: 700; }
.score-mild       { color: var(--c-warning); }
.score-moderate   { color: #ea580c; }
.score-severe     { color: var(--c-danger); background: #fef2f2; padding: 2px 6px; border-radius: 4px; }
.score-low        { color: var(--c-success); font-weight: 600; }

/* ?? Scrollbar polish (WebKit) ????????????????????????????????????????? */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--c-bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ?? Selection ????????????????????????????????????????????????????????? */
::selection { background: rgba(37, 99, 235, 0.25); color: var(--c-text); }


/* ???????????????????????????????????????????????????????????????????????
   Design System Layer 2 — page primitives
   PageHeader, Card, KPI tiles, Badges, Kebab menu, Sticky action bar,
   Empty state, Modal, Toast, Skeleton, Floating focus, mobile collapse.
   Appended last; overrides everything above.
   ??????????????????????????????????????????????????????????????????????? */

/* ?? Skip link (a11y) ?????????????????????????????????????????????????? */
.skip-link {
    position: absolute; top: -40px; left: 0; background: var(--c-primary);
    color: #fff; padding: 8px 16px; z-index: 999; border-radius: 0 0 6px 0;
    text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0; }

/* ?? Page header (every page renders this) ????????????????????????????? */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding-bottom: 1rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--c-border);
    flex-wrap: wrap;
}

.page-header__eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--c-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.page-header__title {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0;
    padding: 0;
    border: none;
    color: var(--c-text);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.page-header__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(37,99,235,0.12) 0%, rgba(14,165,233,0.18) 100%);
    color: var(--c-primary);
    font-size: 1.3rem;
}

.page-header__subtitle {
    color: var(--c-text-muted);
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
    max-width: 60ch;
}

.page-header__actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* When the body of a page is inside a card */
.card-surface {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.card-surface + .card-surface { margin-top: 1.25rem; }

/* ?? KPI Tile grid (Dashboard) ????????????????????????????????????????? */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.kpi-tile {
    position: relative;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.kpi-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-tile::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c-primary) 0%, var(--c-accent) 100%);
}

.kpi-tile__label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex; align-items: center; gap: 0.4rem;
}

.kpi-tile__value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.4rem 0 0.1rem;
    color: var(--c-text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.kpi-tile__hint {
    font-size: 0.78rem;
    color: var(--c-text-muted);
    display: flex; align-items: center; gap: 0.3rem;
}

.kpi-tile--good::before { background: linear-gradient(90deg, var(--c-success) 0%, #14b8a6 100%); }
.kpi-tile--warn::before { background: linear-gradient(90deg, var(--c-warning) 0%, #f97316 100%); }
.kpi-tile--bad::before  { background: linear-gradient(90deg, var(--c-danger)  0%, #be123c 100%); }

.kpi-tile__icon {
    position: absolute;
    bottom: 0.6rem; right: 0.9rem;
    font-size: 2.5rem;
    color: rgba(15, 23, 42, 0.05);
    pointer-events: none;
}

/* ?? Stats / period table — modernized ????????????????????????????????? */
.stats-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.stats-table th, .stats-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--c-border);
    text-align: left;
}
.stats-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-muted);
    font-weight: 600;
    background: var(--c-surface-alt);
}
.stats-table td:first-child { font-weight: 600; }
.stats-table tbody tr:hover td { background: rgba(37, 99, 235, 0.04); }
.stats-table .num { font-variant-numeric: tabular-nums; }
.stats-table .num-good { color: var(--c-success); font-weight: 600; }
.stats-table .num-bad  { color: var(--c-danger);  font-weight: 600; }

/* ?? Badges / pills ???????????????????????????????????????????????????? */
.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: var(--c-surface-alt);
    color: var(--c-text);
    border: 1px solid var(--c-border);
}
.badge-success { background: #ecfdf5; color: #065f46; border-color: rgba(16,185,129,0.3); }
.badge-warn    { background: #fffbeb; color: #92400e; border-color: rgba(245,158,11,0.3); }
.badge-danger  { background: #fef2f2; color: #991b1b; border-color: rgba(239,68,68,0.3); }
.badge-info    { background: #eff6ff; color: #1e40af; border-color: rgba(59,130,246,0.3); }
.badge-neutral { background: #f1f5f9; color: #475569; border-color: var(--c-border); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ?? Empty state ??????????????????????????????????????????????????????? */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--c-text-muted);
    background: var(--c-surface);
    border: 1px dashed var(--c-border);
    border-radius: var(--radius-lg);
}
.empty-state__icon {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(37,99,235,0.08) 0%, rgba(14,165,233,0.12) 100%);
    border-radius: 50%;
    color: var(--c-primary);
    font-size: 1.8rem;
}
.empty-state__title { color: var(--c-text); font-weight: 600; font-size: 1.1rem; margin-bottom: 0.4rem; }
.empty-state__body  { max-width: 40ch; margin: 0 auto 1.25rem; }

/* ?? Kebab menu (row actions) ?????????????????????????????????????????? */
.kebab { position: relative; display: inline-block; }
.kebab__btn {
    background: none; border: none; cursor: pointer;
    color: var(--c-text-muted);
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    transition: background var(--t-fast), color var(--t-fast);
}
.kebab__btn:hover { background: rgba(37,99,235,0.1); color: var(--c-primary); }
.kebab__menu {
    display: none;
    position: absolute; top: 100%; right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    z-index: 50;
    animation: nav-fade-in 140ms ease-out;
}
.kebab.open .kebab__menu { display: block; }
.kebab__menu a, .kebab__menu button {
    display: flex; align-items: center; gap: 0.55rem;
    width: 100%;
    padding: 7px 12px;
    border-radius: 5px;
    border: none; background: none; cursor: pointer;
    color: var(--c-text);
    font-size: 0.85rem;
    text-align: left;
    text-decoration: none;
    font-weight: 500;
}
.kebab__menu a:hover, .kebab__menu button:hover {
    background: rgba(37,99,235,0.08); color: var(--c-primary-700);
}
.kebab__menu .danger { color: var(--c-danger); }
.kebab__menu .danger:hover { background: rgba(239,68,68,0.08); color: #b91c1c; }

/* ?? Sticky form action bar ???????????????????????????????????????????? */
.action-bar-sticky {
    position: sticky;
    bottom: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--c-border);
    margin: 1.5rem -1.5rem -1.5rem;
    padding: 0.85rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    z-index: 10;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ?? Toast notifications ??????????????????????????????????????????????? */
#toast-container {
    position: fixed;
    top: 80px; right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.85rem 1.1rem;
    min-width: 280px; max-width: 380px;
    display: flex; align-items: flex-start; gap: 0.7rem;
    pointer-events: auto;
    animation: toast-in 240ms cubic-bezier(.16,1,.3,1);
    border-left: 4px solid var(--c-primary);
}
.toast.success { border-left-color: var(--c-success); }
.toast.error   { border-left-color: var(--c-danger);  }
.toast.warn    { border-left-color: var(--c-warning); }
.toast__icon { font-size: 1.2rem; flex-shrink: 0; }
.toast.success .toast__icon { color: var(--c-success); }
.toast.error   .toast__icon { color: var(--c-danger);  }
.toast.warn    .toast__icon { color: var(--c-warning); }
.toast__body { flex: 1; font-size: 0.88rem; color: var(--c-text); }
.toast__close {
    background: none; border: none; cursor: pointer;
    color: var(--c-text-muted); font-size: 1rem; padding: 0;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

/* ?? Form row layouts (two-column groups) ?????????????????????????????? */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-row-csz { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) {
    .form-row, .form-row-3, .form-row-csz { grid-template-columns: 1fr; }
}

/* ?? Hero on home page — restyle ??????????????????????????????????????? */
.hero {
    padding: 4rem 2.5rem;
    text-align: left;
}
.hero h1 {
    font-size: 3rem;
    max-width: 18ch;
}
.hero p {
    max-width: 52ch;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}
.hero .btn { padding: 0.7rem 1.4rem; font-size: 0.95rem; }

/* Feature icon grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.feature-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.35);
}
.feature-card__icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-accent) 100%);
    margin-bottom: 0.8rem;
    box-shadow: 0 4px 10px rgba(37,99,235,0.3);
}
.feature-card h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.feature-card p { color: var(--c-text-muted); font-size: 0.88rem; margin: 0; }

/* ?? Navigation: icons inside group labels ???????????????????????????? */
.nav-group-label i { font-size: 0.95rem; opacity: 0.85; margin-right: 0.15rem; }
.nav-dropdown a i  { width: 16px; color: var(--c-primary); margin-right: 0.1rem; }

/* ?? Sub-utility ??????????????????????????????????????????????????????? */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.flex-row { display: flex; gap: 0.5rem; align-items: center; }
.spacer { flex: 1; }

/* ?? Focus rings ??????????????????????????????????????????????????????? */
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ?? Animated underline for in-page links ?????????????????????????????? */
main.container a:not(.btn):not(.kebab__btn):not(.nav-dropdown a):not(.empty-state a) {
    position: relative;
}


/* ?? Completed-reminder row colors (legacy WebForms parity) ??????????
   GetStatusColor in RemindersCompleted.aspx.cs:
     Confirmed              ? LimeGreen
     ConfirmedLate          ? Green
     MessageLeft / SmsSent  ? Green
     CancelationRequested   ? Red
     RescheduleRequested    ? Red
     ErrorReported / Failed ? Firebrick
   GetPhoneColor:
     Status == Failed       ? Firebrick
     AttemptCount > 1       ? DarkViolet
*/
.status-confirmed { color: #32cd32 !important; font-weight: 600; }
.status-voicemail { color: #008000 !important; }
.status-canceled  { color: #ff0000 !important; font-weight: 600; }
.status-failed    { color: #b22222 !important; font-weight: 700; }

.phone-failed       { color: #b22222; font-weight: 600; }
.phone-multi-attempt { color: #9400d3; }


/* Reminders grid: locked rows that cannot be deleted (mirrors WebForms disabled checkbox)
.row-locked td { background: rgba(15,23,42,0.025); color: var(--c-text-muted); }
.row-locked input[type='checkbox'][disabled] { opacity: 0.4; cursor: not-allowed; }*/
.row-locked td { background: rgba(15,23,42,0.03); color: var(--c-text-muted); }
.row-locked input[type='checkbox'][disabled] { opacity: 0.4; cursor: not-allowed; }
