* {
    box-sizing: border-box;
}

:root {
    --ink: #111827;
    --muted: #667085;
    --line: #d9e1ef;
    --paper: #ffffff;
    --soft: #f6f8fc;
    --blue: #0a66c2;
    --blue-dark: #004182;
    --navy: #061527;
    --navy-soft: #0d2542;
    --accent: #38bdf8;
    --green: #0f8f61;
    --amber: #b7791f;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #edf3f8;
    color: var(--ink);
}

.appShell {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    background:
        radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.18), transparent 28%),
        linear-gradient(180deg, #071426 0%, #0b1728 100%);
    color: #fff;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.brandMark {
    display: grid;
    place-items: center;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0a66c2, #38bdf8);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
}

.brandMark svg {
    display: block;
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand strong,
.brand span,
.statusStrip strong,
.statusStrip small,
.stats strong,
.stats span {
    display: block;
}

.brand strong {
    font-size: 17px;
}

.brand span {
    margin-top: 2px;
    color: #98a2b3;
    font-size: 13px;
}

.sideNav {
    display: grid;
    gap: 8px;
}

.navItem {
    border: 0;
    border-radius: 8px;
    padding: 12px 13px;
    background: transparent;
    color: #cbd5e1;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navItem.active {
    background: rgba(10, 102, 194, 0.32);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.12);
}

.navIcon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.07);
    font-size: 16px;
    line-height: 1;
}

.mobileHeader {
    display: none;
}

.mainArea {
    width: 100%;
    padding: 32px 42px;
}

.appHeader {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.eyebrow,
.miniLabel {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 7px 11px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

h1 {
    max-width: 760px;
    margin: 10px 0 10px;
    font-size: 42px;
    line-height: 1.05;
    letter-spacing: 0;
}

h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0;
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.statusStrip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.homeActions {
    display: flex;
    gap: 12px;
    margin: -6px 0 22px;
}

.homeActions.viewSection.active {
    display: flex;
}

.homePrimary {
    width: auto;
}

.viewSection {
    display: none;
}

.viewSection.active {
    display: block;
}

.statusStrip.viewSection.active,
.policyPanel.viewSection.active {
    display: grid;
}

.statusStrip div {
    position: relative;
    min-height: 104px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 16px 16px 70px;
    background: var(--paper);
    box-shadow: 0 14px 36px rgba(16, 24, 40, 0.06);
}

.metricIcon {
    position: absolute;
    left: 16px;
    top: 18px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--blue);
    font-weight: 900;
}

.statusStrip .warn .metricIcon {
    background: #fff7ed;
    color: var(--amber);
}

.statusStrip .ok .metricIcon {
    background: #ecfdf3;
    color: var(--green);
}

.statusStrip strong {
    font-size: 16px;
    margin-top: 1px;
}

.statusStrip small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.uploadBoard {
    display: grid;
    grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1fr);
    gap: 20px;
    align-items: stretch;
}

.uploadIntro {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 430px;
    border-radius: 8px;
    padding: 26px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(37, 99, 235, 0.86)),
        #111827;
    box-shadow: 0 22px 60px rgba(37, 99, 235, 0.22);
}

.uploadIntro .miniLabel {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.uploadIntro h2 {
    max-width: 360px;
    margin-top: 18px;
    font-size: 34px;
    line-height: 1.08;
}

.uploadIntro p {
    max-width: 380px;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.78);
}

.flow {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto;
    gap: 10px;
    align-items: center;
    margin-top: 28px;
}

.flow span {
    display: grid;
    place-items: center;
    min-width: 54px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    font-weight: 900;
}

.flow b {
    height: 2px;
    background: rgba(255, 255, 255, 0.22);
}

.panel,
.uploadPanel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 18px 42px rgba(16, 24, 40, 0.07);
}

.applyDesk {
    min-width: 0;
}

.uploadPanel {
    min-height: 430px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
}

.uploadHead {
    display: grid;
    gap: 6px;
}

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

.smtpGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    border: 1px solid #dbe7ff;
    border-radius: 8px;
    padding: 16px;
    background: #f8fbff;
}

.wideField {
    grid-column: 1 / -1;
}

.fileBox {
    min-height: 168px;
    padding: 18px;
    border: 1px dashed #9fb2d6;
    border-radius: 8px;
    background: #f8fbff;
    justify-content: space-between;
}

.workspace {
    display: block;
    width: 100%;
}

.policyPanel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(240px, 0.65fr) 1fr;
    gap: 20px;
    align-items: start;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 22px;
    background: linear-gradient(135deg, #eff6ff, #ffffff);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.08);
}

.policyPanel h2 {
    margin-top: 12px;
    max-width: 360px;
}

.policyPanel ul {
    margin: 0;
    padding-left: 19px;
    color: #344054;
    line-height: 1.7;
}

.settings {
    width: 100%;
    max-width: none;
}

.profileTools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.toolCard {
    display: grid;
    gap: 8px;
    min-width: 0;
    border: 1px solid #e4e9f2;
    border-radius: 8px;
    padding: 14px;
    background: #f8fbff;
}

.toolCard span,
.toolCard small {
    color: var(--muted);
}

.toolCard span {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.toolCard strong {
    overflow-wrap: anywhere;
}

.miniForm {
    display: grid;
    gap: 8px;
}

.miniForm input[type="file"] {
    min-height: 44px;
    padding: 8px;
}

.secondaryLink {
    display: inline-flex;
    justify-content: center;
    border-radius: 6px;
    padding: 10px 12px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 900;
    text-decoration: none;
}

.profileActions {
    margin-top: 16px;
}

.editorBlock {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    color: #39445b;
    font-size: 13px;
    font-weight: 800;
}

.editorToolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid #d7e2f0;
    border-radius: 8px;
    padding: 8px;
    background: #f8fbff;
}

.editorToolbar button {
    min-height: 34px;
    padding: 7px 10px;
    background: #fff;
    color: #243047;
    border: 1px solid #d7e2f0;
}

.emailEditor {
    min-height: 260px;
    border: 1px solid #c8d2e2;
    border-radius: 8px;
    padding: 14px;
    background: #fff;
    color: var(--ink);
    line-height: 1.55;
    overflow: auto;
}

.emailEditor:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(10, 102, 194, 0.14);
}

.hiddenTemplate {
    display: none;
}

.contactGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    max-height: calc(100vh - 260px);
    overflow: auto;
    padding-right: 4px;
}

.contactTile {
    display: grid;
    gap: 8px;
    border: 1px solid #e4e9f2;
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.contactTile strong {
    font-size: 16px;
}

.contactTile small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.sectionTitle {
    display: grid;
    gap: 4px;
    margin-bottom: 16px;
}

.fields {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    color: #39445b;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c8d2e2;
    border-radius: 6px;
    padding: 11px 12px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(37, 99, 235, 0.14);
}

input[type="file"] {
    min-height: 56px;
    padding: 10px;
    background: #fff;
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    border: 0;
    border-radius: 6px;
    padding: 9px 12px;
    background: #edf3ff;
    color: var(--blue-dark);
    font-weight: 900;
    cursor: pointer;
}

textarea {
    resize: vertical;
    line-height: 1.45;
}

button,
.link {
    border: 0;
    border-radius: 6px;
    padding: 11px 15px;
    background: var(--blue);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

button:hover,
.link:hover {
    background: var(--blue-dark);
}

.primaryBtn {
    width: 100%;
    min-height: 54px;
    font-size: 16px;
}

button:disabled {
    background: #aeb6c4;
    cursor: not-allowed;
}

.hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    margin-top: 12px;
    border-radius: 8px;
    padding: 11px 12px;
    background: var(--soft);
}

.alert {
    background: #fff0f0;
    border: 1px solid #f0b6b6;
    color: #9a1f1f;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.stats div {
    border: 1px solid #e4e9f2;
    border-radius: 8px;
    padding: 12px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.stats strong {
    font-size: 22px;
}

.stats span {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.applyHeader {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.applyHeader h2 {
    margin-top: 10px;
}

.pagerCount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    border-radius: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e4e9f2;
    color: var(--muted);
    font-weight: 900;
}

.leadPager {
    position: relative;
}

.leadCard {
    display: none;
    border: 1px solid #e4e9f2;
    border-radius: 8px;
    padding: 20px;
    background: linear-gradient(180deg, #ffffff, #f9fbff);
}

.leadCard.active {
    display: block;
}

.leadTop,
.leadActions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.leadIdentity {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0;
}

.avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font-size: 24px;
    font-weight: 900;
}

.leadIdentity h3 {
    margin: 0 0 4px;
    font-size: 28px;
    line-height: 1.1;
}

.leadDetails {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.leadDetails div {
    min-width: 0;
    border: 1px solid #edf0f4;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.leadDetails span,
.leadDetails strong {
    display: block;
}

.leadDetails span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.leadDetails strong {
    margin-top: 5px;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.leadActions {
    justify-content: flex-end;
    border-top: 1px solid #edf0f4;
    padding-top: 16px;
}

.secondaryBtn {
    background: #eef2f7;
    color: #243047;
}

.secondaryBtn:hover {
    background: #e2e8f0;
}

.applyBtn {
    min-width: 170px;
    min-height: 46px;
}

.leadCard.sent {
    border-color: #b7ebcf;
}

.status {
    font-weight: 800;
}

.statusBadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
}

.statusBadge.pending {
    background: #fff7ed;
    color: #9a5b13;
}

.statusBadge.sending {
    background: #eff6ff;
    color: #1d4ed8;
}

.statusBadge.applied {
    background: #ecfdf3;
    color: #067647;
}

.sentAt {
    color: var(--muted);
    white-space: nowrap;
}

.sendBtn {
    min-width: 82px;
}

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

    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
    }

    .sideNav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        overflow-x: auto;
    }

    .mainArea {
        padding: 20px;
    }

    .uploadBoard,
    .workspace,
    .statusStrip,
    .policyPanel {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 34px;
    }
}

@media (max-width: 640px) {
    body {
        background: #f4f7fb;
    }

    .brand {
        display: none;
    }

    .brandMark {
        width: 42px;
        height: 42px;
    }

    .sideNav {
        display: flex;
        gap: 8px;
        margin: 0;
        padding: 0;
    }

    .navItem {
        flex: 0 0 auto;
        padding: 10px 12px;
        font-size: 14px;
        text-align: center;
    }

    .mainArea {
        padding: 14px 14px 96px;
    }

    .mobileHeader {
        display: flex;
        align-items: center;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 40;
        margin: -14px -14px 14px;
        padding: 12px 14px;
        background: rgba(244, 247, 251, 0.94);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid #d9e1ef;
    }

    .mobileLogo {
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        border-radius: 8px;
        background: linear-gradient(135deg, #0a66c2, #38bdf8);
        color: #fff;
        font-weight: 900;
    }

    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 50;
        height: auto;
        padding: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .navItem {
        flex: 1 1 0;
        justify-content: center;
        padding: 9px 6px;
        min-height: 50px;
        font-size: 0;
    }

    .navText {
        display: none;
    }

    .navIcon {
        width: 34px;
        height: 34px;
        font-size: 18px;
        background: rgba(255, 255, 255, 0.09);
    }

    .navItem.active .navIcon {
        background: rgba(56, 189, 248, 0.22);
    }

    .appHeader {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 14px;
    }

    .headerNext {
        width: 100%;
        text-align: center;
    }

    .homeActions {
        flex-direction: column;
    }

    .homePrimary {
        width: 100%;
    }

    h1 {
        font-size: 28px;
        line-height: 1.12;
    }

    h2 {
        font-size: 20px;
    }

    .statusStrip {
        gap: 10px;
    }

    .statusStrip div {
        min-height: auto;
        padding: 14px 14px 14px 64px;
    }

    .uploadGrid,
    .smtpGrid,
    .sideNav,
    .profileTools {
        grid-template-columns: 1fr;
    }

    .wideField {
        grid-column: auto;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stats div {
        padding: 10px;
    }

    .stats strong {
        font-size: 20px;
    }

    .leadDetails {
        grid-template-columns: 1fr;
    }

    .leadActions,
    .applyHeader {
        align-items: stretch;
        flex-direction: column;
    }

    .applyBtn,
    .secondaryBtn {
        width: 100%;
        min-height: 48px;
    }

    .uploadIntro {
        min-height: auto;
        padding: 20px;
    }

    .uploadIntro h2 {
        font-size: 28px;
    }

    .panel,
    .uploadPanel,
    .policyPanel,
    .leadCard {
        padding: 16px;
    }

    .leadIdentity {
        align-items: flex-start;
    }

    .leadIdentity h3 {
        font-size: 24px;
    }

    .avatar {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .leadActions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin: 0 -16px -16px;
        padding: 12px 16px 16px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 -12px 24px rgba(16, 24, 40, 0.08);
    }

    .policyPanel ul {
        padding-left: 16px;
    }
}
