:root {
    --brand: #07468a;
    --brand-dark: #053262;
    --ink: #232528;
}

/* Bootstrap theme colours */
html { font-size: 15px; } /* compact scale: every rem-based size follows this */
body { background: #f3f5f9; color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.text-bg-primary { background-color: var(--brand) !important; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand); }

/* Fields. An icon sits inside the field: no grey box and no dividing line. */
.form-control, .form-select { border-color: #d9dee8; }
.form-control:not(.form-control-sm):not(.form-control-lg), .form-select:not(.form-select-sm):not(.form-select-lg), .input-group:not(.input-group-lg) > .input-group-text { padding-top: .5rem; padding-bottom: .5rem; }
.btn:not(.btn-sm):not(.btn-lg) { --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .95rem; }
.input-group:not(.login-field) > .input-group-text { border-color: #d9dee8; background: #fff; color: #98a1b2; transition: color .15s, border-color .15s, background-color .15s; }
.input-group:not(.login-field) > .input-group-text:first-child { padding-right: .2rem; border-right: 0; }
.input-group:not(.login-field) > .input-group-text:first-child + .form-control,
.input-group:not(.login-field) > .input-group-text:first-child + .form-select { padding-left: .45rem; border-left: 0; }
.input-group:not(.login-field) > .form-control:has(+ button.input-group-text) { border-right: 0; }
.input-group:not(.login-field) > button.input-group-text { border-left: 0; }
.input-group:not(.login-field) > button.input-group-text:hover { color: var(--brand); }

/* Focus: the whole field gets a brand border, a soft tint and a solid line underneath (no blurry glow) */
.form-control:focus, .form-select:focus { border-color: var(--brand); background-color: #f6faff; box-shadow: inset 0 -2px 0 var(--brand); }
.input-group:not(.login-field):focus-within > .input-group-text,
.input-group:not(.login-field):focus-within > .form-control,
.input-group:not(.login-field):focus-within > .form-select { border-color: var(--brand); background-color: #f6faff; box-shadow: inset 0 -2px 0 var(--brand); }
.input-group:not(.login-field):focus-within > .input-group-text { color: var(--brand); }

/* A field with an error is outlined in red all round, icon included */
.input-group:not(.login-field):has(> .is-invalid) > .input-group-text,
.input-group:not(.login-field):has(> .is-invalid) > .is-invalid { border-color: var(--bs-form-invalid-border-color); }
.input-group:not(.login-field):has(> .is-invalid) > .input-group-text { color: var(--bs-form-invalid-color); }
.form-check-input:focus { border-color: var(--brand); box-shadow: none; outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: none; }
.sidebar a:focus-visible, .sidebar button:focus-visible { outline-color: #7cc4ff; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { --bs-offcanvas-width: 244px; --bs-offcanvas-bg: #052a55; --bs-offcanvas-color: #fff; --sidebar-bg: linear-gradient(180deg, #07468a 0%, #052a55 45%, #03152d 100%); color: #fff; }
.offcanvas-lg.sidebar { background-image: var(--sidebar-bg); }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: .9rem .85rem .6rem; }
.sidebar-brand a { flex: 1; display: grid; place-items: center; padding: .5rem; background: #fff; border-radius: .6rem; box-shadow: 0 8px 20px rgba(0, 8, 24, .25); }
.sidebar-brand img { width: 112px; }
.sidebar-brand .brand-mini { display: none; width: 32px; height: 32px; }
.sidebar-action { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-shrink: 0; margin: .3rem .85rem .45rem; padding: .5rem; border-radius: .5rem; border: 1px dashed rgba(255, 255, 255, .35); color: #fff; font-weight: 600; transition: background .2s, border-color .2s, color .2s; }
.sidebar-action:hover, .sidebar-action:focus-visible { background: #fff; border-color: #fff; color: var(--brand); }
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 0 .7rem .7rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
.sidebar-label { padding: .75rem .6rem .3rem; font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .45); }
.sidebar-link { position: relative; display: flex; align-items: center; gap: .65rem; margin-bottom: 3px; padding: .35rem .5rem; border-radius: .5rem; color: rgba(255, 255, 255, .78); font-weight: 500; transition: background .2s, color .2s, translate .2s; }
.sidebar-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 31px; border-radius: .4rem; font-size: .85rem; background: rgba(255, 255, 255, .09); transition: background .2s, color .2s; }
.sidebar-link:hover, .sidebar-link:focus-visible { background: rgba(255, 255, 255, .09); color: #fff; translate: 3px 0; }
.sidebar-link.active { background: #fff; color: var(--brand); font-weight: 700; translate: none; box-shadow: 0 8px 18px rgba(0, 8, 24, .28); }
.sidebar-link.active .sidebar-icon { background: var(--brand); color: #fff; }
.sidebar-user { display: flex; align-items: center; gap: .5rem; margin: 0 .7rem .7rem; padding: .55rem; border-radius: .6rem; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); }
.sidebar-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: linear-gradient(135deg, #3d9bf0, #22d3ee); color: #03152d; font-weight: 800; }
.sidebar-who { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-who strong, .sidebar-who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-who strong { font-size: .875rem; }
.sidebar-who small { font-size: .72rem; color: rgba(255, 255, 255, .6); }
.sidebar-logout { width: 31px; height: 31px; border: 0; border-radius: .6rem; background: transparent; color: rgba(255, 255, 255, .75); transition: background .2s, color .2s; }
.sidebar-logout:hover, .sidebar-logout:focus-visible { background: #dc3545; color: #fff; }
@media (min-width: 992px) {
    .offcanvas-lg.sidebar { display: flex; flex-direction: column; width: 244px; flex: 0 0 244px; position: sticky; top: 0; height: 100vh; background-color: #052a55 !important; transition: width .25s, flex-basis .25s; }
    #sidebarToggle i { transition: rotate .25s; }

    /* Collapsed: icons only */
    .sidebar-collapsed #sidebarToggle i { rotate: 180deg; }
    .sidebar-collapsed .offcanvas-lg.sidebar { width: 74px; flex-basis: 74px; }
    .sidebar-collapsed .sidebar-brand { padding: .9rem .65rem .6rem; }
    .sidebar-collapsed .sidebar-brand a { padding: .3rem; }
    .sidebar-collapsed .brand-full { display: none; }
    .sidebar-collapsed .brand-mini { display: block; }
    .sidebar-collapsed .sidebar-text, .sidebar-collapsed .sidebar-who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .sidebar-collapsed .sidebar-action { margin: .3rem .65rem .45rem; gap: 0; }
    .sidebar-collapsed .sidebar-nav { scrollbar-width: none; }
    .sidebar-collapsed .sidebar-label { height: 1px; margin: .55rem .6rem; padding: 0; overflow: hidden; font-size: 0; background: rgba(255, 255, 255, .15); }
    .sidebar-collapsed .sidebar-link { justify-content: center; gap: 0; padding: .35rem; translate: none; }
    .sidebar-collapsed .sidebar-badge { position: absolute; top: 0; right: 0; font-size: .65rem; }
    .sidebar-collapsed .sidebar-user { flex-direction: column; gap: .4rem; padding: .5rem .25rem; }
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .65rem 1.35rem; background: #fff; border-bottom: 1px solid #e8ebf1; }
.topbar h1 { font-size: 1.18rem; margin: 0; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-search { align-items: center; gap: .6rem; flex: 0 1 390px; padding: .38rem .85rem; border: 1px solid #dde2eb; border-radius: .45rem; background: #f5f7fb; transition: border-color .2s, box-shadow .2s, background .2s; }
.topbar-search:focus-within { border-color: var(--brand); background: #f6faff; box-shadow: inset 0 -2px 0 var(--brand); }
.topbar-search i { color: #8791a3; }
.topbar-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: .9rem; color: var(--ink); }
.content { padding: 1.35rem 1.5rem; flex: 1; }
@media (max-width: 575px) { .content { padding: 1rem; } .topbar { padding: .6rem 1rem; } .topbar h1 { font-size: 1.05rem; } }

/* Components */
.card { --bs-card-spacer-y: 1rem; --bs-card-spacer-x: 1.15rem; border: 0; border-radius: .55rem; box-shadow: 0 1px 3px rgba(20, 35, 70, .08); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f4; font-weight: 600; padding: .75rem 1.15rem; border-radius: .55rem .55rem 0 0 !important; }
.card-footer { background: #fafbfd; border-top: 1px solid #eef0f4; }
.toolbar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; font-weight: 400; }
.search { max-width: 360px; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; background: #f8f9fc; white-space: nowrap; }
.table > :not(caption) > * > * { padding: .65rem .9rem; }
.table.items > :not(caption) > * > * { padding: .35rem; }
.empty { text-align: center; color: #8a919e; padding: 1.75rem !important; }
.stat { color: inherit; transition: box-shadow .2s, translate .2s; }
.stat:hover { translate: 0 -3px; box-shadow: 0 8px 20px rgba(20, 35, 70, .12); }
.stat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: .5rem; font-size: 1rem; flex: 0 0 44px; }
.stat-value { font-size: 1.15rem; font-weight: 700; }
.month-row { display: grid; grid-template-columns: 52px 1fr auto; gap: .6rem; align-items: center; margin-bottom: .45rem; line-height: 1.25; }
/* Bars drawn with the HTML5 progress element */
progress.bar, progress.meter { display: block; width: 100%; height: 7px; border: 0; border-radius: 4px; overflow: hidden; appearance: none; -webkit-appearance: none; background: transparent; }
progress.bar { margin: 3px 0; }
progress.meter { background: #e9ecef; }
progress.bar::-webkit-progress-bar { background: transparent; }
progress.meter::-webkit-progress-bar { background: #e9ecef; }
progress.bar::-webkit-progress-value, progress.meter::-webkit-progress-value { border-radius: 4px; background: var(--fill); }
progress.bar::-moz-progress-bar, progress.meter::-moz-progress-bar { border-radius: 4px; background: var(--fill); }
.bar-billed { --fill: var(--brand); }
.bar-received, .meter-success { --fill: #198754; }
.meter-warning { --fill: #ffc107; }
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.section-box { border: 1px solid #e3e7ee; border-radius: .7rem; padding: .8rem; margin-bottom: .85rem; background: #fbfcfe; }
.totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: .32rem 0; }
.totals .grand { border-top: 2px solid var(--brand); margin-top: .5rem; padding-top: .7rem; font-size: 1.15rem; font-weight: 700; color: var(--brand); }
.form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 0; margin-top: .85rem; background: linear-gradient(transparent, #f3f5f9 30%); z-index: 5; }

/* Settings */
.settings { display: grid; grid-template-columns: 255px minmax(0, 1fr); gap: 1.15rem; align-items: start; max-width: 1280px; }
.settings-menu { position: sticky; top: 1rem; padding: .55rem; gap: .2rem; }
.settings-tab { display: flex; align-items: center; gap: .7rem; padding: .55rem; border-radius: .45rem; color: var(--ink); transition: background .2s; }
.settings-tab:hover { background: #eef3fa; color: var(--ink); }
.settings-tab > span:nth-child(2) { flex: 1; min-width: 0; line-height: 1.3; }
.settings-tab strong { display: block; font-size: .92rem; }
.settings-tab small { display: block; font-size: .75rem; color: #7a8394; }
.settings-tab-icon, .settings-head-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: .4rem; background: #eaf1fa; color: var(--brand); }
.settings-chevron { font-size: .7rem; color: #b4bccb; }
.settings-tab.active { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(7, 70, 138, .28); }
.settings-tab.active small, .settings-tab.active .settings-chevron { color: rgba(255, 255, 255, .75); }
.settings-tab.active .settings-tab-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.settings-head { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.35rem; border-bottom: 1px solid #eef0f4; }
.settings-head-icon { width: 42px; height: 42px; flex-basis: 42px; font-size: 1rem; background: var(--brand); color: #fff; }
.settings-head h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.settings-head p { margin: 0; font-size: .85rem; color: #7a8394; }
.settings-block { padding: 1.15rem 1.35rem; border-bottom: 1px solid #eef0f4; }
.settings-block h3 { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: .85rem; }
.settings .form-label { font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.switch-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem .95rem; border: 1px solid #d9dee8; border-radius: .45rem; background: #f8f9fc; cursor: pointer; }
.switch-card small { display: block; color: #7a8394; }
.switch-card .form-check-input { width: 2.9em; height: 1.5em; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips code { padding: .2rem .55rem; border-radius: 2rem; background: #eaf1fa; color: var(--brand); user-select: all; }
.bank-preview { max-width: 460px; padding: .85rem 1.1rem; border: 1px dashed #aebfd8; border-radius: .75rem; background: #f6f9fd; }
.bank-preview > div { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; }
.bank-preview span { color: #6f7889; }
.bank-preview strong { text-align: right; overflow-wrap: anywhere; }
.cron { margin: 0; padding: .8rem 1rem; border-radius: .75rem; background: #101c30; color: #cfe3ff; font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.settings-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .6rem; padding: .85rem 1.35rem; background: #fafbfd; border-radius: 0 0 .9rem .9rem; box-shadow: 0 -6px 14px rgba(20, 35, 70, .05); }
@media (max-width: 1199px) {
    .settings { grid-template-columns: minmax(0, 1fr); }
    .settings-menu { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
    .settings-tab { gap: .55rem; padding: .4rem; }
    .settings-tab small, .settings-chevron { display: none; }
    .settings-tab-icon { width: 28px; height: 28px; flex-basis: 28px; }
}
@media (max-width: 575px) {
    .settings-head, .settings-block, .settings-foot { padding-left: 1rem; padding-right: 1rem; }
}

/* Invoice design gallery */
.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.design-card { --scale: .36; }
.design-card.selected { box-shadow: 0 0 0 2px #198754; }
.design-letter { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: .4rem; background: var(--brand); color: #fff; }
.design-thumb { display: block; width: calc(794px * var(--scale)); height: calc(1123px * var(--scale)); margin: .75rem auto; overflow: hidden; background: #fff; border: 1px solid #dde2eb; box-shadow: 0 4px 14px rgba(20, 35, 70, .12); transition: translate .2s; }
.design-thumb:hover { translate: 0 -3px; }
.design-thumb iframe { width: 794px; height: 1123px; border: 0; transform: scale(var(--scale)); transform-origin: top left; pointer-events: none; }

/* Sign-in details on the dashboard */
.login-info li { display: flex; align-items: center; gap: .6rem; font-size: .875rem; }
.login-info i { color: var(--brand); }
.login-info span { color: #6f7889; }
.login-info strong { margin-left: auto; text-align: right; font-weight: 600; overflow-wrap: anywhere; }

/* Search results */
.search-hit { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; padding: .7rem 1.15rem; }
.search-hit > div { min-width: 0; }
.search-hit small { display: block; color: #6f7889; overflow-wrap: anywhere; }
mark { padding: 0 .1em; border-radius: .2em; background: #ffe69c; }

/* Company documents */
.doc-icon { font-size: 1.5rem; width: 2.2rem; text-align: center; }
.doc-info { min-width: 180px; overflow-wrap: anywhere; }

/* Success messages fade out by themselves after a few seconds (hover to keep one open) */
.flash-auto { overflow: hidden; max-height: 12rem; animation: flash-in .35s ease both, flash-out .6s ease 4s forwards; }
.flash-auto:hover, .flash-auto:focus-within { animation-play-state: paused; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes flash-out { 60% { opacity: 0; } to { opacity: 0; max-height: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border-width: 0; visibility: hidden; } }

/* Client page */
.client-card { overflow: hidden; }
.client-head { display: flex; flex-wrap: wrap; align-items: center; gap: .95rem; padding: 1.15rem 1.35rem; color: #fff; background: linear-gradient(115deg, #052a55, var(--brand) 60%, #0b63bd); }
.client-avatar { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border-radius: .6rem; background: #fff; color: var(--brand); font-size: 1.15rem; font-weight: 800; }
.client-title { flex: 1; min-width: 200px; }
.client-title h2 { margin: 0 0 .2rem; font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.client-tags { display: flex; flex-wrap: wrap; gap: .35rem; font-size: .75rem; }
.client-tags span { padding: .1rem .5rem; border-radius: 2rem; background: rgba(255, 255, 255, .15); }
.client-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.client-round { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; transition: background .2s, color .2s; }
.client-round:hover { background: #fff; color: var(--brand); }
.client-head a:focus-visible { outline-color: #fff; }
.client-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border-bottom: 1px solid #eef0f4; }
.client-stats > div { padding: .8rem 1.35rem; border-right: 1px solid #eef0f4; }
.client-stats > div:last-child { border-right: 0; }
.client-stats small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #7a8394; }
.client-stats strong { font-size: 1.1rem; }
.client-progress .meter { margin-top: .45rem; }
.client-details { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .35rem 1rem; margin: 0; padding: .95rem 1.35rem 1.15rem; }
.client-details > div { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: .7rem; align-items: center; padding: .4rem 0; }
.client-details i { grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: .4rem; background: #eaf1fa; color: var(--brand); font-size: .85rem; }
.client-details dt { font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #7a8394; line-height: 1.3; }
.client-details dd { margin: 0; overflow-wrap: anywhere; line-height: 1.35; }
.client-details .wide { grid-column: 1 / -1; }

/* WhatsApp message preview */
.wa-chat { max-height: 560px; overflow: auto; padding: .75rem; border-radius: .55rem; background: #e5ddd5; }
.wa-bubble { position: relative; max-width: 340px; padding: .55rem .7rem; border-radius: 0 .5rem .5rem .5rem; background: #fff; color: #111b21; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); font-size: .9rem; line-height: 1.4; overflow-wrap: anywhere; }

/* Clients with missing details */
.missing-card { border-left: 4px solid #ffc107; scroll-margin-top: .75rem; }
.client-missing { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .45rem 1rem; background: #fff8e1; color: #6b5200; font-size: .875rem; }
.client-missing a { margin-left: auto; font-weight: 600; }

/* GST export checks */
.gst-checks { border-left: 4px solid #ffc107; }
.gst-checks .list-group { max-height: 220px; overflow: auto; }

/* Country code list beside a phone number */
.input-group > .form-select.dial-code { flex: 0 0 8.2rem; width: 8.2rem; padding-right: 1.6rem; text-overflow: ellipsis; background-position: right .45rem center; }

/* Lists with many columns (clients, GST): smaller text and headings that may wrap, so they fit the screen */
.client-table { font-size: .84rem; }
.client-table > :not(caption) > * > * { padding-left: .5rem; padding-right: .5rem; }
.client-table thead th, .client-table .dt-sort { white-space: normal; text-align: left; }
.client-table thead th.text-end, .client-table th.text-end .dt-sort { text-align: right; }
.client-table .client-email { min-width: 170px; overflow-wrap: anywhere; }
/* The invoice list has six amount columns, so it is set tighter and its headings and buttons may wrap. */
.invoice-table { font-size: .8rem; }
.invoice-table > :not(caption) > * > * { padding-left: .35rem; padding-right: .35rem; }
.invoice-table > :not(caption) > * > :first-child { padding-left: .75rem; }
.invoice-table thead th, .invoice-table .dt-sort { white-space: normal; letter-spacing: 0; }
.invoice-table thead th.text-end, .invoice-table th.text-end .dt-sort { text-align: right; }
.invoice-table .row-actions { min-width: 112px; }
.invoice-table .row-actions > * { margin-bottom: 2px; }

/* Add / edit client */
.client-form { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.15rem; align-items: start; max-width: 1200px; }
.client-form-main { display: grid; gap: 1.15rem; }
.client-form-side { position: sticky; top: .75rem; }
.client-form .form-label { margin-bottom: .35rem; font-size: .85rem; font-weight: 600; }
.client-form .req { color: #dc3545; }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-height: 1.5rem; margin-bottom: .35rem; }
.client-form .label-row .form-label { margin: 0; }
.label-row .form-label small { margin-left: .3rem; font-weight: 400; color: #8a93a5; }
.label-row .form-check { display: flex; align-items: center; gap: .4rem; padding-left: 0; font-size: .8rem; color: #5b6475; white-space: nowrap; }
.label-row .form-check-input { float: none; margin: 0; }
.form-section-head { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.15rem; border-bottom: 1px solid #eef0f4; }
.form-section-head > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: .45rem; background: var(--brand); color: #fff; }
.form-section-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.form-section-head p { margin: 0; font-size: .78rem; color: #7a8394; }
.client-summary { overflow: hidden; }
.client-summary-head { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.35rem 1.1rem 1.1rem; text-align: center; color: #fff; background: linear-gradient(135deg, #052a55, var(--brand) 60%, #0b63bd); }
.client-summary-head strong { overflow-wrap: anywhere; line-height: 1.3; }
.client-summary-head small { padding: .1rem .55rem; border-radius: 2rem; background: rgba(255, 255, 255, .16); font-size: .72rem; }
.checklist { list-style: none; margin: 0 0 .75rem; padding: 0; font-size: .85rem; }
.checklist li { display: flex; align-items: center; gap: .45rem; padding: .25rem 0; color: #8a5b00; }
.checklist li i { color: #e0a800; }
.checklist li.ok { color: var(--ink); }
.checklist li.ok i { color: #198754; }
.checklist label { cursor: pointer; }
@media (max-width: 1099px) {
    .client-form { grid-template-columns: minmax(0, 1fr); }
    .client-form-side { position: static; }
}

/* Invoice and proforma form (built on the .client-form layout) */
.doc-form { max-width: 1240px; grid-template-columns: minmax(0, 1fr) 310px; }
.client-pick { margin-top: .85rem; padding: .8rem .95rem; border: 1px solid #e3e8f1; border-radius: .5rem; background: #f7f9fd; }
.client-pick p { display: flex; gap: .55rem; margin: 0 0 .65rem; font-size: .88rem; color: #4a5365; }
.client-pick p i { margin-top: .2rem; color: var(--brand); }
.client-pick-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .82rem; }
.client-pick-tags > span { padding: .2rem .6rem; border: 1px solid #e1e6ef; border-radius: 2rem; background: #fff; }
.client-pick-tags small { color: #7a8394; }
.client-pick-tags .tag-currency { border-color: var(--brand); color: var(--brand); }
.client-pick-tags a { margin-left: auto; font-weight: 600; text-decoration: none; }
.billing-changed { margin-top: .75rem; padding: .75rem .95rem; border: 1px solid #ffe08a; border-radius: .5rem; background: #fff8e1; font-size: .86rem; }
.billing-changed p { margin-bottom: .45rem; }
.day-chips { display: flex; gap: .35rem; margin-top: .4rem; }
.day-chips button { padding: .05rem .55rem; border: 1px solid #dde2eb; border-radius: 2rem; background: #fff; font-size: .73rem; color: #5b6475; }
.day-chips button:hover, .day-chips button:focus-visible { border-color: var(--brand); color: var(--brand); }
.item-list { display: grid; gap: .85rem; }
.item-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 34px; gap: .6rem .7rem; align-items: start; padding: .9rem; border: 1px solid #e3e8f1; border-radius: .55rem; background: #fbfcfe; transition: border-color .2s, box-shadow .2s; }
.item-row:focus-within { border-color: var(--brand); box-shadow: 0 4px 14px rgba(7, 70, 138, .08); }
.item-no { display: grid; place-items: center; width: 28px; height: 28px; margin-top: .3rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 700; }
.item-desc { resize: vertical; }
.item-remove { width: 34px; height: 34px; margin-top: .15rem; border: 0; border-radius: .4rem; background: transparent; color: #a3abba; transition: background .2s, color .2s; }
.item-remove:hover, .item-remove:focus-visible { background: #fdecee; color: #dc3545; }
.item-meta { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.2fr); gap: .7rem; }
.item-meta label > span:first-child { display: block; margin-bottom: .2rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #7a8394; }
.item-amount .form-control { font-weight: 600; }
.item-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .85rem; }
.js-live .no-js-only { display: none; }
.client-summary-head .doc-total { font-size: 1.75rem; font-weight: 700; }
.doc-total-inr { font-size: .82rem; opacity: .85; }
.doc-form .totals { font-size: .9rem; }
@media (max-width: 1099px) { .doc-form { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 575px) {
    .item-row { grid-template-columns: minmax(0, 1fr) 34px; padding: .7rem; }
    .item-no { display: none; }
    .item-meta { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
    .item-amount { grid-column: 1 / -1; }
}

/* Names beside the icons of the collapsed sidebar */
.sidebar-tip { --bs-tooltip-bg: #0b1f3d; --bs-tooltip-opacity: 1; --bs-tooltip-padding-x: .75rem; --bs-tooltip-padding-y: .4rem; --bs-tooltip-font-size: .82rem; font-weight: 600; white-space: nowrap; }

/* The part of a settings page that was asked for, e.g. "Change PIN" */
.settings-block-focus { background: #f3f8ff; box-shadow: inset 3px 0 0 var(--brand); }

/* SAC code list */
.sac-code { font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap; }
.sac-table .sac-service { width: 62%; min-width: 220px; }

/* Profile photo */
.sidebar-avatar, .sidebar-avatar:hover { overflow: hidden; color: #03152d; text-decoration: none; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-photo { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; vertical-align: -6px; }
.profile-photo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.profile-photo { display: grid; place-items: center; width: 104px; height: 104px; flex-shrink: 0; overflow: hidden; border-radius: 50%; background: var(--brand); color: #fff; font-size: 2.4rem; font-weight: 700; box-shadow: 0 0 0 4px #e6eefb; }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }

/* Stamp and signature upload (Settings > Company) */
.sign-upload { margin-top: 1.15rem; }
.sign-preview { display: grid; place-items: center; height: 130px; margin-bottom: .6rem; padding: .6rem; border: 1px dashed #cfd6e4; border-radius: .5rem; background: #fff; }
.sign-preview img { max-width: 100%; max-height: 100%; }
.sign-preview span { color: #8a93a5; font-size: .82rem; text-align: center; }

/* Document numbers in lists stay on one line */
.table a[href^="invoice_view"], .table a[href^="quotation_view"], .table a[href^="advance_receipt"] { white-space: nowrap; }

/* Financial year selector */
.fy-note { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem; border-radius: 2rem; background: #eef4fc; color: var(--brand); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.fy-switch .dropdown-item.active { background: var(--brand); }
.fy-alert, .fy-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.fy-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .75rem; border: 1px solid rgba(0, 0, 0, .12); border-radius: 2rem; background: #fff; color: var(--ink); font-size: .82rem; font-weight: 600; text-decoration: none; }
.fy-chip:hover, .fy-chip:focus-visible { border-color: var(--brand); color: var(--brand); }
@media (max-width: 575px) { .fy-switch .fa-calendar-days { display: none; } .topbar { gap: .4rem; } .topbar .btn { padding-left: .55rem; padding-right: .55rem; } }

/* Delays for items that animate in one after another */
.stagger-0 { animation-delay: 0s; }
.stagger-1 { animation-delay: .08s; }
.stagger-2 { animation-delay: .16s; }
.stagger-3 { animation-delay: .24s; }
.stagger-4 { animation-delay: .32s; }

/* Sign-in background waves */
.wave-1 { fill: #1c6fd0; fill-opacity: .18; }
.wave-2 { fill: #3d9bf0; fill-opacity: .14; }
.wave-3 { fill: #fff; fill-opacity: .05; }

/* Column widths in the invoice and quotation item tables */
.col-date { width: 170px; }
.col-desc { min-width: 270px; }
.col-sac { width: 120px; }
.col-amount { width: 160px; }
.col-duration { min-width: 160px; }
.col-cost { min-width: 140px; }

/* Error page */
.error-box { max-width: 560px; margin: 80px auto; padding: 0 1rem; }

/* Copyright and developer credit */
.credit { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1rem; padding: .75rem 1.5rem; font-size: .8rem; color: #6f7889; background: #fff; border-top: 1px solid #e8ebf1; }
.credit a { font-weight: 600; }
.credit a:hover { text-decoration: underline; }
.credit .fa-heart { display: inline-block; color: #dc3545; }
.auth-card .credit { flex-direction: column; align-items: center; padding: 1rem 0 0; margin-top: 1rem; }

/* Sign in */
.login { position: relative; isolation: isolate; min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: linear-gradient(135deg, #020d1f 0%, #05264d 45%, #07468a 100%); }
.login-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.login-bg::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.5px); background-size: 28px 28px; -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%); }
.orb { position: absolute; border-radius: 50%; animation: drift 14s ease-in-out infinite alternate; }
.orb-1 { width: 55vmax; height: 55vmax; top: -25vmax; left: -18vmax; background: radial-gradient(circle, rgba(46, 139, 240, .55), transparent 65%); }
.orb-2 { width: 50vmax; height: 50vmax; bottom: -24vmax; right: -15vmax; background: radial-gradient(circle, rgba(34, 211, 238, .38), transparent 65%); animation-delay: -5s; }
.orb-3 { width: 30vmax; height: 30vmax; top: 5vmax; right: 8vmax; background: radial-gradient(circle, rgba(99, 102, 241, .35), transparent 65%); animation-delay: -9s; }
.ring { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); animation: drift 20s ease-in-out infinite alternate-reverse; }
.ring-1 { width: 420px; height: 420px; top: -120px; right: -100px; box-shadow: 0 0 0 60px rgba(255, 255, 255, .025); }
.ring-2 { width: 280px; height: 280px; bottom: 40px; left: -110px; box-shadow: 0 0 0 40px rgba(255, 255, 255, .025); }
.waves { position: absolute; left: 0; bottom: 0; width: 100%; height: 38vh; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(4vmax, 3vmax) scale(1.08); } }
.login-card { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 850px; border-radius: .9rem; overflow: hidden; border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 30px 80px rgba(0, 8, 24, .55); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; padding: 2.25rem 2.1rem; color: #fff; background: linear-gradient(150deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .04)); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.login-brand > :not(.login-shape) { position: relative; }
.login-brand h2 { font-size: 1.5rem; font-weight: 700; }
.login-brand p { color: rgba(255, 255, 255, .78); margin: 0; }
.login-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.login-brand li { display: flex; align-items: center; gap: .9rem; }
.login-brand li > span { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; border-radius: .5rem; background: rgba(255, 255, 255, .13); }
.login-brand li small { display: block; color: rgba(255, 255, 255, .7); }
.login-site { font-size: .85rem; color: rgba(255, 255, 255, .7); }
.login-shape { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.login-shape-1 { width: 280px; height: 280px; top: -110px; right: -90px; }
.login-shape-2 { width: 200px; height: 200px; bottom: -80px; right: 20px; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 2.25rem 2.5rem; background: #fff; }
.login-logo { width: 150px; margin: 0 0 1.35rem -3px; }
.login-panel h1 { font-size: 1.35rem; font-weight: 700; margin-bottom: .25rem; }
.login-panel .form-label { font-size: .875rem; font-weight: 600; }
.login-field { overflow: hidden; border: 1px solid #d5dbe6; border-radius: .45rem; background: #f8f9fc; transition: border-color .2s, box-shadow .2s, background .2s; }
.login-field:focus-within { border-color: var(--brand); background: #f6faff; box-shadow: inset 0 -2px 0 var(--brand); }
.login-field .form-control, .login-field .input-group-text { border: 0; background: transparent; padding-top: .6rem; padding-bottom: .6rem; }
.login-field .form-control:focus, .login-field:focus-within .input-group-text { background-color: transparent; box-shadow: none; }
/* Saved logins: stop the browser painting its own blue autofill background over the field */
.login-field input:-webkit-autofill { -webkit-text-fill-color: var(--ink); caret-color: var(--ink); transition: background-color 0s 600000s, color 0s 600000s !important; }
.login-field .input-group-text { color: #8791a3; }
.login-field:focus-within .input-group-text { color: var(--brand); }
.login-eye { cursor: pointer; border-radius: 0 .45rem .45rem 0 !important; }
.login-eye:hover { color: var(--brand) !important; }
.login-eye:focus-visible { outline: 2px solid var(--brand); outline-offset: -3px; }
.login-note { display: flex; gap: .6rem; margin-bottom: 1.1rem; padding: .65rem .8rem; border: 1px solid #cfe0f7; border-radius: .55rem; background: #eef5fe; color: #164a85; font-size: .82rem; line-height: 1.4; }
.login-note i { margin-top: .15rem; }
.pin-input:not(:placeholder-shown) { letter-spacing: .25rem; }

/* Message after an unsuccessful sign-in */
.login-alert { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.1rem; padding: .7rem .85rem; border: 1px solid #f6c9ce; border-radius: .55rem; background: #fff5f6; color: #842029; line-height: 1.35; }
.login-alert > span { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #dc3545; color: #fff; font-size: .85rem; }
.login-alert strong { display: block; font-size: .9rem; }
.login-alert p { margin: .1rem 0 0; font-size: .8rem; color: #9b4a52; }
.login-alert.paused { border-color: #ffe29a; background: #fffaeb; color: #6b4e00; }
.login-alert.paused > span { background: #f0a500; }
.login-alert.paused p { color: #8a6d1d; }
.login-field.has-error, .login-field.has-error:focus-within { border-color: #dc3545; background: #fff8f8; box-shadow: inset 0 -2px 0 #dc3545; }
.login-field.has-error .input-group-text, .login-field.has-error:focus-within .input-group-text { color: #dc3545; }
.login-submit { padding: .65rem; border-radius: .45rem; font-weight: 600; }
.login-submit i { transition: translate .2s; }
.login-submit:hover i { translate: 4px 0; }
.login-panel .credit { flex-direction: column; align-items: center; padding: 0; margin-top: 1.5rem; background: none; border: 0; }
@media (max-width: 767px) {
    .login { padding: 1rem; }
    .login-card { grid-template-columns: 1fr; max-width: 380px; border-radius: 1.1rem; }
    .login-brand { display: none; }
    .login-panel { padding: 1.5rem 1.25rem 1.1rem; }
    .login-logo { width: 120px; margin: 0 auto .9rem; }
    .login-panel h1 { font-size: 1.3rem; text-align: center; margin-bottom: 1rem; }
    .login-panel h1 + p { display: none; }
    .login-panel .form-label { font-size: .8rem; margin-bottom: .3rem; }
    .login-panel .alert { font-size: .85rem; padding: .6rem .75rem; }
    .login-panel .alert ul { padding-left: 1.1rem; }
    .login-alert { gap: .6rem; margin-bottom: .85rem; padding: .6rem .7rem; }
    .login-field { border-radius: .6rem; }
    .login-field .form-control, .login-field .input-group-text { padding-top: .5rem; padding-bottom: .5rem; }
    .login-field .input-group-text { padding-left: .75rem; padding-right: .75rem; }
    .login-field .form-control { padding-left: .15rem; padding-right: .25rem; }
    .login-field.mb-4 { margin-bottom: 1.1rem !important; }
    .login-eye { border-radius: 0 .6rem .6rem 0 !important; }
    .login-submit { padding: .55rem; border-radius: .6rem; }
    .login-panel .credit { gap: .15rem; margin-top: 1rem; font-size: .72rem; text-align: center; }
    .login-panel .credit-extra { display: none; }
}

/* A status badge that can be changed (status_menu in includes/functions.php) */
.status-pick { border: 0; cursor: pointer; }
.status-pick:hover { filter: brightness(1.1); }
.status-pick:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.status-item { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.status-item:disabled { color: var(--ink); background: #f1f4f9; }

/* Searchable drop-down (assets/js/search-select.js) */
.ss { position: relative; }
.ss-toggle { display: block; width: 100%; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.ss-panel { position: absolute; z-index: 1050; top: calc(100% + 4px); right: 0; left: 0; padding: .5rem; border: 1px solid #d9dee8; border-radius: .5rem; background: #fff; box-shadow: 0 12px 30px rgba(20, 35, 70, .18); font-size: 1rem; }
.ss-list { position: relative; max-height: 16rem; margin: .4rem 0 0; padding: 0; overflow-y: auto; list-style: none; }
.ss-option, .ss-none { padding: .45rem .65rem; border-radius: .35rem; }
.ss-option { cursor: pointer; }
.ss-option.active { background: var(--brand); color: #fff; }
.ss-option[aria-selected="true"] { font-weight: 700; }
.ss-empty, .ss-none { color: #7a8394; }
.ss-native { position: absolute; bottom: 0; left: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; }
.ss-message { margin-top: .25rem; color: #b02a37; font-size: .8rem; }
.card.ss-raised { position: relative; z-index: 20; }

/* Install */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, var(--brand-dark), var(--brand) 55%, #2f6fb8); }
.auth-card { width: 100%; max-width: 430px; }
.auth-logo { display: block; width: 210px; margin: 0 auto 1rem; }

@media (max-width: 767px) {
    .form-control, .form-select, .topbar-search input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .animate__animated, .orb, .ring { animation: none !important; }
    .flash-auto { animation-duration: .01s, .01s; }
}
