:root {
    --bg: #f0f2f5;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #1d2327;
    --muted: #646970;
    --line: #dcdcde;
    --line-strong: #c7d1dc;
    --primary: #1d6fea;
    --primary-dark: #0b3a78;
    --primary-soft: #eaf3ff;
    --success: #1d6fea;
    --warning: #d63638;
    --sidebar: #1d2327;
    --sidebar-active: #1d6fea;
    --radius: 14px;
    --shadow-soft: 0 18px 45px rgba(15, 31, 48, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

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

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(29, 111, 234, 0.12), transparent 34%),
        linear-gradient(180deg, #f8fbff 0%, #edf4fb 100%);
}

.login-card {
    width: min(100%, 420px);
    max-width: 100%;
    padding: 32px;
    background: var(--panel);
    border: 1px solid rgba(199, 209, 220, 0.82);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.login-brand {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
}

.login-brand img {
    display: block;
    max-width: 236px;
    height: auto;
}

.login-brand p {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--muted);
    font-weight: 750;
}

.login-form,
.admin-form {
    display: grid;
    gap: 18px;
}

.login-form label,
.admin-form label {
    display: grid;
    gap: 8px;
}

.login-form span,
.admin-form span {
    font-weight: 750;
}

.login-form input,
.login-form textarea,
.admin-form input,
.admin-form select,
.admin-form textarea,
.template-box {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.login-form textarea,
.admin-form textarea {
    min-height: 124px;
}

.login-form input:focus,
.login-form textarea:focus,
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(29, 111, 234, 0.12);
}

.login-form button,
.admin-form button,
.company-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    justify-self: start;
    min-height: 46px;
    padding: 11px 18px;
    color: #fff;
    background: var(--primary);
    border: 1px solid transparent;
    border-radius: 10px;
    box-shadow: 0 12px 25px rgba(29, 111, 234, 0.18);
    cursor: pointer;
    font-weight: 800;
    line-height: 1.1;
    transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.login-form button:hover,
.admin-form button:hover,
.company-button:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 14px 28px rgba(11, 58, 120, 0.18);
    transform: translateY(-1px);
}

.login-form > button {
    justify-self: stretch;
    width: 100%;
}

.notice {
    padding: 13px 15px;
    margin-bottom: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(29, 35, 39, 0.06);
}

.notice.success {
    border-color: var(--success);
}

.notice.error {
    border-color: var(--warning);
}

.admin-shell {
    min-height: 100vh;
    padding-top: 52px;
    padding-left: 220px;
}

.company-guest {
    padding-left: 0;
}

.company-login-content {
    min-height: calc(100vh - 52px);
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(29, 111, 234, 0.09), transparent 32%),
        linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
}

.company-register-card {
    width: min(960px, 100%);
}

.company-register-form {
    gap: 14px;
}

.company-register-form textarea {
    min-height: 130px;
    resize: vertical;
}

.company-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 22px 0;
    padding: 0;
    list-style: none;
}

.company-steps li {
    display: grid;
    gap: 7px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-soft);
    color: var(--muted);
    font-weight: 700;
}

.company-steps span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e5eef3;
    color: var(--text);
    font-size: 13px;
}

.company-steps strong {
    font-size: 13px;
    line-height: 1.25;
}

.company-steps .is-current {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--text);
}

.company-steps .is-current span,
.company-steps .is-complete span {
    color: #fff;
    background: var(--primary);
}

.company-service-groups {
    display: grid;
    gap: 10px;
}

.company-service-groups details {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.company-service-groups summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    cursor: pointer;
    font-weight: 800;
}

.company-service-groups summary span {
    min-width: 30px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--primary-dark);
    text-align: center;
    font-size: 12px;
}

.company-service-groups details > div,
.company-county-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--line);
    background: var(--panel-soft);
}

.company-service-groups label,
.company-radio-group label,
.company-county-grid label,
.company-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-width: 0;
    font-weight: 650;
}

.company-service-groups input,
.company-radio-group input,
.company-county-grid input,
.company-consent input {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 2px;
}

.company-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.company-radio-group label {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.company-summary {
    display: grid;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-soft);
}

.company-summary dl {
    display: grid;
    margin: 0;
}

.company-summary dl > div {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.company-summary dt {
    color: var(--muted);
    font-weight: 800;
}

.company-summary dd {
    margin: 0;
}

.company-summary h2,
.company-summary p {
    margin: 0;
}

.company-consent {
    display: grid;
    grid-template-columns: 24px 1fr;
}

.company-consent small {
    grid-column: 2;
}

.company-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 2px;
}

.company-button.secondary {
    color: var(--text);
    background: #fff;
    border-color: var(--line);
    box-shadow: none;
}

.company-button.secondary:hover {
    color: var(--text);
    background: var(--panel-soft);
}

.login-form .is-invalid-control {
    border-color: var(--warning);
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.14);
}

@media (max-width: 760px) {
    .company-register-card {
        width: 100%;
        padding: 22px;
    }

    .company-steps {
        grid-template-columns: 1fr;
    }

    .company-service-groups details > div,
    .company-county-grid,
    .company-summary dl > div {
        grid-template-columns: 1fr;
    }

    .company-form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .company-form-actions button,
    .company-form-actions .company-button {
        width: 100%;
    }
}

.admin-topbar {
    position: fixed;
    z-index: 20;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px 0 14px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.admin-brand img {
    display: block;
    width: 190px;
    height: auto;
}

.topbar-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.admin-sidebar {
    position: fixed;
    z-index: 10;
    top: 52px;
    bottom: 0;
    left: 0;
    width: 220px;
    padding: 14px 0;
    background: var(--sidebar);
    color: #fff;
}

.admin-sidebar nav {
    display: grid;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: #c3c4c7;
    border-left: 4px solid transparent;
}

.admin-sidebar a i {
    width: 18px;
    text-align: center;
    color: #8db8f8;
}

.admin-sidebar a:hover,
.admin-sidebar a.is-active {
    color: #fff;
    background: #2c3338;
    border-left-color: var(--sidebar-active);
    text-decoration: none;
}

.admin-content {
    padding: 26px;
}

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

.content-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.admin-user {
    padding: 6px 10px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.metric-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(29, 35, 39, 0.05);
}

.metric-card {
    display: grid;
    gap: 8px;
    min-height: 112px;
    padding: 18px;
    color: var(--text);
}

.metric-card:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.metric-card span {
    color: var(--muted);
}

.metric-card strong {
    font-size: 34px;
    line-height: 1;
}

.admin-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.two-columns {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
}

.panel {
    padding: 0;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--muted);
    background: var(--panel-soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

td small {
    color: var(--muted);
}

.compact th,
.compact td {
    padding: 10px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    color: #1d2327;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-new,
.status-issue {
    color: #8a2424;
    background: #fcf0f1;
    border-color: #ffb8bf;
}

.status-reviewed {
    color: #664d03;
    background: #fff8e5;
    border-color: #f0c36d;
}

.status-forwarded,
.status-ok {
    color: #0b3a78;
    background: #eaf4ff;
    border-color: #93c5fd;
}

.status-closed {
    color: #3c434a;
    background: #f6f7f7;
}

.status-contractor-candidate {
    color: #664d03;
    background: #fff8e5;
    border-color: #f0c36d;
}

.status-contractor-active {
    color: #0b3a78;
    background: #eaf4ff;
    border-color: #93c5fd;
}

.status-contractor-paused {
    color: #3c434a;
    background: #f6f7f7;
}

.status-contractor-rejected {
    color: #8a2424;
    background: #fcf0f1;
    border-color: #ffb8bf;
}

.rank-list {
    display: grid;
    gap: 0;
}

.rank-list div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.rank-list strong {
    color: var(--primary-dark);
}

.empty-state {
    margin: 0;
    padding: 16px;
    color: var(--muted);
}

.status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.status-tabs a {
    padding: 7px 12px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.status-tabs a.is-active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary-dark);
}

.admin-inline-action {
    margin-left: auto;
}

.admin-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.admin-summary span {
    padding: 6px 10px;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
}

.admin-summary strong {
    color: var(--text);
}

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

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.helper-panel {
    display: grid;
    gap: 12px;
    padding: 16px;
    color: var(--muted);
}

.helper-panel p {
    margin: 0;
}

.dx-grid-wrap {
    padding: 16px;
    min-height: 0;
}

.admin-shell .dx-widget,
.admin-shell .dx-widget *,
.admin-shell .dx-overlay-wrapper,
.admin-shell .dx-overlay-wrapper * {
    font-size: 14px;
}

.dx-grid-wrap .dx-datagrid {
    font-family: inherit;
    line-height: 1.45;
    min-height: 360px;
}

.dx-grid-wrap .dx-link {
    color: var(--primary);
}

.lead-match-detail {
    display: grid;
    gap: 12px;
    padding: 12px;
}

.lead-match-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.lead-match-toolbar span {
    color: var(--muted);
}

.lead-forward-button {
    border: 0;
    border-radius: 4px;
    padding: 9px 12px;
    cursor: pointer;
}

.coverage-status-text {
    color: var(--text);
    font-weight: 400;
}

.form-note {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.form-note strong {
    color: var(--text);
}

.contractor-pick-group {
    display: grid;
    gap: 10px;
}

.contractor-pick-group h3,
.contractor-pick-group summary {
    margin: 0;
    font-weight: 700;
}

.checkbox-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel-soft);
}

.checkbox-row input {
    margin-top: 2px;
}

.checkbox-row span {
    display: grid;
    gap: 3px;
}

.checkbox-row small,
.checkbox-row em {
    color: var(--muted);
    font-style: normal;
    font-weight: 500;
}

.detail-list {
    display: grid;
    margin: 0;
    padding: 16px;
    gap: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

.message-box {
    margin: 0 16px 16px;
    padding: 14px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 4px;
}

.admin-form {
    padding: 16px;
}

.template-box {
    display: block;
    border: 0;
    border-radius: 0;
    resize: vertical;
}

@media (max-width: 980px) {
    .admin-shell {
        padding-left: 0;
    }

    .admin-sidebar {
        position: static;
        width: auto;
        padding: 0;
    }

    .admin-sidebar nav {
        display: flex;
        overflow-x: auto;
    }

    .admin-sidebar a {
        white-space: nowrap;
        border-left: 0;
        border-bottom: 4px solid transparent;
    }

    .metric-grid,
    .two-columns {
        grid-template-columns: 1fr;
    }

    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .admin-content {
        padding: 18px;
    }
}

@media (min-width: 981px) and (max-width: 1180px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .company-login-content {
        padding: 14px;
    }

    .login-screen {
        padding: 14px;
    }

    .login-card {
        width: 100%;
        max-width: none;
        padding: 22px 18px;
        overflow: hidden;
    }

    .login-brand img {
        max-width: 100%;
    }

    .login-form input {
        min-width: 0;
    }

    .admin-topbar {
        position: static;
        height: auto;
        align-items: flex-start;
        gap: 12px;
        padding: 12px;
    }

    .admin-shell {
        padding-top: 0;
    }

    .admin-brand img {
        width: 160px;
    }

    .content-header {
        display: grid;
    }

    .detail-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}
