/* =========================================================
   CHECK MY CTC — THEME SYSTEM (Light + Dark)
   Same brand colours (green #15803d, orange #ea580c).
   Theme is set on <html data-bs-theme="light|dark">.
   Anything wrapped in data-bs-theme="light" (PDF / print
   templates) always stays light.
   ========================================================= */

:root,
[data-bs-theme="light"] {
    /* Brand (unchanged) */
    --primary-green: #15803d;
    --primary-green-dark: #166534;
    --primary-green-hover: #166534;
    --tea-orange: #ea580c;
    --tea-orange-hover: #c2410c;
    --red: #dc2626;
    --white: #ffffff;              /* always white – used as text on green */

    /* Surfaces */
    --bg-light: #f8fafc;           /* page background */
    --surface: #ffffff;            /* cards, header, inputs */
    --surface-2: #f8fafc;          /* subtle panels */
    --surface-3: #f1f5f9;          /* hover / tracks */
    --input-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.88);

    /* Text */
    --text-dark: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    /* Lines */
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Tints */
    --light-green-bg: #f0fdf4;
    --green-soft: #f0fdf4;
    --green-soft-2: #dcfce7;
    --green-border: #bbf7d0;
    --green-text: #15803d;
    --green-text-strong: #166534;
    --orange-soft: #fff7ed;
    --orange-border: #fed7aa;
    --orange-text: #c2410c;
    --red-soft: #fef2f2;
    --red-border: #fecaca;
    --red-text: #dc2626;
    --blue-soft: #eff6ff;
    --blue-border: #bfdbfe;
    --blue-text: #1d4ed8;
    --purple-soft: #f5f3ff;

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 6px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.10);
    --focus-ring: 0 0 0 3px rgba(21, 128, 61, 0.22);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    /* Legacy page variables (pages defining their own palette) */
    --theme-color: #15803d;
    --theme-color-dark: #166534;
    --ctc-green: #15803d;
    --ctc-black: #111827;
    --ctc-border: #e5e7eb;

    /* Bootstrap hooks */
    --bs-success: #15803d;
    --bs-success-rgb: 21, 128, 61;
    --bs-link-color: #15803d;
    --bs-link-color-rgb: 21, 128, 61;
    --bs-link-hover-color: #166534;
    --bs-link-hover-color-rgb: 22, 101, 52;

    color-scheme: light;
}

html[data-bs-theme="dark"],
[data-bs-theme="dark"] {
    --bg-light: #0b1220;
    --surface: #111a2b;
    --surface-2: #162236;
    --surface-3: #1c2a40;
    --input-bg: #0e1726;
    --header-bg: rgba(14, 22, 37, 0.88);

    --text-dark: #e8edf5;
    --text-body: #cbd5e1;
    --text-muted: #94a3b8;
    --text-faint: #64748b;

    --border-color: #24324a;
    --border-strong: #33445f;

    --light-green-bg: #0f2a1d;
    --green-soft: #0f2a1d;
    --green-soft-2: #143823;
    --green-border: #1f5136;
    --green-text: #4ade80;
    --green-text-strong: #86efac;
    --orange-soft: #2c1a0e;
    --orange-border: #5b3416;
    --orange-text: #fb923c;
    --red-soft: #2d1416;
    --red-border: #5c2326;
    --red-text: #f87171;
    --blue-soft: #10213d;
    --blue-border: #1e3a66;
    --blue-text: #60a5fa;
    --purple-soft: #1d1836;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.5);
    --focus-ring: 0 0 0 3px rgba(74, 222, 128, 0.25);

    /* Legacy page variables, re-mapped for dark */
    --ctc-black: #e8edf5;
    --ctc-border: #24324a;
    --text: #e8edf5;
    --muted: #94a3b8;
    --black: #e8edf5;
    --border: #24324a;
    --background: #0b1220;
    --green-light: #0f2a1d;
    --ic-muted: #94a3b8;
    --ic-line: #24324a;
    --ic-green-soft: #0f2a1d;
    --qr-green-soft: #0f2a1d;
    --qr-green-line: #1f5136;
    --qr-ink: #e8edf5;
    --qr-text: #cbd5e1;
    --qr-muted: #94a3b8;
    --qr-line: #24324a;
    --qr-line-strong: #33445f;
    --qr-bg-soft: #162236;

    --bs-body-bg: var(--surface);
    --bs-body-color: var(--text-dark);
    --bs-emphasis-color: #ffffff;
    --bs-secondary-color: var(--text-muted);
    --bs-secondary-bg: var(--surface-2);
    --bs-tertiary-bg: var(--surface-2);
    --bs-border-color: var(--border-color);
    --bs-link-color: #4ade80;
    --bs-link-color-rgb: 74, 222, 128;
    --bs-link-hover-color: #86efac;
    --bs-link-hover-color-rgb: 134, 239, 172;
    --bs-success-text-emphasis: #86efac;
    --bs-success-bg-subtle: #0f2a1d;
    --bs-success-border-subtle: #1f5136;

    color-scheme: dark;
}

/* ============ BASE ============ */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg-light);
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s ease, color .25s ease;
}

::selection {
    background: rgba(21, 128, 61, 0.22);
}

a {
    color: var(--green-text);
}

a:hover {
    color: var(--green-text-strong);
}

:focus-visible {
    outline: 2px solid var(--green-text);
    outline-offset: 2px;
}

/* Dark mode: re-colour Bootstrap utilities that are fixed-colour by default.
   Light mode keeps Bootstrap's own values. Anything inside
   data-bs-theme="light" (printable documents) is left untouched. */
[data-bs-theme="dark"] .bg-white:not([data-bs-theme="light"] *)       { background-color: var(--surface) !important; }
[data-bs-theme="dark"] .bg-light:not([data-bs-theme="light"] *)       { background-color: var(--surface-2) !important; }
[data-bs-theme="dark"] .text-dark:not([data-bs-theme="light"] *),
[data-bs-theme="dark"] .text-black:not([data-bs-theme="light"] *)     { color: var(--text-dark) !important; }
[data-bs-theme="dark"] .text-success:not([data-bs-theme="light"] *)   { color: var(--green-text) !important; }
[data-bs-theme="dark"] .text-danger:not([data-bs-theme="light"] *)    { color: var(--red-text) !important; }
[data-bs-theme="dark"] .text-primary:not([data-bs-theme="light"] *)   { color: var(--blue-text) !important; }
[data-bs-theme="dark"] .text-warning:not([data-bs-theme="light"] *)   { color: #fbbf24 !important; }
[data-bs-theme="dark"] .bg-success-subtle:not([data-bs-theme="light"] *) { background-color: var(--green-soft) !important; }

hr {
    border-color: var(--border-color);
    opacity: 1;
}

/* Scrollbars */
* {
    scrollbar-color: var(--border-strong) transparent;
}

/* ============ TOP NOTICE ============ */

.top-notice {
    background-color: var(--green-soft) !important;
    border-bottom: 1px solid var(--green-border) !important;
    font-size: 0.8rem;
}

.top-notice .small {
    font-size: 12px;
}

/* ============ NAVBAR ============ */

.navbar {
    background-color: var(--header-bg) !important;
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border-color) !important;
    padding: 10px 0;
}

.navbar-brand h1 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.navbar-brand span {
    color: var(--green-text);
}

/* Dark-mode: soften the logo image so it does not glare */
[data-bs-theme="dark"] .navbar-brand img,
[data-bs-theme="dark"] .menu-logo img,
[data-bs-theme="dark"] footer img[alt*="Logo"] {
    filter: brightness(1.05);
}

/* ============ THEME TOGGLE ============ */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-dark);
    font-size: 18px;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.theme-toggle:hover {
    background: var(--surface-3);
    border-color: var(--border-strong);
}

.theme-toggle:active {
    transform: scale(.94);
}

.theme-toggle .bi-sun-fill { display: none; color: #f59e0b; }
.theme-toggle .bi-moon-stars-fill { display: inline-block; }
[data-bs-theme="dark"] .theme-toggle .bi-sun-fill { display: inline-block; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: none; }

/* ============ CHECKBOXES / SWITCHES ============ */

.form-check-input {
    background-color: var(--input-bg);
    border-color: var(--border-strong);
}

.form-check-input:checked {
    background-color: var(--primary-green, #15803d) !important;
    border-color: var(--primary-green, #15803d) !important;
}

.form-check-input:focus {
    border-color: var(--primary-green, #15803d) !important;
    box-shadow: var(--focus-ring) !important;
}

.form-check-label {
    cursor: pointer;
}

/* ============ BUTTONS ============ */

.btn-tea {
    background-color: var(--orange-soft);
    color: var(--orange-text);
    border: 1px solid var(--orange-border);
    border-radius: 8px;
    padding: 7px 14px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-tea:hover {
    background-color: var(--tea-orange);
    color: var(--white);
    border-color: var(--tea-orange);
}

.calculate-btn,
.btn-calculate {
    width: 100%;
    min-height: 46px;
    background: var(--primary-green);
    border: 0;
    color: var(--white);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .01em;
    padding: 11px 20px;
    box-shadow: 0 6px 16px rgba(21, 128, 61, 0.22);
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    cursor: pointer;
}

.calculate-btn:hover,
.btn-calculate:hover {
    background: var(--primary-green-dark);
    color: var(--white);
    box-shadow: 0 8px 20px rgba(21, 128, 61, 0.28);
}

.calculate-btn:active,
.btn-calculate:active {
    transform: translateY(1px);
}

.calculate-btn:focus-visible,
.btn-calculate:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.action-btn-group {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.pdf-btn {
    flex: 1;
    min-height: 42px;
    background: var(--surface);
    border: 1px solid var(--primary-green);
    color: var(--green-text);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.pdf-btn:hover {
    background: var(--green-soft);
    color: var(--green-text-strong);
}

.btn-download {
    background: var(--surface);
    border: 1px solid var(--primary-green);
    color: var(--green-text);
    font-weight: 700;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13px;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: var(--white);
}

.coffee-btn {
    flex: 1;
    min-height: 42px;
    background: #ffdd00;
    border: 1px solid #e6c600;
    color: #000000;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.coffee-btn:hover {
    background: #f2d100;
    color: #000000;
}

.btn-donate {
    background: var(--tea-orange);
    color: var(--white);
    font-weight: 700;
    font-size: 13px;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, transform .15s ease;
}

.btn-donate:hover {
    background: var(--tea-orange-hover);
    color: var(--white);
}

.more-btn {
    margin-top: 15px;
    border: none;
    background: transparent;
    color: var(--green-text);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 6px;
}

.more-btn:hover {
    text-decoration: underline;
    color: var(--green-text-strong);
}

/* Bootstrap buttons that pages use — keep brand green, theme the neutrals */
.btn-success {
    --bs-btn-bg: #15803d;
    --bs-btn-border-color: #15803d;
    --bs-btn-hover-bg: #166534;
    --bs-btn-hover-border-color: #166534;
    --bs-btn-active-bg: #14532d;
    --bs-btn-active-border-color: #14532d;
}

.btn-outline-success {
    --bs-btn-color: var(--green-text);
    --bs-btn-border-color: var(--primary-green);
    --bs-btn-hover-bg: var(--primary-green);
    --bs-btn-hover-border-color: var(--primary-green);
    --bs-btn-active-bg: var(--primary-green-dark);
}

.btn-light {
    --bs-btn-bg: var(--surface-2);
    --bs-btn-color: var(--text-dark);
    --bs-btn-border-color: var(--border-color);
    --bs-btn-hover-bg: var(--surface-3);
    --bs-btn-hover-color: var(--text-dark);
    --bs-btn-hover-border-color: var(--border-strong);
}

.btn-outline-secondary,
.btn-outline-dark {
    --bs-btn-color: var(--text-body);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--surface-3);
    --bs-btn-hover-color: var(--text-dark);
    --bs-btn-hover-border-color: var(--border-strong);
}

.btn {
    border-radius: 10px;
}

/* ============ MAIN CALCULATOR CARD ============ */

main {
    width: 100%;
}

.calculator {
    max-width: 950px;
    margin: 30px auto;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.calculator-header {
    background: linear-gradient(135deg, var(--green-soft), var(--surface) 75%);
    border-bottom: 1px solid var(--green-border);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.calculator-header .icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary-green);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(21, 128, 61, 0.25);
}

.calculator-header h1 {
    font-size: 22px;
    margin: 0;
    color: var(--text-dark);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.calculator-header p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.calculator-body {
    padding: 26px;
}

/* Legacy header markup */
.header-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-green);
    color: var(--white);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.brand-name {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-dark);
}

.brand-name span {
    color: var(--green-text);
}

.header-subtitle {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

.deduction-link-banner {
    background: var(--green-soft);
    border: 1px dashed var(--green-border);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.deduction-link-banner p {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dark);
}

.deduction-link-banner a {
    background: var(--primary-green);
    color: var(--white);
    text-decoration: none;
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.deduction-link-banner a:hover {
    background: var(--primary-green-dark);
    color: var(--white);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.section-tag {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.card-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    background: var(--surface);
    margin-bottom: 12px;
}

.card-box h5 {
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.calc-box {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

/* Bootstrap cards, tables & overlays follow the dark theme */
[data-bs-theme="dark"] .card:not([data-bs-theme="light"] *) {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border-color);
    --bs-card-cap-bg: var(--surface-2);
    color: var(--text-dark);
}

[data-bs-theme="dark"] .table:not([data-bs-theme="light"] *) {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-dark);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: var(--surface-2);
    --bs-table-striped-color: var(--text-dark);
    --bs-table-hover-bg: var(--surface-3);
    --bs-table-hover-color: var(--text-dark);
}

[data-bs-theme="dark"] .table-light:not([data-bs-theme="light"] *) {
    --bs-table-bg: var(--surface-2);
    --bs-table-color: var(--text-dark);
    --bs-table-border-color: var(--border-color);
}

[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .accordion-item,
[data-bs-theme="dark"] .accordion-button {
    background-color: var(--surface);
    color: var(--text-dark);
    border-color: var(--border-color);
}

.accordion-button:not(.collapsed) {
    background-color: var(--green-soft);
    color: var(--green-text);
}

/* ============ RESULTS ============ */

.result-box {
    background: var(--green-soft);
    border: 1px solid var(--green-border);
    border-radius: var(--radius-md);
    padding: 8px;
}

.result-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.result-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--green-text);
    font-variant-numeric: tabular-nums;
}

.main-result {
    background: linear-gradient(160deg, var(--green-soft), var(--surface));
    border: 1px solid var(--green-border);
    border-radius: 16px;
    padding: 22px;
    text-align: center;
    margin-top: 22px;
}

.result-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: none;
}

.final-salary {
    font-size: 36px;
    font-weight: 800;
    color: var(--green-text-strong);
    margin: 4px 0;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

.result-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.leave-result {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid var(--green-border);
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.deduction {
    color: var(--red-text);
    font-weight: 700;
}

/* ============ FORM CONTROLS ============ */

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 44px;
    color: var(--text-dark);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .2s ease;
}

textarea.form-control {
    min-height: 0;
}

.form-control-sm,
.form-select-sm {
    min-height: 34px;
    padding: 6px 10px;
}

.form-control::placeholder {
    color: var(--text-faint);
    opacity: 1;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--text-faint);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-dark);
    border-color: var(--primary-green);
    box-shadow: var(--focus-ring);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--surface-2);
}

[data-bs-theme="dark"] .form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-range::-webkit-slider-thumb { background: var(--primary-green); }
.form-range::-moz-range-thumb     { background: var(--primary-green); }
.form-range::-webkit-slider-runnable-track { background: var(--surface-3); }

.input-group-text {
    background: var(--surface-2);
    color: var(--text-body);
    font-weight: 600;
    min-height: 44px;
    border-color: var(--border-strong);
    font-size: 13px;
}

.small-note {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
}

.salary-input {
    position: relative;
    font-size: 20px !important;
    font-weight: 700;
}

.salary-input span {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 2;
}

.salary-input input {
    padding-left: 32px;
    font-size: 18px;
    font-weight: 700;
}

/* ============ SUMMARY / TOTALS ============ */

.salary-total-box {
    background: var(--green-soft);
    border: 1px solid var(--green-border);
    border-radius: var(--radius-md);
    padding: 11px 13px;
}

.salary-total-label {
    color: var(--text-muted);
    font-size: 11.5px;
}

.salary-total-value {
    color: var(--green-text-strong);
    font-size: 19px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
}

.take-home {
    background: linear-gradient(160deg, var(--green-soft), var(--surface));
    border: 1px solid var(--green-border);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    margin-bottom: 12px;
}

.take-home .title {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 2px;
}

.take-home .amount {
    color: var(--green-text-strong);
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 12.5px;
}

.summary-row:last-child {
    border-bottom: 0;
}

.summary-label {
    color: var(--text-body);
}

.summary-value {
    font-weight: 700;
    white-space: nowrap;
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}

.deduction .summary-value {
    color: var(--red-text);
}

.total-row {
    margin-top: 5px;
    padding-top: 9px;
    border-top: 2px solid var(--border-color);
}

.total-row .summary-label {
    font-weight: 700;
    color: var(--text-dark);
}

.total-row .summary-value {
    color: var(--red-text);
    font-weight: 800;
}

.info-box {
    margin-top: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
}

.component-box {
    background: var(--green-soft);
    border: 1px solid var(--green-border);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
}

.component-label {
    font-size: 11px;
    color: var(--text-muted);
}

.component-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--green-text-strong);
    font-variant-numeric: tabular-nums;
}

/* ============ DETAILS / BREAKDOWN ============ */

#moreDetails {
    display: none;
    margin-top: 15px;
}

.details-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
}

.details-title {
    background: var(--surface-2);
    padding: 12px 15px;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-body);
}

.detail-row:hover {
    background: var(--surface-2);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-value {
    font-weight: 700;
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.red-value {
    color: var(--red-text);
    font-weight: 700;
}

.final-row,
.final-row:hover {
    background: var(--green-soft);
    font-weight: 800;
    font-size: 15px;
}

.final-row .detail-value {
    color: var(--green-text-strong);
}

.policy {
    margin-top: 18px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 13px 15px;
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--text-muted);
}

.policy strong {
    color: var(--text-dark);
}

/* ============ DONATION / SUPPORT BOX ============ */

.support-box {
    margin-top: 18px;
    background: var(--surface);
    border: 1px dashed var(--green-border);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
}

.support-box p {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ============ PDF EXPORT TEMPLATE (always light) ============ */

#pdfReportTemplate {
    display: none;
    padding: 30px;
    font-family: Arial, sans-serif;
    color: #0f172a;
    background: #ffffff;
}

.pdf-header {
    background: #0f172a;
    color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.pdf-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

.pdf-header p {
    margin: 4px 0 0;
    font-size: 12px;
    color: #d1d5db;
}

.pdf-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.pdf-highlight {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.pdf-highlight .val {
    font-size: 28px;
    font-weight: 800;
    color: #166534;
}

.pdf-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f1f1;
    font-size: 13px;
}

.pdf-row:last-child {
    border-bottom: none;
}

.pdf-footer {
    font-size: 10px;
    color: #64748b;
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

/* ============ FOOTER ============ */

footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 35px 0 20px;
    margin-top: auto;
    color: var(--text-body);
}

footer h6 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
}

footer a:hover {
    color: var(--green-text);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
}

.footer-links span {
    color: var(--text-faint);
}

.footer-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 10px;
    padding: 0 12px 10px;
}

.site-footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 24px 0;
    font-size: 13px;
    margin-top: auto;
}

.site-footer a {
    color: #bbf7d0;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ============ SHARED WIDGETS (sticky icons / visitor) ============ */

[data-bs-theme="dark"] .social-sidebar {
    background: rgba(17, 26, 43, 0.75);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

/* ============ RESPONSIVE: TABLET/MOBILE ============ */

@media (max-width: 767px) {
    .calculator {
        width: calc(100% - 16px);
        margin: 8px auto;
        border-radius: 14px;
    }

    .calculator-header {
        padding: 14px 15px;
    }

    .header-icon {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    .brand-name {
        font-size: 18px;
    }

    .header-subtitle {
        font-size: 11px;
    }

    .calculator-body {
        padding: 14px;
    }

    .card-box {
        padding: 12px;
        margin-bottom: 10px;
    }

    .summary-card {
        padding: 12px;
    }

    .take-home .amount {
        font-size: 25px;
    }

    .deduction-link-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .deduction-link-banner a {
        width: 100%;
        text-align: center;
    }

    .action-btn-group {
        flex-direction: column;
    }

    /* Prevent iOS zoom on focus */
    .form-control,
    .form-select {
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .calculator {
        margin: 10px;
        width: auto;
        border-radius: 14px;
    }

    .calculator-body {
        padding: 15px;
    }

    .calculator-header {
        padding: 15px;
    }

    .calculator-header .icon {
        width: 42px;
        height: 42px;
        font-size: 19px;
        border-radius: 12px;
    }

    .calculator-header h1 {
        font-size: 18px;
    }

    .calculator-header p {
        font-size: 12px;
    }

    .final-salary {
        font-size: 29px;
    }

    .detail-row {
        padding: 9px 12px;
    }
}

.table,
.calculator-body,
.calculator-body .form-label,
.calculator-body .form-control,
.calculator-body .form-select,
.calculator-body .table,
.calculator-body .info-box,
.calculator-body .title {
    font-size: 13px !important;
}

@media (max-width: 767px) {
    .calculator-body .form-control,
    .calculator-body .form-select {
        font-size: 16px !important;
    }
}

/* ============ MOTION ============ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Printing always uses the light palette (dark text on white paper) */
@media print {
    html[data-bs-theme="dark"],
    html[data-bs-theme="dark"] [data-bs-theme="dark"] {
        --bg-light: #f8fafc;           /* page background */
        --surface: #ffffff;            /* cards, header, inputs */
        --surface-2: #f8fafc;          /* subtle panels */
        --surface-3: #f1f5f9;          /* hover / tracks */
        --input-bg: #ffffff;
        --header-bg: rgba(255, 255, 255, 0.88);
        --text-dark: #0f172a;
        --text-body: #334155;
        --text-muted: #64748b;
        --text-faint: #94a3b8;
        --border-color: #e2e8f0;
        --border-strong: #cbd5e1;
        --light-green-bg: #f0fdf4;
        --green-soft: #f0fdf4;
        --green-soft-2: #dcfce7;
        --green-border: #bbf7d0;
        --green-text: #15803d;
        --green-text-strong: #166534;
        --orange-soft: #fff7ed;
        --orange-border: #fed7aa;
        --orange-text: #c2410c;
        --red-soft: #fef2f2;
        --red-border: #fecaca;
        --red-text: #dc2626;
        --blue-soft: #eff6ff;
        --blue-border: #bfdbfe;
        --blue-text: #1d4ed8;
        --purple-soft: #f5f3ff;
        --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
        --shadow-md: 0 6px 24px rgba(15, 23, 42, 0.06);
        --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.10);
        --focus-ring: 0 0 0 3px rgba(21, 128, 61, 0.22);
        --ctc-black: #111827;
        --ctc-border: #e5e7eb;
        --bs-link-color: #15803d;
        --bs-link-color-rgb: 21, 128, 61;
        --bs-link-hover-color: #166534;
        --bs-link-hover-color-rgb: 22, 101, 52;
        --ctc-black: #111827;
        --ctc-border: #e5e7eb;
        --text: #17201a;
        --muted: #6b7280;
        --black: #111827;
        --border: #e5e7eb;
        --background: #f6f8f7;
        --green-light: #f0fdf4;
        --ic-muted: #6b7280;
        --ic-line: #e5e7eb;
        --ic-green-soft: #ecfdf3;
        --qr-green-soft: #f0fdf4;
        --qr-green-line: #bbf7d0;
        --qr-ink: #111827;
        --qr-text: #374151;
        --qr-muted: #6b7280;
        --qr-line: #e5e7eb;
        --qr-line-strong: #d1d5db;
        --qr-bg-soft: #f9fafb;
        --bs-body-bg: #ffffff;
        --bs-body-color: #212529;
        --bs-emphasis-color: #000;
        --bs-secondary-color: rgba(33, 37, 41, 0.75);
        --bs-secondary-bg: #e9ecef;
        --bs-tertiary-bg: #f8f9fa;
        --bs-border-color: #dee2e6;
        --bs-success-text-emphasis: #0a3622;
        --bs-success-bg-subtle: #d1e7dd;
        --bs-success-border-subtle: #a3cfbb;
        color-scheme: light;
    }
}

/* ============ PRINT ============ */

@media print {
    html,
    body {
        background: #ffffff !important;
    }

    body * {
        visibility: hidden;
    }

    #pdfPrintArea,
    #pdfPrintArea * {
        visibility: visible;
    }

    #pdfPrintArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
        box-shadow: none;
        border: none;
    }
}
