/* ==============================================================================
   DOCTSHUB Professional Design System CSS
   Source: DOCTSHUB Connected Care Wireframe Studio v1.0
   Palette: Ink #17252a, Muted #65767b, Line #dbe3e5, Primary Teal #087c80,
            Mint #e8f6f3, Canvas #f3f5f5, Paper #ffffff
   ============================================================================== */

:root {
    --ink: #17252a;
    --muted: #65767b;
    --line: #dbe3e5;
    --teal: #087c80;
    --teal-dark: #085a61;
    --mint: #e8f6f3;
    --canvas: #f3f5f5;
    --paper: #ffffff;
    --amber: #8b5a12;
    --red: #a53342;
    --radius: 12px;
    --sidebar-width: 250px;
    --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font: 14px/1.5 var(--sans);
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font: inherit;
}

button, a, input, select, textarea {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

a {
    color: var(--teal);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid #309ba4;
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

button:disabled, .button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

/* Skip link for accessibility */
.skip-link {
    position: fixed;
    top: -80px;
    left: 10px;
    z-index: 100;
    background: var(--ink);
    color: white;
    padding: 10px 16px;
    border-radius: 4px;
}
.skip-link:focus {
    top: 10px;
}

/* App Header & Topbar */
.app-header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: .08em;
    color: var(--ink);
    text-decoration: none;
}
.brand-lockup img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}
.brand-lockup small {
    display: block;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--muted);
    font-weight: 600;
    margin-top: 1px;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.org-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--mint);
    color: var(--teal-dark);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}
.user-profile b {
    color: var(--ink);
}

/* Layout container */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: calc(100vh - 65px);
}

.app-layout.single-column {
    display: block;
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 20px;
}

/* Sidebar navigation */
.app-sidebar {
    background: #fbfcfc;
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--muted);
    text-transform: uppercase;
    margin: 0 0 10px 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease;
}

.nav-link:hover {
    background: var(--mint);
    color: var(--teal);
    text-decoration: none;
}

.nav-link.active {
    background: var(--mint);
    color: var(--teal);
    font-weight: 600;
}

.nav-link svg, .nav-link .icon {
    width: 18px;
    height: 18px;
    color: var(--muted);
}
.nav-link.active svg, .nav-link.active .icon {
    color: var(--teal);
}

/* Content Area */
.app-main {
    padding: 28px 36px;
    min-width: 0;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Cards & Panels */
.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(23, 37, 42, 0.02);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    margin: 0;
    font-size: 17px;
    font-weight: 650;
    color: var(--ink);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-card.accent-teal { border-top: 4px solid var(--teal); }
.metric-card.accent-amber { border-top: 4px solid #d97706; }
.metric-card.accent-red { border-top: 4px solid #dc2626; }
.metric-card.accent-green { border-top: 4px solid #059669; }

.metric-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
}

/* Patient Banner (Wireframe Component) */
.patient-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-left: 5px solid var(--teal);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.patient-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.patient-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

.patient-meta {
    font-size: 13px;
    color: var(--muted);
}

.patient-badge {
    background: var(--mint);
    color: var(--teal-dark);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Status Badges & Pills */
.pill, .badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.pill-teal, .badge-teal { background: var(--mint); color: var(--teal-dark); }
.pill-green, .badge-success { background: #def7ec; color: #03543f; border: 1px solid #bcf0da; }
.pill-amber, .badge-warning { background: #fef08a; color: #713f12; border: 1px solid #fde047; }
.pill-red, .badge-danger { background: #fde8e8; color: #9b1c1c; border: 1px solid #f8b4b4; }
.pill-muted, .badge-secondary { background: #e5e7eb; color: #374151; }

/* Buttons & Interactive Elements */
.button, button:not([class]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--teal);
    color: white;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}

.button:hover, button:not([class]):hover {
    background: var(--teal-dark);
    color: white;
    text-decoration: none;
}

.button.secondary, .button-secondary {
    background: white;
    color: var(--ink);
    border-color: var(--line);
}
.button.secondary:hover, .button-secondary:hover {
    background: var(--canvas);
    border-color: #cbd5e1;
    color: var(--ink);
}

.button.danger, .button-danger {
    background: #dc2626;
    color: white;
}
.button.danger:hover, .button-danger:hover {
    background: #b91c1c;
}

.button.small, .button-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.form-help {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    width: 100%;
    max-width: 600px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(8, 124, 128, 0.15);
    outline: none;
}

.errorlist {
    margin: 6px 0 0;
    padding: 0 0 0 18px;
    color: var(--red);
    font-size: 12px;
    font-weight: 500;
}

/* Flash Messages & Alerts */
.notice, .message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    background: white;
    border: 1px solid var(--line);
}

.message.success, .notice.green {
    background: #def7ec;
    border-color: #bcf0da;
    color: #03543f;
}

.message.error, .notice.red {
    background: #fde8e8;
    border-color: #f8b4b4;
    color: #9b1c1c;
}

.message.info, .notice.blue {
    background: var(--mint);
    border-color: #b2dfdb;
    color: var(--teal-dark);
}

.message.warning, .notice.amber {
    background: #fef08a;
    border-color: #fde047;
    color: #713f12;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: var(--mint);
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: 14px;
}

tr:last-child td {
    border-bottom: 0;
}

tr:hover td {
    background: #f9fbfa;
}

/* Empty State Component */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.empty-state h3 {
    margin: 8px 0;
    color: var(--ink);
    font-size: 17px;
}
.empty-state p {
    margin: 0 0 16px;
    font-size: 13px;
}

/* Grid Utilities */
.grid {
    display: grid;
    gap: 20px;
}
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.main-aside { grid-template-columns: minmax(0, 1fr) 300px; }
.grid.aside-main { grid-template-columns: 300px minmax(0, 1fr); }

/* Pagination Component */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    font-size: 13px;
    color: var(--muted);
}

.pagination-links {
    display: flex;
    gap: 6px;
}

/* Mobile & Responsive Rules */
@media (max-width: 900px) {
    .app-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .header-meta {
        gap: 8px;
        flex-wrap: wrap;
    }
    .app-layout {
        grid-template-columns: 1fr;
    }
    .app-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 12px 16px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        position: static;
        width: 100%;
        height: auto;
    }
    .app-sidebar .nav-link {
        padding: 6px 10px;
        font-size: 13px;
        white-space: nowrap;
    }
    .nav-section-title {
        display: none;
    }
    .app-main {
        padding: 20px 16px;
    }
    .grid.two, .grid.three, .grid.main-aside, .grid.aside-main {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .patient-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .panel {
        padding: 16px;
    }
}

/* Print Stylesheet */
@media print {
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }
    .app-header, .app-sidebar, .page-actions, .no-print, .skip-link, nav, button, form {
        display: none !important;
    }
    .app-layout {
        display: block !important;
    }
    .app-main {
        padding: 0 !important;
        margin: 0 !important;
    }
    .panel, .table-wrap {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        break-inside: avoid;
    }
    table {
        border: 1px solid #333 !important;
    }
    th, td {
        border: 1px solid #ccc !important;
        padding: 8px !important;
    }
    th {
        background: #f0f0f0 !important;
        color: black !important;
    }
}


/* Keep sample progress in one horizontal line, including on narrow phones. */
.sample-track-scroll { overflow-x: auto; padding: 18px 4px 12px; margin: 12px 0; }
.sample-track { display: flex; list-style: none; padding: 0; margin: 0; min-width: 520px; }
.sample-track-step { position: relative; flex: 1 0 130px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px; color: var(--muted); }
.sample-track-step::before { content: ""; position: absolute; top: 16px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.sample-track-step:first-child::before { display: none; }
.sample-track-dot { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid #c6d4d7; background: #fff; font-weight: 700; }
.sample-track-step.done::before, .sample-track-step.current::before, .sample-track-step.rejected::before { background: #087f86; }
.sample-track-step.done .sample-track-dot { background: #087f86; border-color: #087f86; color: #fff; }
.sample-track-step.current { color: #07666c; }
.sample-track-step.current .sample-track-dot { background: #e4f5f4; border: 3px solid #087f86; box-shadow: 0 0 0 4px #e4f5f4; }
.sample-track-step.rejected { color: #a92835; }
.sample-track-step.rejected .sample-track-dot { background: #a92835; color: #fff; border-color: #a92835; }
.sample-track-step.stopped .sample-track-dot { border-style: dashed; }
.sample-track-number, .sample-track-state, .sample-track-step time { font-size: 12px; }
.sample-track-step strong { font-size: 13px; }
.sample-track-reason { color: #a92835; }


/* Green horizontal specimen tracker requested for the Diagnostic UI. */
.sample-track-scroll { padding: 28px 12px 22px; margin: 20px 0; background: #f4fbf6; border: 1px solid #dceee1; border-radius: 16px; }
.sample-track { min-width: 560px; }
.sample-track-step { flex-basis: 140px; gap: 8px; color: #466653; }
.sample-track-step::before { top: 20px; height: 4px; background: #45b975; }
.sample-track-dot { width: 44px; height: 44px; border: 3px solid #fff; background: #239b56; color: #fff; box-shadow: 0 0 0 2px #bce4ca; font-size: 16px; }
.sample-track-step.done::before, .sample-track-step.current::before, .sample-track-step.rejected::before { background: #45b975; }
.sample-track-step.done .sample-track-dot { background: #188747; border-color: #fff; color: #fff; }
.sample-track-step.current { color: #166534; }
.sample-track-step.current .sample-track-dot { background: #15803d; border: 3px solid #fff; color: #fff; box-shadow: 0 0 0 5px #bbefcd; }
.sample-track-step strong { font-size: 14px; color: #214b32; }
.sample-track-number { font-weight: 600; color: #52745e; }
.sample-track-state { font-size: 12px; }
.sample-track-step.rejected .sample-track-dot { background: #a92835; border-color: #fff; box-shadow: 0 0 0 2px #f2cbd0; }
.sample-track-step.stopped .sample-track-dot { background: #8b9d91; border: 3px dashed #fff; box-shadow: 0 0 0 2px #dce5df; }
.sample-track-step.stopped::before { background: #c6d5cb; }

@media print { nav, form, details, button, .sample-track-scroll { display: none !important; } }

.sample-track-actor { font-size: 12px; max-width: 170px; overflow-wrap: anywhere; line-height: 1.5; }

/* Common task menus; native disclosure supports keyboard and touch. */
.workspace-dropdown{width:100%;border:1px solid #dce8e3;border-radius:10px;background:#fff;margin:0;box-sizing:border-box}
.workspace-dropdown>summary{padding:13px 15px;min-height:44px;box-sizing:border-box;font-size:14px;font-weight:600;color:#196c61;cursor:pointer;line-height:1.5}
.workspace-dropdown[open]>summary{background:#edf7f1;border-radius:10px 10px 0 0;border-bottom:1px solid #dfeae4}
.workspace-dropdown-links{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:12px}
.workspace-dropdown summary:focus-visible{outline:2px solid #087f86;outline-offset:2px}
.work-home details.work-group{padding:0}.work-home details.work-group>p,.work-home details.work-group>.work-links{margin:12px 15px}.work-home details.work-group>summary{font-size:16px}
.app-sidebar .workspace-dropdown-links{display:block;padding:8px}.app-sidebar .workspace-dropdown{background:transparent}.workspace-dropdown .mobile-actions{margin:0;padding:12px}
@media(max-width:600px){.workspace-dropdown-links{flex-direction:column;align-items:stretch}}
@media print{.workspace-dropdown{display:none}}

.app-vector-icon{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:#e8f5ef;vertical-align:middle;margin-right:9px;flex-shrink:0}.app-vector-icon img{width:22px;height:22px;object-fit:contain}.provider-bottom-nav .app-vector-icon{width:26px;height:26px;margin:0;background:transparent}.patient-app-shortcuts .app-vector-icon{display:flex;margin-bottom:10px}.workspace-dropdown>summary{line-height:1.6}@media(max-width:600px){.app-vector-icon{width:30px;height:30px}.app-vector-icon img{width:20px;height:20px}}

.role-vector-heading{display:flex;align-items:center;gap:16px}.role-vector-picture{width:120px;height:75px;object-fit:contain;flex-shrink:0}@media(max-width:600px){.role-vector-picture{width:85px;height:54px}.role-vector-heading{gap:10px}}

/* Official supplied logo includes the brand name and exact tagline. */
.brand-lockup img[src*="doctshub-official"],body:has(.patient-hub) .brand-lockup img[src*="doctshub-official"],body:has(.provider-bottom-nav) .brand-lockup img[src*="doctshub-official"]{width:110px;height:110px;object-fit:contain;background:#fff;padding:0;border:0;border-radius:0;box-shadow:none}.brand-lockup{gap:10px}.brand-tagline{font-size:11px;letter-spacing:1px;color:#087f86;text-align:center}.auth-card img[src*="doctshub-official"],.login-container img[src*="doctshub-official"]{width:190px;height:190px;object-fit:contain}@media(max-width:600px){.brand-lockup img[src*="doctshub-official"],body:has(.patient-hub) .brand-lockup img[src*="doctshub-official"],body:has(.provider-bottom-nav) .brand-lockup img[src*="doctshub-official"]{width:94px;height:94px}.app-header{padding-top:5px;padding-bottom:5px}}
