:root {
    --bg: #0f1724;
    --surface: #111827;
    --surface-2: #0b1320;
    --text: #e5e7eb;
    --text-2: #d4dce8;
    --muted: #94a3b8;
    --border: rgba(255,255,255,0.06);
    --border-2: rgba(255,255,255,0.08);
    --shadow: 0 10px 30px rgba(0,0,0,0.35);
    --btn-bg: rgba(255,255,255,0.04);
    --btn-bg-hover: rgba(255,255,255,0.06);
    --brand-logo: url('/assets/img/iconlogo.png');
    --danger: #ef4444;
    --success: #34d399;
    --success-hover: #2cc08e;
    --warning: #f59e0b;
    --primary: #2563eb;
    --primary-light: rgba(37,99,235,0.07);
    --bg-2: #1e293b;

    /* Notification icon colors */
    --notif-icon-invoice: #3b82f6;
    --notif-icon-proposal: #8b5cf6;
    --notif-icon-contract: #10b981;
    --notif-icon-project: #f59e0b;
    --notif-icon-client: #ec4899;
    --notif-icon-lead: #ef4444;
    --notif-icon-milestone: #8b5cf6;
    --notif-icon-default: #64748b;
    --notif-icon-bg-opacity: 0.15;
}

html[data-theme="light"] {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --border: rgba(15,23,42,0.10);
    --border-2: rgba(15,23,42,0.14);
    --shadow: 0 10px 30px rgba(2,6,23,0.10);
    --btn-bg: rgba(2,6,23,0.04);
    --btn-bg-hover: rgba(2,6,23,0.07);
    --primary: #2563eb;
    --primary-light: rgba(37,99,235,0.07);
    --bg-2: #f1f5f9;
    --danger: #dc2626;
    --success: #059669;
    --success-hover: #047857;
    --warning: #d97706;

    /* Notification icon colors — light */
    --notif-icon-invoice: #2563eb;
    --notif-icon-proposal: #7c3aed;
    --notif-icon-contract: #059669;
    --notif-icon-project: #d97706;
    --notif-icon-client: #db2777;
    --notif-icon-lead: #dc2626;
    --notif-icon-milestone: #7c3aed;
    --notif-icon-default: #475569;
    --notif-icon-bg-opacity: 0.12;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text) !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
}

a:hover {
    color: var(--text) !important;
    opacity: 0.8 !important;
}

a:focus {
    outline: 0px solid var(--border-2) !important;
    outline-offset: 0px !important;
}

.btn-primary a, .btn a, .btn-ghost a{
    color: #fff !important;

}


/* Ensure links are readable in all contexts */
.alert a,
.card a,
p a {
    color: var(--text) !important;
    text-decoration: none !important;
}

.alert a:hover,
.card a:hover,
p a:hover {
    opacity: 0.9 !important;
    text-decoration: none !important;
}

/* Links in alerts should be more visible */
.alert-error a {
    color: #fecdd3 !important;
}

html[data-theme="light"] .alert-error a,html[data-theme="dark"] .alert-error a {
    color: #991b1b !important;
}

.alert-success a {
    color: #bbf7d0 !important;
}

html[data-theme="light"] .alert-success a {
    color: #065f46 !important;
}

.site-header, .site-footer {
    background: var(--surface);
    color: var(--text);
    padding: 0px 24px;
    border-bottom: 1px solid var(--border);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.brand-logo {
    width: 140px;
    height: 44px;
    background-image: var(--brand-logo);
    background-repeat: no-repeat;
    background-size: 200% 100%;
    background-position: 0% 50%;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-family: 'Geometric Sans-Serif', sans-serif;
}

.brand-text:hover {
    text-decoration: none !important;
}

.brand-text:focus {
    text-decoration: none;
}

.brand-text:active {
    text-decoration: none   ;
}

/* logo.png contains two versions side-by-side:
   - left half = dark-theme logo
   - right half = light-theme logo */
html[data-theme="light"] .brand-logo {
    background-position: 100% 50%;
}

/* ---- Site Navigation ---- */
.site-header .site-nav {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: nowrap;
}

.site-nav .nav-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.site-nav .nav-group-secondary {
    padding-left: 14px;
    border-left: 1px solid var(--border);
    margin-left: auto;
}

.site-header .site-nav a:not(.nav-segment-btn):not(.nav-segment-home):not(.nav-subnav-item) {
    color: var(--text-2);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.site-header .site-nav a:not(.nav-segment-btn):not(.nav-segment-home):not(.nav-subnav-item):hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

/* Navigation Icon Buttons */
.site-header .site-nav .nav-icon-button {
    position: relative;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-2);
    font-size: 1.2rem;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
    text-decoration: none;
}

.site-header .site-nav .nav-icon-button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.site-header .site-nav .nav-icon-button i {
    display: inline-block;
}

.site-header .site-nav .nav-button-text {
    display: none;
}

/* Mobile page links — hidden on desktop */
.nav-mobile-pages {
    display: none;
}
.nav-mobile-segment {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
}
.nav-mobile-segment.active {
    display: flex;
}
.nav-mobile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: background 0.15s;
}
.nav-mobile-link:hover,
.nav-mobile-link.active {
    background: var(--btn-bg);
    color: var(--primary);
}
.nav-mobile-link .bi {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    color: var(--text-2);
}
.nav-mobile-link.active .bi {
    color: var(--primary);
}

/* ---- Segment Tab Links (shared for both <a> and <button>) ---- */
.site-header .nav-segment-home,
a.nav-segment-home,
button.nav-segment-home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    position: relative;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.site-header .nav-segment-home:hover,
a.nav-segment-home:hover,
button.nav-segment-home:hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

.site-header .nav-segment-home.active,
a.nav-segment-home.active,
button.nav-segment-home.active {
    color: var(--primary, #2563eb);
    background: none;
}

.site-header .nav-segment-home.active::after,
a.nav-segment-home.active::after,
button.nav-segment-home.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 6px;
    right: 6px;
    height: 2px;
    background: var(--primary, #2563eb);
    border-radius: 2px;
}

.site-header .nav-segment-btn,
a.nav-segment-btn,
button.nav-segment-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: inherit;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

a.nav-segment-btn:focus{
    outline:0 !important;
}
a.nav-segment-btn:focus-visible,
button.nav-segment-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.site-header .nav-segment-btn i,
a.nav-segment-btn i,
button.nav-segment-btn i {
    font-size: 0.95rem;
}

.site-header .nav-segment-btn:hover,
a.nav-segment-btn:hover,
button.nav-segment-btn:hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

.site-header .nav-segment-btn.active,
a.nav-segment-btn.active,
button.nav-segment-btn.active {
    color: var(--primary, #2563eb);
    font-weight: 600;
    background: none;
}

.site-header .nav-segment-btn.active::after,
a.nav-segment-btn.active::after,
button.nav-segment-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--primary, #2563eb);
    border-radius: 2px;
}

/* ---- Sub-Nav Ribbon (contextual items below header) ---- */
.nav-subnav-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    min-height: 38px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-subnav-bar::-webkit-scrollbar {
    height: 0;
}

.nav-subnav {
    display: none;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
}

.nav-subnav.active {
    display: flex;
}

.nav-subnav-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    position: relative;
}

.nav-subnav-item i {
    font-size: 0.95rem;
}

.nav-subnav-item:hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

.nav-subnav-item.active {
    color: var(--primary, #2563eb);
    font-weight: 600;
}

.nav-subnav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--primary, #2563eb);
    border-radius: 2px;
}

/* ---- Legacy Dropdown (kept for compatibility) ---- */
.nav-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    flex-direction: column;
    padding: 4px 0;
}

.nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-2);
    text-decoration: none;
    border-radius: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown a:hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

/* Inline search bar */
.nav-search-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--btn-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

.nav-search-inline:hover {
    border-color: var(--border-2);
    background: var(--btn-bg-hover);
}

.nav-search-inline i {
    color: var(--text-2);
    font-size: 0.85rem;
}

.nav-search-text {
    color: var(--text-2);
    font-size: 0.85rem;
}

.nav-search-kbd {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    font-family: inherit;
    line-height: 1;
}

/* Quick Actions bar */
.quick-actions-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.quick-actions-bar .quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--btn-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    cursor: pointer;
}

.quick-actions-bar .quick-action-btn:hover {
    background: var(--btn-bg-hover);
    border-color: var(--border-2);
    transform: translateY(-1px);
}

.quick-actions-bar .quick-action-btn i {
    font-size: 1rem;
    opacity: 0.8;
}

/* Advanced fields toggle (collapsible section) */
.advanced-fields-section {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.advanced-fields-section summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    color: var(--text-2);
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--btn-bg);
    transition: background 0.15s ease, color 0.15s ease;
    list-style: none;
    user-select: none;
}

.advanced-fields-section summary::-webkit-details-marker {
    display: none;
}

.advanced-fields-section summary::after {
    content: '\F286';
    font-family: 'bootstrap-icons';
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.advanced-fields-section[open] summary::after {
    transform: rotate(180deg);
}

.advanced-fields-section summary:hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

.advanced-fields-content {
    padding: 16px;
}

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    padding: 12px 0;
}

.pagination-bar .pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-2) !important;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
    border: 1px solid transparent;
}

.pagination-bar .pagination-link:hover {
    background: var(--btn-bg-hover);
    color: var(--text) !important;
    border-color: var(--border);
}

.pagination-bar .pagination-current {
    background: var(--primary);
    color: #fff !important;
    font-weight: 600;
    border-color: var(--primary);
}

.pagination-bar .pagination-current:hover {
    background: var(--primary);
    color: #fff !important;
}

.pagination-bar .pagination-ellipsis {
    color: var(--muted);
    padding: 4px 6px;
    cursor: default;
}

.pagination-bar .pagination-prev,
.pagination-bar .pagination-next {
    gap: 4px;
    font-weight: 500;
}

.pagination-info {
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 8px;
}

.nav-dropdown-wrapper.active .nav-dropdown {
    display: flex;
}

/* Nav dropdown responsive styles moved to responsive.css */

/* Breadcrumbs under main header - styles defined in .breadcrumbs-inner below */

.breadcrumbs-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-2);
}

.breadcrumbs-root {
    font-weight: 600;
    color: var(--text);
}

.breadcrumbs-root:hover {
    text-decoration: underline;
}

.breadcrumbs-separator {
    color: var(--text-2);
}

.breadcrumbs-current {
    color: var(--text-2);
}

/* Hamburger toggle - hidden by default, shown on mobile */
.nav-toggle {
    display: none;
    position: relative;
    width: 40px;
    height: 40px;
    border: 0px solid var(--border) !important;
    border-radius: 6px;
    background: none !important;
    padding: 0;
    box-sizing: border-box;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    z-index: 100;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--border-2);
    outline-offset: 2px;
}

.nav-toggle:hover {
    background: var(--btn-bg-hover);
}

.site-header.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.site-header.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.site-header.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile navigation */
/* Mobile navigation + desktop toggle styles moved to responsive.css */

.content {
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
    width: 100%;
    box-sizing: border-box;
}

/* Content responsive styles - consolidated in main media query block below */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.hero {
    padding: 28px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 28px;
    color: var(--text);
}

.hero .tagline {
    margin: 0;
    color: var(--text-2);
}

.features {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 18px;
}

.features article {
    padding: 16px;
}

.features h2 {
    margin-top: 0;
    color: var(--text);
}

.features p {
    margin-bottom: 0;
    color: var(--text-2);
}

.auth-card {
    max-width: 440px;
    margin: 40px auto;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
}

/* Auth card responsive styles moved to responsive.css */

.auth-card form {
    display: grid;
    gap: 12px;
}

.auth-card label {
    display: grid;
    gap: 6px;
    color: var(--text-2);
    font-size: 14px;
}

.auth-card input,
.form-input,
.auth-card textarea,
.auth-card select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.auth-card input:focus,
.form-input:focus,
.auth-card textarea:focus,
.auth-card select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border);
    background: var(--surface);
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--border-2);
    border-radius: 4px;
    background: var(--surface-2);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease;
    margin: 8px;
    vertical-align: middle;
}

input[type="checkbox"]:checked {
    background: var(--text);
    border-color: var(--text);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 7px;
    height: 13px;
    border: solid var(--surface);
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.auth-card button {
    padding: 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.auth-card button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(37,99,235,0.35);
}

.auth-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-card a {
    color: var(--text-2);
    text-decoration: none;
}

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid transparent;
}

.alert-error {
    background: rgba(248, 113, 113, 0.12);
    color: #fecdd3;
    border-color: rgba(248, 113, 113, 0.3);
}

html[data-theme="light"] .alert-error {
    background: rgba(248, 113, 113, 0.15);
    color: #991b1b;
    border-color: rgba(248, 113, 113, 0.4);
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.25);
}

html[data-theme="light"] .alert-success {
    background: rgba(52, 211, 153, 0.15);
    color: #065f46;
    border-color: rgba(52, 211, 153, 0.35);
}

.alert-info {
    background: rgba(37, 99, 235, 0.12);
    color: #93c5fd;
    border-color: rgba(37, 99, 235, 0.3);
}

html[data-theme="light"] .alert-info {
    background: rgba(37, 99, 235, 0.15);
    color: #1e40af;
    border-color: rgba(37, 99, 235, 0.4);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.3);
}

html[data-theme="light"] .alert-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #92400e;
    border-color: rgba(251, 191, 36, 0.4);
}

/* Status buttons for invoice actions */
.btn-status-draft {
    background: rgba(148, 163, 184, 0.15) !important;
    color: #cbd5e1 !important;
    border-color: rgba(148, 163, 184, 0.3) !important;
}

html[data-theme="light"] .btn-status-draft {
    background: rgba(148, 163, 184, 0.2) !important;
    color: #475569 !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}

.btn-status-available,
.btn-status-sent {
    background: rgba(37, 99, 235, 0.15) !important;
    color: #93c5fd !important;
    border-color: rgba(37, 99, 235, 0.3) !important;
}

html[data-theme="light"] .btn-status-available,
html[data-theme="light"] .btn-status-sent {
    background: rgba(37, 99, 235, 0.2) !important;
    color: #1e40af !important;
    border-color: rgba(37, 99, 235, 0.4) !important;
}

.btn-status-paid {
    background: rgba(52, 211, 153, 0.15) !important;
    color: #bbf7d0 !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
}

html[data-theme="light"] .btn-status-paid {
    background: rgba(52, 211, 153, 0.2) !important;
    color: #065f46 !important;
    border-color: rgba(52, 211, 153, 0.4) !important;
}

.btn-status-overdue {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fde68a !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

html[data-theme="light"] .btn-status-overdue {
    background: rgba(251, 191, 36, 0.2) !important;
    color: #92400e !important;
    border-color: rgba(251, 191, 36, 0.4) !important;
}

.btn-status-void {
    background: rgba(248, 113, 113, 0.15) !important;
    color: #fecdd3 !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
}

html[data-theme="light"] .btn-status-void {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #991b1b !important;
    border-color: rgba(248, 113, 113, 0.4) !important;
}

.btn-status-draft:hover,
.btn-status-available:hover,
.btn-status-sent:hover,
.btn-status-paid:hover,
.btn-status-overdue:hover,
.btn-status-void:hover {
    opacity: 0.9 !important;
    transform: translateY(-1px);
}

.site-footer {
    margin-top: 10px;
    padding: 32px 0px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-nav {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.footer-nav a {
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.footer-nav a:hover {
    color: var(--text);
    background: var(--btn-bg);
}

.footer-copyright {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

.footer-lang {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    padding: 6px 0;
}
.footer-lang a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease;
}
.footer-lang a:hover {
    color: var(--text);
}
.footer-lang strong {
    color: var(--text);
}

/* Footer responsive styles moved to responsive.css */

/* Buttons - Bootstrap overrides to preserve theme colors */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--border-2) !important;
    background: var(--btn-bg) !important;
    color: var(--text) !important;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    min-height: 44px; /* Touch target size */
}

/* Button responsive styles moved to responsive.css */

html[data-theme="light"] .btn-primary {
    border: none !important;
    background: #2563eb !important;
    color: #fff !important;
}



.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
    color: #fff !important;
    border: none !important;
}

.btn-ghost {
    background: transparent !important;
    border-color: var(--border-2) !important;
    font-weight: 600 !important;
}

.btn:hover,
.btn:focus {
    background: var(--btn-bg-hover) !important;
    color: var(--text) !important;
}

.btn-ghost:hover,
.btn-ghost:focus {
    background: var(--btn-bg-hover) !important;
}

/* Form buttons */
form button[type="submit"],
form input[type="submit"],
form button:not([type]),
button:not(.btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid var(--border-2);
    background: var(--btn-bg);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

form button[type="submit"]:hover,
form input[type="submit"]:hover,
form button:not([type]):hover,
button:not(.btn):hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

/* Ensure buttons are visible */
button.btn, a.btn, input.btn[type="submit"], input.btn[type="button"] {
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-flex !important;
    text-decoration: none !important;
}

/* Button size variants */
.btn-sm {
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
    min-height: 44px !important;
    gap: 6px !important;
}

.btn-xs {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
    min-height: 36px !important;
    gap: 4px !important;
}

/* Button color variants */
.btn-danger {
    color: var(--danger, #ef4444) !important;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger, #ef4444) !important;
}

.btn-success {
    background: var(--success, #34d399) !important;
    color: #fff !important;
    border-color: var(--success, #34d399) !important;
}

.btn-success:hover {
    background: var(--success-hover, #2cc08e) !important;
    color: #fff !important;
}

/* Theme toggle button (in header) */
.theme-toggle {
    padding: 8px 10px !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-2) !important;
    background: var(--btn-bg) !important;
    color: var(--text) !important;
    cursor: pointer;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--btn-bg-hover) !important;
    color: var(--text) !important;
}

/* Theme icon visibility */
.theme-icon-light,
.theme-icon-dark {
    font-size: 1.1rem;
}

html[data-theme="light"] .theme-icon-light {
    display: inline-block !important;
}

html[data-theme="light"] .theme-icon-dark {
    display: none !important;
}

html[data-theme="dark"] .theme-icon-light {
    display: none !important;
}

html[data-theme="dark"] .theme-icon-dark {
    display: inline-block !important;
}

/* Table styling for theme consistency */
table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    color: var(--text-2);
    font-weight: 600;
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-2);
    color: var(--text);
}

table tbody tr:hover {
    background: var(--btn-bg);
}

/* Table container utility class */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table-container table {
    min-width: 100%;
}

/* Form elements theme consistency */
label {
    color: var(--text-2);
    font-size: 14px;
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text) !important;
    font-weight: 700;
    margin-top: 0;
}

/* Ensure headings are readable in all contexts with higher specificity */
section h1, section h2, section h3, section h4, section h5, section h6,
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6,
article h1, article h2, article h3, article h4, article h5, article h6,
div h1, div h2, div h3, div h4, div h5, div h6 {
    color: var(--text) !important;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text) !important;
}

/* Force h2 readability - highest specificity */
h2,
* h2,
* > h2,
section h2,
.card h2,
article h2,
div h2 {
    color: var(--text) !important;
}

/* Responsive form, grid, and flex improvements - consolidated in main media query block below */

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text) !important;
}

h4, h5, h6 {
    color: var(--text) !important;
}

p {
    color: var(--text-2);
    line-height: 1.6;
}

/* Improved spacing and layout */
section.card {
    margin-bottom: 24px;
}

/* Card hover effect */
.card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

html[data-theme="light"] .card:hover {
    box-shadow: 0 12px 40px rgba(2,6,23,0.12);
}

/* Main responsive styles moved to responsive.css */

/* Removed duplicate table styling - handled above with responsive improvements */

/* Admin styles moved to admin.css (conditionally loaded) */

/* Removed duplicate heading rules - handled above with !important */

@media (max-width: 520px) {
    .brand-logo {
        width: 120px;
        height: 40px;
    }
}

/* Removed duplicate - handled above */

/* Home */
.home-landing-hero {
    padding: 48px 32px;
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr);
    gap: 32px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(15,23,42,0.95));
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

html[data-theme="light"] .home-landing-hero {
    background: linear-gradient(135deg, #e0edff, #f8fafc);
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}

.home-landing-hero__actions {
    position: absolute;
    top: 18px;
    right: 22px;
    display: flex;
    gap: 8px;
}

.home-landing-hero__body {
    display: contents;
}

.home-landing-hero__copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-landing-title {
    margin: 0 0 16px 0;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    color: #f8fafc;
    letter-spacing: -0.5px;
}

html[data-theme="light"] .home-landing-title {
    color: #0f172a;
}

.home-landing-tagline {
    margin: 0 0 24px 0;
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-2);
    font-weight: 400;
}

.hero-highlights {
    margin: 0;
    padding-left: 0;
    list-style: none;
    line-height: 1.8;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hero-highlights li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 1rem;
}

.hero-highlights li span {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.home-landing-hero__pricing {
    max-width: 340px;
    justify-self: end;
}

.pricing-options {
    padding: 32px 24px;
    text-align: center;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
}

html[data-theme="light"] .pricing-options {
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.pricing-options__price {
    margin-bottom: 6px;
}

.pricing-options__amount {
    font-size: 3rem;
    font-weight: 800;
    color: #34d399;
    line-height: 1;
}

.pricing-options__period {
    font-size: 0.9rem;
    color: var(--muted);
}

.pricing-options__plan {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text);
}

.pricing-options__list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
    font-size: 0.95rem;
    color: var(--text-2);
}

.pricing-options__cta {
    margin-top: 4px;
    margin-bottom: 4px;
}

.pricing-options__hint {
    display: block;
    margin-top: 2px;
    font-size: 0.9rem;
    color: var(--muted);
}

.pricing-options__divider {
    margin: 12px 0;
    border: none;
    border-top: 1px solid var(--border);
}

.pricing-options__footer {
    font-size: 0.95rem;
}

.pricing-options__footer-title {
    color: #1d4ed8;
}

.pricing-options__footer-copy {
    color: var(--muted);
}

.home-landing-hero__image {
    position: absolute;
    bottom: -40px;
    left: 32px;
    width: 300px;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(23,78,166,0.4);
    border: 4px solid #ffffff;
    transition: transform 0.3s ease;
}

.home-landing-hero__image:hover {
    transform: translateY(-8px);
}

html[data-theme="dark"] .home-landing-hero__image {
    border-color: #0b1320;
}

@media (max-width: 900px) {
    .home-landing-hero {
        grid-template-columns: minmax(0, 1fr);
        padding: 32px 24px 48px;
        border-radius: 16px;
    }
    .home-landing-hero__actions {
        position: static;
        justify-content: flex-end;
        margin-bottom: 20px;
    }
    .home-landing-hero__image {
        position: static;
        width: 100%;
        margin-top: 24px;
        border-radius: 12px;
    }
    .home-landing-title {
        font-size: 28px;
    }
    .icon-bar {
        flex-wrap: wrap;
        padding: 32px 24px;
        gap: 16px;
    }
    .icon-bar__item {
        min-width: auto;
        flex: 1 1 calc(50% - 8px);
    }
    .cta-section {
        padding: 40px 24px;
    }
    .cta-section h2 {
        font-size: 1.5rem;
    }
}

.icon-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 40px 32px;
    margin: 40px 0;
    background: var(--surface);
    border-radius: 16px;
    gap: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

html[data-theme="light"] .icon-bar {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.icon-bar__item {
    text-align: center;
    min-width: 100px;
    padding: 16px;
    border-radius: 12px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.icon-bar__item:hover {
    transform: translateY(-4px);
    background: var(--surface-2);
}

.icon-bar__icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 8px;
}

.icon-bar-label {
    display: block;
    margin-top: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

.home-landing-grid {
    margin: 40px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.feature-card {
    padding: 32px 24px;
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.feature-card h2 {
    margin: 0 0 16px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.feature-card p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-2);
}

.busy-testimonials {
    margin: 26px 0 20px;
}

.testimonials__list {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.testimonials__list .testimonial {
    min-width: 230px;
}

.testimonial__author-inline {
    margin-top: 6px;
    color: var(--text-2);
    font-size: 0.9rem;
}

.cta-section {
    text-align: center;
    padding: 60px 32px;
    margin: 60px 0 40px;
    background: linear-gradient(135deg, rgba(37,99,235,0.1), rgba(15,23,42,0.8));
    border-radius: 20px;
    border: 1px solid var(--border);
}

html[data-theme="light"] .cta-section {
    background: linear-gradient(135deg, #e0edff, #f8fafc);
}

.cta-section h2 {
    margin: 0 0 24px 0;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.3;
}

.cta-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 16px 40px;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(52,211,153,0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(52,211,153,0.5);
}

.cta-section__sub {
    margin-top: 20px;
    font-size: 1.05rem;
    color: var(--text-2);
}

.cta-section__link {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cta-section__link:hover {
    color: #1d4ed8;
}

.cta-section__meta {
    margin-top: 20px;
    font-size: 0.95rem;
    color: var(--muted);
    letter-spacing: 0.3px;
}

.home-hero {
    padding: 28px;
    display: grid;
    gap: 18px;
    grid-template-columns: 1.4fr 0.9fr;
    align-items: start;
}

.home-hero .pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.2px;
    background: rgba(255,255,255,0.06);
    color: #cbd5e1;
}

.pill-success {
    background: rgba(52, 211, 153, 0.16);
    color: #bbf7d0;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.home-hero__content h1 {
    margin: 0 0 10px;
    font-size: 30px;
    color: #f8fafc;
}

.home-hero__tagline {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.6;
}

.home-hero__actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.home-hero__note {
    margin-top: 12px;
    color: #94a3b8;
    font-size: 14px;
}

.home-icon-row {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.home-icon-row__item {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    color: #cbd5e1;
    font-size: 14px;
}

.home-icon-row__item .emoji {
    font-size: 16px;
}

.home-hero__aside {
    display: grid;
    gap: 12px;
}

.home-metric {
    padding: 14px;
    background: rgba(255,255,255,0.02);
}

.home-metric__label {
    color: #9ca3af;
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.home-metric__value {
    color: #f8fafc;
    font-weight: 700;
    margin-top: 6px;
}

.home-metric__hint {
    margin-top: 4px;
    color: #cbd5e1;
    font-size: 13px;
}

.home-pricing {
    padding: 16px;
    text-align: center;
    background: linear-gradient(140deg, rgba(37,99,235,0.12), rgba(52,211,153,0.08));
}

.home-pricing__price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    color: #f8fafc;
}

.home-pricing__amount {
    font-size: 32px;
    font-weight: 800;
}

.home-pricing__period {
    color: #cbd5e1;
}

.home-pricing__plan {
    margin-top: 8px;
    font-weight: 700;
    color: #e5e7eb;
}

.home-pricing__list {
    list-style: none;
    padding: 0;
    margin: 12px 0 14px;
    color: #d1d5db;
    display: grid;
    gap: 6px;
}

.home-pricing__hint {
    margin: 10px 0 0;
    color: #cbd5e1;
    font-size: 13px;
}

.home-grid {
    margin-top: 18px;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    padding: 18px;
}

.home-feature {
    padding: 16px;
}

.home-feature h2 {
    margin: 0 0 8px;
    color: var(--text);
}

.home-feature p {
    margin: 0;
    color: var(--text-2);
}

.home-cta {
    margin-top: 18px;
    padding: 18px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.home-cta__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.home-cta h2 {
    margin: 0 0 6px;
    color: var(--text);
}

.home-cta p {
    margin: 0;
    color: var(--text-2);
}

@media (max-width: 900px) {
    .home-hero {
        grid-template-columns: 1fr;
    }
    .home-cta {
        flex-direction: column;
        align-items: flex-start;
    }
}

.home-testimonials {
    margin-top: 18px;
    padding: 18px;
    display: grid;
    gap: 16px;
    background: rgba(255,255,255,0.02);
}

.home-testimonials__header h2 {
    margin: 4px 0 6px;
    color: var(--text);
}

.home-testimonials__list {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.testimonial {
    padding: 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.05);
}

.testimonial__rating {
    color: #fbbf24;
    font-size: 16px;
}

.testimonial__quote {
    margin: 6px 0;
    color: var(--text);
    line-height: 1.5;
}

.testimonial__author {
    color: var(--text-2);
    font-size: 13px;
}

/* Support Ticket Styles */
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.ticket-header-content {
    flex: 1;
    min-width: 0;
}

.ticket-header-title {
    margin: 0 0 8px 0;
}

.ticket-header-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.ticket-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.ticket-category {
    color: var(--text-2);
    font-size: 0.9rem;
}

.ticket-workspace-info {
    margin-top: 8px;
    color: var(--text-2);
    font-size: 0.9rem;
}

.ticket-conversation {
    margin-top: 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
}

.ticket-conversation-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.ticket-conversation-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
}

.ticket-messages-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg);
}

.ticket-messages-empty {
    text-align: center;
    color: var(--text-2);
    padding: 40px;
}

.ticket-message {
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
}

.ticket-message.ticket-message-agent {
    flex-direction: row-reverse;
}

.ticket-message-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    background: var(--text);
}

.ticket-message-avatar.ticket-message-avatar-agent {
    background: #8b5cf6;
}

.ticket-message-content {

    min-width: 0;
}

.ticket-message-content.ticket-message-content-agent {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ticket-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ticket-message-header.ticket-message-header-agent {
    flex-direction: row-reverse;
}

.ticket-message-name {
    color: var(--text);
}

.ticket-message-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ticket-message-badge-agent {
    background: #8b5cf622;
    color: #8b5cf6;
}

.ticket-message-badge-internal {
    background: #8b5cf622;
    color: #8b5cf6;
}

.ticket-message-badge-internal-note {
    background: #ef444422;
    color: #ef4444;
}

.ticket-message-badge-agent-user {
    background: #94a3b822;
    color: #94a3b8;
}

.ticket-message-time {
    color: var(--text-2);
    font-size: 0.85rem;
}

.ticket-message-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.ticket-message-bubble {
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text);

    word-wrap: break-word;
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
}

.ticket-message-bubble.ticket-message-bubble-agent {
    background: #8b5cf611;
    border: 1px solid #8b5cf6;
}

.ticket-message-edit-link {
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--text-2);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.ticket-message-delete-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--danger);
    background: none;
    border: 1px solid var(--danger);
    border-radius: 4px;
    cursor: pointer;
}

.ticket-message-edit-form {
    margin: 0;
    width: 100%;
}

.ticket-message-edit-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    resize: vertical;
}

.ticket-message-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.ticket-message-edit-btn {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.ticket-message-form {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.ticket-message-form-closed {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    text-align: center;
    color: var(--text-2);
}

.ticket-message-form-closed p {
    margin: 0;
}

.ticket-message-form-row {
    display: flex;
    gap: 8px;
}

.ticket-message-form-row-column {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.ticket-message-textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    resize: vertical;
}

.ticket-message-form-options {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ticket-message-form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-2);
    font-size: 0.9rem;
}

.ticket-message-form-checkbox {
    margin: 0;
    cursor: pointer;
}

.ticket-info {
    margin-top: 20px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ticket-info-title {
    margin: 0 0 12px 0;
    color: var(--text);
    font-size: 1rem;
}

.ticket-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    color: var(--text-2);
    font-size: 0.9rem;
}

.ticket-info-label {
    color: var(--text);
}

.ticket-settings {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ticket-settings-title {
    margin: 0 0 12px 0;
    color: var(--text);
    font-size: 1rem;
}

.ticket-settings-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.ticket-settings-field {
    display: flex;
    align-items: flex-end;
}

.ticket-settings-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-2);
    font-size: 0.9rem;
}

.ticket-settings-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

/* Notification Styles */
.notification-wrapper {
    position: relative;
    display: inline-block;
}

.notification-bell {
    position: relative !important;
    border: none !important;
    padding: 8px !important;
    cursor: pointer;
    color: var(--text-2) !important;
    font-size: 1.2rem;
    background: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    transition: background 0.2s !important;
}

.notification-bell:hover {
    background: var(--surface-2) !important;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 390px;
    max-width: calc(100vw - 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 500px;
    display: none;
    flex-direction: column;
}

.notification-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-dropdown-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.notification-mark-all-read {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.notification-mark-all-read:hover {
    background: var(--surface-2);
    color: var(--text);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-loading,
.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-2);
    font-size: 0.9rem;
}

.notifications-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.notification-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--surface-2);
}

.notification-item.unread {
    background: var(--surface-2);
    border-left: 3px solid var(--primary, #2563eb);
}

.notification-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

/* Notification icon colors - theme-aware — merged into main :root / light blocks */
/* (notif-icon variables are in the main :root and html[data-theme="light"] blocks at top of file) */

/* Set icon colors and backgrounds using CSS variables and data attributes */
.notification-item-icon[data-icon-color-var="--notif-icon-invoice"] {
    color: var(--notif-icon-invoice);
    background: rgba(59, 130, 246, var(--notif-icon-bg-opacity, 0.15));
}

.notification-item-icon[data-icon-color-var="--notif-icon-proposal"] {
    color: var(--notif-icon-proposal);
    background: rgba(139, 92, 246, var(--notif-icon-bg-opacity, 0.15));
}

.notification-item-icon[data-icon-color-var="--notif-icon-contract"] {
    color: var(--notif-icon-contract);
    background: rgba(16, 185, 129, var(--notif-icon-bg-opacity, 0.15));
}

.notification-item-icon[data-icon-color-var="--notif-icon-project"] {
    color: var(--notif-icon-project);
    background: rgba(245, 158, 11, var(--notif-icon-bg-opacity, 0.15));
}

.notification-item-icon[data-icon-color-var="--notif-icon-client"] {
    color: var(--notif-icon-client);
    background: rgba(236, 72, 153, var(--notif-icon-bg-opacity, 0.15));
}

.notification-item-icon[data-icon-color-var="--notif-icon-lead"] {
    color: var(--notif-icon-lead);
    background: rgba(239, 68, 68, var(--notif-icon-bg-opacity, 0.15));
}

.notification-item-icon[data-icon-color-var="--notif-icon-milestone"] {
    color: var(--notif-icon-milestone);
    background: rgba(139, 92, 246, var(--notif-icon-bg-opacity, 0.15));
}

.notification-item-icon[data-icon-color-var="--notif-icon-default"] {
    color: var(--notif-icon-default);
    background: rgba(100, 116, 139, var(--notif-icon-bg-opacity, 0.15));
}

/* Light theme adjustments for better contrast */
html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-invoice"] {
    background: rgba(37, 99, 235, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-proposal"] {
    background: rgba(124, 58, 237, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-contract"] {
    background: rgba(5, 150, 105, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-project"] {
    background: rgba(217, 119, 6, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-client"] {
    background: rgba(219, 39, 119, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-lead"] {
    background: rgba(220, 38, 38, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-milestone"] {
    background: rgba(124, 58, 237, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-milestone"] {
    background: rgba(124, 58, 237, var(--notif-icon-bg-opacity, 0.12));
}

html[data-theme="light"] .notification-item-icon[data-icon-color-var="--notif-icon-default"] {
    background: rgba(71, 85, 105, var(--notif-icon-bg-opacity, 0.12));
}

.notification-item-message {
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 6px;
}

.notification-item-time {
    color: var(--text-2);
    font-size: 0.7rem;
}

.notification-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
    margin-left: auto;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-icon:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.notification-item-delete {
    background: none;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.notification-item-delete:hover {
    background: var(--surface-2);
    color: var(--danger);
}

.notification-dropdown-footer {
    padding: 0px 16px 0px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.notification-view-all {
    color: var(--text-2);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.notification-view-all:hover {
    color: var(--text);
    text-decoration: underline;
}

/* Notification responsive styles moved to responsive.css */

/* ============================================
   Common Page Layout Styles
   Used across Projects, Proposals, Invoices, Contracts, Milestones, Leads
   ============================================ */

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-header-content h1 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-header-content {
    width: 100%;
}

.page-header-content p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.95rem;
}

/* Page header action buttons (top-right) */
.page-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    float: right;
}

/* Bulk actions toolbar */
.bulk-toolbar {
    display: none;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 8px;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Activity timeline */
.activity-item {
    display: flex;
    gap: 6px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-2);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

/* Progress bar */
.progress-track {
    background: var(--btn-bg);
    border-radius: 6px;
    height: 12px;
    overflow: hidden;
    flex: 1;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s;
}

/* Checklist items */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-2);
}

.checklist-item:last-child {
    border-bottom: none;
}

/* Statistics Cards */
.page-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.stat-card {
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 120px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-2);
    margin-top: 4px;
}

/* Table Wrapper and Styles (legacy — kept for detail pages) */
.page-table-wrapper {
    margin-top: 24px;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.page-table {
    width: 100%;
    border-collapse: collapse;

}

.page-table thead {
    background: var(--surface-2);
}

.page-table th {
    padding: 16px;
    text-align: left;
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.page-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-2);
}

.page-table tbody tr:hover {
    background: var(--surface-2);
}

.page-table tbody tr:last-child {
    border-bottom: none;
}

.page-table td {
    padding: 16px;
    vertical-align: middle;
}

/* ============================================
   Card List — Replaces tables on list pages
   ============================================ */
.list-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.list-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: var(--text);
    position: relative;
}

.list-card:hover {
    border-color: var(--border-2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

html[data-theme="light"] .list-card:hover {
    box-shadow: 0 4px 16px rgba(2,6,23,0.06);
}

/* Clickable card variant */
a.list-card {
    cursor: pointer;
}

/* Bulk-select checkbox */
.list-card-check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.list-card-check input[type="checkbox"] {

    cursor: pointer;
    accent-color: var(--primary, #2563eb);
}

/* Main content area */
.list-card-body {
    flex: 1;
    min-width: 0;
}

.list-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    text-decoration: none;
    display: inline;
    transition: color 0.15s;
}

.list-card-title:hover {
    color: var(--primary, #2563eb);
}

a.list-card .list-card-title {
    color: var(--text);
}

a.list-card:hover .list-card-title {
    color: var(--primary, #2563eb);
}

.list-card-id {
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: 8px;
    font-weight: 500;
}

.list-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-2);
}

.list-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.list-card-meta-item i {
    font-size: 0.85rem;
    color: var(--muted);
    flex-shrink: 0;
}

.list-card-meta-item a {
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.15s;
}

.list-card-meta-item a:hover {
    color: var(--primary, #2563eb);
}

/* Right-side area: status + amount + actions */
.list-card-end {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.list-card-amount {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    text-align: right;
}

.list-card-amount-sub {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 400;
}

.list-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.list-card-actions .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    min-height: 32px;
}

.list-card-actions form {
    display: inline;
}

/* Hover reveal for actions (desktop) */
@media (min-width: 769px) {
    .list-card-actions {
        opacity: 0;
        transition: opacity 0.15s;
    }
    .list-card:hover .list-card-actions {
        opacity: 1;
    }
}

/* ---- Responsive: list cards on mobile ---- */
@media (max-width: 768px) {
    .list-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px 16px;
    }

    .list-card-check {
        position: absolute;
        top: 14px;
        right: 16px;
    }

    .list-card-end {
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .list-card-amount {
        font-size: 0.95rem;
    }

    .list-card-actions {
        opacity: 1;
        width: 100%;
    }

    .list-card-actions .btn {
        flex: 1;
        text-align: center;
    }

    .list-card-meta {
        gap: 4px 10px;
    }
}

@media (max-width: 480px) {
    .list-card {
        padding: 12px;
        border-radius: 10px;
    }

    .list-card-title {
        font-size: 0.9rem;
    }

    .list-card-meta {
        font-size: 0.78rem;
    }

    .list-card-amount {
        font-size: 0.9rem;
    }
}

/* Item Styles */
.item-number {
    color: var(--text-2);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
}

.item-number a,
a.item-number {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.item-number a:hover,
a.item-number:hover {
    color: var(--primary, #2563eb);
}

.item-name-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease;
    display: inline-block;
}

.item-name-link:hover {
    color: var(--primary, #2563eb);
}

.item-secondary {
    color: var(--text-2);
    font-size: 0.9rem;
}

.item-secondary a {
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.2s ease;
}

.item-secondary a:hover {
    color: var(--primary, #2563eb);
}

.item-meta {
    color: var(--text-2);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge-sm {
    font-size: 0.75rem;
    padding: 2px 8px;
}

/* Actions */
.item-actions {
    display: flex;
    gap: 8px;
}

/* Empty State */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
}

.empty-state p {
    margin: 0 0 20px 0;
    color: var(--text-2);
    font-size: 0.95rem;
}

/* Value Displays */
.money-value {
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
}

.effort-value {
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Date Display */
.due-date {
    color: var(--text-2);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Check Marks */
.check-yes {
    color: #10b981;
    font-weight: 600;
}

.check-no {
    color: var(--text-2);
}

/* Search and Filter Bar */
.search-filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.search-filter-bar .search-input-wrapper {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-filter-bar .search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-2);
    pointer-events: none;
}

.search-filter-bar input[type="search"],
.search-filter-bar input[type="text"] {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.search-filter-bar input[type="search"]:focus,
.search-filter-bar input[type="text"]:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
}

.search-filter-bar .filter-select-wrapper {
    min-width: 150px;
}

.search-filter-bar select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.search-filter-bar select:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
}

.search-filter-bar .btn-filter {
    padding: 10px 16px;
    background: var(--btn-bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px;
    color: var(--text-2) !important;
    font-size: 0.9rem;
    font-weight: normal;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: unset;
    cursor: pointer;
}

.search-filter-bar .btn-filter:hover {
    background: var(--surface) !important;
    color: var(--text) !important;
}

.search-filter-bar .clear-filters {
    padding: 10px 16px;
    background: var(--btn-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-filter-bar .clear-filters:hover {
    background: var(--surface);
    color: var(--text);
}

.dashboard-billing-warning-btn {
    border: 1px solid var(--border-2) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
}

.dashboard-billing-warning-btn:hover {
    background: var(--surface) !important;
    color: var(--text) !important;
    opacity: 0.9 !important;
}

/* Page layout responsive styles moved to responsive.css */

/* Profile & Settings Styles */


.profile-header {
    margin-bottom: 32px;
}

.profile-header h1 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.profile-header p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.95rem;
}

.profile-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;

    -webkit-overflow-scrolling: touch;
}

.profile-tab {
    padding: 12px 25px;
    text-decoration: none !important;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 400;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.profile-tab:hover {
    color: var(--text);
    opacity:0.8 !important;
    border-radius: 8px 8px 0 0;
}

.profile-tab.active {
    color: var(--text);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Mobile dropdown for profile tabs */
.profile-tabs-mobile {
    display: none;
    margin-bottom: 24px;
}

.profile-tab-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-tab-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 99,102,241), 0.15);
}

.profile-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.profile-section h2 {
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.profile-section h3 {
    margin: 24px 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ============================================
   Form Input Utility Classes
   ============================================ */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--muted);
}

.form-input-sm {
    padding: 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--surface-2);
}

.form-input-readonly {
    background: var(--surface-2);
    cursor: not-allowed;
}

.form-checkbox {
    width: auto;
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid.cols-3 {
        grid-template-columns: 1fr;
    }
}

.form-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.line-item-grid {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
    align-items: end;
}

/* Validation states */
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(34, 211, 153, 0.1);
}

.form-error {
    display: none;
    color: var(--danger);
    font-size: 0.82rem;
    margin-top: 4px;
}

.form-input.is-invalid ~ .form-error,
.form-select.is-invalid ~ .form-error,
.form-textarea.is-invalid ~ .form-error {
    display: block;
}

/* Skip to content link (accessibility) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 12px 24px;
    background: var(--primary);
    color: #fff !important;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none !important;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:disabled {
    background: var(--surface-2);
    color: var(--text-2);
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-2);
    font-size: 0.85rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: background 0.2s ease;
}

.checkbox-group:hover {
    background: var(--surface);
}

.checkbox-group input[type="checkbox"] {
    margin-top: 2px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.checkbox-group label {
    flex: 1;
    margin: 0;
    cursor: pointer;
    font-weight: 400;
}

.checkbox-group .checkbox-description {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-2);
    font-weight: 400;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.divider {
    margin: 32px 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* Profile responsive styles moved to responsive.css */

/* Dashboard Styles */
.dashboard-billing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-billing-card {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-left: 4px solid var(--border);
    transition: all 0.2s ease;
}

.dashboard-billing-card:hover {
    border-left-color: var(--primary, #2563eb);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dashboard-billing-card-title {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-2);
}

.dashboard-billing-card-value {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.dashboard-billing-card-subvalue {
    font-size: 1.2em;
    color: var(--text-2);
}

.dashboard-billing-card-subvalue-small {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 4px;
    color: var(--text-2);
}

/* #25 — Semantic color utility classes (avoid hardcoded hex) */
.border-accent-blue    { border-left-color: var(--accent-blue, #3b82f6)   !important; }
.border-accent-green   { border-left-color: var(--accent-green, #34d399)  !important; }
.border-accent-amber   { border-left-color: var(--accent-amber, #f59e0b)  !important; }
.border-accent-purple  { border-left-color: var(--accent-purple, #8b5cf6) !important; }
.border-accent-red     { border-left-color: var(--accent-red, #ef4444)    !important; }
.border-accent-cyan    { border-left-color: var(--accent-cyan, #06b6d4)   !important; }
.border-accent-indigo  { border-left-color: var(--accent-indigo, #6366f1) !important; }

.text-accent-blue   { color: var(--accent-blue, #3b82f6)   !important; }
.text-accent-green  { color: var(--accent-green, #34d399)  !important; }
.text-accent-amber  { color: var(--accent-amber, #f59e0b)  !important; }
.text-accent-purple { color: var(--accent-purple, #8b5cf6) !important; }
.text-accent-red    { color: var(--accent-red, #ef4444)    !important; }
.text-accent-cyan   { color: var(--accent-cyan, #06b6d4)   !important; }
.text-accent-indigo { color: var(--accent-indigo, #6366f1) !important; }
.text-overdue       { color: var(--accent-red, #ef4444) !important; font-weight: 600; }

.dashboard-status-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.dashboard-status-breakdown-card {
    padding: 16px;
    background: var(--surface-2);
    border-left: 4px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dashboard-status-breakdown-card:hover {
    background: var(--surface);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dashboard-status-breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.dashboard-status-breakdown-label {
    font-weight: 600;
    color: var(--text);
}

.dashboard-status-breakdown-count {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text);
}

.dashboard-status-breakdown-value {
    color: var(--text-2);
    font-size: 0.9rem;
}

.dashboard-recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 12px;
}

.dashboard-recent-section {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.dashboard-recent-section h2 {
    margin: 0 0 16px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dashboard-recent-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-2);
}

.dashboard-recent-item:last-child {
    border-bottom: none;
}

.dashboard-recent-link {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.dashboard-recent-link:hover {
    color: var(--primary, #2563eb);
}

.dashboard-recent-meta {
    font-size: 0.85rem;
    color: var(--text-2);
}

.dashboard-recent-action {
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.dashboard-billing-section {
    margin-bottom: 2px;
}

.dashboard-billing-subsection {
    margin-bottom: 24px;
}

.dashboard-billing-subsection h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.dashboard-billing-warning {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.dashboard-billing-warning-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.dashboard-billing-warning-icon {
    font-size: 1.5em;
    line-height: 1;
}

.dashboard-billing-warning-body {
    flex: 1;
}

.dashboard-billing-warning-title {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1em;
    font-weight: 600;
}

.dashboard-billing-warning-text {
    margin: 0 0 12px 0;
    color: #7f1d1d;
}

.dashboard-billing-warning-list {
    margin: 0 0 12px 0;
    padding-left: 20px;
    color: #7f1d1d;
}

.dashboard-billing-warning-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-billing-warning-btn {
    padding: 8px 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Dashboard responsive styles moved to responsive.css */

/* ============================================
   Keyframe Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =============================================
   Show / Detail Page Component System
   ============================================= */

/* Header: flex row with title left, actions right */
.show-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.show-header h1 {
    margin: 0;
}

.show-header .show-subtitle {
    color: var(--text-2);
    margin: 8px 0 0;
}

/* Action buttons wrapper */
.show-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Alerts below header */
.show-alert {
    margin-top: 12px;
}

/* Content card used in show pages */
.show-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.show-card h2,
.show-card h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--text);
}

/* Grid for key-value detail pairs */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.detail-grid.cols-1 {
    grid-template-columns: 1fr;
}

.detail-grid + .detail-grid {
    margin-top: 16px;
}

/* Label / value for detail items */
.detail-label {
    color: var(--text-2);
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

.detail-value {
    margin: 0;
    color: var(--text);
}

.detail-value a {
    color: var(--primary);
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

/* 2-column show layout: main + sidebar */
.show-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

/* 2 equal columns show layout */
.show-layout-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 18px;
}

/* Auto-fit responsive show layout */
.show-layout-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .show-header {
        flex-direction: column;
    }
    .show-actions {
        width: 100%;
        flex-direction: column;
    }
    .show-actions .btn,
    .show-actions form {
        width: 100%;
    }
    .show-actions form .btn {
        width: 100%;
    }
    .ticket-header-actions {
        width: 100%;
        flex-direction: column;
    }
    .ticket-header-actions .btn,
    .ticket-header-actions form {
        width: 100%;
    }
    .ticket-header-actions form .btn {
        width: 100%;
    }
    .show-layout {
        grid-template-columns: 1fr;
    }
    .show-layout-equal {
        grid-template-columns: 1fr;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-grid.cols-3 {
        grid-template-columns: 1fr;
    }
}

/* ─── Sort Toolbar ─── */
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: nowrap; }
.list-toolbar > .flex-wrap-flex1 { flex-wrap: nowrap; overflow-x: auto; }
.sort-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-toolbar .sort-bar { margin-bottom: 0; }
.sort-bar-label { font-size: 0.8rem; color: var(--text-2); margin-right: 4px; white-space: nowrap; }
.sort-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; font-size: 0.8rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-2); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.sort-btn:hover { background: var(--bg-2); color: var(--text); }
.sort-btn.sort-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sort-btn::after { content: ''; display: inline-block; width: 0; }
.sort-btn.sort-asc::after { content: '↑'; font-size: 0.75rem; }
.sort-btn.sort-desc::after { content: '↓'; font-size: 0.75rem; }

/* ─── Activity Timeline ─── */
.activity-timeline { position: relative; padding-left: 24px; }
.activity-timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.activity-item { position: relative; padding: 10px 0 10px 16px; }
.activity-item::before { content: ''; position: absolute; left: -20px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); z-index: 1; }
.activity-item.activity-created::before { background: #22c55e; }
.activity-item.activity-updated::before { background: #3b82f6; }
.activity-item.activity-deleted::before { background: #ef4444; }
.activity-item-header { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-2); flex-wrap: wrap; }
.activity-item-user { font-weight: 600; color: var(--text); }
.activity-item-action { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.activity-item-time { font-size: 0.78rem; color: var(--text-3, var(--text-2)); margin-left: auto; }
.activity-item-desc { font-size: 0.85rem; color: var(--text-2);  }

/* ─── Kanban Leads ─── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; min-height: 60vh; }
.kanban-column { flex: 1; min-width: 260px; max-width: 340px; background: var(--bg-2, #f1f5f9); border-radius: 12px; display: flex; flex-direction: column; }
.kanban-column-header { padding: 14px 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; border-bottom: 2px solid transparent; }
.kanban-column-body { padding: 8px; flex: 1; min-height: 100px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: var(--surface, #fff); border: 1px solid var(--border-2, #e2e8f0); border-radius: 8px; padding: 12px; cursor: grab; transition: box-shadow 0.15s, transform 0.15s; }
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.kanban-card-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.kanban-card-title a { color: var(--text); text-decoration: none; }
.kanban-card-title a:hover { color: var(--primary); }
.kanban-card-meta { font-size: 0.8rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kanban-drop-zone { min-height: 40px; border: 2px dashed transparent; border-radius: 8px; transition: border-color 0.2s; }
.kanban-drop-zone.drag-over { border-color: var(--primary, #3b82f6); background: var(--primary-light, #3b82f622); }
.kanban-count { background: var(--surface, #fff); padding: 1px 8px; border-radius: 10px; font-size: 0.8rem; font-weight: 600; }

/* ─── Onboarding Wizard ─── */
.onboarding-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.onboarding-card { background: var(--surface); border-radius: 16px; padding: 40px; max-width: 600px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.onboarding-steps { display: flex; gap: 8px; margin-bottom: 24px; }
.onboarding-step { flex: 1; height: 4px; background: var(--border); border-radius: 2px; transition: background 0.3s; }
.onboarding-step.done { background: var(--primary); }
.onboarding-step.active { background: var(--primary); opacity: 0.6; }
.onboarding-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.onboarding-desc { color: var(--text-2); margin-bottom: 24px; line-height: 1.6; }
.onboarding-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ─── Related Records Panel ─── */
.related-panel { margin-top: 24px; }
.related-panel-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.related-panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.related-panel-list { display: flex; flex-direction: column; gap: 6px; }
.related-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg-2); border-radius: 10px; font-size: 0.9rem; text-decoration: none; color: var(--text); transition: background 0.15s, transform 0.1s; cursor: pointer; }
.related-item:hover { background: var(--surface-2); transform: translateY(-1px); }
.related-item .bi { font-size: 1.1rem; color: var(--text-2); }
.related-item-count { font-weight: 700; font-size: 1.1rem; }
.related-item-label { font-size: 0.8rem; color: var(--text-2); }
.related-item-empty { opacity: 0.45; cursor: default; }
.related-item-empty:hover { background: var(--bg-2); transform: none; }
.related-item-icon { color: var(--text-2); font-size: 1rem; width: 20px; text-align: center; }
.related-item-meta { margin-left: auto; font-size: 0.8rem; color: var(--text-2); }

/* ─── Autosave Indicator ─── */
.autosave-indicator { position: fixed; bottom: 20px; right: 20px; padding: 8px 16px; border-radius: 8px; font-size: 0.8rem; z-index: 1000; transition: opacity 0.3s; pointer-events: none; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); opacity: 0; }
.autosave-indicator.visible { opacity: 1; }

/* ─── Client Contacts ─── */
.contacts-list { display: flex; flex-direction: column; gap: 8px; }
.contact-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-2); border-radius: 8px; }
.contact-card-info { flex: 1; }
.contact-card-name { font-weight: 600; font-size: 0.95rem; }
.contact-card-detail { font-size: 0.8rem; color: var(--text-2); }
.contact-card-badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 4px; background: var(--primary); color: #fff; }
.contact-card-actions { display: flex; gap: 4px; }

/* ─── Merge Wizard ─── */
.merge-wizard { max-width: 800px; margin: 0 auto; }
.merge-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.merge-record { background: var(--bg-2); border-radius: 12px; padding: 16px; border: 2px solid transparent; transition: border-color 0.2s; }
.merge-record.selected { border-color: var(--primary); }
.merge-field-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.merge-field-label { font-weight: 600; font-size: 0.85rem; width: 100px; flex-shrink: 0; }
.merge-field-value { flex: 1; font-size: 0.85rem; }


/* ======================================================================
   RESPONSIVE DESIGN (merged from responsive.css)
   ====================================================================== */

/* ==============================================
   Responsive Design System
   Mobile-first, consistent, and theme-aware
   ============================================== */

/* ---- Global Box Sizing ---- */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ---- Smooth transitions for theme switching ---- */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

html.no-transition,
html.no-transition * {
    transition: none !important;
}

/* ---- Auto theme: respect OS preference ---- */
html[data-theme="auto"] {
    color-scheme: light dark;
}

@media (prefers-color-scheme: light) {
    html[data-theme="auto"] {
        --bg: #f8fafc;
        --surface: #ffffff;
        --surface-2: #ffffff;
        --text: #0f172a;
        --text-2: #334155;
        --muted: #64748b;
        --border: rgba(15,23,42,0.10);
        --border-2: rgba(15,23,42,0.14);
        --shadow: 0 10px 30px rgba(2,6,23,0.10);
        --btn-bg: rgba(2,6,23,0.04);
        --btn-bg-hover: rgba(2,6,23,0.07);
        --primary: #2563eb;
        --primary-light: rgba(37,99,235,0.07);
        --bg-2: #f1f5f9;
        --danger: #dc2626;
        --success: #059669;
        --success-hover: #047857;
        --warning: #d97706;
        --notif-icon-invoice: #2563eb;
        --notif-icon-proposal: #7c3aed;
        --notif-icon-contract: #059669;
        --notif-icon-project: #d97706;
        --notif-icon-client: #db2777;
        --notif-icon-lead: #dc2626;
        --notif-icon-milestone: #7c3aed;
        --notif-icon-default: #475569;
        --notif-icon-bg-opacity: 0.12;
    }
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        --bg: #0f1724;
        --surface: #111827;
        --surface-2: #0b1320;
        --text: #e5e7eb;
        --text-2: #cbd5e1;
        --muted: #94a3b8;
        --border: rgba(255,255,255,0.06);
        --border-2: rgba(255,255,255,0.08);
        --shadow: 0 10px 30px rgba(0,0,0,0.35);
        --btn-bg: rgba(255,255,255,0.04);
        --btn-bg-hover: rgba(255,255,255,0.06);
        --primary: #2563eb;
        --primary-light: rgba(37,99,235,0.07);
        --bg-2: #1e293b;
        --danger: #ef4444;
        --success: #34d399;
        --success-hover: #2cc08e;
        --warning: #f59e0b;
        --notif-icon-invoice: #3b82f6;
        --notif-icon-proposal: #8b5cf6;
        --notif-icon-contract: #10b981;
        --notif-icon-project: #f59e0b;
        --notif-icon-client: #ec4899;
        --notif-icon-lead: #ef4444;
        --notif-icon-milestone: #8b5cf6;
        --notif-icon-default: #64748b;
        --notif-icon-bg-opacity: 0.15;
    }
}

/* ---- Sticky Header ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ---- Sticky Sub-Nav Ribbon ---- */
.nav-subnav-bar {
    position: sticky;
    top: 44px; /* below header */
    z-index: 99;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ---- Theme Switcher ---- */
.theme-switcher-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.theme-switcher-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.15rem;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    min-width: 40px;
    min-height: 40px;
}

.theme-switcher-btn:hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

.theme-switcher-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 1001;
    min-width: 140px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.theme-switcher-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    background: none;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    width: 100%;
    text-align: left;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.theme-option:hover {
    background: var(--btn-bg-hover);
    color: var(--text);
}

.theme-option.active {
    color: var(--text);
    font-weight: 600;
    background: var(--btn-bg);
}

.theme-option i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* ---- Touch targets: minimum 44x44px ---- */
@media (pointer: coarse) {
    .btn, .nav-icon-button, .notification-bell,
    .theme-switcher-btn, a.nav-icon-button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ==============================================
   TABLET breakpoint: 769px - 1024px
   ============================================== */
@media (max-width: 1024px) {
    .content {
        padding: 12px;
    }

    .home-landing-hero {
        padding: 32px 24px;
    }

    .dashboard-billing-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-recent-grid {
        grid-template-columns: 1fr;
    }

    .icon-bar {
        flex-wrap: wrap;
        padding: 24px;
        gap: 12px;
    }

    .icon-bar__item {
        flex: 1 1 calc(33% - 12px);
        min-width: auto;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
    }
}

/* ==============================================
   MOBILE breakpoint: max-width 768px
   ============================================== */
@media (max-width: 768px) {

    /* ---- Layout ---- */
    .content {
        padding: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* ---- Header & Navigation ---- */
    .site-header {
        padding: 0 16px !important;
        flex-wrap: nowrap;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        justify-content: flex-start;
    }

    .nav-toggle {
        display: flex !important;
        order: -1;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .brand {
        order: 0;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .site-header .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        background: var(--surface-2);
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;
        box-sizing: border-box;
        display: none;
        flex-direction: column;
        gap: 8px;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        z-index: 99;
        order: 10;
    }

    .site-header.nav-open .site-nav {
        display: flex;
    }

    .site-nav .nav-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
    }

    .site-nav .nav-group-primary {
        margin: 0;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Segment links on mobile: stay inline, don't stretch full-width */
    .site-header .site-nav .nav-segment-btn {
        width: auto !important;
        display: inline-flex !important;
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    /* Sub-nav bar on mobile: horizontal scroll */
    /* Hide sub-nav ribbon on mobile — page links are inside the dropdown now */
    .nav-subnav-bar {
        display: none !important;
    }

    /* Show mobile inline page links inside the dropdown */
    .nav-mobile-pages {
        display: block;
        width: 100%;
        border-top: 1px solid var(--border);
        margin-top: 4px;
        padding-top: 4px;
    }

    .nav-subnav-item {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* ---- Inline search on mobile ---- */
    .nav-search-inline {
        width: 100%;
        padding: 10px 12px;
    }

    .nav-search-kbd {
        display: none;
    }

    .site-nav .nav-group-secondary {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        margin-top: 8px;
        padding-top: 12px;
    }

    .site-header .site-nav a:not(.nav-segment-btn):not(.nav-subnav-item) {
        width: 100%;
        padding: 10px 12px;
        display: block;
        border-radius: 8px;
        font-size: 0.95rem;
    }

    .site-header .site-nav a:not(.nav-segment-btn):not(.nav-subnav-item):hover {
        background: var(--btn-bg-hover);
    }

    .site-header .site-nav .nav-icon-button {
        width: 100%;
        height: auto;
        padding: 10px 12px;
        font-size: 1rem;
        justify-content: flex-start;
        gap: 10px;
    }

    .site-header .site-nav .nav-button-text {
        display: inline-block;
    }

    /* ---- Notification bell mobile ---- */
    .site-header .site-nav .notification-bell {
        width: 100%;
        padding: 10px 12px !important;
        justify-content: flex-start !important;
        gap: 10px;
    }

    .site-header .site-nav .notification-bell .nav-button-text {
        display: inline-block;
        font-size: 1rem;
        font-weight: normal;
    }

    .notification-dropdown {
        width: calc(100vw - 32px);
        right: -16px;
    }

    /* ---- Nav dropdown on mobile (legacy) ---- */
    .nav-dropdown {
        position: static;
        margin-top: 0;
        margin-left: 16px;
        box-shadow: none;
        border: none;
        border-top: 1px solid var(--border);
        border-radius: 0;
        background: transparent;
    }

    .nav-dropdown a {
        padding: 10px 0;
    }

    /* ---- Theme switcher on mobile ---- */
    .theme-switcher-wrapper {
        width: 100%;
    }

    .theme-switcher-btn {
        width: 100%;
        padding: 10px 12px;
        justify-content: flex-start;
        gap: 10px;
        border-radius: 8px;
        font-size: 1rem;
    }

    .theme-switcher-dropdown {
        position: static;
        width: 100%;
        margin-top: 4px;
        box-shadow: none;
        border: 1px solid var(--border);
        transform: none;
    }

    .theme-switcher-dropdown.show {
        transform: none;
    }

    /* ---- Typography ---- */
    h1 {
        font-size: 1.5rem !important;
        word-break: break-word;
    }

    h2 {
        font-size: 1.2rem !important;
    }

    h3 {
        font-size: 1.05rem !important;
    }

    /* ---- Cards ---- */
    .card {
        padding: 14px !important;
        border-radius: 10px !important;
    }

    section.card {
        margin-left: 0;
        margin-right: 0;
    }

    /* ---- Tables ---- */
    .table-container,
    div[style*="overflow:auto"],
    .page-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100vw;
    }

    table {
        font-size: 0.8rem;
        display: table;
        width: 100%;
        table-layout: auto;
    }

    /* Override inline fixed widths on th elements */
    .page-table th[style*="width"],
    .page-table td[style*="width"] {
        width: auto !important;
    }

    table th,
    table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .page-table th,
    .page-table td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    .page-table th {
        font-size: 0.7rem;
        letter-spacing: 0.3px;
    }

    table td:not(:first-child):not(:last-child) {
        white-space: normal;
        word-break: break-word;
    }

    table td:first-child,
    table td:last-child {
        white-space: nowrap;
    }

    /* Let tables compress naturally — no forced min-width */
    .page-table {
        min-width: 0;
        width: 100%;
    }

    /* Hide bulk-select checkbox column on mobile to save space */
    .page-table th:first-child:has(input[type="checkbox"]),
    .page-table td:first-child:has(input[type="checkbox"]) {
        display: none;
    }

    /* Compact item meta */
    .item-meta {
        font-size: 0.7rem;
    }

    .item-secondary {
        font-size: 0.78rem;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    /* Compact action buttons in tables */
    .item-actions .btn {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
        min-height: 32px;
    }

    /* Override inline min-width on tables at 768px */
    table[style*="min-width:720px"],
    table[style*="min-width:760px"],
    table[style*="min-width:700px"],
    table[style*="min-width"] {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Override inline width on columns */
    th[style*="width"],
    td[style*="width"] {
        width: auto !important;
    }

    /* Inline overflow:auto wrappers — constrain to viewport */
    div[style*="overflow:auto"] {
        max-width: 100vw;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Buttons ---- */
    .btn {
        min-height: 44px;
        font-size: 0.9rem;
    }

    /* Small action buttons keep compact sizing */
    .btn-sm {
        min-height: 32px !important;
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }

    .btn-xs {
        min-height: 28px !important;
        padding: 4px 8px !important;
        font-size: 0.8rem !important;
    }

    /* Table/card row action buttons stay compact */
    .item-actions .btn,
    .list-card-actions .btn {
        min-height: 36px;
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
    }

    /* ---- Forms ---- */
    .auth-card {
        padding: 20px;
        margin: 16px auto;
        max-width: 100%;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    textarea,
    select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .form-row {
        grid-template-columns: 1fr !important;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    form [style*="display:grid"],
    form [style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Also catch display:grid on standalone divs with gap */
    [style*="display: grid"][style*="gap: 16px"],
    [style*="display: grid"][style*="gap: 20px"],
    [style*="display:grid"][style*="gap: 16px"],
    [style*="display:grid"][style*="gap: 20px"] {
        grid-template-columns: 1fr !important;
    }

    /* ---- Grid layouts ---- */
    [style*="grid-template-columns:repeat(auto-fill"],
    [style*="grid-template-columns: repeat(auto-fill"],
    [style*="grid-template-columns:repeat(auto-fit"],
    [style*="grid-template-columns: repeat(auto-fit"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns:repeat(2"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:2fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns:2fr 2fr"],
    [style*="grid-template-columns: 2fr 2fr"],
    [style*="grid-template-columns:3fr"],
    [style*="grid-template-columns: 3fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Line-item grids (invoice/credit note items) — scroll horizontally */
    .line-item[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    .line-item input,
    .line-item select,
    .line-item textarea {
        width: 100% !important;
        min-width: 0 !important;
    }

    [style*="display:grid"][style*="gap:16px"],
    [style*="display:grid"][style*="gap: 16px"],
    [style*="display: grid"][style*="gap:16px"],
    [style*="display: grid"][style*="gap: 16px"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* ---- Flex layouts ---- */
    [style*="display:flex"][style*="justify-content:space-between"]:not([style*="flex-wrap"]),
    [style*="display: flex"][style*="justify-content:space-between"]:not([style*="flex-wrap"]),
    [style*="display: flex"][style*="justify-content: space-between"]:not([style*="flex-wrap"]) {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    [style*="display:flex"][style*="flex-wrap:wrap"],
    [style*="display: flex"][style*="flex-wrap:wrap"],
    [style*="display: flex"][style*="flex-wrap: wrap"],
    [style*="display:flex"][style*="flex-wrap: wrap"] {
        flex-direction: row !important;
    }

    [style*="display:flex"][style*="gap:8px"],
    [style*="display:flex"][style*="gap:10px"],
    [style*="display:flex"][style*="gap:12px"],
    [style*="display: flex"][style*="gap: 8px"],
    [style*="display: flex"][style*="gap: 10px"],
    [style*="display: flex"][style*="gap: 12px"],
    [style*="display: flex"][style*="gap:8px"],
    [style*="display:flex"][style*="gap: 8px"],
    [style*="display:flex"][style*="gap: 10px"],
    [style*="display:flex"][style*="gap: 12px"] {
        flex-wrap: wrap !important;
    }

    [style*="display:flex"] .btn,
    [style*="display: flex"] .btn {
        flex: 1 1 auto;
        min-width: 0;
    }

    /* ---- Show/View Page Headers ---- */
    /* Header row: title left, buttons right → stack on mobile */
    div[style*="justify-content:space-between"][style*="flex-wrap:wrap"],
    div[style*="justify-content:space-between"][style*="flex-wrap: wrap"],
    div[style*="justify-content: space-between"][style*="flex-wrap:wrap"],
    div[style*="justify-content: space-between"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    div[style*="justify-content:space-between"][style*="flex-wrap:wrap"] > div:last-child,
    div[style*="justify-content:space-between"][style*="flex-wrap: wrap"] > div:last-child,
    div[style*="justify-content: space-between"][style*="flex-wrap:wrap"] > div:last-child,
    div[style*="justify-content: space-between"][style*="flex-wrap: wrap"] > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Action button rows on show pages → full width, wrapped */
    div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"],
    div[style*="display:flex"][style*="gap:10px"][style*="flex-wrap:wrap"],
    div[style*="display: flex"][style*="gap: 8px"][style*="flex-wrap: wrap"],
    div[style*="display: flex"][style*="gap: 10px"][style*="flex-wrap: wrap"],
    div[style*="display: flex"][style*="gap:8px"][style*="flex-wrap:wrap"],
    div[style*="display:flex"][style*="gap: 8px"][style*="flex-wrap: wrap"] {
        width: 100% !important;
    }

    div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] > .btn,
    div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] > form,
    div[style*="display:flex"][style*="gap:10px"][style*="flex-wrap:wrap"] > .btn,
    div[style*="display:flex"][style*="gap:10px"][style*="flex-wrap:wrap"] > form,
    div[style*="display: flex"][style*="gap: 8px"][style*="flex-wrap: wrap"] > .btn,
    div[style*="display: flex"][style*="gap: 8px"][style*="flex-wrap: wrap"] > form,
    div[style*="display: flex"][style*="gap: 10px"][style*="flex-wrap: wrap"] > .btn,
    div[style*="display: flex"][style*="gap: 10px"][style*="flex-wrap: wrap"] > form {
        flex: 1 1 calc(50% - 6px);
        min-width: 120px;
    }

    div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] > form .btn,
    div[style*="display:flex"][style*="gap:10px"][style*="flex-wrap:wrap"] > form .btn,
    div[style*="display: flex"][style*="gap: 8px"][style*="flex-wrap: wrap"] > form .btn,
    div[style*="display: flex"][style*="gap: 10px"][style*="flex-wrap: wrap"] > form .btn {
        width: 100%;
    }

    /* ---- Show Page Detail Sections ---- */
    /* Card sections with max-width → allow full width */
    section[style*="max-width"],
    div[style*="max-width:300px"],
    div[style*="max-width: 300px"],
    div[style*="max-width:420px"],
    div[style*="max-width: 420px"],
    div[style*="max-width:500px"],
    div[style*="max-width: 500px"],
    div[style*="max-width:600px"],
    div[style*="max-width: 600px"],
    div[style*="max-width:800px"],
    div[style*="max-width: 800px"],
    div[style*="max-width:900px"],
    div[style*="max-width: 900px"],
    div[style*="max-width:1000px"],
    div[style*="max-width: 1000px"] {
        max-width: 100% !important;
    }

    /* Forms with max-width → allow full width */
    form[style*="max-width"] {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Show page info cards that use auto-fit/auto-fill grid */
    div[style*="repeat(auto-fit, minmax(300px"],
    div[style*="repeat(auto-fit, minmax(200px"],
    div[style*="repeat(auto-fill, minmax(300px"],
    div[style*="repeat(auto-fill, minmax(200px"] {
        grid-template-columns: 1fr !important;
    }

    /* Detail row items — cover spaced and unspaced gap */
    div[style*="display:grid"][style*="gap:24px"],
    div[style*="display:grid"][style*="gap: 24px"],
    div[style*="display: grid"][style*="gap:24px"],
    div[style*="display: grid"][style*="gap: 24px"],
    div[style*="display:grid"][style*="gap:20px"],
    div[style*="display:grid"][style*="gap: 20px"],
    div[style*="display: grid"][style*="gap:20px"],
    div[style*="display: grid"][style*="gap: 20px"] {
        gap: 16px !important;
    }

    /* ---- Invoice/Proposal Tables Inside Show Pages ---- */
    /* Line-item tables in show pages */
    div[style*="overflow-x:auto"],
    div[style*="overflow-x: auto"],
    div[style*="overflow:auto"] {
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* ---- Edit/Create Form Improvements ---- */
    /* Ensure form labels are visible */
    label {
        font-size: 0.85rem;
        word-break: break-word;
    }

    /* Form fieldsets and groups */
    fieldset {
        padding: 12px !important;
        margin: 0 0 16px 0 !important;
    }

    /* Textarea responsiveness */
    textarea {
        min-height: 80px;
        resize: vertical;
    }

    /* ---- Status Update Forms on Show Pages ---- */
    form[style*="display:flex"][style*="gap"],
    form[style*="display: flex"][style*="gap"] {
        flex-wrap: wrap !important;
    }

    form[style*="display:flex"][style*="gap"] select,
    form[style*="display: flex"][style*="gap"] select {
        flex: 1 1 100% !important;
    }

    form[style*="display:flex"][style*="gap"] .btn,
    form[style*="display: flex"][style*="gap"] .btn {
        flex: 1 1 auto;
    }

    /* ---- Sidebar Info Cards on Show Pages ---- */
    /* Contract show sidebar, invoice sidebar etc */
    div[style*="border-left:"],
    div[style*="border-left :"],
    aside[style*="border-left:"] {
        border-left: none !important;
        border-top: 1px solid var(--border) !important;
        padding-left: 0 !important;
        padding-top: 16px !important;
    }

    /* ---- Money/Amount Display ---- */
    .money-value,
    [style*="font-weight:600"][style*="text-align:right"] {
        text-align: left !important;
    }

    /* ---- Compact spacing for cards inside show pages ---- */
    div[style*="background:var(--surface)"][style*="border-radius"] {
        padding: 14px !important;
    }

    /* ---- Tab navigation on show pages ---- */
    div[style*="border-bottom:"][style*="display:flex"][style*="gap"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
    }

    div[style*="border-bottom:"][style*="display:flex"][style*="gap"]::-webkit-scrollbar {
        display: none;
    }

    div[style*="border-bottom:"][style*="display:flex"][style*="gap"] > a,
    div[style*="border-bottom:"][style*="display:flex"][style*="gap"] > button {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* ---- Page Header ---- */
    .page-header {
        flex-direction: column;
        gap: 12px;
    }

    .page-header-content h1 {
        font-size: 1.5rem;
    }

    .page-header-actions {
        float: none;
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 4px;
    }

    .bulk-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .bulk-toolbar .btn {
        width: 100%;
        text-align: center;
    }

    /* ---- Stats ---- */
    .page-stats {
        width: 100%;
    }

    .stat-card {
        flex: 1 1 calc(50% - 6px);
        min-width: calc(50% - 6px);
    }

    /* ---- Search & Filter Bar ---- */
    .search-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-filter-bar .search-input-wrapper,
    .search-filter-bar .filter-select-wrapper {
        width: 100%;
        min-width: 100%;
    }

    .search-filter-bar .clear-filters {
        width: 100%;
        text-align: center;
    }

    /* ---- Status buttons ---- */
    .btn-status-draft,
    .btn-status-available,
    .btn-status-sent,
    .btn-status-paid,
    .btn-status-overdue,
    .btn-status-void {
        width: 100%;
        margin-bottom: 8px;
    }

    [style*="display:flex"][style*="gap:10px"] {
        flex-direction: column;
    }

    /* ---- Footer ---- */
    .footer-nav {
        gap: 8px;
        flex-direction: column;
        align-items: center;
    }

    .footer-nav a {
        font-size: 0.85rem;
    }

    .site-footer {
        padding: 24px 16px;
    }

    /* ---- Profile ---- */
    .profile-header h1 {
        font-size: 1.5rem;
    }

    .profile-tabs {
        display: none;
    }

    .profile-tabs-mobile {
        display: block;
    }

    .profile-section {
        padding: 16px;
    }

    /* ---- Dashboard ---- */
    .dashboard-billing-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .dashboard-billing-card {
        padding: 14px;
        border-radius: 8px;
    }

    .dashboard-billing-card-value {
        font-size: 1.5em;
    }

    .dashboard-status-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-recent-grid {
        grid-template-columns: 1fr;
    }

    /* ---- Portal ---- */
    .portal-secure-text {
        display: none;
    }

    .portal .card,
    #portal .card {
        margin: 0;
        width: 100%;
    }

    /* Admin styles moved to admin.css (conditionally loaded) */

    /* ---- Ticket styles ---- */
    .ticket-header {
        flex-direction: column;
    }

    .ticket-header-actions {
        width: 100%;
    }

    .ticket-header-actions .btn {
        width: 100%;
    }

    .ticket-message {
        gap: 8px;
    }

    .ticket-message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .ticket-info-grid,
    .ticket-settings-form {
        grid-template-columns: 1fr;
    }

    /* ---- Button groups ---- */
    .btn-group,
    .action-buttons {
        flex-direction: column !important;
    }

    .btn-group .btn,
    .action-buttons .btn {
        width: 100%;
        margin-bottom: 8px;
    }

    /* ---- Home page ---- */
    .home-landing-hero {
        grid-template-columns: 1fr;
        padding: 24px 16px 36px;
        border-radius: 14px;
    }

    .home-landing-hero__actions {
        position: static;
        justify-content: flex-end;
        margin-bottom: 16px;
    }

    .home-landing-hero__image {
        position: static;
        width: 100%;
        margin-top: 20px;
        border-radius: 10px;
    }

    .home-landing-title {
        font-size: 1.75rem;
    }

    .home-landing-hero__pricing {
        max-width: 100%;
    }

    .icon-bar {
        flex-wrap: wrap;
        padding: 20px 16px;
        gap: 12px;
    }

    .icon-bar__item {
        min-width: auto;
        flex: 1 1 calc(50% - 8px);
    }

    .cta-section {
        padding: 32px 16px;
        margin: 32px 0 24px;
    }

    .cta-section h2 {
        font-size: 1.4rem;
    }

    .home-hero {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .home-cta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==============================================
   SMALL MOBILE breakpoint: max-width 480px
   ============================================== */
@media (max-width: 480px) {
    .content {
        padding: 8px;
    }

    .site-header {
        padding: 0 10px !important;
    }

    .brand-logo {
        width: 120px;
        height: 40px;
    }

    h1 {
        font-size: 1.35rem !important;
    }

    h2 {
        font-size: 1.1rem !important;
    }

    .card {
        padding: 12px !important;
        border-radius: 8px !important;
    }

    table {
        font-size: 0.75rem;
    }

    table th,
    table td {
        padding: 6px 4px;
        font-size: 0.72rem;
    }

    .page-table th,
    .page-table td {
        padding: 6px 4px;
        font-size: 0.72rem;
    }

    .page-table th {
        font-size: 0.65rem;
    }

    /* Override inline min-width on tables */
    table[style*="min-width:720px"],
    table[style*="min-width:760px"],
    table[style*="min-width:700px"],
    table[style*="min-width"] {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Override inline width on th/td for very small screens */
    th[style*="width"],
    td[style*="width"] {
        width: auto !important;
    }

    .item-actions .btn {
        padding: 3px 6px !important;
        font-size: 0.7rem !important;
        min-height: 28px;
    }

    .btn {
        padding: 10px 12px;
        font-size: 0.875rem;
        width: 100%;
    }

    .btn:not([style*="width"]):not(.btn-sm):not(.btn-xs) {
        width: 100% !important;
    }

    /* Small buttons stay inline on small screens */
    .btn-sm,
    .btn-xs,
    .item-actions .btn,
    .list-card-actions .btn {
        width: auto !important;
    }

    /* Prevent iOS zoom on input focus */
    input, textarea, select {
        font-size: 16px !important;
    }

    .auth-card {
        margin: 8px auto;
        padding: 14px;
    }

    .dashboard-billing-card-value {
        font-size: 1.35em;
    }

    .dashboard-billing-card-title {
        font-size: 0.8rem;
    }

    .pricing-options__amount {
        font-size: 2.25rem;
    }

    .cta-btn {
        padding: 14px 28px;
        font-size: 1rem;
        width: 100%;
        text-align: center;
    }

    /* ---- View/Edit page improvements at 480px ---- */
    /* All action buttons stack fully */
    div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] > .btn,
    div[style*="display:flex"][style*="gap:8px"][style*="flex-wrap:wrap"] > form,
    div[style*="display:flex"][style*="gap:10px"][style*="flex-wrap:wrap"] > .btn,
    div[style*="display:flex"][style*="gap:10px"][style*="flex-wrap:wrap"] > form,
    div[style*="display: flex"][style*="gap: 8px"][style*="flex-wrap: wrap"] > .btn,
    div[style*="display: flex"][style*="gap: 8px"][style*="flex-wrap: wrap"] > form,
    div[style*="display: flex"][style*="gap: 10px"][style*="flex-wrap: wrap"] > .btn,
    div[style*="display: flex"][style*="gap: 10px"][style*="flex-wrap: wrap"] > form {
        flex: 1 1 100% !important;
    }

    /* Status badges smaller */
    .status-badge {
        font-size: 0.7rem !important;
        padding: 2px 8px !important;
    }

    /* Compact detail cards */
    div[style*="background:var(--surface)"][style*="border-radius"] {
        padding: 10px !important;
    }

    /* Line items in edit forms — stack labels above inputs */
    .line-item label {
        font-size: 0.75rem;
        margin-bottom: 2px;
    }

    /* Show page meta info */
    div[style*="color:var(--text-2)"][style*="display:flex"][style*="align-items:center"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }
}

/* ==============================================
   DESKTOP optimizations: min-width 769px
   ============================================== */
@media (min-width: 769px) {
    .nav-toggle {
        display: none !important;
    }

    .site-header .site-nav {
        display: flex !important;
    }

    /* Hide mobile-only page links on desktop */
    .nav-mobile-pages {
        display: none !important;
    }

    .card {
        padding: 24px;
    }

    .content {
        padding: 10px;
    }

    table {
        table-layout: auto;
    }
}

/* ==============================================
   LARGE DESKTOP: min-width 1200px
   ============================================== */
@media (min-width: 1200px) {
    .content {
        max-width: 1200px;
    }
}

/* ==============================================
   Print styles
   ============================================== */
@media print {
    .site-header,
    .site-footer,
    .nav-toggle,
    .nav-subnav-bar,
    .breadcrumbs,
    .notification-wrapper,
    .theme-switcher-wrapper {
        display: none !important;
    }

    .content {
        max-width: 100%;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    body {
        background: #fff;
        color: #000;
    }
}

/* ==============================================
   Accessibility: Reduced motion
   ============================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
