/* staff.css - staff portal (classic desktop look) */

/* 1. Colours and base text */

:root {
    --face: #ECE9D8; /* window and button face */
    --face-dark: #D6D2C2;
    --shadow: #ACA899; /* frame shadow */
    --frame: #D0D0BF; /* group box border */
    --field: #7F9DB9; /* input border */
    --text: #000000;
    --text-grey: #555555;
    --select: #316AC5; /* selection blue */
    --select-light: #C1D2EE; /* row hover */
    --title-1: #0A246A; /* title bar gradient */
    --title-2: #3A6EA5;
    --link: #0033CC;
    --bg: var(--face);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
}

.staff-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--face);
    color: var(--text);
    font-family: Tahoma, Verdana, "Segoe UI", sans-serif;
    font-size: 12px;
    line-height: 1.35;
}

.staff-body h1,
.staff-body h2,
.staff-body h3,
.staff-body p {
    margin: 0;
}

.staff-body a {
    color: var(--link);
}

.staff-body strong {
    font-weight: bold;
}

/* screen reader only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* skip link, visible on focus */
.skip-link {
    position: absolute;
    top: -100px;
    left: 8px;
    z-index: 200;
    padding: 4px 8px;
    background: #FFFFE1;
    border: 1px solid #000000;
    color: #000000;
}
.skip-link:focus {
    top: 4px;
}

/* line icons not used in the portal */
.staff-body .icon {
    display: none;
}

/* 2. Title bar, nav, main area, status bar */

/* title bar */
.staff-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 26px;
    padding: 0 4px 0 8px;
    background: linear-gradient(to right, var(--title-1), var(--title-2));
    color: #FFFFFF;
}

.app-title {
    overflow: hidden;
    color: #FFFFFF !important;
    font-weight: bold;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-title img {
    display: none;
}
.app-practice {
    font-weight: normal;
}

/* user name and log out */
.staff-user {
    display: none;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.role-pill {
    font-weight: bold;
}
.role-pill::before {
    content: "(";
    font-weight: normal;
}
.role-pill::after {
    content: ")";
    font-weight: normal;
}

.topbar-link {
    padding: 1px 8px;
    border: 1px solid #FFFFFF;
    border-color: #FFFFFF #404040 #404040 #FFFFFF;
    background: var(--face);
    color: #000000 !important;
    text-decoration: none;
}
.topbar-link:active {
    border-color: #404040 #FFFFFF #FFFFFF #404040;
}

/* phone menu button */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 26px;
    height: 22px;
    padding: 4px;
    border: 1px solid #FFFFFF;
    background: transparent;
    cursor: pointer;
}
.menu-toggle-bar {
    display: block;
    height: 2px;
    background: #FFFFFF;
}

/* phones: nav above the content until opened */
.staff-layout {
    flex: 1;
    display: block;
}

/* left nav (tree pane style) */
.staff-nav {
    display: none;
    padding: 4px 0;
    background: #FFFFFF;
    border-bottom: 1px solid var(--shadow);
}
.staff-nav.is-open {
    display: block;
}

/* nav group headings */
.nav-group {
    margin: 8px 0 0;
    padding: 2px 8px;
    font-weight: bold;
    color: var(--text-grey);
}
.nav-group:first-child {
    margin-top: 0;
}

.staff-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.staff-nav a {
    display: block;
    margin: 0 4px;
    padding: 2px 4px 2px 16px;
    color: #000000;
    text-decoration: none;
}
.staff-nav a:hover {
    text-decoration: underline;
}

/* current page */
.staff-nav a[aria-current="page"] {
    background: var(--select);
    color: #FFFFFF;
}

/* bottom nav links */
.staff-nav-bottom {
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--frame);
}

/* main content area */
.staff-main {
    padding: 11px;
}

/* status bar */
.staff-statusbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 2px;
    background: var(--face);
    border-top: 1px solid var(--shadow);
    font-size: 11px;
}
.staff-statusbar span {
    padding: 1px 8px;
    border: 1px solid;
    border-color: var(--shadow) #FFFFFF #FFFFFF var(--shadow);
}
.staff-statusbar span:last-child {
    margin-left: auto;
}

/* Desktop: nav always visible */
@media (min-width: 960px) {
    .menu-toggle {
        display: none;
    }
    .staff-user {
        display: flex;
    }

    .staff-layout {
        display: grid;
        grid-template-columns: 176px minmax(0, 1fr);
    }

    .staff-nav {
        display: block;
        border-bottom: 0;
        border-right: 1px solid var(--shadow);
    }

    .staff-main {
        max-width: 1240px;
        padding: 11px 11px 22px;
    }
}

/* 3. Page heading and home tasks */

/* title with actions on the right */
.staff-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
    margin-bottom: 11px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--shadow);
    box-shadow: 0 1px 0 #FFFFFF;
}
.staff-heading h1 {
    font-size: 14px;
    font-weight: bold;
}
.staff-heading p {
    color: var(--text-grey);
}

/* home task list */
.action-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 7px;
    margin-bottom: 11px;
}

/* task button */
.action-tile {
    display: block;
    padding: 4px 8px;
    border: 1px solid;
    border-color: #FFFFFF var(--shadow) var(--shadow) #FFFFFF;
    background: var(--face);
    color: #000000 !important;
    text-decoration: none;
}
.action-tile:hover {
    background: #F4F3EC;
}
.action-tile:hover strong {
    text-decoration: underline;
}
.action-tile:active {
    border-color: var(--shadow) #FFFFFF #FFFFFF var(--shadow);
}
.action-tile strong {
    display: block;
    color: var(--link);
}
.action-tile small {
    display: block;
    font-size: 11px;
    color: var(--text-grey);
}
.action-tile-icon {
    display: none;
}

/* 4. Panels (group boxes) */

.panel {
    position: relative;
    margin: 7px 0 11px;
    padding: 16px 9px 11px;
    border: 1px solid var(--frame);
    border-radius: 3px;
    background: transparent;
}

/* title on the frame line */
.panel-head {
    position: absolute;
    top: -8px;
    left: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}
.panel-head > * {
    padding: 0 4px;
    background: var(--bg);
    pointer-events: auto;
}
.panel-head h2 {
    font-size: 12px;
    font-weight: bold;
    color: #0046D5;
}
.panel-head p,
.panel-head .cell-sub,
.panel-head a {
    font-size: 11px;
    color: var(--text-grey);
}
.panel-head a {
    color: var(--link);
}

/* collapsible panel */
summary.panel-head {
    cursor: pointer;
    list-style: none;
}
summary.panel-head::-webkit-details-marker {
    display: none;
}
summary.panel-head h2::before {
    content: "[+] ";
    font-weight: normal;
}
details[open] > summary.panel-head h2::before {
    content: "[-] ";
}
details.panel:not([open]) {
    padding: 4px;
}

/* two panels side by side */
.panel-row {
    display: grid;
    gap: 0 11px;
}
@media (min-width: 1100px) {
    .panel-row {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

/* inset area */
.details-body {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--frame);
    background: #F7F6F0;
}

.empty-state {
    padding: 4px 0;
    color: var(--text-grey);
}

/* 5. Forms (labels left of inputs) */

/* text inputs */
.staff-main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
.staff-main select,
.staff-main textarea {
    width: 100%;
    height: 23px;
    margin: 0;
    padding: 1px 4px;
    border: 1px solid var(--field);
    border-radius: 0;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 12px;
    color: #000000;
}
.staff-main select {
    padding: 0 1px;
}
.staff-main textarea {
    height: auto;
    min-height: 48px;
    resize: vertical;
}

/* disabled inputs */
.staff-main input:disabled,
.staff-main select:disabled,
.staff-main textarea:disabled,
.staff-main input[readonly] {
    background: var(--face);
    color: var(--text-grey);
}

/* focus */
.staff-main input:focus,
.staff-main select:focus,
.staff-main textarea:focus {
    outline: 1px dotted #000000;
    outline-offset: 1px;
}

.staff-main input[type="checkbox"],
.staff-main input[type="radio"] {
    width: 13px;
    height: 13px;
    margin: 0;
    flex-shrink: 0;
}

.form-grid {
    display: grid;
    gap: 7px 22px;
}

/* 120px label column */
.form-grid > div {
    display: grid;
    grid-template-columns: 120px minmax(0, 280px);
    align-items: center;
    column-gap: 10px;
}
.form-grid > div:has(textarea) {
    align-items: start;
}
.form-grid > div:has(textarea) .field-label {
    padding-top: 4px;
}

.field-label {
    display: flex;
    margin: 0;
    font-weight: normal;
}
.field-label::after {
    content: ":";
    order: 1;
}
/* required marker */
.field-label .req {
    order: 2;
    margin-left: 2px;
    font-style: normal;
    color: #C00000;
}

@media (min-width: 900px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 410px));
    }
    /* full-width field */
    .form-grid .span-all {
        grid-column: 1 / -1;
        grid-template-columns: 120px minmax(0, 1fr);
    }
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

/* form buttons, right aligned */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 11px;
}

/* toolbar above a table */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin: 0 0 7px;
}
.filter-bar > * {
    flex: 0 1 auto;
}
.filter-bar input[type="search"],
.filter-bar input:not([type]),
.filter-bar input[type="text"] {
    width: 240px !important;
}
.filter-bar select,
.filter-bar input[type="date"] {
    width: auto !important;
}

/* inline controls in a table cell */
.inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.inline-actions form {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}
.inline-actions input:not([type="hidden"]),
.inline-actions select {
    width: auto !important;
}

.staff-main details > summary {
    cursor: pointer;
    list-style: none;
}
.staff-main details > summary::-webkit-details-marker {
    display: none;
}

/* 6. Buttons */

.staff-main .btn,
.staff-main button:not(.file-tabs button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto;
    min-width: 75px;
    height: 23px;
    padding: 0 12px;
    border: 1px solid #003C74;
    border-radius: 3px;
    background: linear-gradient(to bottom, #FFFFFF, #F0F0EA 60%, #D6D0C5);
    font-family: inherit;
    font-size: 12px;
    font-weight: normal;
    color: #000000;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.staff-main .btn:hover,
.staff-main button:not(.file-tabs button):hover {
    border-color: #E59700;
    box-shadow: inset 0 0 0 1px #FFD278;
}
.staff-main .btn:active,
.staff-main button:not(.file-tabs button):active {
    background: linear-gradient(to bottom, #D6D0C5, #ECEBE6);
}

/* default button */
.staff-main .btn-primary {
    font-weight: bold;
    box-shadow: inset 0 0 0 1px #A4BDEC;
}

/* destructive actions */
.staff-main .btn-danger-outline {
    color: #A00000;
}

/* small table buttons */
.staff-main .btn-xs {
    min-width: 0;
    height: 19px;
    padding: 0 6px;
    font-size: 11px;
}

/* 7. Tables */

/* inset table wrapper, scrolls sideways on small screens */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--field);
    background: #FFFFFF;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #FFFFFF;
    font-size: 12px;
}

/* column headers */
.data-table th {
    height: 20px;
    padding: 0 6px;
    border-right: 1px solid var(--frame);
    border-bottom: 1px solid var(--shadow);
    background: linear-gradient(to bottom, #FFFFFF, #EBEADB);
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    height: 20px;
    padding: 1px 6px;
    border-right: 1px solid #F0F0F0;
    border-bottom: 1px solid #F0F0F0;
    vertical-align: middle;
}

/* row hover */
.data-table tbody tr:hover td {
    background: var(--select-light);
}

.data-table .cell-main {
    font-weight: bold;
}
.data-table .cell-main a {
    color: #000000;
}

/* secondary text */
.cell-sub {
    display: block;
    font-size: 11px;
    font-weight: normal;
    color: var(--text-grey);
}

/* 8. Badges, messages, counters */

/* status text */
.badge {
    font-weight: bold;
    white-space: nowrap;
}
.badge-pending,
.badge-late,
.badge-requested   { color: #B06000; }
.badge-confirmed,
.badge-approved,
.badge-completed,
.badge-active      { color: #007000; }
.badge-cancelled,
.badge-no-show,
.badge-declined,
.badge-inactive,
.badge-low         { color: #C00000; }

/* flash message bar */
.staff-main .success-message,
.staff-main .error-message {
    margin: 0 0 8px;
    padding: 4px 8px;
    border: 1px solid var(--shadow);
    background: #FFFFE1;
}
.staff-main .error-message {
    border-color: #C00000;
    color: #C00000;
}
.staff-main .success-message p,
.staff-main .error-message p {
    margin: 2px 0;
}

/* dashboard counters */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px 11px;
    margin-bottom: 11px;
}
@media (min-width: 960px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
.stat-card {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 2px 6px;
    border: 1px solid var(--field);
    background: #FFFFFF;
}
.stat-card .stat-number {
    font-weight: bold;
}
.stat-card.is-alert .stat-number {
    color: #C00000;
}

/* 9. Patient file */

/* patient banner */
.patient-banner {
    border: 1px solid var(--field);
    background: #FFFFFF;
}
.patient-banner-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
    padding: 4px 8px;
}
.patient-banner h1 {
    font-size: 14px;
    font-weight: bold;
}

/* label: value pairs */
.banner-facts {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 2px 4px;
    border-top: 1px solid var(--frame);
    background: #F7F6F0;
}
.banner-facts div {
    display: flex;
    gap: 4px;
    padding: 1px 8px 1px 4px;
}
.banner-facts dt {
    color: var(--text-grey);
}
.banner-facts dt::after {
    content: ":";
}
.banner-facts dd {
    margin: 0;
    font-weight: bold;
}
.banner-facts .banner-allergy dd {
    color: #C00000;
}

.file-number {
    font-weight: bold;
    color: var(--text-grey);
}

/* tabs */
.file-tabs {
    display: flex;
    flex-wrap: wrap;
    margin: 11px 0 0;
    padding: 0 0 0 4px;
}
.file-tabs button {
    position: relative;
    margin: 2px 0 -1px -1px;
    padding: 2px 10px;
    border: 1px solid #919B9C;
    border-bottom: 0;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(to bottom, #FFFFFF, #ECEBE6);
    font-family: inherit;
    font-size: 12px;
    color: #000000;
    cursor: pointer;
}
.file-tabs button:hover {
    border-top: 2px solid #FFC83C;
    padding-top: 1px;
}
/* active tab */
.file-tabs button[aria-selected="true"] {
    z-index: 1;
    margin-top: 0;
    padding: 3px 10px 4px;
    border-top: 2px solid #FFC83C;
    background: #FCFCFE;
}

.tab-panels {
    --bg: #FCFCFE;
    padding: 11px 11px 0;
    border: 1px solid #919B9C;
    background: #FCFCFE;
}
.tab-panel[hidden] {
    display: none;
}

.allergy-alert {
    font-weight: bold;
    color: #C00000;
}

/* vitals row */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px 11px;
    margin: 7px 0;
}
.vitals-grid .field-label {
    text-align: left;
}
@media (min-width: 768px) {
    .vitals-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* consultation note */
.note-card {
    margin-bottom: 8px;
    border: 1px solid var(--frame);
    background: #FFFFFF;
}
.note-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 8px;
    padding: 2px 6px;
    background: linear-gradient(to bottom, #FFFFFF, #EBEADB);
    border-bottom: 1px solid var(--frame);
}
.note-list {
    display: grid;
    gap: 2px 8px;
    margin: 0;
    padding: 4px 6px;
}
.note-list dt {
    color: var(--text-grey);
}
.note-list dd {
    margin: 0 0 4px;
}
@media (min-width: 768px) {
    .note-list {
        grid-template-columns: 112px 1fr;
    }
    .note-list dt {
        text-align: right;
    }
    .note-list dd {
        margin: 0;
    }
}

/* bill total */
.bill-total {
    font-size: 14px;
    font-weight: bold;
}

/* inputs fill their table cells */
.medicine-entry td {
    padding: 2px;
}
.medicine-entry input {
    min-width: 80px;
}
.medicine-entry .bill-qty {
    width: 60px;
    min-width: 0;
}

/* 10. Small screens */
@media (max-width: 640px) {
    /* labels above inputs */
    .form-grid > div {
        grid-template-columns: 1fr;
        row-gap: 2px;
    }
    .field-label {
        text-align: left;
    }

    /* 16px stops iOS zoom on focus */
    .staff-main input:not([type="checkbox"]):not([type="radio"]),
    .staff-main select,
    .staff-main textarea {
        height: 28px;
        font-size: 16px;
    }

    .filter-bar input[type="search"],
    .filter-bar input:not([type]) {
        width: 100% !important;
    }

    .app-practice {
        display: none;
    }
}

/* 11. Transactions page */

.staff-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    background: #FFFFFF;
}
.staff-table th,
.staff-table td {
    height: 20px;
    padding: 1px 6px;
    border-bottom: 1px solid #F0F0F0;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}
.staff-table th {
    border-bottom: 1px solid var(--shadow);
    background: linear-gradient(to bottom, #FFFFFF, #EBEADB);
    font-weight: normal;
}

.status-badge {
    font-weight: bold;
}
.status-unpaid         { color: #C00000; }
.status-partially-paid { color: #B06000; }
.status-paid           { color: #007000; }
.status-cancelled      { color: var(--text-grey); }

/* 12. Staff login */

/* desktop background */
.staff-login-page {
    background: #3A6EA5;
}
.staff-login-page .staff-main {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    padding: 16vh 8px 16px;
}

/* login window */
.staff-login-box {
    margin: 0;
    padding: 0;
    border: 1px solid #0831D9;
    border-radius: 0;
    background: var(--face);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}
.staff-login-box .panel-head {
    position: static;
    height: 22px;
    padding: 0 8px;
    background: linear-gradient(to right, var(--title-1), var(--title-2));
}
.staff-login-box .panel-head > * {
    padding: 0;
    background: none;
}
.staff-login-box .panel-head h2 {
    color: #FFFFFF;
}
.staff-login-body {
    padding: 12px;
}
.staff-login-brand {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--shadow);
    box-shadow: 0 1px 0 #FFFFFF;
}
.staff-login-brand strong {
    display: block;
}
.staff-login-page .form-grid {
    grid-template-columns: 1fr;
}
.staff-login-page .form-grid > div {
    grid-template-columns: 72px minmax(0, 1fr);
}
.staff-login-page .form-actions {
    justify-content: space-between;
}
.staff-login-back {
    margin-top: 8px !important;
    text-align: center;
}
.staff-login-back a {
    color: #FFFFFF !important;
}

/* checkbox left, buttons right */
.form-actions .checkbox-row,
.form-actions > a:first-child {
    margin-right: auto;
}

/* 13. Patient list */

/* match count */
.search-count {
    color: var(--text-grey);
}

/* clickable rows */
.patient-list .data-table th,
.patient-list .data-table td {
    padding: 0 8px;
    border-right: 0;
}
.patient-list .data-table td {
    height: 24px;
}
.patient-list tr[data-href] {
    cursor: pointer;
}
.patient-list td a {
    color: #000000;
    text-decoration: none;
}

/* matching rows */
.patient-list tr.is-match td {
    background: #D6E6FB;
    border-bottom-color: #C3D7F2;
}
/* divider after the last match */
.patient-list tr.is-match:has(+ tr:not(.is-match)) td {
    border-bottom: 2px solid var(--select);
}

/* highlighted digits */
.patient-list mark {
    background: var(--select);
    color: #FFFFFF;
}
