/* ==========================================================
   Atomic Calculator — Shared Stylesheet
   ========================================================== */

/* ===== CSS Variables ===== */
:root {
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;

    --primary: #4f6d9b;
    --primary-dark: #3b5278;
    --primary-light: #6b87b3;
    --primary-surface: #edf1f7;

    --accent: #5b8def;

    --white: #ffffff;
    --bg: var(--slate-50);
    --card-bg: var(--white);
    --text: var(--slate-800);
    --text-muted: var(--slate-500);
    --border: var(--slate-200);
    --input-bg: var(--slate-100);

    --green: #16a34a;
    --green-bg: #f0fdf4;
    --green-border: #bbf7d0;
    --yellow: #ca8a04;
    --yellow-bg: #fefce8;
    --yellow-border: #fef08a;
    --orange: #ea580c;
    --orange-bg: #fff7ed;
    --orange-border: #fed7aa;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --red-border: #fecaca;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- Mobile Touch Performance --- */
button,
a,
input,
select,
textarea,
.tab-btn,
.btn-calculate,
.hamburger,
.mode-toggle-btn {
    touch-action: manipulation;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    font-display: swap;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==========================================================
   SITE HEADER / NAV
   ========================================================== */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    contain: layout style;
    will-change: transform;
    min-height: 60px;
}

.site-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.site-brand:hover {
    text-decoration: none;
}

.site-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(79, 109, 155, 0.2);
}

.site-brand-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--white);
}

.site-brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.02em;
}

/* Desktop nav */
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-nav a {
    padding: 8px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate-600);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-decoration: none;
}

.site-nav a:hover {
    background: var(--slate-100);
    color: var(--slate-900);
    text-decoration: none;
}

.site-nav a.active {
    background: var(--primary-surface);
    color: var(--primary-dark);
    font-weight: 600;
}

/* Hamburger */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.hamburger:hover {
    background: var(--slate-100);
}

.hamburger svg {
    width: 24px;
    height: 24px;
    fill: var(--slate-700);
}

/* Mobile nav */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 8px 20px 16px;
}

.mobile-nav.open {
    display: flex;
}

.mobile-nav a {
    padding: 12px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--slate-600);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: var(--transition);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.mobile-nav a:hover {
    background: var(--slate-100);
    color: var(--slate-900);
}

.mobile-nav a.active {
    background: var(--primary-surface);
    color: var(--primary-dark);
    font-weight: 600;
}

@media (max-width: 640px) {
    .site-nav {
        display: none;
    }

    .hamburger {
        display: block;
    }
}

/* ==========================================================
   SITE FOOTER
   ========================================================== */
.site-footer {
    margin-top: auto;
    background: var(--slate-900);
    color: var(--slate-400);
    padding: 40px 20px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

.site-footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
}

.footer-brand p {
    font-size: 0.8125rem;
    line-height: 1.7;
    margin-top: 10px;
    color: var(--slate-400);
}

.footer-brand .site-brand-name {
    color: var(--white);
}

.footer-brand .site-brand {
    margin-bottom: 4px;
}

.footer-col h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-300);
    margin-bottom: 12px;
}

.footer-col a {
    display: flex;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--slate-400);
    padding: 8px 0;
    min-height: 44px;
    text-decoration: none;
    transition: var(--transition);
}

.footer-col a:hover {
    color: var(--white);
    text-decoration: none;
}

.footer-bottom {
    max-width: 960px;
    margin: 24px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--slate-700);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--slate-500);
}

.footer-bottom a {
    color: var(--slate-500);
    text-decoration: none;
}

.footer-bottom a:hover {
    color: var(--slate-300);
}

@media (max-width: 640px) {
    .site-footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* ==========================================================
   MAIN CONTENT WRAPPER
   ========================================================== */
.app-wrapper {
    max-width: 640px;
    margin: 0 auto;
    padding: 28px 16px 48px;
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
    flex: 1;
    width: 100%;
}

/* ==========================================================
   PAGE HEADER (per-page hero)
   ========================================================== */
.page-hero {
    text-align: center;
    margin-bottom: 28px;
}

.page-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 14px;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(79, 109, 155, 0.25);
}

.page-hero-icon svg {
    width: 28px;
    height: 28px;
    fill: var(--white);
}

.page-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.h1-subtitle {
    font-size: 0.55em;
    font-weight: 500;
    opacity: 0.85;
    display: block;
    margin-top: 4px;
}

/* Calculator Inner Padding */
.calc-pad {
    padding: 24px;
}

@media (max-width: 600px) {
    .calc-pad {
        padding: 16px;
    }
}

/* ===== TAB SYSTEM ===== */
.page-hero p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--green);
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    border-radius: 999px;
}

.privacy-badge svg {
    width: 12px;
    height: 12px;
    fill: var(--green);
}

/* Author Byline (E-E-A-T) */
.author-byline {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--slate-500);
    line-height: 1.5;
}

.author-byline svg {
    flex-shrink: 0;
    color: var(--slate-400);
}

.author-byline a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.author-byline a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Featured Snippet Answer */
.snippet-answer {
    background: var(--primary-surface);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 28px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--slate-700);
}

.snippet-answer strong:first-child {
    display: block;
    font-size: 0.95rem;
    color: var(--slate-900);
    margin-bottom: 6px;
}

/* Input Helper Text */
.input-helper {
    display: block;
    font-size: 0.7rem;
    color: var(--slate-400);
    margin-top: 4px;
    line-height: 1.4;
}

/* Try an Example Button */
.btn-example {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-surface);
    border: 1px solid var(--primary-light);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 16px;
}

.btn-example:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-example:hover svg {
    fill: var(--white);
}

/* ==========================================================
   CARD
   ========================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card+.card {
    margin-top: 16px;
}

/* ==========================================================
   TABS
   ========================================================== */
.tab-bar {
    display: flex;
    background: var(--slate-100);
    border-bottom: 1px solid var(--border);
    padding: 6px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--slate-500);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--slate-700);
    background: rgba(255, 255, 255, 0.5);
}

.tab-btn.active {
    color: var(--primary-dark);
    background: var(--white);
    box-shadow: var(--shadow);
}

.tab-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--slate-400);
    margin-top: 2px;
}

.tab-btn.active .tab-label {
    color: var(--primary-light);
}

/* ==========================================================
   TAB CONTENT
   ========================================================== */
.tab-content {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================
   FORMS
   ========================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 6px;
}

.form-hint {
    font-size: 0.7rem;
    color: var(--slate-400);
    font-weight: 400;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.12);
}

.form-input::placeholder {
    color: var(--slate-400);
}

textarea.form-input {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-with-unit {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-with-unit .form-input {
    flex: 1;
}

.input-with-unit .unit-select {
    width: auto;
    min-width: 90px;
    flex: none;
    cursor: pointer;
}

.section-divider {
    border: none;
    border-top: 1px dashed var(--slate-200);
    margin: 22px 0;
}

.calc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calc-section-header .section-title,
.calc-section-header .btn-example {
    margin-bottom: 0;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--primary);
    border-radius: 2px;
}

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn-calculate {
    width: 100%;
    padding: 14px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 24px;
    box-shadow: 0 2px 8px rgba(79, 109, 155, 0.3);
}

.btn-calculate:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 109, 155, 0.4);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* ==========================================================
   RESULTS
   ========================================================== */
.results-panel {
    display: none;
    margin-top: 20px;
    animation: fadeIn 0.35s ease;
}

.results-panel.show {
    display: block;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--primary-surface);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-label {
    font-size: 0.8125rem;
    color: var(--slate-600);
    font-weight: 500;
}

.result-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-dark);
    font-variant-numeric: tabular-nums;
}

.result-subtext {
    font-size: 0.7rem;
    color: var(--slate-400);
    margin-top: 2px;
}

.result-highlight {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.result-highlight .result-label {
    color: rgba(255, 255, 255, 0.8);
}

.result-highlight .result-value {
    color: var(--white);
    font-size: 1.25rem;
}

.result-highlight .result-subtext {
    color: rgba(255, 255, 255, 0.65);
}

/* ==========================================================
   HEALTH SCORE
   ========================================================== */
.health-score {
    display: none;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    border-left: 4px solid;
    animation: fadeIn 0.35s ease;
}

.health-score.show {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.health-score .hs-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.health-score .hs-icon svg {
    width: 14px;
    height: 14px;
}

.health-score .hs-title {
    font-size: 0.8125rem;
    font-weight: 700;
}

.health-score .hs-msg {
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.5;
}

/* Yellow */
.health-score.hs-yellow {
    background: var(--yellow-bg);
    border-color: var(--yellow);
}

.health-score.hs-yellow .hs-icon {
    background: var(--yellow-bg);
}

.health-score.hs-yellow .hs-icon svg {
    fill: var(--yellow);
}

.health-score.hs-yellow .hs-title {
    color: var(--yellow);
}

.health-score.hs-yellow .hs-msg {
    color: #92400e;
}

/* Green */
.health-score.hs-green {
    background: var(--green-bg);
    border-color: var(--green);
}

.health-score.hs-green .hs-icon {
    background: var(--green-bg);
}

.health-score.hs-green .hs-icon svg {
    fill: var(--green);
}

.health-score.hs-green .hs-title {
    color: var(--green);
}

.health-score.hs-green .hs-msg {
    color: #166534;
}

/* Orange */
.health-score.hs-orange {
    background: var(--orange-bg);
    border-color: var(--orange);
}

.health-score.hs-orange .hs-icon {
    background: var(--orange-bg);
}

.health-score.hs-orange .hs-icon svg {
    fill: var(--orange);
}

.health-score.hs-orange .hs-title {
    color: var(--orange);
}

.health-score.hs-orange .hs-msg {
    color: #9a3412;
}

/* Red */
.health-score.hs-red {
    background: var(--red-bg);
    border-color: var(--red);
}

.health-score.hs-red .hs-icon {
    background: var(--red-bg);
}

.health-score.hs-red .hs-icon svg {
    fill: var(--red);
}

.health-score.hs-red .hs-title {
    color: var(--red);
}

.health-score.hs-red .hs-msg {
    color: #991b1b;
}

/* ==========================================================
   GUIDE / ARTICLE
   ========================================================== */
.guide {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-top: 24px;
    padding: 32px 28px 36px;
}

.guide h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 36px 0 14px;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.guide h2:first-of-type {
    margin-top: 0;
}

.guide h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 24px 0 10px;
    line-height: 1.4;
}

.guide p {
    font-size: 0.9375rem;
    color: var(--slate-700);
    line-height: 1.75;
    margin-bottom: 14px;
}

.guide strong {
    color: var(--slate-900);
    font-weight: 600;
}

.guide ul,
.guide ol {
    padding-left: 22px;
    margin-bottom: 16px;
}

.guide li {
    font-size: 0.9375rem;
    color: var(--slate-700);
    line-height: 1.7;
    margin-bottom: 8px;
}

.guide li strong {
    color: var(--slate-800);
}

.guide .formula-block {
    background: var(--primary-surface);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 18px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-dark);
    line-height: 1.6;
    overflow-x: auto;
}

.guide .example-box {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 20px 22px;
    margin: 18px 0;
}

.guide .example-box h4 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 12px;
}

.guide .example-box p,
.guide .example-box li {
    font-size: 0.875rem;
}

.guide .callout-warning {
    background: var(--red-bg);
    border-left: 4px solid var(--red);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 20px 0;
}

.guide .callout-warning strong {
    color: var(--red);
}

.guide .callout-warning p {
    color: #991b1b;
    margin-bottom: 0;
}

.guide .callout-tip {
    background: var(--green-bg);
    border-left: 4px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 20px 0;
}

.guide .callout-tip strong {
    color: var(--green);
}

.guide .callout-tip p {
    color: #166534;
    margin-bottom: 0;
}

.guide .unit-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.875rem;
}

.guide .unit-table th {
    background: var(--primary);
    color: var(--white);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
}

.guide .unit-table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.guide .unit-table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.guide .unit-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--slate-200);
    color: var(--slate-700);
}

.guide .unit-table tr:nth-child(even) td {
    background: var(--slate-50);
}

.guide .unit-table tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-sm);
}

.guide .unit-table tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-sm) 0;
}

.guide .faq-item {
    border-bottom: 1px solid var(--slate-200);
    padding: 18px 0;
}

.guide .faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.guide .faq-item h3 {
    margin-top: 0;
    font-size: 1rem;
    color: var(--slate-900);
}

.guide .faq-item p:last-child {
    margin-bottom: 0;
}

.guide .sep {
    border: none;
    border-top: 1px solid var(--slate-200);
    margin: 32px 0;
}

/* PT Calculator — Billing module */
.cpt-row {
    margin-bottom: 8px;
}

.cpt-row .form-group.cpt-code {
    flex: 2;
}

.cpt-row .form-group.cpt-minutes {
    flex: 1;
}

.btn-add-cpt {
    background: none;
    border: 1px dashed var(--slate-300);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    margin-bottom: 20px;
    width: 100%;
    transition: var(--transition);
}

.btn-add-cpt:hover {
    border-color: var(--primary);
    background: var(--primary-surface);
}

.billing-intro {
    font-size: 0.85rem;
    color: var(--slate-500);
    margin-bottom: 16px;
}

.billing-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
    color: var(--slate-600);
    border-bottom: 1px solid var(--slate-100);
}

.clinical-divider {
    margin: 28px 0;
}

.walk-actual-row {
    display: none;
}

.guide .last-updated {
    font-size: 0.8rem;
    color: var(--slate-400);
    margin-bottom: 4px;
    font-style: italic;
}

.guide .author-byline {
    font-size: 0.8rem;
    color: var(--slate-400);
    margin-bottom: 20px;
    line-height: 1.6;
}

.guide .author-byline a {
    color: var(--primary);
    text-decoration: none;
}

.guide .author-byline a:hover {
    text-decoration: underline;
}

.settings-restored-notice {
    background: var(--green-bg);
    border: 1px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 14px;
    font-size: 0.8125rem;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    transition: opacity 0.5s ease;
}

.settings-restored-notice button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0;
    text-decoration: underline;
}

.guide .color-yellow {
    color: var(--yellow);
}

.guide .color-green {
    color: var(--green);
}

.guide .color-orange {
    color: var(--orange);
}

.guide .color-red {
    color: var(--red);
}

/* Section subtitle (e.g. PDPM tier headings) */
.section-subtitle {
    font-size: .8rem !important;
    margin-top: 20px;
}

/* Checkbox labels inside forms */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ==========================================================
   STATIC PAGES (About, Contact, Privacy, Terms, Disclaimer)
   ========================================================== */
.page-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px 28px 36px;
}

.page-content h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 28px 0 12px;
    line-height: 1.35;
}

.page-content h2:first-child {
    margin-top: 0;
}

.page-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 20px 0 8px;
}

.page-content p {
    font-size: 0.9375rem;
    color: var(--slate-700);
    line-height: 1.75;
    margin-bottom: 14px;
}

.page-content ul,
.page-content ol {
    padding-left: 22px;
    margin-bottom: 16px;
}

.page-content li {
    font-size: 0.9375rem;
    color: var(--slate-700);
    line-height: 1.7;
    margin-bottom: 6px;
}

.page-content strong {
    color: var(--slate-900);
    font-weight: 600;
}

.page-content .last-updated {
    font-size: 0.8rem;
    color: var(--slate-400);
    margin-bottom: 20px;
    font-style: italic;
}

/* Contact form submit */
.btn-submit {
    display: inline-flex;
    padding: 12px 32px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(79, 109, 155, 0.3);
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 109, 155, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

/* ==========================================================
   MORE TOOLS SECTION
   ========================================================== */
.more-tools {
    margin-top: 24px;
}

.more-tools-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.more-tools-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.01em;
}

.more-tools-icon {
    width: 22px;
    height: 22px;
    fill: var(--primary);
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}

.tool-card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(79, 109, 155, 0.2);
}

.tool-card-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--white);
}

.tool-card-body {
    flex: 1;
    min-width: 0;
}

.tool-card-body h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--slate-900);
    margin-bottom: 3px;
    line-height: 1.3;
}

.tool-card-body p {
    font-size: 0.8125rem;
    color: var(--slate-500);
    line-height: 1.5;
    margin: 0;
}

.tool-card-arrow {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    opacity: 0.4;
    transition: var(--transition);
}

.tool-card-arrow svg {
    width: 20px;
    height: 20px;
    fill: var(--slate-500);
}

.tool-card:hover .tool-card-arrow {
    opacity: 1;
    transform: translateX(3px);
}

.tool-card:hover .tool-card-arrow svg {
    fill: var(--primary);
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 480px) {
    .app-wrapper {
        padding: 16px 12px 36px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row.form-row-compact {
        grid-template-columns: 1fr 1fr;
    }

    .page-hero h1 {
        font-size: 1.25rem;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .tab-content {
        padding: 18px 16px;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .result-value {
        font-size: 1rem;
    }

    .guide {
        padding: 22px 16px 28px;
    }

    .guide h2 {
        font-size: 1.15rem;
    }

    .guide .formula-block {
        font-size: 0.85rem;
        padding: 14px 16px;
    }

    .guide .unit-table th,
    .guide .unit-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .page-content {
        padding: 22px 16px 28px;
    }

    /* Prevent iOS Safari zoom on input focus */
    .form-input,
    .form-input.speed-input,
    select.form-input,
    .form-select {
        font-size: 16px;
    }
}

/* ==========================================================
   ADVANCED MODE — PRODUCTIVITY & REVENUE OPTIMIZER
   ========================================================== */

/* --- Form Select (dropdown) --- */
.form-select {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    background: var(--input-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.12);
}

/* --- Toggle Switch (Manual / AI) --- */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.toggle-group-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate-500);
    transition: var(--transition);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.toggle-group-label.active {
    color: var(--primary-dark);
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--slate-300);
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked+.toggle-slider {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* --- Tooltip Icon --- */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--slate-400);
    border: 1.5px solid var(--slate-300);
    border-radius: 50%;
    cursor: help;
    vertical-align: middle;
    margin-left: 4px;
    position: relative;
}

/* --- Dashboard Cards --- */
.adv-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    animation: fadeIn 0.35s ease;
}

.adv-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.adv-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.adv-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.adv-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.adv-card-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--white);
}

.adv-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.adv-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.adv-card-sub {
    font-size: 0.7rem;
    color: var(--slate-400);
    line-height: 1.4;
}

/* Card accents */
.adv-card--productivity::before {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

.adv-card--productivity .adv-card-icon {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

.adv-card--productivity .adv-card-value {
    color: #0d9488;
}

.adv-card--productivity .adv-card-label {
    color: #0f766e;
}

.adv-card--financial::before {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.adv-card--financial .adv-card-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.adv-card--financial .adv-card-value {
    color: var(--primary-dark);
}

.adv-card--financial .adv-card-label {
    color: var(--primary);
}

.adv-card--ai::before {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.adv-card--ai .adv-card-icon {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.adv-card--ai .adv-card-value {
    color: #7c3aed;
}

.adv-card--ai .adv-card-label {
    color: #6d28d9;
}

/* --- Time Bank Progress Bar --- */
.time-bank-container {
    margin-top: 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.35s ease;
}

.time-bank-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-bank-bar {
    height: 28px;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    background: var(--slate-100);
    margin-bottom: 10px;
}

.time-bank-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--white);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.time-bank-segment--billable {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

.time-bank-segment--doc {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.time-bank-segment--break {
    background: linear-gradient(135deg, #16a34a, #4ade80);
}

.time-bank-bar.danger .time-bank-segment--doc {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.time-bank-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.time-bank-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--slate-600);
}

.time-bank-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.time-bank-legend-dot--billable {
    background: #14b8a6;
}

.time-bank-legend-dot--doc {
    background: #f59e0b;
}

.time-bank-legend-dot--break {
    background: #4ade80;
}

/* --- Burnout / Turnover Gauge --- */
.burnout-gauge {
    margin-top: 16px;
    padding: 18px 16px;
    border-radius: var(--radius);
    border-left: 5px solid var(--red);
    background: var(--red-bg);
    display: none;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.35s ease;
}

.burnout-gauge.show {
    display: flex;
}

.burnout-gauge-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.burnout-gauge-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--white);
}

.burnout-gauge-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--red);
    margin-bottom: 4px;
}

.burnout-gauge-msg {
    font-size: 0.8125rem;
    color: #991b1b;
    line-height: 1.6;
}

.burnout-gauge-cost {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--red);
    background: rgba(220, 38, 38, 0.1);
    border-radius: 6px;
}

/* --- Advanced Results Panel --- */
.adv-results {
    display: none;
    animation: fadeIn 0.35s ease;
}

.adv-results.show {
    display: block;
}

/* --- Revenue Lost Alert --- */
.revenue-lost-alert {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--orange);
    background: var(--orange-bg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.35s ease;
}

.revenue-lost-alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.revenue-lost-alert-text {
    font-size: 0.8125rem;
    color: #9a3412;
    line-height: 1.5;
}

.revenue-lost-alert-text strong {
    color: var(--orange);
}

/* --- Responsive Overrides for Advanced Dashboard --- */
@media (max-width: 700px) {
    .adv-dashboard {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .adv-card-value {
        font-size: 1.25rem;
    }

    .toggle-group {
        flex-wrap: wrap;
    }

    .time-bank-legend {
        gap: 10px;
    }
}

/* ==========================================================
   OFFSCREEN CONTENT DEFERRAL
   ========================================================== */
.guide {
    content-visibility: auto;
    contain-intrinsic-size: auto 2000px;
}

/* FY Update Highlight Box */
.fy-update-box {
    border-left: 4px solid #22c55e;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

/* ==========================================================
   LABOR PRODUCTIVITY CALCULATOR SPECIFIC
   ========================================================== */
.lp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.lp-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 4px;
}
.lp-header-status {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--slate-500);
}
.lp-header-status.success {
    color: var(--green);
}
.lp-header-stats {
    display: flex;
    gap: 20px;
}
.lp-stat-col {
    display: flex;
    flex-direction: column;
}
.lp-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--slate-500);
    text-transform: uppercase;
}
.lp-stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--slate-900);
    margin-top: 2px;
}
.lp-middle-box {
    background: var(--slate-100);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    margin-bottom: 24px;
}
.lp-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}
.lp-icon svg {
    width: 32px;
    height: 32px;
    fill: var(--primary);
}
.lp-trend-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--slate-500);
    text-transform: uppercase;
    margin-bottom: 12px;
}
.lp-value-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-width: 300px;
    margin: 0 auto 12px;
    box-shadow: var(--shadow);
}
.lp-value-box span {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--green);
    letter-spacing: -0.02em;
}
.lp-subtext {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--slate-800);
    margin-bottom: 16px;
}
.lp-pill {
    display: inline-block;
    padding: 6px 16px;
    background: var(--white);
    border: 2px solid var(--primary-light);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}
.lp-inputs-wrapper .form-row {
    margin-bottom: 16px;
}
.lp-inline-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--slate-50);
    padding: 6px 6px 6px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex: 1;
}
@media (max-width: 600px) {
    .lp-inline-input {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
        gap: 8px;
    }
    .lp-inline-input .form-input {
        width: 100%;
    }
}
.lp-inline-input label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--slate-700);
}
.lp-inline-input .form-input {
    width: 140px;
    margin: 0;
    border-color: var(--border);
}
.lp-btn-example {
    margin-top: 16px;
    width: 100%;
    justify-content: center;
}
.lp-formula-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}

/* ==========================================================
   REDUCED MOTION — ACCESSIBILITY & BATTERY
   ========================================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}