/* =====================================================================
   EASY FLOW INVOICING - APP STYLES
   Same look as the landing page: navy + gold, Bricolage Grotesque headings,
   Public Sans text, soft sky background. Each business's own brand colour
   (Business Settings) still drives buttons and highlights through --brand.
===================================================================== */
:root {
    --navy: #0A1F44;
    --navy-2: #13305f;
    --gold: #CBA052;
    --gold-dark: #b38a3f;
    --gold-soft: #F3E6CA;
    --sky: #EEF3FA;
    --sky-2: #F6F8FC;
    --ink: #1B2638;
    --muted: #556176;
    --line: #D9E1EC;
    --field: #C3CDDC;
    --paid: #1F7A50;
    --danger: #C4314B;
    --danger-dark: #A2263D;
    --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
    --body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    /* Overridden per business in layout/header.php */
    --brand: #0A1F44; --brand-text: #FFFFFF; --brand-dark: #081936;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--body); font-size: 15px; line-height: 1.5; background: var(--sky); margin: 0; color: var(--ink); }
h1, h2, h3 { font-family: var(--display); color: var(--navy); line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 2rem; font-weight: 800; margin: 0 0 .4em; }
h2 { font-size: 1.55rem; font-weight: 800; margin: 0 0 .6em; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 0 0 .6em; }
h4 { color: var(--navy); }
a { color: var(--navy-2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.container {
    max-width: 1080px;
    margin: 28px auto;
    background: #fff;
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 1px 0 var(--line);
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
table th, table td { padding: 11px 10px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
table th { background: var(--sky-2); color: var(--muted); font-size: 13px; font-weight: 600; border-bottom: 2px solid var(--line); }
table tbody tr:hover td { background: #FAFBFE; }
.num, .text-right { text-align: end; font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 40px; padding: 9px 16px;
    background: var(--brand); color: var(--brand-text);
    font-family: var(--body); font-size: 15px; font-weight: 600; line-height: 1.2;
    text-decoration: none; border: 0; border-radius: 10px; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); }
.btn i { pointer-events: none; }
.btn-small { min-height: 32px; padding: 6px 10px; font-size: 13px; border-radius: 8px; gap: 5px; }
.btn-edit { background: var(--gold); color: var(--navy); }
.btn-edit:hover { background: var(--gold-dark); color: var(--navy); }
.btn-delete { background: var(--danger); color: #fff; }
.btn-delete:hover { background: var(--danger-dark); }
/* Secondary actions (View, Items, Payments, Cancel, Back): quiet, so the main action stands out */
.btn-soft { background: var(--sky); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-soft:hover { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }
/* Money-in / done actions (Mark paid, Complete, Convert, Resume) */
.btn-ok { background: var(--paid); color: #fff; }
.btn-ok:hover { background: #17603F; color: #fff; }
.btn-big { min-height: 52px; padding: 14px 22px; font-size: 17px; border-radius: 12px; }
button.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--navy); font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="time"], input[type="search"], input[type="tel"], input[type="url"],
input[type="color"], input:not([type]), select, textarea {
    font-family: var(--body); font-size: 15px; color: var(--ink);
    padding: 10px 12px; border: 1.5px solid var(--field); border-radius: 10px; background: #fff;
}
input[type="color"] { padding: 4px; min-height: 42px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(203,160,82,.45); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--navy); }
textarea { line-height: 1.45; }

/* ---------- Messages ---------- */
.msg { padding: 12px 14px; margin-bottom: 16px; border-radius: 10px; background: #E7F4EC; color: #17573A; border-inline-start: 4px solid var(--paid); }

/* =====================================================================
   NAVIGATION
===================================================================== */
.navbar {
    background: var(--navy); color: #fff;
    display: flex; align-items: center; gap: 24px;
    padding: 0 24px; min-height: 64px;
    position: sticky; top: 0; z-index: 1000;
}
.nav-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; white-space: nowrap;
             font-family: var(--display); font-weight: 800; font-size: 19px; }
.nav-brand img { width: 30px; height: 30px; background: #fff; border-radius: 50%; padding: 2px; }
.nav-menu { display: flex; flex: 1; justify-content: space-between; align-items: center; }
.nav-links { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; align-items: center; }
.nav-links li a, .dropbtn {
    color: #fff; text-decoration: none; font-size: 15px; font-weight: 600;
    display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; cursor: pointer;
    position: relative; white-space: nowrap;
}
.nav-links li a i, .dropbtn i { color: rgba(255,255,255,.75); }
.nav-links li a:hover, .dropdown:hover > .dropbtn, .dropdown.open > .dropbtn { background: rgba(255,255,255,.1); }
.nav-links li a.is-active, .dropdown.is-active > .dropbtn { color: #fff; }
.nav-links li a.is-active::after, .dropdown.is-active > .dropbtn::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 3px; border-radius: 2px; background: var(--gold);
}
.dropbtn .fa-caret-down { font-size: 12px; }
.logout-btn { border: 1.5px solid rgba(255,255,255,.35); }
.logout-btn:hover { border-color: #fff; }
.hamburger { display: none; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; margin-inline-start: auto;
             min-width: 48px; min-height: 48px; border-radius: 10px; }
.hamburger:hover { background: rgba(255,255,255,.1); }

.dropdown { position: relative; }
.dropdown-content {
    display: none; position: absolute; top: 100%; left: 0; min-width: 210px; z-index: 1001;
    background: #fff; border-radius: 12px; padding: 6px; border: 1px solid var(--line);
    box-shadow: 0 14px 34px rgba(10,31,68,.18);
}
.nav-right .dropdown-content { left: auto; right: 0; }
[dir="rtl"] .dropdown-content { left: auto; right: 0; }
[dir="rtl"] .nav-right .dropdown-content { right: auto; left: 0; }
.dropdown-content a { color: var(--ink) !important; padding: 11px 12px !important; border-radius: 8px; display: flex !important; }
.dropdown-content a i { color: var(--muted) !important; width: 18px; text-align: center; }
.dropdown-content a:hover { background: var(--sky) !important; }
.dropdown-content a.is-active { background: var(--gold-soft) !important; }
.dropdown-content a.is-active::after { display: none; }
@media (hover: hover) and (min-width: 1001px) { .dropdown:hover .dropdown-content { display: block; } }
.dropdown.open .dropdown-content { display: block; }

/* Super admin "inside another workspace" banner */
.acting-bar { background: #8E1F33; color: #fff; padding: 8px 20px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.acting-bar button { background: #fff; color: #8E1F33; border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 700; font-family: var(--body); }

/* =====================================================================
   DASHBOARD
===================================================================== */
.dash-head { display: flex; align-items: center; gap: 18px; margin: 4px 0 22px; }
.dash-head img { width: 76px; height: auto; flex: none; }
.dash-head h1 { margin: 0; }
.dash-head p { margin: 4px 0 0; color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.panel h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.panel h3 i { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); color: var(--navy); display: inline-grid; place-items: center; font-size: 15px; }
.quick-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.quick-links a { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 12px; background: var(--sky-2);
                 border: 1px solid var(--line); color: var(--navy); font-weight: 600; text-decoration: none; }
.quick-links a:hover { border-color: var(--navy); background: #fff; }
.quick-links a i { color: var(--gold-dark); width: 20px; text-align: center; }
.reminders-list { display: grid; gap: 0; }
.reminder-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.reminder-item:last-child { border-bottom: 0; }
.reminder-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin-inline-end: 6px; }
.reminder-date.overdue { color: var(--danger); }
.add-reminder-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }
.add-reminder-form input[type="text"] { grid-column: 1 / -1; }

/* =====================================================================
   SIGN-IN PAGES (login, register, password reset, verify email)
===================================================================== */
.auth-body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px; background: var(--sky); }
.auth-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-family: var(--display); font-weight: 800; font-size: 20px; margin-bottom: 18px; }
.auth-brand img { width: 36px; height: auto; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 2px solid var(--navy); border-radius: 18px; padding: 30px 28px; box-shadow: 8px 8px 0 var(--navy); }
.auth-card h1 { font-size: 1.8rem; margin: 0 0 6px; }
.auth-card .auth-sub { color: var(--muted); margin: 0 0 20px; }
.auth-card .btn { width: 100%; min-height: 50px; font-size: 16px; margin-top: 6px; background: var(--navy); color: #fff; }
.auth-card .btn:hover { background: var(--navy-2); }
.auth-card .btn-gold { background: var(--gold); color: var(--navy); }
.auth-card .btn-gold:hover { background: var(--gold-dark); }
.auth-links { margin-top: 18px; display: grid; gap: 10px; text-align: center; }
.auth-links a { color: var(--navy); font-weight: 600; text-decoration: none; padding: 6px; }
.auth-links a:hover { text-decoration: underline; }
.note-ok, .success, .note-err, .error, .note-warn { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 15px; text-align: start; }
.note-ok, .success { background: #E7F4EC; color: #17573A; border-inline-start: 4px solid var(--paid); }
.note-err, .error { background: #FBE9EC; color: #8E1F33; border-inline-start: 4px solid var(--danger); }
.note-warn { background: #FFF6DD; color: #6E5208; border-inline-start: 4px solid #E0B437; }
.auth-foot { margin-top: 22px; color: var(--muted); font-size: 14px; }
@media (max-width: 480px) { .auth-card { padding: 24px 18px; box-shadow: 5px 5px 0 var(--navy); } }

/* =====================================================================
   TABLET AND PHONE
===================================================================== */
@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
    .navbar { padding: 0 12px 0 16px; flex-wrap: wrap; }
    .hamburger { display: block; }
    .nav-menu {
        display: none; flex-direction: column; align-items: stretch;
        position: absolute; top: 64px; left: 0; width: 100%;
        background: var(--navy); padding: 8px 0 14px; box-shadow: 0 12px 24px rgba(0,0,0,.25);
        max-height: calc(100vh - 64px); overflow-y: auto;
    }
    .nav-menu.active { display: flex; }
    .nav-links { flex-direction: column; align-items: stretch; width: 100%; gap: 0; }
    .nav-right { border-top: 1px solid rgba(255,255,255,.15); margin-top: 8px; padding-top: 8px; }
    .nav-links li { width: 100%; }
    .nav-links li a, .dropbtn { padding: 13px 20px; border-radius: 0; width: 100%; min-height: 48px; font-size: 16px; }
    .nav-links li a.is-active::after, .dropdown.is-active > .dropbtn::after { inset-inline-start: 0; inset-inline-end: auto; left: auto; right: auto; top: 10px; bottom: 10px; width: 4px; height: auto; }
    [dir="rtl"] .dropdown-content { right: auto; }
    .dropbtn .fa-caret-down { margin-inline-start: auto; }
    .dropdown-content { position: static; box-shadow: none; border: 0; border-radius: 0; background: rgba(0,0,0,.18); padding: 4px 0; min-width: 0; }
    .dropdown-content a { color: #fff !important; padding-block: 13px !important; padding-inline: 46px 20px !important; border-radius: 0; min-height: 48px; }
    .dropdown-content a i { color: rgba(255,255,255,.7) !important; }
    .dropdown-content a:hover, .dropdown-content a.is-active { background: rgba(255,255,255,.1) !important; }
    .logout-btn { border: 0; }

    table { display: block; width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

    .container { padding: 18px; margin: 12px auto; width: calc(100% - 20px); border-radius: 14px; }

    div[style*="display: flex"] { flex-direction: column !important; gap: 10px !important; }
    .form-group { width: 100% !important; flex: none !important; }
}
@media (max-width: 700px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dash-head img { width: 60px; }
    h1 { font-size: 1.65rem; }
}

/* ---- Phones, tablets and any touch screen: fat-finger sizes ---- */
@media (pointer: coarse), (max-width: 768px) {
    body { font-size: 16px; }
    .btn { min-height: 48px; padding: 12px 18px; font-size: 16px; }
    .btn-small { min-height: 44px; min-width: 44px; padding: 10px 14px; font-size: 15px; margin: 4px 6px 4px 0; }
    .form-group input, .form-group select, .form-group textarea, input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="tel"], select, textarea {
        min-height: 48px; font-size: 16px; /* 16px stops phones zooming in on tap */
    }
    .form-group label { font-size: 16px; }
    input[type="checkbox"], input[type="radio"] { width: 22px !important; height: 22px; }
    .nav-links li a, .dropbtn, .dropdown-content a { min-height: 48px; font-size: 16px !important; }
    table th, table td { padding: 12px 10px; }
}

/* ---- Tables marked class="cards" become stacked cards on phones ---- */
@media (max-width: 760px) {
    table.cards, table.cards tbody { display: block; width: 100%; min-width: 0 !important; overflow: visible; white-space: normal; }
    table.cards tr { display: block; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; margin: 0 0 14px; padding: 8px 14px; }
    table.cards tbody tr:hover td { background: none; }
    table.cards tr.th-row { display: none; }
    table.cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px;
                     border: 0; border-bottom: 1px solid #EEF1F6; padding: 10px 0; text-align: end; font-size: 16px; }
    table.cards td:last-child { border-bottom: 0; }
    table.cards td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: start; flex: 0 0 38%; }
    table.cards td:first-child { font-size: 18px; font-family: var(--display); font-weight: 700; color: var(--navy); }
    table.cards td.card-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding-top: 12px; }
    table.cards td.card-actions::before { display: none; }
    table.cards td.card-actions .btn, table.cards td.card-actions form, table.cards td.card-actions button { flex: 1 1 auto; margin: 0; }
    table.cards td[colspan] { display: block; text-align: center; }
    table.cards td[colspan]::before { display: none; }
    table.cards tr.grp { border: 0; background: none; padding: 0; margin: 18px 0 6px; }
    table.cards tr.grp td { font-size: 20px; border: 0; padding: 0; color: var(--brand); }
}

/* =====================================================================
   DELETE CONFIRMATION, UNDO, RECENTLY DELETED
===================================================================== */
.confirm-overlay { position: fixed; inset: 0; background: rgba(10, 31, 68, .62); z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.confirm-overlay[hidden] { display: none; }
.confirm-box { background: #fff; border-radius: 18px; max-width: 420px; width: 100%; padding: 28px 22px 22px; text-align: center; border: 2px solid var(--navy); box-shadow: 8px 8px 0 var(--navy); }
.confirm-icon { font-size: 48px; color: var(--danger); line-height: 1; }
.confirm-box h3 { margin: 12px 0 6px; font-size: 21px; color: var(--navy); overflow-wrap: anywhere; }
.confirm-box p { margin: 0 0 4px; color: var(--muted); font-size: 16px; }
/* "No" on top, "Yes, delete" at the very bottom with a big gap, so a slip lands on "No". */
.confirm-box .btn { width: 100%; min-height: 56px; font-size: 18px; }
.confirm-cancel { background: var(--navy) !important; color: #fff !important; margin-top: 20px; }
.confirm-yes { margin-top: 44px; }
.confirm-yes[disabled] { opacity: .6; }
body.modal-open { overflow: hidden; }

.undo-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 4000;
            background: var(--navy); color: #fff; border-radius: 14px; padding-block: 10px; padding-inline: 18px 12px;
            display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); box-shadow: 0 12px 30px rgba(10,31,68,.35);
            font-size: 16px; transition: opacity .6s; }
.undo-bar .undo-btn { background: var(--gold); color: var(--navy); min-height: 48px; }
.undo-close { background: none; border: 0; color: #C9D4E6; font-size: 28px; cursor: pointer; min-width: 44px; min-height: 44px; }
.undo-fade { opacity: .55; }
@media (max-width: 560px) { .undo-bar { flex-wrap: wrap; justify-content: center; text-align: center; } }

.trash-list { display: grid; gap: 12px; margin-top: 14px; }
.trash-card { display: flex; align-items: center; gap: 14px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.trash-icon { font-size: 22px; color: var(--navy); width: 42px; height: 42px; border-radius: 12px; background: var(--gold-soft); display: grid; place-items: center; flex: none; }
.trash-text { flex: 1; min-width: 0; }
.trash-text strong { font-size: 17px; }
.trash-sub, .trash-when { color: var(--muted); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .trash-card { flex-wrap: wrap; } .trash-card form, .trash-card .btn { width: 100%; } }

/* Words next to icon-only buttons on phones ("Delete"), so nobody has to guess an icon. */
.m-only { display: none; }
@media (max-width: 760px) {
    .m-only { display: inline; }
    /* Stacked forms: fields use the full width instead of drifting to one side. */
    form[style*="display: flex"], form div[style*="display: flex"] { align-items: stretch !important; }
}

/* Footer line on app pages */
.app-foot { max-width: 1080px; margin: 10px auto 30px; padding: 0 16px; color: var(--muted); font-size: 13px; text-align: center; }

/* =====================================================================
   LANGUAGES
===================================================================== */
/* Arabic: a typeface made for Arabic script; Chinese: the phone/computer's own Chinese fonts */
html[dir="rtl"] { --display: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; --body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif; }
html[lang="zh-Hans"] { --display: "Bricolage Grotesque", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; --body: "Public Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { letter-spacing: 0; }
html[lang="zh-Hant"] { --display: "Bricolage Grotesque", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; --body: "Public Sans", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; }
html[lang="ne"] { --display: "Bricolage Grotesque", "Noto Sans Devanagari", sans-serif; --body: "Public Sans", "Noto Sans Devanagari", sans-serif; }
html[lang="el"] { --display: "Noto Sans", "Segoe UI", Arial, sans-serif; --body: "Noto Sans", "Segoe UI", Arial, sans-serif; }
html[lang="ne"] h1, html[lang="ne"] h2, html[lang="ne"] h3, html[lang="el"] h1, html[lang="el"] h2, html[lang="el"] h3 { letter-spacing: 0; line-height: 1.25; }
/* Numbers, amounts, dates and emails stay left-to-right inside Arabic text */
[dir="rtl"] .num, [dir="rtl"] td[data-label] { unicode-bidi: plaintext; }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="tel"], [dir="rtl"] input[type="number"] { direction: ltr; text-align: right; }
[dir="rtl"] .fa-arrow-right, [dir="rtl"] .fa-arrow-left, [dir="rtl"] .fa-sign-out-alt { transform: scaleX(-1); }

.lang-drop .lang-name { display: none; }
@media (max-width: 1000px) { .lang-drop .lang-name { display: inline; } .lang-drop .lang-code { display: none; } }
.lang-drop .dropdown-content a.is-current { background: var(--gold-soft) !important; }
@media (max-width: 1000px) { .lang-drop .dropdown-content a.is-current { background: rgba(255,255,255,.12) !important; } }

/* Language menu on the sign-in pages */
.lang-pick { position: relative; }
.lang-pick summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 14px; min-height: 44px;
                     border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--navy); font-weight: 600; font-size: 15px; }
.lang-pick summary::-webkit-details-marker { display: none; }
.lang-pick summary:hover { border-color: var(--navy); }
.lang-pick .lang-globe { width: 18px; height: 18px; }
.lang-pick .lang-list { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 50; background: #fff; border: 1px solid var(--line);
                        border-radius: 12px; padding: 6px; min-width: 180px; box-shadow: 0 14px 34px rgba(10,31,68,.18); display: grid;  max-height: min(70vh, 640px); overflow-y: auto;}
.lang-pick .lang-list a { padding: 11px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; }
.lang-pick .lang-list a:hover { background: var(--sky); }
.lang-pick .lang-list a[aria-current] { background: var(--gold-soft); }
.auth-top { width: 100%; max-width: 440px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-top .auth-brand { margin-bottom: 0; }
/* Right-to-left: mirror the left/right alignment written directly on page elements */
[dir="rtl"] [style*="float: right"], [dir="rtl"] [style*="float:right"] { float: left !important; }
[dir="rtl"] [style*="float: left"], [dir="rtl"] [style*="float:left"] { float: right !important; }
[dir="rtl"] [style*="text-align: right"], [dir="rtl"] [style*="text-align:right"] { text-align: left !important; }
[dir="rtl"] [style*="text-align: left"], [dir="rtl"] [style*="text-align:left"] { text-align: right !important; }
[dir="rtl"] [style*="margin-left: auto"], [dir="rtl"] [style*="margin-left:auto"] { margin-left: 0 !important; margin-right: auto !important; }

/* Medium screens: keep the whole menu on one row (longer words in French/Spanish) */
@media (min-width: 1001px) and (max-width: 1500px) {
    .navbar { gap: 14px; padding: 0 14px; }
    .nav-links { gap: 0; }
    .nav-links li a, .dropbtn { padding: 10px 9px; gap: 6px; }
    .nav-user { display: none; }
}
@media (min-width: 1001px) and (max-width: 1320px) {
    .nav-left > li > a > i:first-child, .nav-left .dropbtn > i:first-child, .nav-right .dropbtn > i:first-child { display: none; }
    .nav-brand { font-size: 0; gap: 0; }
    .nav-brand img { width: 34px; height: 34px; }
}

/* "Allow this AI app?" screen */
.consent-box { background: var(--sky-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 4px 0 18px; }
.consent-box p { margin: 0 0 8px; }
.consent-list { margin: 0 0 10px; padding-inline-start: 20px; }
.consent-list li { margin: 4px 0; }
.consent-list li.warn { color: var(--danger); }
.consent-small { font-size: 13.5px; color: var(--muted); }

/* 13 languages: keep the app-bar language menu on screen */
@media (min-width: 1001px) { .lang-drop .dropdown-content { max-height: calc(100vh - 80px); overflow-y: auto; } }

/* Item codes and third-party billing */
code.item-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: var(--sky, #EEF3FA); color: var(--navy, #0A1F44); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
small.billed-to { color: #8F631C; font-weight: 600; }

/* Price typed ex or inc GST (partials/price_pair.php) */
.gst-pair { display: flex; gap: 6px; min-width: 0; }
.gst-pair .gst-box { flex: 1 1 0; min-width: 0; margin: 0; font-weight: normal; position: relative; display: block; }
.gst-pair .gst-box span { position: absolute; top: -7px; left: 8px; padding: 0 4px; background: #fff; font-size: 10.5px; line-height: 1.2; color: #667; border-radius: 3px; pointer-events: none; white-space: nowrap; }
[dir="rtl"] .gst-pair .gst-box span { left: auto; right: 8px; }
.gst-pair input { width: 100%; min-width: 0; box-sizing: border-box; }
table.no-gst .gst-pair .gst-box:nth-child(2) { display: none; }
table.no-gst .gst-pair .gst-box span { display: none; }

/* =====================================================================
   PAYROLL
===================================================================== */
.msg.error { background: #FCEBEE; color: #8E1F33; border-inline-start-color: var(--danger); }
.pr-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--sky); border-radius: 12px; padding: 4px; margin: 4px 0 20px; }
.pr-tabs a { padding: 9px 16px; border-radius: 9px; color: var(--navy); text-decoration: none; font-weight: 600; font-size: 15px; }
.pr-tabs a.on { background: var(--navy); color: #fff; }
.pr-tabs a:not(.on):hover { background: #fff; }
.pr-hint { color: var(--muted); font-size: 14px; line-height: 1.5; }
.pr-ticks { padding-inline-start: 0; list-style: none; } .pr-ticks li { padding: 6px 0 6px 28px; position: relative; }
.pr-ticks li::before { content: "\2713"; position: absolute; left: 4px; color: var(--paid); font-weight: 700; }
[dir="rtl"] .pr-ticks li { padding: 6px 28px 6px 0; } [dir="rtl"] .pr-ticks li::before { left: auto; right: 4px; }
.pr-empty { background: var(--sky-2); border: 1.5px dashed var(--field); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.pr-alert { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; background: #FFF6E5; border: 1px solid #F0D9A8; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.pr-alert.late { background: #FCEBEE; border-color: #F1B9C3; }
.pr-alert a { font-weight: 600; margin-inline-start: auto; }
.pr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.pr-card { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; text-decoration: none; color: var(--muted); }
.pr-card .n { font-size: 26px; font-weight: 700; color: var(--navy); }
.pr-card:hover { border-color: var(--gold); }
.pr-table .num { text-align: end; }
.pr-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0; white-space: nowrap; }
.pr-badge.draft { background: #EEF1F6; color: #3d4b66; } .pr-badge.done { background: #E7F4EC; color: #17573A; }
.pr-badge.due { background: #FFF1D6; color: #7A5200; } .pr-badge.late { background: #FCEBEE; color: #8E1F33; }
.pr-form fieldset { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 16px 6px; margin: 0 0 16px; min-width: 0; }
.pr-form legend { font-weight: 700; color: var(--navy); padding: 0 6px; }
.pr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.pr-check { display: flex; align-items: center; gap: 8px; font-weight: normal; margin: 6px 0; }
.pr-check input { width: auto !important; margin: 0; }
.pr-ruleset { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 12px 0; background: #fff; }
.pr-ruleset .hd { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pr-chip { background: var(--sky); border-radius: 999px; padding: 5px 11px; font-size: 13px; }
.pr-chip small { color: var(--muted); }
table.pr-rules { min-width: 560px; } table.pr-rules td { padding: 6px; } table.pr-rules td.c { text-align: center; }
table.pr-rules input[type=number] { width: 90px; } table.pr-rules input:not([type]) { min-width: 180px; }
.pr-new { background: var(--sky-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 22px; }
.pr-runhead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.pr-totals { display: flex; gap: 8px; flex-wrap: wrap; }
.pr-totals div { background: var(--sky); border-radius: 10px; padding: 8px 14px; min-width: 100px; }
.pr-totals span { display: block; font-size: 12px; color: var(--muted); } .pr-totals b { font-size: 18px; color: var(--navy); }
.pr-emp { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0 0 14px; background: #fff; }
.pr-emp-hd { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.pr-emp-hd small { color: var(--muted); margin-inline-start: 6px; }
.pr-emp-fig { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.pr-emp-fig b { color: var(--navy); }
.pr-emp details { margin-top: 10px; } .pr-emp summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 4px 0; }
.pr-hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.pr-hours label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13.5px; margin: 0; }
.pr-hours label small { color: var(--muted); font-weight: normal; }
.pr-extra { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 20px; margin-top: 14px; }
.pr-extra .lbl { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.pr-extra .row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.pr-extra .row input:not([type=checkbox]) { flex: 1 1 0; min-width: 0; }
.pr-extra .row input[type=number] { flex: 0 0 96px; }
.pr-extra .row .pr-check { margin: 0; font-size: 13px; white-space: nowrap; }
.pr-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.pr-remove { margin-top: 6px; }
button.linklike { background: none; border: 0; padding: 0; color: var(--danger); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; }
.pr-warn { background: #FFF6E5; color: #7A5200; border-radius: 8px; padding: 6px 10px; margin-top: 8px; font-size: 13.5px; }
table.pr-lines { margin-top: 10px; font-size: 14px; } table.pr-lines td { padding: 6px 8px; border-bottom: 1px solid #EEF1F6; }
table.pr-lines td.num { text-align: end; white-space: nowrap; color: var(--muted); } table.pr-lines td.num:last-child { color: var(--ink); font-weight: 600; }
.pr-bottom { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 20px 0 10px; }
.pr-bottom form { margin: 0; }
.pr-paid { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; background: #FFF6E5; border-radius: 10px; padding: 6px 10px; }
.pr-paid input { width: auto; margin: 0; }
@media (max-width: 760px) {
    .pr-tabs { flex-wrap: nowrap; overflow-x: auto; }
    .pr-tabs a { white-space: nowrap; padding: 9px 12px; }
    .pr-totals div { flex: 1 1 40%; }
    .pr-emp { padding: 12px; }
    .pr-hours { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) { .pr-badge { white-space: normal; } }

/* Balance page - BAS position */
.bas-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.bas-card { background: #fff; border: 1.5px solid var(--line); border-top: 5px solid var(--danger); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.bas-card.refund { border-top-color: var(--paid); }
.bas-hd { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-weight: 700; color: var(--navy); }
.bas-hd small { color: var(--muted); font-weight: 600; }
.bas-amt { font-size: 30px; font-weight: 700; color: var(--danger); margin-top: 6px; }
.bas-card.refund .bas-amt { color: var(--paid); }
.bas-what { color: var(--muted); font-size: 14px; margin-top: -2px; }
table.bas-lines { width: 100%; margin: 10px 0 6px; font-size: 14px; border-collapse: collapse; }
table.bas-lines td { padding: 5px 0; border-bottom: 1px solid #EEF1F6; background: none; }
table.bas-lines td:last-child { text-align: end; white-space: nowrap; }
.bas-due { font-size: 13.5px; font-weight: 600; color: #7A5200; background: #FFF6E5; border-radius: 8px; padding: 6px 10px; margin-top: 4px; }
.bas-due.late { color: #8E1F33; background: #FCEBEE; }
.bas-link { font-size: 14px; font-weight: 600; margin-top: 8px; }
.bas-card.zero { border-top-color: var(--field); } .bas-card.zero .bas-amt { color: var(--navy); }
table.bas-lines { display: table !important; min-width: 0 !important; table-layout: auto; }
table.bas-lines td:first-child { padding-inline-end: 10px; }
form.dup-form { display: inline; margin: 0; }
