/* Vet Clinic & Mart Management System - base styles.
   Plain CSS only, no framework (CLAUDE.md conventions). */

:root {
    --color-bg: #f4f6f8;
    --color-surface: #ffffff;
    --color-surface-alt: #fafbfc;
    --color-text: #1a2332;
    --color-muted: #64748b;
    --color-border: #e5e9ee;
    --color-border-strong: #d4dae2;
    --color-primary: #0f7a64;
    --color-primary-dark: #0a5c4a;
    --color-primary-bg: #e8f5f1;
    --color-danger: #c0281c;
    --color-danger-bg: #fdecea;
    --color-warning: #b45309;
    --color-warning-bg: #fef3c7;
    --color-info-bg: #eaf3ff;
    --color-info: #1d5faa;
    --color-success-bg: #e6f4ef;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow: 0 4px 12px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 12px 28px rgba(16, 24, 40, 0.14), 0 4px 10px rgba(16, 24, 40, 0.08);
    --transition: 150ms ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -0.01em;
}

code {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Left sidebar navigation */

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    display: flex;
    flex-direction: column;
    background: #16212e;
    color: #cbd5e1;
    overflow-y: auto;
    z-index: 30;
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.25rem;
    font-weight: 700;
    font-size: 1rem;
    color: #ffffff;
    letter-spacing: -0.01em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar__logo {
    height: 28px;
    width: auto;
    border-radius: 6px;
}

.app-sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem;
}

.app-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.app-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-decoration: none;
}

.app-sidebar__link .icon {
    width: 18px;
    height: 18px;
}

.app-sidebar__link--sub {
    padding-left: 2.4rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

.app-sidebar__link--sub:hover {
    color: #ffffff;
}

/* Grouped nav items (OPD, Pharmacy, Mart): a non-clickable label followed
   by its sub-pages, all always visible - no hover/reveal trickery, since a
   fixed vertical sidebar has the room to just show everything at once. */

.app-sidebar__group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.app-sidebar__group-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: #e2e8f0;
}

.app-sidebar__group-label .icon {
    width: 18px;
    height: 18px;
    opacity: 0.85;
}

.tag {
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: var(--color-border);
    color: var(--color-muted);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    margin-left: 0.25rem;
    display: inline-block;
}

.tag--overdue,
.tag--unpaid {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.tag--paid {
    background: var(--color-success-bg);
    color: var(--color-primary-dark);
}

.app-sidebar__user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar__user > span {
    color: #94a3b8;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__logout {
    margin: 0;
}

.app-sidebar__logout button {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    color: #cbd5e1;
    font-size: 0.8rem;
    transition: background var(--transition), border-color var(--transition);
}

.app-sidebar__logout button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* Shift page content right of the fixed sidebar. Screen-only: print.css
   resets .page/.receipt margins for paper output, and a combinator
   selector here would otherwise out-specificity that reset. Collapses to
   a static, full-width sidebar below 900px (front desk/POS tablets),
   deliberately without hiding any nav items. */

@media screen {
    .app-sidebar ~ main {
        margin-left: 240px;
    }

    /* .page's original 960px max-width was sized for a full-width centred
       layout; beside a 240px sidebar that left most of the screen empty.
       Widen it here rather than in the shared .page rule so the A4
       print-preview (.print-sheet-page, its own narrower max-width) and
       the 80mm thermal receipt (.receipt) stay exactly as designed. */
    .app-sidebar ~ main.page:not(.print-sheet-page) {
        max-width: 1400px;
    }
}

@media screen and (max-width: 900px) {
    .app-sidebar {
        position: static;
        width: auto;
    }

    .app-sidebar__nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .app-sidebar__group {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .app-sidebar__link--sub {
        padding-left: 0.7rem;
    }

    .app-sidebar ~ main {
        margin-left: 0;
    }
}

/* Page content */

.page {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid transparent;
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    color: var(--color-text);
    text-decoration: none;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--color-border-strong);
    transform: translateY(-1px);
    text-decoration: none;
}

.stat-card .icon {
    color: var(--color-primary);
    width: 26px;
    height: 26px;
}

/* Applied only when a card's count is non-zero (see dashboard.html) -
   an accent border/icon so counts that need attention stand out from
   purely informational ones like "Visits today", instead of every
   card reading with equal (teal) weight regardless of urgency. */

.stat-card--warning {
    border-left-color: var(--color-warning);
}

.stat-card--warning .icon {
    color: var(--color-warning);
}

.stat-card--danger {
    border-left-color: var(--color-danger);
}

.stat-card--danger .icon {
    color: var(--color-danger);
}

.stat-card__value {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-text);
}

.stat-card__label {
    display: block;
    font-size: 0.82rem;
    color: var(--color-muted);
    margin-top: 0.15rem;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Dashboard's tile-grid has a fixed tile count (see dashboard.html), so a
   fixed 3-column layout leaves no trailing blank space in the last row,
   unlike auto-fit's variable column count. Falls back to auto-fit below
   900px, the same breakpoint the sidebar collapses at, where a uniform
   fixed-width column would otherwise force horizontal scrolling. */
.tile-grid--fixed-3 {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
}

@media screen and (max-width: 900px) {
    .tile-grid--fixed-3 {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

.tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.tile:hover {
    box-shadow: var(--shadow);
    border-color: var(--color-border-strong);
    transform: translateY(-1px);
}

.tile .icon {
    color: var(--color-primary);
    width: 22px;
    height: 22px;
    margin-bottom: 0.5rem;
}

.tile h2 {
    margin-top: 0;
    font-size: 1.05rem;
    color: var(--color-text);
}

.tile p {
    color: var(--color-muted);
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Chart cards (dashboard preview + full Reports page) */

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin: 0 0 2rem;
}

.chart-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.chart-card h2 {
    margin: 0 0 0.15rem;
    font-size: 1.05rem;
}

.chart-card__meta {
    color: var(--color-muted);
    font-size: 0.85rem;
    margin-bottom: 0.9rem;
}

.chart-card__canvas-wrap {
    position: relative;
    height: 220px;
}

.chart-card__canvas-wrap--tall {
    height: 300px;
}

/* Generic buttons, used across registry-style screens (OPD, and future
   pharmacy/mart screens) */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn[disabled] {
    background: var(--color-border);
    border-color: var(--color-border);
    color: var(--color-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border-strong);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-muted);
    color: var(--color-text);
    box-shadow: none;
}

/* Medicine/item/customer search picker (prescription form, POS) */

.rx-medicine-cell,
.pos-code-field {
    position: relative;
    min-width: 180px;
}

.rx-search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
    margin-top: 0.25rem;
}

.rx-search-dropdown:empty {
    display: none;
}

.rx-search-dropdown__item {
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}

.rx-search-dropdown__item:last-child {
    border-bottom: none;
}

.rx-search-dropdown__item:hover {
    background: var(--color-primary-bg);
}

.rx-search-dropdown__empty {
    padding: 0.5rem 0.7rem;
    color: var(--color-muted);
    font-size: 0.85rem;
}

.tab-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.tab-bar__item {
    padding: 0.55rem 1rem;
    color: var(--color-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}

.tab-bar__item:hover {
    color: var(--color-text);
    text-decoration: none;
}

.tab-bar__item--active {
    color: var(--color-primary-dark);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

/* Page header: title + primary action */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* Search input, used for the htmx-powered owner search */

.search-input {
    width: 100%;
    max-width: 420px;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

/* Data tables */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    background: var(--color-surface-alt);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:nth-child(even) {
    background: var(--color-surface-alt);
}

.data-table tbody tr:hover {
    background: var(--color-primary-bg);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .empty-row td {
    color: var(--color-muted);
    text-align: center;
    padding: 1.75rem;
}

.data-table .empty-row,
.data-table .empty-row:hover {
    background: transparent;
}

/* Registry forms (owner/patient create & edit - broader than .auth-form) */

.record-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 520px;
    box-shadow: var(--shadow-sm);
}

.record-form .field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.1rem;
}

.record-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.record-form input,
.record-form select,
.record-form textarea {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.record-form input:focus,
.record-form select:focus,
.record-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.record-form .checkbox-field {
    flex-direction: row;
    align-items: center;
}

.record-form .actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.detail-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.detail-card h2 {
    font-size: 1.05rem;
}

.detail-card dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.25rem;
    margin: 0;
}

.detail-card dt {
    color: var(--color-muted);
    font-size: 0.82rem;
}

.detail-card dd {
    margin: 0;
}

.attachment-upload {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Printable document sheet - shared by the prescription and invoice print
   views (see print.css), so both get one consistent letterhead layout. */

.print-sheet-page {
    max-width: 720px;
}

.print-sheet {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.print-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    border-bottom: 2px solid var(--color-primary-dark);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.print-sheet__header-text h2 {
    margin: 0;
    color: var(--color-primary-dark);
}

.print-sheet__header-text p {
    margin: 0.25rem 0 0;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
}

.print-sheet__logo {
    max-height: 96px;
    width: auto;
    flex-shrink: 0;
}

.print-sheet__meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
    margin: 0 0 1.25rem;
}

.print-sheet__meta dt {
    color: var(--color-muted);
    font-size: 0.85rem;
}

.print-sheet__meta dd {
    margin: 0;
}

.print-sheet__vitals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface-alt);
    border-radius: var(--radius);
}

.print-sheet__vitals dt {
    color: var(--color-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.print-sheet__vitals dd {
    margin: 0 0 0.4rem;
    font-weight: 600;
}

.print-sheet__diagnosis,
.print-sheet__notes {
    margin-bottom: 1.25rem;
}

.print-sheet__items {
    margin-bottom: 1.5rem;
}

.data-table td.amount,
.data-table th.amount {
    text-align: right;
}

.print-sheet__totals {
    margin-left: auto;
    width: 260px;
    max-width: 100%;
}

.print-sheet__totals dl {
    display: grid;
    grid-template-columns: 1fr max-content;
    gap: 0.3rem 1rem;
    margin: 0;
}

.print-sheet__totals dt {
    color: var(--color-muted);
}

.print-sheet__totals dd {
    margin: 0;
    text-align: right;
}

.print-sheet__grand-total {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
    border-top: 1px solid var(--color-border);
    padding-top: 0.4rem;
    margin-top: 0.2rem;
}

.print-sheet__signature {
    margin-top: 3rem;
    text-align: right;
    color: var(--color-muted);
}

.print-sheet__physician {
    margin: 0 0 0.25rem;
    font-weight: 600;
    color: var(--color-text);
}

.print-sheet__footer {
    margin-top: 2rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-muted);
    font-size: 0.8rem;
}

/* Prescription print sheet (opd/prescriptions/view.html): a dedicated
   clinical-chart layout - patient info bar, a vitals/complaint sidebar,
   the medication list, and a diagnosis sidebar - rather than reusing
   .print-sheet (invoices/receipts keep that simpler letterhead layout;
   this one is deliberately its own thing, not a shared variant, so
   invoice printing can't be affected by changes here). */

.rx-sheet {
    position: relative;
    /* A short prescription (few medicines) shouldn't shrink the sheet to
       a tiny box the watermark then has to cram into - a real
       prescription pad is a full page regardless of how much is written
       on it, and the watermark below is sized to span that full page. */
    min-height: 960px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
}

/* Real foreground text, not a background image - prints by default in
   every browser without needing "print backgrounds" enabled. Sized to
   the sheet via inset:0 + flex centering (not a fixed font-size guess),
   so it always spans the full page corner-to-corner rather than being
   clipped by, or looking lost inside, a particular sheet size. */
.rx-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.rx-watermark span {
    display: inline-block;
    transform: rotate(-32deg);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(100, 116, 139, 0.18);
}

.rx-sheet__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.rx-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    border-bottom: 2px solid var(--color-primary-dark);
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
}

.rx-header__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rx-header__logo {
    max-height: 56px;
    width: auto;
    flex-shrink: 0;
}

.rx-header__clinic h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--color-primary-dark);
}

.rx-header__clinic p {
    margin: 0.15rem 0 0;
    color: var(--color-muted);
    font-size: 0.78rem;
}

.rx-patient-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem 1rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}

.rx-patient-bar__label {
    display: block;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.rx-patient-bar__value {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--color-text);
    margin-top: 0.1rem;
}

.rx-body {
    flex: 1;
    display: grid;
    grid-template-columns: 0.85fr 2fr 0.85fr;
    gap: 1.1rem;
    align-items: stretch;
}

.rx-vitals {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rx-vital-box {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.5rem;
    text-align: center;
}

.rx-vital-box__label {
    display: block;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.rx-vital-box__value {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-text);
    margin-top: 0.15rem;
}

.rx-note-block {
    margin-top: 0.9rem;
}

.rx-note-block h3 {
    margin: 0 0 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.rx-note-block p {
    margin: 0;
    font-size: 0.83rem;
}

.rx-col-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.4rem;
    margin-bottom: 0.75rem;
}

.rx-col-heading h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-primary-dark);
}

.rx-col-heading span {
    font-size: 0.78rem;
    color: var(--color-muted);
}

.rx-med {
    margin-bottom: 0.9rem;
}

.rx-med__name {
    margin: 0;
    font-weight: 700;
    font-size: 0.94rem;
    color: var(--color-text);
}

.rx-med__detail {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: var(--color-muted);
}

.rx-med__instructions {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    font-style: italic;
}

.rx-aside {
    border-left: 1px solid var(--color-border);
    padding-left: 1rem;
}

.rx-aside > div + div {
    margin-top: 1rem;
}

.rx-aside h3 {
    margin: 0 0 0.3rem;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.rx-aside p {
    margin: 0 0 1rem;
    font-size: 0.84rem;
}

.rx-footer {
    /* Pushed to the bottom of the flex column (.rx-sheet__content), so it
       sits at a fixed distance from the sheet's actual bottom edge (the
       min-height floor, or further down if content grows past it)
       instead of trailing right after however little content there is. */
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
}

.rx-footer__signature {
    margin-left: auto;
    text-align: right;
    color: var(--color-muted);
    font-size: 0.85rem;
}

.rx-footer__physician {
    margin: 0 0 0.3rem;
    font-size: 1.15rem;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 0.02em;
    color: var(--color-primary-dark);
}

@media screen and (max-width: 700px) {
    .rx-patient-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .rx-body {
        grid-template-columns: 1fr;
    }

    .rx-sheet {
        min-height: 0;
    }

    .rx-watermark span {
        font-size: 1.1rem;
    }
}

/* Auth pages (login, change password, error pages) */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(180deg, var(--color-bg) 0%, #eef2f0 100%);
}

.auth-card {
    background: var(--color-surface);
    max-width: 380px;
    width: 100%;
    padding: 2.25rem;
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
}

.auth-card__logo {
    display: block;
    height: 56px;
    width: auto;
    margin: 0 auto 1rem;
    border-radius: var(--radius-sm);
}

.auth-card h1 {
    margin-top: 0;
    font-size: 1.4rem;
    color: var(--color-primary-dark);
    text-align: center;
}

.auth-card > .auth-card__subtitle {
    text-align: center;
}

.auth-card__subtitle {
    color: var(--color-muted);
    margin-top: -0.5rem;
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.25rem;
}

.auth-form label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.auth-form input {
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.auth-form button {
    margin-top: 1rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition), box-shadow var(--transition);
}

.auth-form button:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow);
}

.alert {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert--error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: rgba(192, 40, 28, 0.15);
}

.alert--info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border-color: rgba(29, 95, 170, 0.15);
}

.field-error {
    color: var(--color-danger);
    font-size: 0.8rem;
    margin: 0.1rem 0 0;
}

/* Thermal receipt (80mm till printer) - deliberately plain/monospace,
   nothing like the A4 print-sheet used for prescriptions and full
   invoices. Sized to preview at roughly true width on screen too. */

.receipt {
    max-width: 320px;
    margin: 0 auto;
    padding: 1rem;
}

.receipt__sheet {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 1rem;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: var(--shadow-sm);
}

.receipt__center {
    text-align: center;
    margin: 0 0 0.2rem;
}

.receipt__bold {
    font-weight: 700;
}

.receipt__rule {
    margin: 0.4rem 0;
    letter-spacing: -1px;
}

.receipt__line {
    margin-bottom: 0.3rem;
}

.receipt__line-amounts {
    display: flex;
    justify-content: space-between;
}

/* POS counter (pos/screen.html): a two-column terminal layout, not just
   another registry-style page - entry/quick-picks on the left, an
   always-visible running sale on the right, sized for a cashier standing
   at a counter all day rather than someone reading at a desk. */

.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.25rem;
    align-items: start;
}

.pos-entry-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.25rem;
}

.pos-entry-row {
    display: flex;
    align-items: flex-end;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.pos-entry-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.pos-entry-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
}

.pos-code-input {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 0.55rem 0.8rem;
    width: 16rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
}

.pos-code-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.pos-qty-input {
    font-size: 1.5rem;
    font-weight: 600;
    padding: 0.55rem 0.6rem;
    width: 5.5rem;
    text-align: center;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
}

.pos-qty-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

.pos-add-btn {
    font-size: 1.05rem;
    padding: 0.65rem 1.6rem;
}

.pos-entry-hint {
    margin: 0.6rem 0 0;
    font-size: 0.82rem;
    color: var(--color-muted);
}

/* Confirmation banner: "the selected item name is displayed prominently
   as a line-item confirmation" (CLAUDE.md Mart POS constraints). Pops in
   once per add (server pops it from the session the same way posError
   works) and fades - a cashier scanning a queue of customers needs the
   confirmation to register at a glance, not require reading a table row. */

.pos-confirm {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--color-success-bg);
    color: var(--color-primary-dark);
    border: 1px solid rgba(15, 122, 100, 0.2);
    border-radius: var(--radius);
    padding: 0.7rem 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    animation: pos-confirm-in 180ms ease-out;
}

.pos-confirm__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.85rem;
    flex-shrink: 0;
}

@keyframes pos-confirm-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quick-pick tiles: tap-to-add for popular items, no typing required -
   the keyboard-first code entry above stays the fast path, this is the
   fallback for an item the cashier doesn't have memorised. */

.pos-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.pos-quick-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
    font-family: inherit;
}

.pos-quick-tile:hover {
    box-shadow: var(--shadow);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.pos-quick-tile:active {
    transform: translateY(0);
}

.pos-quick-tile__name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.25;
}

.pos-quick-tile__price {
    font-size: 0.82rem;
    color: var(--color-primary-dark);
    font-weight: 600;
}

.pos-quick-tile__code {
    font-size: 0.72rem;
    color: var(--color-muted);
}

.pos-section-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    margin: 0 0 0.6rem;
}

/* Right column: the running sale, kept in view (sticky) the whole time
   the cashier is keying in items - always answers "what's on this sale
   so far" without scrolling back up. */

.pos-cart-panel {
    position: sticky;
    top: 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.25rem 1.25rem;
}

.pos-cart-panel h2 {
    margin: 0 0 0.9rem;
    font-size: 1.05rem;
}

.pos-cart-lines {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 40vh;
    overflow-y: auto;
    margin-bottom: 0.9rem;
}

.pos-cart-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--color-border);
}

.pos-cart-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pos-cart-line__name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--color-text);
}

.pos-cart-line__meta {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.pos-cart-line__amount {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}

.pos-cart-line__remove {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 0;
    margin-top: 0.15rem;
    text-decoration: underline;
}

.pos-cart-line__remove:hover {
    color: var(--color-danger);
}

.pos-cart-empty {
    color: var(--color-muted);
    font-size: 0.9rem;
    padding: 1.5rem 0;
    text-align: center;
}

.pos-total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    background: var(--color-primary-bg);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
}

.pos-total-row__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.pos-total-row__value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--color-primary-dark);
}

.pos-cart-actions {
    display: flex;
    gap: 0.6rem;
}

.pos-cart-actions .btn {
    flex: 1;
    font-size: 1rem;
    padding: 0.7rem 1rem;
}

.pos-customer-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

@media screen and (max-width: 900px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }

    .pos-cart-panel {
        position: static;
    }
}
