/* File: public/style.css — all site styling for the app (FRAMEWORK: change the palette in :root).
 * Betty palette (teal): primary #0F766E, primary-dark #134E4A, accent #2DD4BF (on dark) / #0D9488 (on white), bg #FFFFFF, text #000000.
 * Light accents on dark surfaces: #99F6E4 (hero title), #5EEAD4 (footer links).
 * No inline CSS anywhere else (except email HTML in mailer.php).
 */

:root {
    --primary:       #0F766E;
    --primary-dark:  #134E4A;
    --secondary:     #2DD4BF;
    --secondary-dark:#0D9488;
    --bg:            #FFFFFF;
    --text:          #000000;
    --muted:         #6b7b8a;
    --white:         #FFFFFF;
    --border:        #dce0e8;
    --border-gold:   rgba(45,212,191,0.45);
    --danger:        #C0392B;
    --danger-dark:   #a5342a;
    --shadow:        0 2px 8px rgba(19,78,74,0.08);
    --shadow-lg:     0 8px 24px rgba(19,78,74,0.12);
    --radius:        10px;
}

* { box-sizing: border-box; }

html { margin: 0; padding: 0; height: 100%; }
body { margin: 0; padding: 0; }
/* Footer at the bottom of the screen on short pages (owner 2026-10-30): the page fills the window height. */
body:not(.doc-print-body) { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body:not(.doc-print-body) > main { flex: 1 0 auto; width: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

h1, h2, h3, h4, h5, h6 { color: var(--primary); line-height: 1.25; }

/* ---------- Header ---------- */
.site-header {
    background-color: var(--white);
    border-bottom: 2px solid rgba(45,212,191,0.45);
    box-shadow: var(--shadow);
}
.header-inner {
    /* Full screen width (owner 2026-10-12): logo at the left edge, menu at the right edge, as the app pages below. */
    max-width: none;
    margin: 0;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}
.brand-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.header-nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    line-height: 1.2;
}
.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-dark); }
.btn-secondary { background-color: var(--white); color: var(--primary); border-color: var(--secondary); }
.btn-secondary:hover { background-color: rgba(45,212,191,0.08); }
.btn-danger { background-color: var(--danger); color: var(--white); }
.btn-danger:hover { background-color: var(--danger-dark); }
.btn-large { padding: 14px 28px; font-size: 17px; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, #0F766E 0%, #134E4A 100%);
    padding: 24px 24px 10px;
}
.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.hero-inner h1 { font-size: 40px; margin: 0 0 16px; color: #99F6E4; }
.hero-lead { font-size: 19px; color: rgba(255,255,255,0.92); margin: 0 auto 16px; max-width: 620px; text-align: justify; }
.hero-lead-secondary { font-size: 19px; color: rgba(255,255,255,0.92); margin-bottom: 28px !important; text-align: justify; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.hero-note { font-size: 13px; color: rgba(255,255,255,0.60); }

/* ---------- Sections ---------- */
.section { padding: 20px 24px; }
.section-alt { background-color: #fafbff; padding-top: 12px; }
.section-inner { max-width: 1120px; margin: 0 auto; }
.section-title { font-size: 30px; text-align: center; margin: 0 0 16px; color: var(--primary); }

.steps-grid, .features-grid {
    display: grid;
    gap: 16px;
}
.steps-grid { grid-template-columns: repeat(3, 1fr); }
.features-grid { grid-template-columns: repeat(2, 1fr); }

.step-card, .feature-card {
    background-color: var(--white);
    border: 1.5px solid var(--border-gold);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow);
}
.section-alt .feature-card { background-color: #fafbff; border-color: var(--border-gold); }
.step-card h3, .feature-card h3 { margin: 12px 0 8px; font-size: 20px; color: var(--primary); }
.step-card p, .feature-card p { margin: 0; color: #2a2a2a; }
.step-number {
    width: 44px; height: 44px;
    border-radius: 50%;
    background-color: var(--secondary);
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 20px;
    display: flex; align-items: center; justify-content: center;
}

.disclaimer-section { background-color: #fafbff; padding-top: 12px; padding-bottom: 14px; }
.disclaimer-card {
    background: var(--white);
    border: 2px solid rgba(45,212,191,0.55);
    border-radius: 14px;
    padding: 24px 32px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 36px;
    align-items: flex-start;
}
.disclaimer-icon-col {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
    gap: 14px; min-width: 120px;
}
.disclaimer-icon-lg {
    width: 80px; height: 80px; display: flex; align-items: center; justify-content: center;
    background: rgba(208,2,27,0.07); border-radius: 50%; border: 2px solid rgba(208,2,27,0.3);
    color: #D0021B;
}
.disclaimer-icon-lg svg { width: 40px; height: 40px; }
.disclaimer-icon-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
    color: #D0021B; text-transform: uppercase; white-space: nowrap;
}
.disclaimer-body { flex: 1 1 0; }
.disclaimer-title { color: #D0021B !important; }
.disclaimer-text { text-align: left; color: #000000; font-size: 16px; line-height: 1.65; margin: 0; }
@media (max-width: 700px) {
    .disclaimer-card { flex-direction: column; align-items: center; padding: 20px; gap: 18px; }
    .disclaimer-icon-col { min-width: unset; }
}

/* ---------- Footer ---------- */
.site-footer {
    background-color: #134E4A;
    color: #cfd8e0;
    padding: 10px 24px;
    margin-top: auto;
}
.footer-inner { max-width: 1120px; margin: 0 auto; text-align: center; }
.footer-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.footer-links a { color: #5EEAD4; text-decoration: none; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }
.footer-tagline { margin: 3px 0; font-size: 14px; color: #9fb0c0; }
.footer-copy { margin: 3px 0 0; font-size: 13px; color: #8496a6; }

/* ---------- Auth / forms ---------- */
.auth-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 48px 24px;
}
.auth-card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 36px;
    max-width: 460px;
    margin: 0 auto;
}
.auth-card-wide { max-width: 640px; }
/* App pages (documents, notes, calendar, tasks, images, analysis, billing, profile) use the whole window
   width and scale with it (owner 2026-10-30: "All of Betty must autoscale"). */
.auth-main-full { max-width: none; width: 100%; padding: 28px clamp(12px, 2.5vw, 40px); display: flex; flex-direction: column; }
.auth-main-full > .auth-card-full { flex: 1 1 auto; width: 100%; }   /* the card fills the window down to the footer */
.auth-card-full { max-width: 100%; }
.auth-card h1 { margin: 0 0 8px; font-size: 26px; }
.auth-sub { color: var(--muted); margin: 0 0 24px; }
.auth-alt { text-align: center; margin: 16px 0 0; font-size: 14px; }

.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background-color: var(--white);
}
input[type="date"], input[type="time"], input[type="datetime-local"] {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; font-family: inherit; color: var(--text); background-color: var(--white);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 108, 168, 0.12);
}
textarea { resize: vertical; }
.field-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

.disclaimer-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    margin: 8px 0 24px;
    background-color: #FAFCFE;
}
.disclaimer-box legend { font-weight: 700; padding: 0 8px; font-size: 14px; }
.checkbox-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 400;
    margin-bottom: 14px;
    font-size: 14px;
    color: #4a5a6a;
}
.checkbox-line input { width: auto; margin-top: 4px; flex-shrink: 0; }
.checkbox-line:last-child { margin-bottom: 0; }

/* ---------- Alerts ---------- */
.alert { border-radius: 8px; padding: 14px 16px; margin-bottom: 20px; font-size: 14px; }
.alert ul { margin: 0; padding-left: 20px; }
.alert-error { background-color: #FDECEA; color: #922; border: 1px solid #F5C6C0; }
.alert-success { background-color: #E7F6EF; color: #1c6b4c; border: 1px solid #B9E3CE; }

/* ---------- Profile ---------- */
.profile-meta { background-color: var(--bg); border-radius: 8px; padding: 16px 18px; margin-bottom: 24px; }
.profile-meta p { margin: 4px 0; font-size: 14px; }
.profile-section-title { font-size: 18px; margin: 28px 0 14px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ---------- Legal pages ---------- */
.legal-main { max-width: 820px; margin: 0 auto; padding: 48px 24px; }
.legal-inner { background-color: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow); }
.legal-inner h1 { font-size: 30px; margin: 0 0 4px; }
.legal-inner h2 { font-size: 19px; margin: 28px 0 8px; color: var(--primary); }
.legal-updated { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.legal-inner h3 { font-size: 16px; margin: 18px 0 6px; color: var(--primary); }
.legal-region-note { background-color: #fdf6e3; border: 1px solid var(--border-gold); border-radius: var(--radius); padding: 12px 16px; font-size: 14px; margin: 0 0 20px; }
.legal-country-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 14px; }
.legal-country-form label { color: var(--muted); }
.legal-country-form select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; max-width: 260px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 12px 0 8px; font-size: 14px; }
.legal-table th, .legal-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.legal-table th { background-color: #f6f8fb; color: var(--primary); }


/* ---------- App shell (dashboard) ---------- */
.app-body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.app-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.app-header-right { display: flex; align-items: center; gap: 10px; }
.app-user { font-size: 14px; color: var(--muted); margin-right: 4px; }
/* Moved into the drawer — hidden in the header on all screen sizes */
.app-user       { display: none; }
.header-auth-btn { display: none; }

.app-shell { display: flex; flex: 1; min-height: 0; }


/* ---------- Admin ---------- */
.admin-main { max-width: 1120px; margin: 0 auto; padding: 32px 24px; }
.admin-main h1 { margin: 0 0 4px; }
.admin-sub { color: var(--muted); margin: 0 0 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
    background-color: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; text-align: center; box-shadow: var(--shadow);
}
.stat-number { display: block; font-size: 34px; font-weight: 800; color: var(--primary); }
.stat-label { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.admin-section { margin-bottom: 36px; }
.admin-section h2 { font-size: 20px; margin: 0 0 14px; }
.table-wrap { overflow-x: auto; background-color: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th { background-color: #F3F8FC; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.admin-inline-form input, .admin-inline-form select { width: auto; flex: 1; min-width: 140px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-ok { background-color: #E7F6EF; color: #1c6b4c; }
.badge-off { background-color: #FDECEA; color: #922; }

/* ---------- Error / staging screen ---------- */
.error-screen {
    max-width: 480px;
    margin: 80px auto;
    padding: 48px 32px;
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.error-screen h1 { font-size: 64px; margin: 0 0 12px; color: var(--primary); }
.error-screen p { color: var(--muted); margin: 8px 0; }


/* ---------- Betty chat (dashboard.php) ---------- */
.chat-sidebar {
    width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px;
    padding: 16px; border-right: 1px solid var(--border); background-color: #F7FAFA; min-height: 0;
}
.conversation-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto; }
.conversation-item { margin: 0 0 4px; }
.conversation-link {
    width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px;
    padding: 8px 10px; font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-link:hover { background-color: var(--white); border-color: var(--border); }
.conversation-item.active .conversation-link { background-color: var(--white); border-color: var(--secondary); font-weight: 600; }
.chat-usage { margin: 0; font-size: 12px; color: var(--muted); }
.chat-usage a { color: var(--primary); }

.chat-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px 20px; }
.chat-titlebar { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.chat-title-input { flex: 1; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 700; font-size: 17px; background: none; }
.chat-title-input:hover:not(:disabled), .chat-title-input:focus { border-color: var(--border); outline: none; }
.chat-limit { margin: 0 0 8px; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 8px 2px; }
.chat-welcome { margin: auto; max-width: 560px; text-align: center; color: var(--muted); }
.chat-welcome h1 { color: var(--primary); font-size: 26px; margin: 0 0 8px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.msg-user { align-self: flex-end; background-color: var(--primary); color: var(--white); border-bottom-right-radius: 4px; }
.msg-assistant { align-self: flex-start; background-color: #F1F5F5; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-assistant p { margin: 0 0 8px; }
.msg-assistant p:last-child { margin-bottom: 0; }
.msg-assistant h3, .msg-assistant h4, .msg-assistant h5, .msg-assistant h6 { margin: 10px 0 6px; color: var(--primary-dark); }
.msg-assistant ul, .msg-assistant ol { margin: 4px 0 8px; padding-left: 22px; }
.msg-assistant code { background-color: var(--white); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.msg-assistant pre { background-color: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; }
.msg-assistant pre code { border: none; padding: 0; }
.msg-assistant a { color: var(--primary); }
.msg-typing { color: var(--muted); font-style: italic; }
.msg-error { align-self: center; max-width: 90%; background-color: #FDECEA; color: #922; border: 1px solid #f3c4bf; font-size: 14px; }
.chat-file-chip { align-self: flex-start; margin: 6px 0 0; padding: 4px 10px; border: 1px solid var(--border); border-radius: 16px; font-size: 13px; background-color: var(--white); }
.chat-file-chip button { background: none; border: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 200px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; }
.chat-form textarea:focus { outline: 2px solid var(--secondary); outline-offset: 0; }
.chat-attach { padding-left: 12px; padding-right: 12px; }
.chat-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 600px) {
    .chat-sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .conversation-list { max-height: 30vh; }
    .chat-panel { padding: 10px 12px; }
    .msg { max-width: 92%; }
}

/* ---------- Betty documents (documents.php, document.php, document_print.php) ---------- */
.doc-create { margin: 0 0 28px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background-color: #F7FAFA; }
.doc-create h2 { margin-top: 0; font-size: 18px; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc-list a { color: var(--primary); font-weight: 600; }
.doc-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.doc-sheet { background-color: var(--white); border: 1px solid var(--border); border-radius: 6px; padding: 32px 36px; line-height: 1.55; }
.doc-sheet h1, .doc-sheet h2, .doc-sheet h3 { color: var(--primary-dark); margin: 16px 0 8px; }
.doc-sheet p { margin: 0 0 10px; }
.doc-sheet blockquote { margin: 0 0 10px 20px; font-style: italic; }
.doc-editor { min-height: 360px; outline: none; }
.doc-editor:focus { border-color: var(--secondary); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.doc-remove { margin-top: 18px; }
.doc-print-body { background-color: #EEF2F2; padding: 20px; }
.doc-print-toolbar { max-width: 210mm; margin: 0 auto 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.doc-print-sheet { max-width: 210mm; margin: 0 auto; min-height: 297mm; box-shadow: var(--shadow-lg); }
.msg-actions { margin-top: 8px; display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* ---------- Event / task proposed in the chat (dashboard.php) ---------- */
.action-card { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background-color: var(--white); display: grid; gap: 8px; max-width: 520px; }
.action-head { font-weight: 700; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-field { display: grid; gap: 3px; font-size: 13px; }
.action-field > span { color: var(--muted); font-weight: 600; }
.action-field input[type="text"], .action-field input[type="date"], .action-field input[type="datetime-local"], .action-field select, .action-field textarea { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.action-check { display: flex; align-items: center; gap: 6px; }
.action-check > span { order: 2; }
.action-done { margin-top: 8px; font-size: 13px; }
@media (max-width: 560px) { .action-row { grid-template-columns: 1fr; } }

/* ---------- Calendar and tasks (calendar.php, tasks.php) ---------- */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.cal-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cal-connect { font-size: 13px; color: var(--muted); }
.cal-day { margin: 18px 0 6px; font-size: 15px; color: var(--primary-dark); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.cal-day.is-today { font-weight: 800; }
.cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cal-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background-color: var(--white); }
.cal-item.is-external { background-color: #f8fafc; }
.cal-item.is-open { border-color: var(--primary); }
.cal-time { font-weight: 700; font-size: 13px; }
.cal-title { font-weight: 600; }
.cal-meta { display: block; font-size: 12px; color: var(--muted); }
.cal-form { display: grid; gap: 10px; margin: 14px 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background-color: var(--white); }
.cal-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.task-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background-color: var(--white); }
.task-item.is-done .cal-title { text-decoration: line-through; color: var(--muted); }
.task-item.is-overdue .cal-meta { color: #b91c1c; }
.task-check { margin: 0; }
.task-check button { width: 22px; height: 22px; border: 2px solid var(--primary); border-radius: 50%; background: transparent; cursor: pointer; padding: 0; line-height: 1; color: var(--primary); }
.task-item.is-done .task-check button { background-color: var(--primary); color: #fff; }
.prio-high { color: #b91c1c; font-weight: 700; }
@media (max-width: 560px) {
    .cal-item { grid-template-columns: 1fr; gap: 4px; }
    .cal-form .form-row { grid-template-columns: 1fr; }
}

/* ---------- Profile tabs (profile.php) and public Pricing (pricing.php) ---------- */
.profile-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 0 0 18px; }
.profile-tab { padding: 8px 14px; border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; color: var(--muted); text-decoration: none; font-weight: 600; }
.profile-tab.active { color: var(--primary-dark); border-color: var(--border); background-color: var(--white); margin-bottom: -1px; }
.drawer-tab-link.active { font-weight: 700; }
.pricing-section { max-width: 1040px; }
.pricing-lead { font-size: 17px; color: #334155; }
.pricing-grid { margin: 20px 0 32px; }
.plan-desc { color: var(--muted); margin: 0 0 8px; }

/* ---------- Data analysis (analysis.php) ---------- */
.analysis-report { margin-bottom: 18px; }
.data-table td, .data-table th { white-space: normal; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.chart-card { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.chart-card figcaption { font-weight: 600; margin-bottom: 6px; }
.data-chart { width: 100%; height: auto; }
@media (max-width: 600px) { .chart-grid { grid-template-columns: 1fr; } }

/* ---------- Images (images.php) ---------- */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 18px; }
.image-card { margin: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.image-card.is-new { border-color: var(--secondary); box-shadow: 0 0 0 2px var(--secondary); }
.image-card img { display: block; width: 100%; height: 220px; object-fit: cover; background: #F1F5F5; }
.image-card figcaption { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.image-prompt { font-size: 13px; color: #334155; }
.image-actions { display: flex; gap: 6px; align-items: center; }

/* ---------- Notes (notes.php) ---------- */
.notes-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.notes-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; margin-top: 12px; }
.notes-search input { width: 100%; margin-bottom: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.notes-list ul { list-style: none; margin: 0; padding: 0; max-height: 65vh; overflow-y: auto; }
.notes-list li a { display: block; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; text-decoration: none; color: var(--text); }
.notes-list li a:hover { border-color: var(--border); background-color: #F7FAFA; }
.notes-list li.active a { border-color: var(--secondary); background-color: #F0FDFA; }
.notes-list strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-list span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-list small { font-size: 11px; color: var(--muted); }
.note-title { width: 100%; font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.note-body { width: 100%; min-height: 360px; resize: vertical; font: inherit; line-height: 1.55; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 800px) { .notes-layout { grid-template-columns: 1fr; } .notes-list ul { max-height: 30vh; } }

/* ---------- Two-step login setup (profile.php) ---------- */
.totp-steps { padding-left: 20px; }
.totp-qr { display: inline-block; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; margin: 4px 0 10px; }
.totp-qr svg { display: block; }
.totp-key { font-size: 15px; letter-spacing: 1px; background: #F1F5F5; padding: 2px 6px; border-radius: 4px; }
.totp-form { margin-top: 10px; max-width: 360px; }
.linked-list { list-style: none; padding: 0; }
.linked-list li { padding: 6px 0; }
.inline-form { display: inline; margin-left: 6px; }
.btn-ms { margin-top: 8px; }

/* ---------- Continue with Google (login.php, register.php) ---------- */
.auth-or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.btn-google { text-align: center; }
@media (max-width: 600px) {
    .doc-sheet { padding: 18px 16px; }
    .doc-print-body { padding: 8px; }
}

/* ---------- Cookie banner (cookie_banner.php, every page via footer.php) ---------- */
.cookie-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background-color: var(--primary-dark); color: #fff; box-shadow: 0 -4px 24px rgba(0,0,0,0.25); }
.cookie-banner[hidden] { display: none; }
.cookie-banner-inner { max-width: 1100px; margin: 0 auto; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; justify-content: space-between; }
.cookie-banner-text { flex: 1 1 420px; min-width: 260px; }
.cookie-banner-text strong { display: block; font-size: 15px; margin-bottom: 4px; color: #5EEAD4; }
.cookie-banner-text p { margin: 0; font-size: 13px; line-height: 1.5; color: #E6F4F2; }
.cookie-banner-text a { color: #fff; text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 640px) { .cookie-banner-actions { width: 100%; } .cookie-banner-actions .btn { flex: 1 1 auto; } }

/* ---------- Splash screen (index.php, once per browser session) ---------- */
#splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: #FFFFFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 24px;
}
.splash-logo {
    width: 220px;
    height: auto;
    max-width: 60vw;
    animation: fadeScaleIn 0.6s ease both;
}
.splash-title {
    margin: 6px 0 0;
    font-size: 44px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 2px;
    animation: fadeScaleIn 0.6s ease 0.1s both;
}
.splash-tagline {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--secondary-dark);
    letter-spacing: 1px;
    animation: fadeScaleIn 0.6s ease 0.2s both;
}
.splash-fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
@keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---------- Betty home page: light hero so the logo shows in full colour ---------- */
.hero.hero-light { background: linear-gradient(180deg, #FFFFFF 0%, #ECFDF8 100%); color: var(--text); border-bottom: 1px solid var(--border); }
.hero-light .hero-inner h1 { color: var(--primary-dark); }
.hero-light .hero-lead, .hero-light .hero-lead-secondary { color: #334155; }
.hero-light .hero-note { color: var(--muted); }
.hero-logo { display: block; width: 200px; max-width: 50vw; height: auto; margin: 0 auto 18px; }
.feature-icon { font-size: 30px; line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .steps-grid { grid-template-columns: 1fr; }
    .features-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .hero-inner h1 { font-size: 30px; }
    .form-row { grid-template-columns: 1fr; }
    .msg { max-width: 90%; }
    .report-sheet { padding: 28px 22px; }
    .report-header { flex-direction: column; }
    .report-headmeta { text-align: left; }
}
@media (max-width: 600px) {
    /* --- Mobile: abandon the fixed-viewport "app shell". Let the whole page
       flow and scroll like a normal document. This restores native
       pull-to-refresh and guarantees the header, sidebar and chat are all
       visible/scrollable on every mobile browser (Samsung Internet, Chrome,
       Android WebView, etc.). --- */
    html { height: auto; }
    .app-body {
        display: block;      /* was flex column with fixed height */
        height: auto;
        min-height: 100vh;
        overflow: visible;   /* body scrolls natively -> pull-to-refresh works */
    }
    /* Keep the header reachable while the page scrolls. */
    .app-header {
        position: sticky;
        top: 0;
        z-index: 100;
        padding: 8px 12px;
        flex-wrap: nowrap;
    }
    .brand-sub { display: none; }  /* Hide the sub-text on mobile */
    .app-user { display: none; }   /* Hide "Hi, [name]" — saves header width */
    .header-logo { height: 36px; }

    .app-shell {
        display: block;      /* stack sidebar above chat in normal flow */
        overflow: visible;
        min-height: 0;
    }
    /* .sidebar — drawer positioning handled by the universal base .sidebar rule */
    .chat-panel {
        display: block;
        overflow: visible;
        min-height: 0;
    }
    .chat-messages {
        overflow: visible;   /* grows with content; the page (body) scrolls */
        min-height: 40vh;
        /* keep flex column (gap + msg align-self) — just let height grow */
        display: flex;
        flex-direction: column;
        flex: 0 1 auto;
    }
    /* Unrelated mobile rules — keep these */
    .stats-grid { grid-template-columns: 1fr; }
}


/* ---------- Header logo / brand ---------- */
.header-brand {
    align-items: center;
}
.header-logo {
    height: 60px;   /* a bit larger (owner 2026-10-30); header padding 10px keeps the header 82px, level with the pinned menu bar */
    width: auto;
    display: block;
    flex-shrink: 0;
}
.brand-text {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

/* Report header logo (report_view.php) */
.report-header-logo {
    height: 168px;
    width: auto;
    display: block;
    margin: 0 auto 8px;
}


/* ═══════════════════════════════════════════════════════════════
   Hamburger button + Right-side Drawer
   Universal: on ALL screen sizes the sidebar is hidden and slides in
   as a right drawer via the always-visible hamburger button.
   ═══════════════════════════════════════════════════════════════ */

/* ---- Hamburger toggle button (visible on all screen sizes) ---- */
.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--primary);
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}
.hamburger-btn:hover { background: rgba(45,212,191,0.12); border-color: var(--secondary); }

/* ---- Overlay (dims the page when the drawer is open) ---- */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 450;
    background: rgba(0,0,0,0.45);
}
.drawer-overlay.drawer-open { display: block; }

/* Prevent page scroll behind the open drawer */
body.drawer-open { overflow: hidden; }

/* ---- Drawer-top: navy header + nav links ----
   Shown inside the sidebar drawer on all screen sizes. */
.drawer-top { display: flex; flex-direction: column; flex-shrink: 0; }

.drawer-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--primary);
    flex-shrink: 0;
}
.drawer-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    margin: 0;
}
.drawer-close-btn {
    background: none;
    border: none;
    color: var(--secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.15s;
}
.drawer-close-btn:hover { color: #fff; }

.drawer-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-nav-link {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
}
.drawer-nav-link:hover { background: #f0f4f8; }

/* Menu screen-awareness: hide the link to the currently active page/tab. */
.hidden { display: none !important; }

/* ---- Accordion navigation groups ---- */
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.nav-group-toggle:hover { background: #f0f4f8; }
.nav-group-label { flex: 1; }
.nav-chevron {
    display: inline-block;
    font-size: 18px;
    line-height: 1;
    color: var(--muted, #64748b);
    transition: transform 0.2s ease;
}
.nav-group.expanded .nav-chevron { transform: rotate(90deg); }
.nav-sub {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 12px;
    margin-top: 0;
}
.nav-group.expanded .nav-sub { margin-top: 6px; }
.nav-sub-link {
    font-weight: 500;
    font-size: 13.5px;
}


/* Drawer behaviour is now universal (all screen sizes) — see the base
   .hamburger-btn, .sidebar, .drawer-top and #newChatBtn rules above.
   The mobile-specific scroll fixes live in @media (max-width: 600px). */


/* ---- Profile page: standalone right-side drawer ---- */
.profile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    width: min(85vw, 300px);
    z-index: 500;
    background: var(--white);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(19,78,74,0.18);
    transform: translateX(110%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}
.profile-drawer.drawer-open { transform: translateX(0); }

/* ---- Pin the menu open on desktop (menu.php; owner 2026-10-12, as SafferHelp) ---- */
.drawer-pin-btn {
    display: none;
    margin-left: auto;
    margin-right: 6px;
    background: none;
    border: none;
    padding: 4px;
    line-height: 0;
    cursor: pointer;
    color: #fff;
    opacity: 0.6;
    transition: opacity 0.15s, color 0.15s, transform 0.25s;
}
.drawer-pin-btn:hover, .drawer-pin-btn:focus-visible { opacity: 1; }
body.nav-pinned .drawer-pin-btn { color: var(--secondary); opacity: 1; transform: rotate(45deg); }
body.nav-pin-instant, body.nav-pin-instant .profile-drawer { transition: none !important; }
@media (min-width: 769px) {
    .drawer-pin-btn { display: block; }
    body { transition: padding-right 0.25s ease; }
    body.nav-pinned { padding-right: 300px; }
    body.nav-pinned .profile-drawer { transform: translateX(0); width: 300px; box-shadow: -2px 0 10px rgba(19,78,74,0.10); }
    body.nav-pinned .drawer-overlay { display: none; }
    body.nav-pinned .drawer-close-btn { display: none; }   /* pinned: the pin or the hamburger closes it */
    body.nav-pinned .cookie-banner { right: 300px; }
    /* Menu title bar as tall as the page header (60px logo + 2 x 10px padding + 2px line), so both line up (owner 2026-10-30). */
    .drawer-header-bar { min-height: 82px; border-bottom: 2px solid rgba(45,212,191,0.45); }
}

/* Section separator label inside profile drawer */
.drawer-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 14px 16px 6px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* Tab links inside the drawer */
.drawer-tab-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 16px 16px;
}
.drawer-tab-link {
    appearance: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    width: 100%;
}
.drawer-tab-link:hover { background: #f0f4f8; }




/* ============================================================
   Admin impersonation banner
   ============================================================ */
.impersonation-banner {
    background: #7C3AED; color: #fff; padding: 10px 20px;
    display: flex; align-items: center; justify-content: center; gap: 16px;
    font-size: 0.875rem; position: sticky; top: 0; z-index: 200;
    flex-wrap: wrap; text-align: center;
}
.impersonation-exit {
    color: #fff; font-weight: 700; border: 1px solid rgba(255,255,255,0.5);
    border-radius: 6px; padding: 4px 12px; text-decoration: none; font-size: 0.8rem;
}
.impersonation-exit:hover { background: rgba(255,255,255,0.15); }


/* ---------- Settings page (settings.php) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.settings-section { padding-inline: 0; max-width: 760px; }
.settings-section h2 { margin: 0 0 6px; font-size: 1.25rem; }
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.setting-row-stack { flex-direction: column; align-items: stretch; gap: 12px; }
.setting-text { flex: 1; min-width: 0; }
.setting-label { font-weight: 600; color: var(--primary); display: block; }
.setting-label-inline { font-weight: 600; color: var(--primary); }
.setting-value { min-width: 3.2em; font-variant-numeric: tabular-nums; color: var(--muted); }
.setting-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.setting-controls select { flex: 1 1 240px; min-width: 0; }
.setting-controls input[type="range"] { flex: 1 1 200px; accent-color: var(--primary); }

.switch { position: relative; display: inline-block; flex-shrink: 0; width: 50px; height: 28px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch-slider { position: absolute; inset: 0; border-radius: 999px; background: #CBD5E1; transition: background 0.15s ease; }
.switch-slider::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.15s ease; }
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(22px); }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--primary); outline-offset: 2px; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; align-self: flex-start; }
.segmented label { position: relative; margin: 0; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 8px 16px; font-weight: 600; color: var(--primary); border-right: 1px solid var(--border); }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--primary); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (max-width: 480px) { .segmented span { padding: 8px 12px; } }


.setting-error { color: #C62828; font-weight: 600; font-size: 14px; }

/* ===== Plans & Billing (billing.php) ===== */
.billing-note { border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; border: 1px solid var(--border); background: #F8FAFC; }
.billing-note.ok { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.billing-note.warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.billing-current { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
                   border: 1px solid var(--border-gold); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 22px; box-shadow: var(--shadow); }
.billing-current h2 { margin: 0 0 4px; font-size: 1.15rem; }
.billing-current p { margin: 2px 0; color: var(--muted); }
.billing-current form { margin: 0; }
.billing-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.billing-toolbar .field-hint { margin: 0; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--white); box-shadow: var(--shadow); }
.plan-card.is-current { border-color: var(--secondary); box-shadow: 0 0 0 2px var(--border-gold), var(--shadow); }
.plan-card h3 { margin: 0 0 4px; font-size: 1.1rem; color: var(--primary); }
.plan-card .plan-desc { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.plan-price { font-size: 1.7rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.plan-price small { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.plan-trial { font-size: 0.82rem; color: #15803D; margin: 4px 0 0; }
.plan-card ul { list-style: none; padding: 0; margin: 14px 0 16px; flex: 1; }
.plan-card li { padding: 3px 0 3px 22px; position: relative; font-size: 0.92rem; }
.plan-card li::before { content: '\2713'; position: absolute; left: 0; color: var(--secondary-dark); font-weight: 700; }
.plan-card li.no { color: var(--muted); }
.plan-card li.no::before { content: '\2014'; color: var(--border); }
.plan-card form { margin: 0; }
.plan-card .btn { width: 100%; }
.plan-badge { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
              background: var(--secondary); color: #fff; border-radius: 999px; padding: 2px 9px; margin-bottom: 8px; align-self: flex-start; }
.plan-period[hidden] { display: none; }
.billing-legal { font-size: 0.8rem; color: var(--muted); margin-top: 18px; }


/* ---------- Form security standard (form_guard_lib.php): honeypot hidden from people, Turnstile spacing ---------- */
.form-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.form-turnstile { margin: 4px 0 16px; min-height: 65px; }

/* ---------- Invoices on Plans & Billing (invoice_lib.php) ---------- */
.billing-invoices-title { margin-top: 32px; }
.billing-invoices { width: 100%; border-collapse: collapse; font-size: 14px; }
.billing-invoices th, .billing-invoices td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.billing-invoices .num { text-align: right; white-space: nowrap; }
@media (max-width: 560px) { .billing-invoices th:nth-child(3), .billing-invoices td:nth-child(3) { display: none; } }

/* ---------- Calendar: Day / Week / Month (owner 2026-10-30: "like Outlook and Google") ---------- */
.cal-card { display: flex; flex-direction: column; padding: 20px; }
.cal-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; flex: 1 1 auto; }
.cal-side { display: flex; flex-direction: column; gap: 18px; }
.cal-create { align-self: flex-start; border-radius: 22px; padding: 10px 20px; box-shadow: var(--shadow); }
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.cal-mini-head a { text-decoration: none; color: var(--primary-dark); font-size: 20px; padding: 0 8px; border-radius: 50%; }
.cal-mini-head a:hover { background-color: #F0FDFA; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-mini-dow { font-size: 11px; color: var(--muted); font-weight: 700; padding: 2px 0; }
.cal-mini-day { font-size: 12px; line-height: 28px; height: 28px; border-radius: 50%; text-decoration: none; color: var(--text); }
.cal-mini-day:hover { background-color: #F0FDFA; }
.cal-mini-day.is-other { color: #a5b1bc; }
.cal-mini-day.is-range { background-color: #E6F7F4; border-radius: 4px; }
.cal-mini-day.is-today { background-color: var(--primary); color: #fff; font-weight: 700; border-radius: 50%; }
.cal-legend { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.cal-legend .btn { align-self: flex-start; }
.cal-tip { font-size: 12px; color: var(--muted); margin: 0; }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Event colours by calendar: Betty teal, Outlook blue, Google orange. */
.src-betty   { --ev: #0F766E; --ev-bg: #CCFBF1; }
.src-outlook { --ev: #0F6CBD; --ev-bg: #DCEBFA; }
.src-google  { --ev: #C2410C; --ev-bg: #FDE6D6; }
.cal-dot.src-betty, .cal-dot.src-outlook, .cal-dot.src-google { background-color: var(--ev); }

.cal-view { display: flex; flex-direction: column; min-width: 0; }
.cal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-arrow { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; text-decoration: none; color: var(--primary-dark); font-size: 24px; line-height: 1; }
.cal-arrow:hover { background-color: #F0FDFA; }
.cal-title-range { margin: 0 6px; font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.cal-tz { font-size: 12px; color: var(--muted); }
.cal-views { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-views a { padding: 7px 16px; text-decoration: none; color: var(--primary-dark); font-weight: 600; font-size: 14px; border-left: 1px solid var(--border); }
.cal-views a:first-child { border-left: none; }
.cal-views a.active { background-color: var(--primary); color: #fff; }
.cal-views a:not(.active):hover { background-color: #F0FDFA; }

/* Month */
.cal-month { flex: 1 1 auto; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto; grid-auto-rows: minmax(110px, 1fr);
             border-top: 1px solid var(--border); border-left: 1px solid var(--border); min-height: calc(100vh - 290px); }
.cal-month-dow { padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
                 border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.cal-month-cell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: pointer; }
.cal-month-cell:hover { background-color: #FAFDFC; }
.cal-month-cell.is-other { background-color: #F8FAFB; }
.cal-month-cell.is-other .cal-month-num { color: #a5b1bc; }
.cal-month-num { align-self: center; min-width: 26px; height: 26px; line-height: 26px; padding: 0 6px; text-align: center; border-radius: 13px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text); }
.cal-month-num:hover { background-color: #E6F7F4; }
.cal-month-cell.is-today .cal-month-num { background-color: var(--primary); color: #fff; }
.cal-chip { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 2px 6px; border-radius: 4px; font-size: 12px; line-height: 18px; text-decoration: none; color: var(--text); }
.cal-chip:hover { background-color: #EEF2F5; }
.cal-chip.is-allday { background-color: var(--ev-bg); color: var(--ev); font-weight: 600; border-left: 3px solid var(--ev); }
.cal-chip-time { color: var(--muted); flex-shrink: 0; }
.cal-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: 12px; font-weight: 600; color: var(--primary-dark); padding: 0 6px; text-decoration: none; }
.cal-more:hover { text-decoration: underline; }

/* Day / Week time grid (one hour = 48px, CAL_HOUR_PX in calendar.php) */
.cal-grid-wrap { flex: 1 1 auto; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-grid-head, .cal-allday-row, .cal-grid { display: grid; grid-template-columns: 56px repeat(var(--cal-cols), minmax(0, 1fr)); }
.cal-grid-head, .cal-allday-row { overflow-y: hidden; scrollbar-gutter: stable; }
.cal-grid-head { border-bottom: 1px solid var(--border); }
.cal-colhead { display: flex; flex-direction: column; align-items: center; padding: 6px 0; text-decoration: none; color: var(--muted); border-left: 1px solid var(--border); }
.cal-colhead-dow { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.cal-colhead-num { font-size: 22px; font-weight: 600; color: var(--text); width: 40px; height: 40px; line-height: 40px; text-align: center; border-radius: 50%; }
.cal-colhead:hover .cal-colhead-num { background-color: #E6F7F4; }
.cal-colhead.is-today .cal-colhead-dow { color: var(--primary); }
.cal-colhead.is-today .cal-colhead-num { background-color: var(--primary); color: #fff; }
.cal-allday-row { border-bottom: 1px solid var(--border); min-height: 30px; }
.cal-gutter-label { font-size: 11px; color: var(--muted); text-align: right; padding: 8px 6px 0 0; }
.cal-allday-cell { border-left: 1px solid var(--border); padding: 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: pointer; }
.cal-grid-scroll { flex: 1 1 auto; height: calc(100vh - 330px); min-height: 420px; overflow-y: auto; scrollbar-gutter: stable; }
.cal-grid { position: relative; }
.cal-hours { position: relative; }
.cal-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.cal-daycol { position: relative; border-left: 1px solid var(--border); cursor: pointer;
              background-image: linear-gradient(to bottom, #e7ebf0 1px, transparent 1px), linear-gradient(to bottom, transparent 24px, #f3f5f8 24px, #f3f5f8 25px, transparent 25px);
              background-size: 100% 48px; }
.cal-daycol.is-today { background-color: #FBFEFD; }
.cal-block { position: absolute; overflow: hidden; padding: 3px 6px; border-radius: 6px; background-color: var(--ev-bg); border-left: 4px solid var(--ev);
             color: #10202e; text-decoration: none; font-size: 12px; line-height: 1.3; box-shadow: 0 1px 2px rgba(19,78,74,0.12); z-index: 1; }
.cal-block:hover { filter: brightness(0.97); box-shadow: 0 3px 8px rgba(19,78,74,0.2); z-index: 3; }
.cal-block.is-open { outline: 2px solid var(--ev); }
.cal-block-title { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-block-time { display: block; color: #3c4a57; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-block.is-short { display: flex; gap: 6px; align-items: center; padding-top: 0; padding-bottom: 0; }
.cal-block.is-short .cal-block-title, .cal-block.is-short .cal-block-time { display: inline; }
.cal-now { position: absolute; left: -1px; right: 0; height: 2px; background-color: #DC2626; z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background-color: #DC2626; }

/* Details card for Google / Outlook events, and the event window */
.cal-pop { position: fixed; z-index: 60; width: 280px; padding: 14px 16px; background-color: #fff; border: 1px solid var(--border); border-radius: 10px;
           box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.cal-pop[hidden] { display: none; }
.cal-pop-title { font-size: 16px; padding-right: 20px; }
.cal-pop-when, .cal-pop-where { color: #3c4a57; }
.cal-pop-src { color: var(--muted); font-size: 12px; }
.cal-pop-close { position: absolute; top: 6px; right: 8px; border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.cal-modal-backdrop { position: fixed; inset: 0; z-index: 70; background-color: rgba(15, 35, 45, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.cal-modal { width: 100%; max-width: 560px; background-color: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); padding: 20px 22px; }
.cal-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-modal-head h2 { margin: 0; font-size: 20px; color: var(--primary-dark); }
.cal-modal-x { font-size: 26px; line-height: 1; text-decoration: none; color: var(--muted); padding: 0 6px; }
.cal-modal .cal-form { border: none; padding: 0; margin: 10px 0 0; }
.cal-modal .form-row .form-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; align-content: flex-start; }
.cal-modal .form-row .form-group label { width: 100%; }
.cal-modal input[type="date"] { flex: 1 1 120px; min-width: 0; }
.cal-modal input[type="time"] { flex: 0 0 108px; min-width: 0; padding-left: 8px; padding-right: 8px; }
.cal-modal .form-row .field-hint { width: 100%; }
.cal-modal .cal-delete { border-top: 1px solid var(--border); padding-top: 12px; }

@media (max-width: 1000px) {
    .cal-shell { grid-template-columns: 1fr; }
    .cal-side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
    .cal-mini, .cal-tip { display: none; }
    .cal-legend { flex-direction: row; flex-wrap: wrap; align-items: center; }
}
@media (max-width: 640px) {
    .cal-card { padding: 12px; }
    .cal-views { margin-left: 0; }
    .cal-title-range { font-size: 18px; }
    .cal-grid-head, .cal-allday-row, .cal-grid { grid-template-columns: 44px repeat(var(--cal-cols), minmax(0, 1fr)); }
    .cal-colhead-num { font-size: 16px; width: 30px; height: 30px; line-height: 30px; }
    .cal-block-time { display: none; }
    .cal-month { grid-auto-rows: minmax(70px, 1fr); }
    .cal-chip-time { display: none; }
}

/* ---------- Phones (owner 2026-10-31: "All pages must auto adapt to be mobile friendly") ----------
   Less frame around the content so forms and lists get the screen width; bigger tap targets. */
@media (max-width: 600px) {
    .auth-main { padding: 20px 10px; }
    .auth-card { padding: 22px 16px; }
    .auth-main-full { padding: 8px 6px; }
    .auth-card-full { padding: 16px 12px; border-radius: 8px; box-shadow: none; }
    .auth-card h1 { font-size: 23px; }
    .doc-create, .cal-form { padding: 12px; margin-bottom: 18px; }
    .legal-main { padding: 24px 14px; }
    .profile-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .profile-tab { padding: 8px 10px; white-space: nowrap; }
    .header-inner { padding-left: 12px; padding-right: 12px; }
    .btn-small { min-height: 34px; }
    input, select, textarea { font-size: 16px; }   /* 16px stops iPhone zooming into a field */
    .cal-card { padding: 10px 8px; }
    .cal-grid-scroll { height: calc(100vh - 290px); min-height: 360px; }
    .cal-modal-backdrop { padding: 10px 6px; }
    .cal-modal { padding: 16px 14px; }
}

/* ---------- Request a feature (feature_request.php) ---------- */
.fr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fr-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background-color: var(--white); }
.fr-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fr-note { font-size: 13px; color: #334155; background-color: #F7FAFA; border-radius: 6px; padding: 6px 8px; margin-top: 4px; }
.fr-status { flex-shrink: 0; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; background-color: #EEF2F5; color: #475569; }
.fr-status.fr-planned { background-color: #DCEBFA; color: #0F6CBD; }
.fr-status.fr-implemented { background-color: #CCFBF1; color: #0F766E; }
.fr-status.fr-declined { background-color: #F3F4F6; color: #6B7280; }

/* ---------- Refer a friend (refer.php) ---------- */
.ref-box { display: grid; gap: 10px; }
.ref-row { display: flex; gap: 8px; }
.ref-row input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.ref-share { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Help Center (help/index.php, owner 2026-10-31) ---------- */
.help-main { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; max-width: 1240px; width: 100%; margin: 0 auto; padding: 24px 16px 48px; }
.help-index { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.help-search { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; }
.help-count { font-size: 13px; color: var(--muted); margin: 6px 0 0; min-height: 1em; }
.help-group h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 14px 0 4px; }
.help-group ul { list-style: none; margin: 0; padding: 0; }
.help-group li a { display: block; padding: 4px 6px; border-radius: 6px; text-decoration: none; color: var(--primary); font-size: 14px; }
.help-group li a:hover { background: #F0FDFA; }
.help-content h1 { margin-top: 0; color: var(--primary-dark); }
.help-intro { color: #4a5a6a; }
.help-topic { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 18px; scroll-margin-top: 16px; }
.help-topic h2 { margin: 0 0 6px; font-size: 20px; color: var(--primary-dark); }
.help-group-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 2px; }
.help-where { font-size: 14px; color: #4a5a6a; background: #F7FAFA; border-left: 3px solid var(--secondary); padding: 4px 10px; margin: 0 0 10px; }
.help-anchor { font-size: 14px; color: var(--muted); text-decoration: none; margin-left: 4px; }
.help-body ol, .help-body ul { padding-left: 22px; }
.help-body li { margin: 4px 0; line-height: 1.55; }
.help-topic[hidden], .help-group[hidden], .help-index li[hidden], .help-none[hidden] { display: none; }
@media (max-width: 820px) { .help-main { grid-template-columns: 1fr; padding: 12px 10px 32px; } .help-index { position: static; max-height: none; } .help-topic { padding: 14px; } }
