/* ============================================================
   Dental LMS — modern sidebar dashboard theme
   Palette: soft lavender-white bg, indigo-blue accent, rose accent,
            deep slate text
   Type: Poppins (headings) + Inter (body/UI)
   ============================================================ */

* { box-sizing: border-box; }

:root {
    --bg: #F3F5FA;
    --card: #FFFFFF;
    --ink: #1F2437;
    --muted: #8B93A7;
    --line: #ECEFF5;
    --blue: #4C6FFF;
    --blue-light: #E8ECFF;
    --blue-dark: #33459E;
    --rose: #FF6B9D;
    --rose-light: #FFE4ED;
    --success: #22A06B;
    --success-bg: #E1F5EC;
    --danger: #E5484D;
    --danger-bg: #FCE4E4;
    --warn: #C98A1F;
    --warn-bg: #FCEFD2;
    --dark: #1C2033;
}

body {
    font-family: 'Inter', -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

h1, h2, h3 { font-family: 'Poppins', sans-serif; color: var(--ink); font-weight: 600; }
h1 { font-size: 1.7rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 28px 0 14px; }

/* ---------- App shell: sidebar + main area ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 76px;
    background: var(--dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    flex-shrink: 0;
}
.sidebar-brand { color: var(--rose); font-size: 1.4rem; margin-bottom: 30px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.side-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 13px;
    color: #9098B5;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.side-icon svg {
    width: 20px; height: 20px;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}
.side-icon { position: relative; }
.side-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px;
    background: var(--danger); color: #fff;
    font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--dark);
    animation: side-badge-pulse 2s ease-out infinite;
}
@keyframes side-badge-pulse {
    0%   { box-shadow: 0 0 0 2px var(--dark), 0 0 0 2px rgba(229,72,77,0.6); }
    70%  { box-shadow: 0 0 0 2px var(--dark), 0 0 0 9px rgba(229,72,77,0); }
    100% { box-shadow: 0 0 0 2px var(--dark), 0 0 0 9px rgba(229,72,77,0); }
}
@media (prefers-reduced-motion: reduce) { .side-badge { animation: none; } }
.side-icon:hover { background: rgba(255,255,255,0.06); color: #fff; }
.side-icon.active { background: var(--blue); color: #fff; }
.side-icon-logout { margin-top: auto; color: #6b7290; }
.side-icon-logout:hover { color: var(--rose); background: rgba(255,107,157,0.12); }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
    background: transparent;
    padding: 22px 32px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.topbar-logo {
    height: 34px;
    width: auto;
    flex-shrink: 0;
}
.topbar-search {
    flex: 1;
    max-width: 420px;
    background: var(--card);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    box-shadow: 0 2px 10px rgba(31,36,55,0.05);
}
.search-icon { width: 17px; height: 17px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.topbar-search input {
    border: none; outline: none; font-size: 0.9rem; width: 100%;
    font-family: inherit; background: transparent; color: var(--ink);
}
.topbar-right { display: flex; align-items: center; gap: 14px; }

.role-tag {
    background: var(--blue-light);
    color: var(--blue-dark);
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    font-weight: 700;
}

.profile-link { display: flex; align-items: center; }
.avatar-sm {
    width: 38px; height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(31,36,55,0.12);
}
.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blue), var(--rose));
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}
.avatar-lg {
    width: 110px; height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--rose));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-size: 2.4rem; font-weight: 700;
    box-shadow: 0 6px 20px rgba(76,111,255,0.25);
}
.profile-photo-lg {
    width: 110px; height: 110px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 6px 20px rgba(31,36,55,0.15);
    border: 3px solid #fff;
}
.profile-card {
    background: var(--card);
    border-radius: 18px;
    padding: 28px;
    display: flex;
    gap: 32px;
    align-items: flex-start;
    box-shadow: 0 2px 16px rgba(31,36,55,0.06);
}
.profile-photo-block { flex-shrink: 0; text-align: center; }

.container { max-width: 1080px; margin: 0 auto; padding: 18px 32px 60px; width: 100%; }

.greeting { font-size: 1rem; color: var(--muted); margin: 0 0 22px; }
.greeting-name { color: var(--ink); font-weight: 700; font-family: 'Poppins', sans-serif; }
.wave { display: inline-block; }

.back-link { margin: 0 0 20px; }
.back-link a {
    color: var(--blue-dark);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}
.back-link a:hover { color: var(--rose); }
.footer { text-align: center; color: var(--muted); padding: 24px 20px 40px; font-size: 0.8rem; }

/* ---------- Auth pages ---------- */
.auth-box {
    max-width: 400px;
    margin: 70px auto;
    background: var(--card);
    padding: 36px 34px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(31,36,55,0.1);
}
.auth-box h1 {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}
.auth-box h2 { margin-top: 4px; font-size: 1.5rem; }
.auth-box p a { color: var(--blue); font-weight: 600; text-decoration: none; }
.auth-box p a:hover { text-decoration: underline; }

/* Login and the short account pages (forgot / reset / verify): the whole card is centred
   on the screen and sized to fit without scrolling. Only a very short window scrolls. */
.auth-logo { display: block; width: 96px; height: 96px; margin: 0 auto 12px; }
body.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
body.auth-page .auth-box { margin: 0; width: 100%; padding: 26px 34px; }
body.auth-page .auth-box h1 { margin-bottom: 14px; }
body.auth-page .auth-box h2 { margin: 0 0 12px; font-size: 1.35rem; }
body.auth-page .auth-box form label { margin-bottom: 12px; }

/* ---------- Forms ---------- */
form label {
    display: block;
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
}
form input, form select, form textarea {
    width: 100%;
    padding: 10px 13px;
    margin-top: 6px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 0.94rem;
    font-family: inherit;
    font-weight: 400;
    color: var(--ink);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
form input:focus, form select:focus, form textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(76,111,255,0.12);
}

button, .btn {
    background: var(--blue);
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
    box-shadow: 0 4px 14px rgba(76,111,255,0.25);
}
button:hover, .btn:hover { background: var(--blue-dark); transform: translateY(-1px); }

.form-card {
    background: var(--card);
    padding: 24px 26px;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(31,36,55,0.06);
    max-width: 520px;
    margin-bottom: 28px;
}

/* ---------- Password / email helpers (assets/js/account.js) ---------- */
.pw-field { position: relative; display: block; margin-top: 6px; }
.pw-field input { margin-top: 0; padding-right: 46px; }
.pw-toggle {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: 44px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: none; box-shadow: none;
    color: var(--muted);
    border-radius: 0 10px 10px 0;
}
.pw-toggle:hover { background: none; color: var(--blue); transform: none; }
.pw-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pw-meter-bar { display: flex; gap: 4px; flex: 1; }
.pw-meter-bar i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: var(--blue); }
.pw-meter[data-score="4"] i { background: var(--success); }
.pw-meter-label { font-size: 0.78rem; font-weight: 500; color: var(--muted); min-width: 40%; }

.pw-note { display: block; margin-top: 6px; font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.pw-note:empty { display: none; }
.pw-note.pw-ok { color: var(--success); }
.pw-note.pw-bad { color: var(--danger); }
.pw-note a { color: var(--blue); font-weight: 700; }

.link-btn {
    background: none; color: var(--blue);
    padding: 0; border-radius: 0; box-shadow: none;
    font-size: 0.82rem; font-weight: 600;
}
.link-btn:hover { background: none; color: var(--blue-dark); transform: none; text-decoration: underline; }
.field-hint { display: block; margin-top: 6px; font-size: 0.78rem; font-weight: 400; color: var(--muted); }
.readonly-field, form input.readonly-field { background: #F6F7FB; color: var(--muted); cursor: default; }
.text-link { color: var(--blue); font-weight: 600; text-decoration: none; font-size: 0.88rem; }
.text-link:hover { text-decoration: underline; }
.field-row-link { margin: -6px 0 18px; text-align: right; font-size: 0.82rem; }
.field-row-link a, .auth-box a.text-link { color: var(--blue); font-weight: 600; text-decoration: none; }
.field-row-link a:hover, .auth-box a.text-link:hover { text-decoration: underline; }

.verify-pill { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 0.68rem; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.verify-pill.ok { background: var(--success-bg); color: var(--success); }
.verify-pill.no { background: var(--warn-bg); color: var(--warn); }

/* ---------- Tables ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(31,36,55,0.06);
}
.data-table th, .data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 0.88rem;
}
.data-table th {
    background: #fff;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--line);
}
.data-table tbody tr:hover { background: #FAFBFF; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table a { color: var(--blue-dark); font-weight: 600; text-decoration: none; }
.data-table a:hover { color: var(--rose); }

/* ---------- Status pills ---------- */
.status {
    padding: 4px 13px;
    border-radius: 20px;
    font-size: 0.72rem;
    text-transform: capitalize;
    font-weight: 700;
    background: #eee;
    display: inline-block;
}
.status-submitted    { background: var(--blue-light); color: var(--blue-dark); }
.status-design       { background: var(--warn-bg); color: var(--warn); }
.status-manufacturing{ background: #FDE9D0; color: #B4680F; }
.status-qa           { background: #EEE3FB; color: #7B4FC9; }
.status-ready        { background: var(--success-bg); color: var(--success); }
.status-delivered    { background: var(--success-bg); color: var(--success); }
.status-cancelled    { background: var(--danger-bg); color: var(--danger); }
.status-hold         { background: #E4E7EF; color: #4A5268; }
.status-paid         { background: var(--success-bg); color: var(--success); }
.status-unpaid       { background: var(--danger-bg); color: var(--danger); }
.status-overdue      { background: var(--warn-bg); color: var(--warn); }

/* ---------- Stat cards ---------- */
.stat-cards { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 28px; }
.stat-cards .card {
    background: var(--card);
    padding: 22px 24px;
    border-radius: 18px;
    box-shadow: 0 2px 16px rgba(31,36,55,0.06);
    min-width: 150px;
    flex: 1;
}
.stat-cards .card:nth-child(1) { border-top: 3px solid var(--blue); }
.stat-cards .card:nth-child(2) { border-top: 3px solid var(--rose); }
.stat-cards .card:nth-child(3) { border-top: 3px solid var(--success); }
.stat-cards .card:nth-child(4) { border-top: 3px solid var(--warn); }
.stat-cards .card h3 { margin: 0 0 6px; font-size: 1.8rem; color: var(--ink); }
.stat-cards .card p {
    margin: 0; color: var(--muted); font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600;
}

/* ---------- Messages / communication ---------- */
.messages { margin-bottom: 18px; }
.message {
    background: var(--card);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 8px rgba(31,36,55,0.05);
    border-left: 3px solid var(--blue);
}
.msg-time { float: right; color: var(--muted); font-size: 0.74rem; }

/* ---------- Alerts ---------- */
.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    border-left: 3px solid var(--danger);
}
.alert-success {
    color: var(--success);
    background: var(--success-bg);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    border-left: 3px solid var(--success);
}

/* ---------- Case summary block ---------- */
.case-summary {
    background: var(--card);
    padding: 20px 24px;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(31,36,55,0.06);
    margin-bottom: 24px;
}
.case-summary p { margin: 6px 0; font-size: 0.92rem; }

/* ---------- Floating help/FAQ chat widget ---------- */
.help-bubble {
    position: fixed;
    bottom: 26px;
    right: 26px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--rose));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(76,111,255,0.35);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.15s;
}
.help-bubble:hover { transform: scale(1.06); }
.help-bubble-icon { color: #fff; font-size: 1.5rem; font-weight: 700; font-family: 'Poppins', sans-serif; }

.help-panel {
    position: fixed;
    bottom: 96px;
    right: 26px;
    width: 340px;
    max-width: calc(100vw - 40px);
    max-height: 60vh;
    background: var(--card);
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(31,36,55,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
}
.help-panel.open { display: flex; }
.help-panel-header {
    background: linear-gradient(135deg, var(--blue), var(--rose));
    color: #fff;
    padding: 14px 18px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.help-close {
    background: none; border: none; color: #fff; font-size: 1.3rem;
    cursor: pointer; box-shadow: none; padding: 0; line-height: 1;
}
.help-close:hover { background: none; transform: none; opacity: 0.8; }
.help-panel-body { padding: 14px; overflow-y: auto; flex: 1; }
.help-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    margin-bottom: 8px;
}
.help-input:focus { outline: none; border-color: var(--blue); }
.help-search-btn {
    width: 100%;
    padding: 8px;
    font-size: 0.82rem;
    margin-bottom: 12px;
    box-shadow: none;
}
.help-hint { color: var(--muted); font-size: 0.82rem; margin: 8px 0; }
.help-result {
    background: var(--blue-light);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.help-result-q { font-weight: 700; font-size: 0.82rem; color: var(--blue-dark); margin-bottom: 4px; }
.help-result-a { font-size: 0.82rem; color: var(--ink); }

@media (max-width: 720px) {
    .sidebar { width: 60px; }
    .side-icon { width: 38px; height: 38px; }
    .topbar { padding: 16px 16px 0; flex-wrap: wrap; }
    .container { padding: 16px 16px 50px; }
    .profile-card { flex-direction: column; align-items: center; text-align: center; }
    .stat-cards .card { min-width: 100%; }
    .help-panel { right: 12px; left: 12px; width: auto; }
    .help-bubble { right: 16px; bottom: 16px; }
}

/* ---------- Billing layout (shared across billing_overview / invoices / statements / payments / price_list) ---------- */

/* Give billing pages more room than the standard 980px content width,
   since these tables have many columns. */
.container:has(.billing-layout) { max-width: 1440px; }

.billing-layout { display: flex; gap: 20px; align-items: flex-start; }
.billing-subnav {
    width: 170px; flex-shrink: 0; background: var(--card); border-radius: 16px;
    box-shadow: 0 2px 16px rgba(31,36,55,0.06); padding: 10px; position: sticky; top: 20px;
}
.billing-subnav a {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-size: 0.88rem; font-weight: 600; margin-bottom: 2px;
}
.billing-subnav a.active { background: var(--blue-light); color: var(--blue-dark); }
.billing-subnav a.disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.billing-subnav .soon-tag {
    margin-left: auto; font-size: 0.62rem; background: var(--warn-bg); color: var(--warn);
    padding: 1px 6px; border-radius: 8px; font-weight: 700;
}
.billing-main { flex: 1; min-width: 0; }

/* Only short, single-word-ish columns stay on one line; text-heavy
   columns (Patient, Item, Instruction, Dentist...) wrap instead of
   forcing the whole table wider than the page. */
.bill-table th, .bill-table td { white-space: normal; word-break: break-word; }
.bill-table td.nowrap, .bill-table th.nowrap { white-space: nowrap; }
.bill-table td.wrap { max-width: 220px; }
.bill-table-compact th, .bill-table-compact td { white-space: nowrap; }
.bill-table a.ref-link { color: var(--blue-dark); font-weight: 700; text-decoration: none; }
.bill-table a.ref-link:hover { color: var(--rose); }

.bill-pagination {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 4px; font-size: 0.85rem; color: var(--muted);
}
.bill-pagination select { width: auto; display: inline-block; padding: 4px 8px; }
.bill-pagination .pages a, .bill-pagination .pages span {
    display: inline-block; padding: 4px 10px; margin: 0 2px; border-radius: 6px; text-decoration: none; color: var(--ink);
}
.bill-pagination .pages a.current { background: var(--blue); color: #fff; font-weight: 700; }

@media (max-width: 720px) {
    .billing-layout { flex-direction: column; }
    .billing-subnav { width: 100%; position: static; }
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
