/* =========================================
   1. CORE VARIABLES & RESET
   ========================================= */
:root {
    --primary:       #E8590C;
    --primary-hover: #C44A09;
    --primary-light: #FEF0E8;
    --primary-ring:  rgba(232,89,12,0.18);
    --bg-body:       #FFFFFF;
    --bg-surface:    #FBF8F5;
    --border:        #EDE8E2;
    --text-main:     #1C1410;
    --text-muted:    #6B6156;
    --success:       #15803D;
    --success-bg:    #F0FDF4;
    --danger:        #DC2626;
    --danger-bg:     #FEF2F2;
    --warning:       #D97706;
    --warning-bg:    #FFFBEB;
    --info:          #2563EB;
    --info-bg:       #EFF6FF;
    --shadow:        0 4px 16px rgba(28,20,16,0.08);
    --radius:        8px;
    --font-sans:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: var(--primary); transition: 0.2s; }
a:hover { color: var(--primary-hover); }

h1, h2, h3 { font-weight: 500; letter-spacing: -0.5px; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* =========================================
   2. BUTTONS & UTILITIES
   ========================================= */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: background-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.12s;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(232,89,12,0.28);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
    box-shadow: 0 4px 14px rgba(232,89,12,0.36);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border-color: var(--border);
}
.btn-outline:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger { background-color: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background-color: #b91c1c; color: white; }

.btn-sm { padding: 5px 14px; font-size: 0.85rem; border-radius: 5px; }
.btn-large { padding: 12px 32px; font-size: 1rem; }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    display: flex;
    align-items: center;
    border-radius: 5px;
    transition: background-color 0.18s, color 0.18s;
}
.btn-icon:hover { background-color: var(--bg-surface); color: var(--primary); }
.btn-icon.text-danger:hover { background-color: var(--danger-bg); color: var(--danger); }
.btn-icon.text-success { color: var(--success); }
.btn-icon.text-success:hover { background-color: var(--success-bg); color: var(--success); }

/* Utility classes */
.hidden          { display: none !important; }
.text-muted      { color: var(--text-muted); }
.text-danger     { color: var(--danger); }
.text-danger:hover { color: #9b1c1c; }
.text-success    { color: var(--success); }
.text-right      { text-align: right; }
.text-center     { text-align: center; }
.text-sm         { font-size: 0.8rem; }
.text-hint       { font-size: 0.8rem; margin-top: 5px; }
.text-hint-top   { font-size: 0.85rem; margin-top: 5px; }
.fw-medium       { font-weight: 500; }
.fw-semibold     { font-weight: 600; }
.section-disabled { opacity: 0.5; pointer-events: none; }

/* Alerts */
.alert-box { padding: 14px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 0.92rem; border: 1px solid transparent; }
.alert-danger  { background-color: var(--danger-bg);  color: var(--danger);  border-color: #fca5a5; }
.alert-success { background-color: var(--success-bg); color: var(--success); border-color: #86efac; }
.alert-margin  { margin: 20px; }
.alert-form    { margin: 20px; }

/* =========================================
   3. PUBLIC HEADER & NAVIGATION
   ========================================= */
header:not(.app-header) {
    border-bottom: 1px solid var(--border);
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
}
header:not(.app-header) nav {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}
.logo-word {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    line-height: 1;
}
.logo-word em {
    font-style: normal;
    color: var(--primary);
}
.nav-links { display: flex; gap: 20px; align-items: center; }

@media (max-width: 768px) {
    .nav-links a:not(.btn) { display: none; }
}

/* =========================================
   4. AUTH PAGES
   ========================================= */
main {
    flex: 1;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 65px);
    background:
        radial-gradient(circle at top left, rgba(1, 140, 152, 0.12), transparent 26%),
        radial-gradient(circle at bottom right, rgba(194, 181, 155, 0.2), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, var(--bg-surface) 100%);
    padding: 32px 20px 48px;
}

.auth-shell {
    min-height: calc(100vh - 65px);
    background:
        radial-gradient(circle at top left, rgba(1, 140, 152, 0.12), transparent 26%),
        radial-gradient(circle at bottom right, rgba(194, 181, 155, 0.2), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, var(--bg-surface) 100%);
    padding: 32px 20px 48px;
}

.auth-focus-wrap {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
}

.auth-brand-stack {
    text-align: center;
    margin: 0 auto 22px;
}

.auth-display-compact {
    max-width: none;
    margin-top: 14px;
    text-align: center;
    font-size: clamp(2.2rem, 5vw, 3.15rem);
}

.auth-copy-compact {
    max-width: 480px;
    margin: 14px auto 0;
    text-align: center;
    font-size: 0.98rem;
}

.auth-grid {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 470px);
    gap: 34px;
    align-items: center;
}

.auth-grid-single {
    grid-template-columns: minmax(0, 520px);
    justify-content: center;
}

.auth-showcase {
    position: relative;
    padding: 20px 12px 20px 0;
}

.auth-showcase::before,
.auth-showcase::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.auth-showcase::before {
    width: 180px;
    height: 180px;
    top: -18px;
    right: 12%;
    background: radial-gradient(circle, rgba(1, 140, 152, 0.14) 0%, rgba(1, 140, 152, 0) 72%);
}

.auth-showcase::after {
    width: 220px;
    height: 220px;
    bottom: -40px;
    left: -50px;
    background: radial-gradient(circle, rgba(194, 181, 155, 0.28) 0%, rgba(194, 181, 155, 0) 72%);
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(1, 140, 152, 0.16);
    background: rgba(255, 255, 255, 0.8);
    color: #018c98;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-display {
    margin-top: 22px;
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    line-height: 0.96;
    letter-spacing: -0.06em;
    font-weight: 800;
    color: var(--text-main);
    max-width: 650px;
}

.auth-copy {
    margin-top: 18px;
    max-width: 560px;
    color: var(--text-muted);
    font-size: 1.02rem;
    line-height: 1.75;
}

.auth-feature-list {
    display: grid;
    gap: 14px;
    margin-top: 28px;
    max-width: 620px;
}

.auth-feature-item {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(28, 20, 16, 0.08);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 14px 38px rgba(28, 20, 16, 0.06);
    backdrop-filter: blur(12px);
}

.auth-feature-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(1, 140, 152, 0.12), rgba(1, 140, 152, 0.06));
    color: #018c98;
}

.auth-feature-item strong {
    display: block;
    font-size: 0.96rem;
    margin-bottom: 4px;
}

.auth-feature-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.auth-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 26px;
}

.auth-metric {
    min-width: 148px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(28, 20, 16, 0.08);
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 10px 28px rgba(28, 20, 16, 0.05);
}

.auth-metric-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.auth-metric-label {
    display: block;
    margin-top: 4px;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.auth-card {
    background: rgba(255, 255, 255, 0.92);
    width: 100%;
    max-width: 470px;
    padding: 34px;
    border: 1px solid rgba(28, 20, 16, 0.08);
    border-radius: 28px;
    box-shadow: 0 22px 60px rgba(28, 20, 16, 0.1);
    backdrop-filter: blur(14px);
}

.auth-card--auth {
    max-width: none;
}

.auth-header {
    text-align: left;
    margin-bottom: 24px;
}

.auth-header h1,
.auth-header h2 {
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    line-height: 1.05;
    letter-spacing: -0.05em;
    font-weight: 800;
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.7;
}

.auth-card-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-header-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(1, 140, 152, 0.12), rgba(194, 181, 155, 0.2));
    color: #018c98;
    margin-bottom: 18px;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.auth-footer a {
    font-weight: 600;
}

.auth-note-panel {
    border: 1px solid rgba(28, 20, 16, 0.08);
    border-radius: 18px;
    background: rgba(248, 246, 243, 0.9);
    padding: 16px 18px;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.65;
}

.auth-card-note {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(28, 20, 16, 0.08);
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.65;
}

.auth-page-links {
    margin-top: 18px;
    display: grid;
    gap: 10px;
    text-align: center;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.auth-page-links a {
    font-weight: 600;
}

.auth-shell-minimal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-minimal-wrap {
    width: 100%;
    max-width: 420px;
}

.auth-card-minimal {
    max-width: none;
    padding: 30px 28px;
    border-radius: 24px;
}

.auth-mini-brand {
    text-align: center;
    margin-bottom: 18px;
}

.auth-header-minimal {
    text-align: center;
}

.auth-page-links-minimal {
    margin-top: 20px;
}

.auth-note-panel strong {
    color: var(--text-main);
}

.alert-success-auth {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #86efac;
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    text-align: left;
    line-height: 1.5;
}
.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fca5a5;
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    text-align: left;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .auth-card { padding: 24px 18px; border-radius: 22px; }
    .auth-container { align-items: flex-start; padding: 18px 12px 28px; }
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form .form-group {
    margin-bottom: 0;
}

.auth-card .form-group label {
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.auth-field {
    position: relative;
}

.auth-field.has-icon .form-control {
    padding-left: 48px;
    padding-right: 70px;
}

.auth-field .form-control {
    min-height: 54px;
    border-radius: 16px;
    border-color: #ddd6ce;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.95);
}

.auth-field .form-control::placeholder {
    color: #8b8175;
}

.auth-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c7267;
    pointer-events: none;
}

.auth-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 700;
}

.auth-toggle:hover {
    color: var(--primary);
}

.auth-submit {
    width: 100%;
    min-height: 54px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 4px;
}

.auth-stack-links {
    margin-top: 20px;
    display: grid;
    gap: 10px;
    text-align: center;
    font-size: 0.92rem;
}

.auth-stack-links a {
    font-weight: 600;
}

.auth-inline-link {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.auth-inline-link a {
    font-weight: 600;
}

.auth-helper-panel {
    margin-top: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(1, 140, 152, 0.16);
    background: rgba(1, 140, 152, 0.06);
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.6;
}

.auth-helper-panel .btn {
    margin-top: 10px;
}

.auth-success-state {
    display: grid;
    gap: 18px;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(1, 140, 152, 0.12), rgba(194, 181, 155, 0.2));
    color: #018c98;
}

.strength-meter {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    border-radius: 999px;
    background: #e5e0d8;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    transition: width 0.25s ease, background-color 0.25s ease;
}

.strength-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

@media (max-width: 992px) {
    .auth-shell {
        padding: 20px 14px 28px;
    }

    .auth-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .auth-card {
        max-width: none;
        margin: 0;
    }

    .auth-showcase {
        padding: 6px 0 10px;
    }

    .auth-showcase::before {
        right: 0;
    }

}

@media (max-width: 640px) {
    .auth-display {
        font-size: 2.35rem;
    }

    .auth-copy {
        font-size: 0.95rem;
    }

    .auth-feature-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .auth-feature-icon {
        width: 38px;
        height: 38px;
    }

    .auth-kicker,
    .auth-card-eyebrow {
        letter-spacing: 0.09em;
    }

    .auth-card-minimal {
        padding: 24px 20px;
    }
}

/* =========================================
   5. FORMS
   ========================================= */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; font-weight: 500; }

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border 0.18s, box-shadow 0.18s;
    background: white;
    color: var(--text-main);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bg-surface);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 1;
}

.form-label { display: block; margin-bottom: 6px; font-size: 0.875rem; font-weight: 600; color: var(--text-main); }
.form-label-wrapper { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.form-label-wrapper label { margin-bottom: 0; }
.small-link { font-size: 0.85rem; text-decoration: none; color: var(--primary); }
.small-link:hover { text-decoration: underline; }

.input-group { display: flex; width: 100%; }
.input-group-text {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-right: 0;
    padding: 0 12px;
    display: flex;
    align-items: center;
    border-radius: 6px 0 0 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}
.input-group .form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-readonly { background: var(--bg-surface); cursor: not-allowed; }

.form-inline { display: inline; margin: 0; padding: 0; }
.form-actions { margin-top: 30px; text-align: right; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* Form grid helpers */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-4      { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3      { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 25px; }
.span-2      { grid-column: span 2; }

@media (max-width: 992px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  {
    .form-grid-2 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
}

.form-card-wide { max-width: 800px; margin: 0 auto; }
.form-card-md   { max-width: 800px; margin: 0 auto; }
.form-card-sm   { max-width: 600px; margin: 0 auto; }
.form-card-lg   { max-width: 900px; margin: 0 auto; }

/* =========================================
   6. APP LAYOUT — HEADER
   ========================================= */
.app-body { background-color: #F7F3EE; }

.app-header {
    height: 64px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 0 var(--border), 0 2px 8px rgba(28,20,16,0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 10px;
    /* needed for ::after accent line */
    overflow: visible;
}
/* Orange accent at very bottom of header */
.app-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 60%, transparent 100%);
    opacity: 0.55;
}

.header-left  { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.user-email { font-size: 0.9rem; font-weight: 500; color: var(--text-main); }

.log-user   { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text-main); }
.log-avatar {
    width: 32px; height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .app-header { padding: 0 12px; }
    .header-right { gap: 6px; }
}

/* =========================================
   7. APP LAYOUT — SIDEBAR
   ========================================= */
.app-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.app-sidebar {
    width: 240px;
    background-color: white;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, width 0.3s ease;
}
.sidebar-content { padding: 12px 0; }

.nav-section  { margin-bottom: 25px; }
.nav-label    { padding: 0 20px; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.6px; text-transform: uppercase; white-space: nowrap; }
.nav-group    { margin-bottom: 2px; }

.nav-link-parent {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    transition: 0.18s;
    border-radius: 7px;
    margin: 0 8px;
    text-decoration: none;
    font-size: 0.9rem;
}
.nav-link-parent:hover { background-color: var(--primary-light); color: var(--primary); }

.nav-label-wrapper { display: flex; align-items: center; gap: 10px; }

.nav-arrow {
    width: 14px; height: 14px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

/* Active / open states */
.nav-group.open .nav-arrow { transform: rotate(180deg); }
.nav-group.active-parent .nav-link-parent {
    background-color: var(--primary-light);
    color: var(--primary);
}
.nav-group.active-parent .nav-arrow,
.nav-group.active-parent .nav-label-wrapper svg { color: var(--primary); }

/* Sub menu */
.nav-sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    margin-left: 28px;
    padding-left: 14px;
    border-left: 2px solid var(--border);
}
.nav-group.open .nav-sub-menu { max-height: 600px; }

.nav-sub-link {
    display: block;
    padding: 7px 10px;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 5px;
    margin-top: 1px;
    position: relative;
    transition: 0.15s;
}
.nav-sub-link:hover  { color: var(--primary); background-color: var(--primary-light); }
.nav-sub-link.active { color: var(--primary); font-weight: 600; }
.nav-sub-link::before {
    content: '';
    position: absolute;
    left: -15px; top: 50%;
    width: 8px; height: 1px;
    background-color: var(--border);
}

/* Sidebar desktop collapse */
@media (min-width: 769px) {
    .app-sidebar.active { width: 64px; }
    .app-sidebar.active .nav-label-wrapper span,
    .app-sidebar.active .nav-arrow,
    .app-sidebar.active .nav-sub-menu,
    .app-sidebar.active .nav-label { display: none !important; }
    .app-sidebar.active .nav-link-parent { justify-content: center; padding: 12px; margin: 0 4px; }
    .app-sidebar.active .nav-label-wrapper { gap: 0; }
}

/* Sidebar mobile */
@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        left: 0; top: 64px; bottom: 0;
        z-index: 200;
        width: 260px;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(28,20,16,0.14);
    }
    .app-sidebar.active { transform: translateX(0); }
    .nav-sub-menu { border-left: none; padding-left: 8px; margin-left: 8px; }
    .nav-sub-link::before { display: none; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 64px 0 0 0;
        background: rgba(28,20,16,0.3);
        z-index: 199;
    }
    .sidebar-overlay.active { display: block; }
}

/* =========================================
   8. APP CONTENT AREA
   ========================================= */
.app-content { flex: 1; padding: 28px 24px; overflow-x: hidden; min-width: 0; }

.app-content > .container {
    max-width: 1440px;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

@media (max-width: 768px) { .app-content { padding: 16px 14px; } }
@media (max-width: 480px) { .app-content { padding: 12px 10px; } }

/* =========================================
   9. PAGE HEADER
   ========================================= */
.page-header,
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-title    { font-size: 1.4rem; font-weight: 700; color: var(--text-main); }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 3px; }

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 600px) {
    .page-header,
    .dashboard-header { flex-direction: column; align-items: stretch; }
    .header-actions   { justify-content: flex-start; }
    .page-title       { font-size: 1.2rem; }
}

/* =========================================
   10. CARDS
   ========================================= */
.content-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--bg-surface);
}
.card-title  { font-size: 1rem; font-weight: 700; color: var(--text-main); margin: 0; }
.card-body   { padding: 20px; }

@media (max-width: 600px) {
    .card-header { padding: 12px 16px; }
    .card-body   { padding: 14px; }
}

/* =========================================
   11. TABLES
   ========================================= */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
    background-color: var(--bg-surface);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background-color: #FFF8F5; }

/* Column helpers */
.col-desc       { width: 45%; }
.col-qty        { width: 12%; text-align: center; }
.col-price      { width: 14%; text-align: right; }
.col-total      { width: 14%; text-align: right; }
.col-action     { width: 10%; text-align: center; }
.col-contact    { width: 35%; }
.col-address    { width: 30%; }
.col-added      { width: 15%; }
.col-action-crm { width: 15%; text-align: right; }
.col-sku        { width: 15%; }
.col-product    { width: 40%; }
.col-stock      { width: 15%; text-align: center; }
.col-actions    { width: 100px; text-align: right; }

.cell-center  { text-align: center !important; }
.cell-right   { text-align: right !important; }
.row-total    { padding-top: 18px !important; font-weight: 600; }

/* =========================================
   12. BADGES & STATUS
   ========================================= */
.badge {
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: inline-block;
    white-space: nowrap;
}
.badge-success { background-color: var(--success-bg); color: var(--success); }
.badge-warning { background-color: var(--warning-bg); color: var(--warning); }
.badge-danger  { background-color: var(--danger-bg);  color: var(--danger); }
.badge-info    { background-color: var(--info-bg);    color: var(--info); }
.badge-neutral { background-color: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary { background-color: var(--primary-light); color: var(--primary); }

/* =========================================
   13. STAT CARDS (DASHBOARD)
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: white;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(232,89,12,0.10); }
.stat-icon  { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.revenue-icon  { background: var(--primary-light); color: var(--primary); }
.customer-icon { background: var(--success-bg);    color: var(--success); }
.invoice-icon  { background: var(--warning-bg);    color: var(--warning); }
.product-icon  { background: var(--info-bg);       color: var(--info); }
.stat-info h3  { font-size: 1.4rem; margin-bottom: 2px; font-weight: 700; }
.stat-info p   { font-size: 0.82rem; color: var(--text-muted); }

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card  { padding: 14px; gap: 10px; }
    .stat-icon  { width: 36px; height: 36px; }
    .stat-info h3 { font-size: 1.1rem; }
}

/* =========================================
   14. FILTER TOOLBAR
   ========================================= */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.filter-group     { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-group-end { flex-grow: 1; justify-content: flex-end; }
.filter-select    { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: white; font-size: 0.9rem; min-width: 110px; }
.search-input     { max-width: 240px; }

@media (max-width: 768px) {
    .filter-toolbar   { flex-direction: column; align-items: stretch; }
    .filter-group     { flex-direction: row; flex-wrap: wrap; }
    .filter-select,
    .search-input     { width: 100%; max-width: 100%; }
}

/* =========================================
   15. PAGINATION
   ========================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-main);
    background: white;
    border: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}
.page-btn:hover:not(.disabled):not(.active):not(.page-ellipsis) {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
.page-btn.active   { background: var(--primary); color: white; border-color: var(--primary); cursor: default; }
.page-btn.disabled { color: var(--text-muted); cursor: not-allowed; opacity: 0.6; }
.page-btn.page-ellipsis { border: none; background: transparent; cursor: default; min-width: 20px; }

.page-link { padding: 8px 12px; border: 1px solid var(--border); background: white; color: var(--text-main); text-decoration: none; border-radius: 6px; font-size: 0.9rem; transition: 0.2s; }
.page-link:hover  { background-color: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-link.active { background-color: var(--primary); color: white; border-color: var(--primary); }

.page-info { color: var(--text-muted); font-size: 0.8rem; margin-left: 6px; }

/* =========================================
   16. AUTOCOMPLETE / SEARCH DROPDOWN
   ========================================= */
.search-wrapper { position: relative; }

.search-results {
    position: absolute;
    top: 100%; left: 0;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 24px rgba(28,20,16,0.12);
    z-index: 9999;
    display: none;
}
.search-results.show { display: block; }

.search-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--bg-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: background 0.13s;
}
.search-item:last-child  { border-bottom: none; }
.search-item:hover       { background-color: var(--primary-light); color: var(--primary); }
.search-item strong      { display: block; font-weight: 600; }
.search-item span        { font-size: 0.8rem; color: var(--text-muted); }

/* =========================================
   17. ACTION BUTTONS GROUP
   ========================================= */
.action-buttons, .action-group {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.action-group { justify-content: center; }

@media (max-width: 600px) {
    .action-buttons { gap: 4px; }
}

/* =========================================
   18. INVOICE / QUOTATION MODULE
   ========================================= */
.invoice-form-container { max-width: 1000px; margin: 0 auto; }
.invoice-grid      { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.invoice-card-padded { padding: 22px; margin-bottom: 24px; }
.invoice-table-wrapper { padding: 0; }
.invoice-table-head  { background-color: var(--bg-surface); }
.invoice-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.grand-total-text { font-size: 1.2rem; font-weight: 700; }

@media (max-width: 768px) {
    #itemsTable,
    #itemsTable tbody,
    #itemsTable tr,
    #itemsTable td { display: block; width: 100% !important; }
    #itemsTable thead { display: none; }
    #itemsTable tr {
        margin-bottom: 14px;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 10px;
        background: white;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    #itemsTable td {
        border: none;
        padding: 6px 0;
        text-align: left !important;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    #itemsTable td:nth-of-type(1)::before { content: "Item";        font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
    #itemsTable td:nth-of-type(2)::before { content: "Description"; font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
    #itemsTable td:nth-of-type(3)::before { content: "Quantity";    font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
    #itemsTable td:nth-of-type(4)::before { content: "Price";       font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
    #itemsTable td:nth-of-type(5)::before { content: "Total";       font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
    #itemsTable input.form-control { text-align: left !important; background-color: var(--bg-surface); }
    #grandTotalDisplay { font-size: 1.4rem !important; }

    .invoice-footer { flex-direction: column; align-items: flex-start; }
}

/* =========================================
   19. LANDSCAPE FORM LAYOUT
   ========================================= */
.form-card-landscape {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.form-section { padding: 22px 24px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; }
.form-section.bg-footer {
    background-color: var(--bg-surface);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.form-section-head  { margin-bottom: 18px; }
.form-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-section-title svg { color: var(--text-muted); }
.form-section-danger { border-left: 4px solid var(--danger); background-color: var(--danger-bg); }
.form-section-head-padded { padding: 15px 20px 0 20px; }
.form-section-padded { padding: 0 20px 20px 20px; }
.text-danger-title { color: #9b1c1c; }
.btn-save-profile { min-width: 140px; }

@media (max-width: 600px) {
    .form-section { padding: 16px; }
    .form-section.bg-footer { justify-content: stretch; }
    .form-section.bg-footer .btn { width: 100%; text-align: center; }
}

/* =========================================
   20. CRM / CUSTOMERS MODULE
   ========================================= */
.crm-search-card  { padding: 14px; margin-bottom: 16px; }
.crm-search-form  { display: flex; gap: 10px; flex-wrap: wrap; }
.crm-search-input { flex: 1; min-width: 180px; }
.customer-name    { font-weight: 600; color: var(--text-main); }
.customer-meta    { font-size: 0.82rem; color: var(--text-muted); }
.address-cell     { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 600px) {
    .crm-search-form  { flex-direction: column; }
    .crm-search-input { width: 100%; }
    .btn-clear        { text-align: center; display: block; width: 100%; }
    .address-cell     { display: none; }
}

/* =========================================
   21. INVENTORY MODULE
   ========================================= */
.stock-low   { color: var(--danger); font-weight: 600; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.92rem; }

/* =========================================
   22. HRM MODULE
   ========================================= */
.hrm-wrapper {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.hrm-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}
.hrm-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.hrm-section-box {
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
}

@media (max-width: 600px) { .hrm-form-grid { grid-template-columns: 1fr; } }

/* =========================================
   23. USER / PERMISSIONS MODULE
   ========================================= */
.perm-section-title { font-size: 1rem; margin-bottom: 14px; font-weight: 700; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.perm-category-card { background: var(--bg-surface); padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); }
.perm-category-title { text-transform: uppercase; font-size: 0.72rem; color: var(--text-muted); display: block; margin-bottom: 10px; font-weight: 700; }
.perm-item  { margin-bottom: 8px; }
.perm-label { display: flex; align-items: center; gap: 8px; font-weight: normal; font-size: 0.9rem; cursor: pointer; }

@media (max-width: 600px) { .perm-grid { grid-template-columns: 1fr; } }

/* =========================================
   24. COMPANY SETTINGS
   ========================================= */
.logo-upload-container {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px;
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1.5px dashed var(--border);
    margin-bottom: 20px;
}
.logo-preview {
    width: 90px; height: 90px;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.logo-preview img   { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-placeholder   { color: var(--text-muted); font-size: 0.8rem; text-align: center; }
.upload-info        { font-size: 0.82rem; color: var(--text-muted); margin-top: 5px; }

@media (max-width: 600px) {
    .logo-upload-container { flex-direction: column; align-items: flex-start; }
}

/* =========================================
   25. TAB SWITCHER
   ========================================= */
.tab-segmented {
    display: inline-flex;
    background: var(--bg-surface);
    padding: 4px;
    border-radius: 9px;
    margin-bottom: 22px;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid var(--border);
}
.tab-segment-item {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.18s ease;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
}
.tab-segment-item:hover  { color: var(--primary); background: var(--primary-light); }
.tab-segment-item.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(28,20,16,0.12);
    font-weight: 700;
}

@media (max-width: 600px) {
    .tab-segmented    { display: flex; width: 100%; }
    .tab-segment-item { flex: 1; justify-content: center; padding: 9px 6px; font-size: 0.8rem; }
}

/* =========================================
   26. SETTINGS MODULE
   ========================================= */
.settings-toggle-box   { background: var(--bg-surface); padding: 14px; border-radius: 8px; border: 1px solid var(--border); }
.settings-toggle-row   { display: flex; justify-content: space-between; align-items: center; }
.settings-toggle-label { margin: 0; cursor: pointer; font-weight: 500; color: var(--text-main); }
.settings-toggle-input { transform: scale(1.2); cursor: pointer; accent-color: var(--primary); }
.settings-desc         { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }

/* =========================================
   27. FORM MISC UTILITIES
   ========================================= */
.info-box-green {
    background: var(--success-bg);
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--success);
    font-size: 0.9rem;
    width: 100%;
}
.flex-bottom { display: flex; align-items: flex-end; padding-bottom: 10px; }
.text-method { margin-top: 4px; font-size: 0.85rem; }

/* =========================================
   28. FINANCIAL REPORTS
   ========================================= */
.report-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.report-title          { text-align: center; margin-bottom: 28px; }
.report-section-header { border-bottom: 2px solid var(--primary); padding-bottom: 10px; margin-bottom: 14px; font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.report-section-header.liability { border-color: var(--danger); color: var(--danger); }
.report-sub-header     { font-size: 0.92rem; font-weight: 600; margin-bottom: 8px; margin-top: 18px; color: var(--text-main); }
.report-table          { width: 100%; border-collapse: collapse; }
.report-total-row      { font-weight: 700; background-color: var(--bg-surface); }
.report-total-row td   { padding: 10px 5px; }
.report-double-line    { border-top: 1px solid var(--border); border-bottom: 3px double; }

@media (max-width: 768px) {
    .report-container { padding: 16px; }
}
@media print {
    .report-container { border: none; width: 100%; max-width: none; padding: 0; }
    .btn { display: none !important; }
}

/* =========================================
   29. REPORTS CENTER
   ========================================= */
.report-card        { padding: 0; overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.report-card-header { background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 14px 18px; font-weight: 700; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.6px; color: var(--text-muted); }
.report-list        { padding: 8px; flex-grow: 1; }
.report-list-item   { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 8px; text-decoration: none; transition: background-color 0.18s; margin-bottom: 4px; }
.report-list-item:hover { background-color: var(--primary-light); }
.report-icon-box    { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.report-item-title  { font-weight: 600; color: var(--text-main); font-size: 0.92rem; margin-bottom: 2px; }
.report-item-desc   { font-size: 0.78rem; color: var(--text-muted); }

/* =========================================
   30. SELECT2 OVERRIDES
   ========================================= */
.select2-container .select2-selection--single {
    height: 42px !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    padding: 6px;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__arrow    { top: 8px !important; }
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text-main) !important; padding-left: 0; }
.select2-container--default .select2-results__option--highlighted { background-color: var(--primary-light) !important; color: var(--primary) !important; }

/* =========================================
   31. FOOTER
   ========================================= */
footer {
    background-color: white;
    border-top: 1px solid var(--border);
    padding: 30px 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* =========================================
   32. MOBILE — GLOBAL RESPONSIVE FIXES
   ========================================= */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .table th, .table td { padding: 8px 10px; font-size: 0.85rem; }
    .content-card { border-radius: 8px; }
    .btn { padding: 10px 18px; }
    .btn-sm { padding: 7px 12px; font-size: 0.82rem; }
    .filter-toolbar .btn { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
    .card-header { flex-direction: column; align-items: flex-start; }
    .form-section.bg-footer { flex-direction: column; }
    .form-section.bg-footer .btn { width: 100%; text-align: center; }
    .table th { font-size: 0.72rem; }
    .table td { font-size: 0.82rem; }
    .badge    { font-size: 0.65rem; padding: 2px 7px; }
}
