:root {
    --bg: #f3f6fb;
    --bg-2: #eef4ff;
    --card: rgba(255, 255, 255, 0.94);
    --card-solid: #ffffff;
    --text: #101828;
    --heading: #0b1220;
    --muted: #667085;
    --muted-2: #98a2b3;
    --border: #d9e2ef;
    --border-strong: #c9d6ea;
    --primary: #2854ff;
    --primary-dark: #173fe0;
    --primary-soft: #eef3ff;
    --success: #12b76a;
    --success-dark: #087443;
    --danger: #f04438;
    --warning: #f79009;
    --purple: #7c3aed;
    --info: #0284c7;
    --shadow: 0 24px 80px rgba(16, 24, 40, 0.12);
    --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.08);
    --radius: 22px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(40, 84, 255, 0.13), transparent 30%),
        radial-gradient(circle at 85% 10%, rgba(124, 58, 237, 0.10), transparent 28%),
        linear-gradient(180deg, #f7f9fe 0%, #eef3fb 100%);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 70%);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

.container {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 42px;
    position: relative;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background:
        radial-gradient(circle at top left, rgba(40, 84, 255, 0.22), transparent 34%),
        radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.16), transparent 36%),
        #f5f7fb;
}

.login-card,
.card {
    background: var(--card);
    border: 1px solid rgba(217, 226, 239, 0.84);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.login-card {
    width: min(460px, 100%);
    padding: 34px;
}

.card {
    padding: 26px;
    margin-bottom: 20px;
}

.brand-title {
    margin: 0 0 8px;
    font-size: clamp(28px, 4vw, 38px);
    letter-spacing: -0.055em;
    color: var(--heading);
}

.subtitle {
    margin: 0 0 24px;
    color: var(--muted);
}

.topbar {
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(217, 226, 239, 0.8);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 34px rgba(16, 24, 40, 0.06);
}

.topbar-inner {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 15px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar h1 {
    margin: 0;
    font-size: 21px;
    color: var(--heading);
    letter-spacing: -0.03em;
}

.user-meta {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    margin-bottom: 18px;
    position: relative;
}

label {
    display: block;
    font-weight: 800;
    margin-bottom: 8px;
    font-size: 13px;
    color: #344054;
    letter-spacing: -0.01em;
}

.required {
    color: var(--danger);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 15px;
    padding: 13px 14px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #667085 50%),
        linear-gradient(135deg, #667085 50%, transparent 50%);
    background-position:
        calc(100% - 20px) 52%,
        calc(100% - 14px) 52%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 42px;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-strong);
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 5px rgba(40, 84, 255, 0.12), 0 10px 24px rgba(16, 24, 40, 0.07);
    transform: translateY(-1px);
    background: #fff;
}

input:valid,
select:valid,
textarea:valid {
    border-color: #cfd9ea;
}

textarea {
    min-height: 112px;
    resize: vertical;
}

input[type="file"] {
    padding: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border: 1.5px dashed #b9c8df;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    margin-right: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    font-weight: 800;
    cursor: pointer;
}

input[type="checkbox"] {
    accent-color: var(--primary);
}

small.help {
    display: block;
    color: var(--muted);
    margin-top: 7px;
    font-size: 12px;
}

.btn,
button {
    border: 0;
    border-radius: 14px;
    padding: 12px 17px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    min-height: 44px;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff;
    box-shadow: 0 14px 30px rgba(40, 84, 255, 0.26);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #6d28d9);
    text-decoration: none;
    box-shadow: 0 18px 38px rgba(40, 84, 255, 0.32);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #0f9f65);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c0262d);
    color: #fff;
}

.btn-light {
    background: #f3f6fb;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-light:hover {
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: 8px 11px;
    border-radius: 11px;
    font-size: 12px;
    min-height: 34px;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    border: 1px solid transparent;
    font-weight: 700;
}

.alert-success {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
}

.alert-error {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1250px;
}

th,
td {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

th {
    background: #f8fafc;
    color: #475467;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 1;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background-color 0.18s ease;
}

tbody tr:hover {
    background: #f8fbff;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.badge-pending {
    color: #92400e;
    background: #fef3c7;
}

.badge-approved {
    color: #067647;
    background: #dcfae6;
}

.badge-blue {
    color: #1d4ed8;
    background: #dbeafe;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 140px;
}

.file-link {
    display: inline-block;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 6px 9px;
    border-radius: 10px;
    font-size: 12px;
    word-break: break-word;
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.file-link:hover {
    transform: translateX(2px);
    background: #dbeafe;
}

.muted-text {
    color: var(--muted);
}

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

.section-title {
    margin: 0 0 16px;
    font-size: 20px;
    letter-spacing: -0.035em;
    color: var(--heading);
}

.form-footer {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.notice-box {
    background: #f8fafc;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    padding: 14px;
    color: var(--muted);
    margin-bottom: 18px;
}

/* Modern CRM form layout */
.dashboard-hero {
    display: grid;
    grid-template-columns: 1.45fr 0.75fr;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 22px;
}

.hero-card,
.progress-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(248,251,255,0.88));
    border: 1px solid rgba(217, 226, 239, 0.86);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

.hero-card::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -70px;
    top: -70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(40, 84, 255, 0.18), transparent 70%);
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid #d8e2ff;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 14px;
}

.hero-title {
    margin: 0;
    color: var(--heading);
    font-size: clamp(28px, 4vw, 46px);
    letter-spacing: -0.065em;
    line-height: 1.02;
}

.hero-text {
    color: var(--muted);
    margin: 12px 0 0;
    max-width: 650px;
}

.hero-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #344054;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 12px;
}

.progress-track {
    height: 12px;
    background: #e9eef7;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.08);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 999px;
    transition: width 0.35s ease;
}

.progress-hint {
    color: var(--muted);
    margin: 12px 0 0;
    font-size: 13px;
}

.form-card {
    padding: 0;
    overflow: hidden;
}

.crm-modern-form {
    padding: 0;
}

.form-section {
    padding: 26px;
    border-bottom: 1px solid rgba(217, 226, 239, 0.74);
    background: rgba(255, 255, 255, 0.65);
}

.form-section:nth-of-type(even) {
    background: rgba(248, 251, 255, 0.72);
}

.form-section:last-of-type {
    border-bottom: 0;
}

.section-heading {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.section-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 950;
    box-shadow: 0 12px 24px rgba(40, 84, 255, 0.22);
    flex: 0 0 auto;
}

.section-heading h2,
.section-heading h3 {
    margin: 0;
    color: var(--heading);
    letter-spacing: -0.04em;
    font-size: 20px;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.form-group.is-filled label::after {
    content: " ✓";
    color: var(--success);
    font-weight: 950;
}

.file-selected {
    display: none;
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    color: #344054;
    font-size: 13px;
}

.file-selected.is-visible {
    display: block;
}

.file-selected ul {
    margin: 8px 0 0 18px;
    padding: 0;
}

.inline-check {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 800 !important;
    background: #fff;
    border: 1px solid var(--border);
    padding: 13px 14px;
    border-radius: 15px;
    cursor: pointer;
    width: fit-content;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.inline-check:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.inline-check input {
    width: 18px !important;
    height: 18px;
    margin: 0;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 25;
    padding: 18px 26px;
    margin-top: 0;
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(217, 226, 239, 0.86);
    backdrop-filter: blur(14px);
    justify-content: flex-end;
}

.crm-modern-form.is-submitting button[type="submit"] {
    opacity: 0.82;
    pointer-events: none;
}

.crm-modern-form.is-submitting button[type="submit"]::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.65);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status/campaign dropdown visual hints */
select.has-value {
    font-weight: 800;
}

select[name="campaign"].has-value,
select[name="lead_status"].has-value,
select[name="transfered"].has-value,
select[name="approval_status"].has-value {
    background-color: #ffffff;
    border-color: #b8c7ff;
}

@media (max-width: 980px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .card,
    .login-card {
        padding: 20px;
    }

    .form-card {
        padding: 0;
    }

    .form-section,
    .sticky-actions {
        padding: 20px;
    }
}

@media (max-width: 560px) {
    .container,
    .topbar-inner {
        width: min(100% - 22px, 1220px);
    }

    .hero-card,
    .progress-card {
        padding: 20px;
    }

    .hero-stats {
        flex-direction: column;
    }

    .hero-pill {
        width: 100%;
        justify-content: center;
    }

    .sticky-actions {
        justify-content: stretch;
    }

    .sticky-actions .btn,
    .sticky-actions button {
        width: 100%;
    }
}
