/* PD-Rx Customer Portal - look and feel per spec section 4.
   Maroon menu, black selected/hover, light-blue table titles, grey/cream detail panels,
   Kalinga menu font, Arial elsewhere. Text is a little larger than the old 9.5pt and the layout is responsive (problem #14). */

@font-face { font-family: "Kalinga"; src: url("../fonts/Kalinga_gdi.ttf") format("truetype"); font-weight: normal; font-display: swap; }
@font-face { font-family: "Kalinga"; src: url("../fonts/Kalinga-Bold_gdi.ttf") format("truetype"); font-weight: bold; font-display: swap; }

:root {
    --maroon: #800000;
    --maroon-dark: #660000;
    --black: #000;
    --table-title: #c5d9f1;
    --detail-head: #DDDDE5;
    --detail-body: #fcfaef;
    --border: #b8b8c4;
    --row-alt: #f6f7fb;
    --row-hover: #eef3fb;
    --link: #0645ad;
    --text: #1a1a1a;
    --muted: #5d5d66;
    --error-bg: #fbeaea;
    --error-border: #c94a4a;
    --info-bg: #eaf2fb;
    --info-border: #6d94c4;
    --base-size: 10pt;   /* old site: 9.5pt */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: #fff;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--base-size);
    line-height: 1.35;
}
a { color: var(--link); }
h1, h2 { font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: bold; margin: 0; }
h3 { font-size: 1em; margin: 12px 0 4px; }
code { font-size: .95em; }
[hidden] { display: none !important; }

.page { padding: 0 25px 40px; max-width: 100%; }
.content { padding-top: 14px; }
.muted { color: var(--muted); }
.inline { display: inline; margin: 0; }
.center { text-align: center; }

/* ---------------------------------------------------------------- header */
.site-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-top: 10px; }
.brand img { display: block; max-width: 100%; height: auto; max-height: 70px; }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-bottom: 6px; }
.header-links { display: flex; align-items: center; gap: 12px; }
.small-link { font-size: .9em; }
.btn-signout { background: var(--detail-head); color: #000; border: 1px solid #aaa; padding: 2px 10px; font-size: .9em; cursor: pointer; border-radius: 0; }
.btn-signout:hover { background: #c9c9d3; }
.selectors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; justify-content: flex-end; }
.selectors label { font-weight: bold; margin-right: 4px; }
.selectors select { font: inherit; padding: 2px; }
.account-select { width: 150px; }
.cust-select { max-width: 320px; }
.link-button { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9em; }
.header-error { color: var(--error-border); font-size: .9em; }

/* ---------------------------------------------------------------- menu bar */
.menu { background: var(--maroon); margin-top: 4px; font-family: "Kalinga", Arial, sans-serif; position: relative; z-index: 10; }
.menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.menu > ul > li { position: relative; }
.menu a { display: block; color: #fff; text-decoration: none; padding: 0 18px; line-height: 26px; min-height: 26px; white-space: nowrap; }
.menu a:hover, .menu a:focus-visible, .menu a.active, .menu li.has-sub:hover > a, .menu li.has-sub:focus-within > a { background: var(--black); }
.menu li.has-sub > ul { display: none; position: absolute; left: 0; top: 100%; min-width: 190px; background: var(--maroon); flex-direction: column; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.menu li.has-sub:hover > ul, .menu li.has-sub:focus-within > ul { display: flex; }
.menu .sub-head { color: #f3d6d6; padding: 4px 18px 2px; font-size: .9em; }
.menu-toggle, .menu-toggle-label { display: none; }
.emulation-bar { background: #fff6d6; border: 1px solid #e3cf86; border-top: 0; padding: 4px 10px; font-size: .95em; }

/* ---------------------------------------------------------------- generic panels, alerts, buttons, forms */
.panel { margin: 0 0 18px; }
.panel.narrow { max-width: 720px; }
.panel h2 { margin: 18px 0 8px; }
.alert { padding: 8px 12px; margin: 0 0 12px; border: 1px solid; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert-error { background: var(--error-bg); border-color: var(--error-border); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); }
.btn {
    display: inline-block; font: inherit; color: #000; background: #f4f4f4; border: 1px solid #8f8f99;
    padding: 3px 12px; cursor: pointer; text-decoration: none; border-radius: 0; line-height: 1.4;
}
.btn:hover { background: #e4e4ea; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: default; }
.btn-strong { font-weight: bold; }
.btn-export::before { content: "\1F5CE  "; }
.icon-btn { font: inherit; font-weight: bold; width: 26px; height: 22px; border: 1px solid #8f8f99; background: #fff; cursor: pointer; padding: 0; line-height: 1; }
.icon-btn:hover { background: var(--detail-head); }
input, select, textarea { font: inherit; padding: 3px 4px; border: 1px solid #9a9aa5; border-radius: 0; max-width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid #3b6fb6; outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 12px; align-items: center; margin: 12px 0; }
.form-grid > label, .form-label { text-align: right; font-weight: bold; }
.form-grid textarea { width: 100%; max-width: 520px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.page-actions { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 0; }
.kv dt { font-weight: bold; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.link-list { padding-left: 18px; line-height: 1.9; }

/* ---------------------------------------------------------------- login */
.login-page { display: flex; flex-direction: column; align-items: center; padding-top: 40px; }
.login-logo { max-width: 100%; height: auto; margin-bottom: 18px; }
.login-box { width: 370px; max-width: 100%; border: 1px solid #555; }
.login-head { background: #000; color: #fff; font-weight: bold; padding: 6px 10px; }
.login-body { padding: 14px 16px; }
.login-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 10px; }
.login-row label { text-align: right; }
.login-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* ---------------------------------------------------------------- home */
.home-graphic { text-align: center; padding: 30px 0; }
.home-graphic img { max-width: 100%; height: auto; }

/* ---------------------------------------------------------------- data tables */
.dt-wrap { margin: 0 0 22px; border: 1px solid var(--border); }
.table-title { background: var(--table-title); display: flex; justify-content: space-between; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 6px 10px; }
.table-title .title-sub { color: var(--muted); }
.dt-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.dt { border-collapse: collapse; width: 100%; }
table.dt th, table.dt td { border: 1px solid #d3d3dc; padding: 3px 6px; text-align: left; vertical-align: top; }
table.dt thead th { background: #eef0f6; font-weight: bold; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.dt thead th[data-sort] { cursor: pointer; user-select: none; }
table.dt thead th[data-sort]::after { content: " \2195"; color: #9a9aa5; font-weight: normal; }
table.dt thead th[aria-sort="ascending"]::after { content: " \25B2"; color: #000; }
table.dt thead th[aria-sort="descending"]::after { content: " \25BC"; color: #000; }
table.dt thead tr.dt-filters th { background: #f7f8fb; padding: 2px 4px; position: static; }
table.dt thead tr.dt-filters input { width: 100%; min-width: 60px; padding: 1px 3px; }
table.dt tbody tr.dt-row.alt { background: var(--row-alt); }
table.dt tbody tr.dt-row:hover { background: var(--row-hover); }
table.dt .num { text-align: right; white-space: nowrap; }
table.dt .qty { white-space: nowrap; }
.qty-input { width: 72px; text-align: right; }
.toggle-col { width: 24px; text-align: center !important; }
.dt-toggle { border: 0; background: none; cursor: pointer; width: 20px; height: 20px; padding: 0; }
.dt-toggle::before { content: "\25B6"; font-size: 10px; color: #333; }
.dt-toggle[aria-expanded="true"]::before { content: "\25BC"; }
tr.dt-detail > td { background: var(--detail-body); padding: 8px 10px; }
.detail-box { border: 1px solid var(--border); background: var(--detail-body); }
.detail-head { background: var(--detail-head); font-weight: bold; padding: 4px 8px; }
.detail-body { padding: 8px 10px; }
table.inner { border-collapse: collapse; width: 100%; background: #fff; }
table.inner th, table.inner td { border: 1px solid #ddd; padding: 2px 6px; text-align: left; }
table.inner th { background: var(--detail-head); }
table.inner .num { text-align: right; }
.item-detail { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.drug-img { width: 121px; height: 128px; object-fit: contain; background: #fff; border: 1px solid #ddd; }
.dt-pager { display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; padding: 6px 10px; border-top: 1px solid var(--border); background: #fafafa; }
.dt-pager:empty { display: none; }
.dt-pager button { font: inherit; padding: 1px 8px; cursor: pointer; }
.dt-pager .pager-info { color: var(--muted); }
.empty-note { padding: 8px 10px; margin: 0; color: var(--muted); }
.table-note { margin: 0; padding: 6px 10px; }
.save-status { color: var(--muted); min-width: 110px; text-align: right; }
.save-status.error { color: var(--error-border); font-weight: bold; }
/* Two-button switch (Order: Formulary items / Favorites only); the current choice looks pressed. */
.seg { display: inline-flex; }
.seg .btn + .btn { margin-left: -1px; }
.seg .btn[aria-current="true"] { background: var(--detail-head); box-shadow: inset 0 1px 3px rgba(0,0,0,.25); }
/* Formulary favorite checkbox column */
.fav-col { width: 1%; white-space: nowrap; text-align: center; }
.fav-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fav-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* report column groups */
table.report.hide-c-m .c-m, table.report.hide-c-q .c-q, table.report.hide-c-y .c-y, table.report.hide-c-p .c-p { display: none; }
table.report.hide-c-m.hide-c-q .c-mq { display: none; }
.col-toggles { border: 0; margin: 0; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 12px; }
.filter-bar > label:first-of-type { font-weight: bold; }
.search-param-label { margin-left: 8px; }

/* history tabs and date pickers */
.tabs { display: flex; flex-wrap: wrap; border-bottom: 2px solid var(--maroon); margin-bottom: 12px; }
.tabs a { padding: 6px 16px; text-decoration: none; color: #000; border: 1px solid var(--border); border-bottom: 0; margin-right: 4px; background: #f2f2f6; }
.tabs a.active { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.date-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 12px; }
.date-title { font-weight: bold; margin-right: 6px; }
.date-picker .scope { margin-left: auto; }

/* order review */
.order-form { border: 1px solid var(--border); padding: 10px 14px; }
.order-total { font-size: 1.25em; }

/* account */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 12px 0; }

/* sales docs */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 12px; }
.docs-section h2 { font-size: 1.05em; text-decoration: underline; margin: 0 0 6px; }
.docs-section ul { margin: 0; padding-left: 18px; line-height: 1.7; }

/* ---------------------------------------------------------------- web invoice */
.web-invoice { border: 1px solid #555; padding: 18px; max-width: 980px; background: #fff; }
.wi-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wi-vendor { display: flex; gap: 14px; align-items: flex-start; }
.wi-logo { max-width: 160px; height: auto; }
.wi-title { text-align: right; }
.wi-title h1 { font-size: 22px; letter-spacing: 1px; margin-bottom: 6px; }
.wi-box, .wi-grid, .wi-lines, .wi-totals { border-collapse: collapse; }
.wi-box th, .wi-box td, .wi-grid th, .wi-grid td, .wi-lines th, .wi-lines td, .wi-totals th, .wi-totals td { border: 1px solid #777; padding: 3px 8px; text-align: left; }
.wi-box th, .wi-grid th, .wi-lines th { background: var(--detail-head); font-size: .9em; }
.wi-addresses { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 16px 0; }
.wi-address { border: 1px solid #777; padding: 8px 10px; min-height: 100px; }
.wi-label { font-weight: bold; background: var(--detail-head); margin: -8px -10px 6px; padding: 3px 10px; }
.wi-grid { width: 100%; margin-bottom: 14px; }
.wi-lines { width: 100%; }
.wi-lines .num, .wi-totals td { text-align: right; }
.wi-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.wi-due { margin-top: 8px; font-weight: bold; }
.wi-totals { min-width: 260px; }
.wi-totals th { background: #f4f4f4; }
.wi-total th, .wi-total td { font-weight: bold; background: var(--detail-head); }

/* ---------------------------------------------------------------- phones and small tablets */
@media (max-width: 760px) {
    .page { padding: 0 16px 30px; }
    :root { --base-size: 11pt; }
    .site-header { align-items: flex-start; }
    .header-right { align-items: stretch; width: 100%; }
    .header-links, .selectors { justify-content: space-between; }
    .selectors select, .account-select, .cust-select { width: 100%; max-width: none; }
    .selectors form { display: block; width: 100%; }
    .menu-toggle-label { display: block; color: #fff; padding: 0 16px; line-height: 34px; cursor: pointer; }
    .menu-toggle-label::before { content: "\2630  "; }
    .menu > ul { display: none; flex-direction: column; }
    .menu-toggle:checked ~ ul { display: flex; }
    .menu a { line-height: 34px; }
    .menu li.has-sub > ul { position: static; display: flex; box-shadow: none; padding-left: 14px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid > label, .form-label { text-align: left; }
    .form-grid > span:empty { display: none; }
    .date-picker .scope { margin-left: 0; width: 100%; }
    .wi-title { text-align: left; }
}

@media print {
    .site-header, .menu, .emulation-bar, .no-print, .page-actions, .dt-pager, .dt-tools, .tabs, .date-picker, .filter-bar { display: none !important; }
    .page { padding: 0; }
    .web-invoice { border: 0; padding: 0; }
    .dt-scroll { overflow: visible; }
}
