/* =========================================================
   NILA SERVICES - shared look for login, sign-up, employer
   and admin pages.
   ========================================================= */

:root {
    --brand: #c2410c;
    --brand-dark: #9a3412;
    --brand-soft: #fff7ed;
    --page: #f7f6f3;
    --card: #ffffff;
    --text: #1c1917;
    --text-2: #44403c;
    --muted: #78716c;
    --line: #e7e5e4;
    --line-soft: #f0efed;
    --ok: #15803d;
    --ok-soft: #ecfdf3;
    --warn: #a16207;
    --warn-soft: #fefce8;
    --bad: #b91c1c;
    --bad-soft: #fef2f2;
    --info: #1d4ed8;
    --info-soft: #eff6ff;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: inherit;
}

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

[hidden] {
    display: none !important;
}

.container {
    width: 92%;
    max-width: 1100px;
    margin: 0 auto;
}

.container.narrow {
    max-width: 760px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* ---------- Header ---------- */

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.site-header .container {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand img {
    width: 38px;
    height: 38px;
}

.brand strong {
    display: block;
    color: var(--brand);
    font-size: 19px;
    letter-spacing: 1px;
    line-height: 1;
}

.brand span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2.5px;
}

.header-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}

.header-nav a,
.header-nav button.link {
    padding: 8px 11px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.header-nav a:hover,
.header-nav button.link:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.header-nav a[aria-current="page"] {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.logout-btn {
    margin-left: 6px;
    padding: 8px 14px;
    border: 1px solid #d6d3d1;
    border-radius: 8px;
    background: var(--card);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.logout-btn:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.header-lang {
    margin-left: 6px;
}


/* ---------- Page ---------- */

main {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 32px 0 56px;
}

.page-head {
    margin-bottom: 22px;
}

.page-head h1 {
    font-size: 28px;
    line-height: 1.25;
}

.page-head p {
    margin-top: 6px;
    color: #57534e;
    font-size: 15px;
}

.page-head-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.back-link {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--brand-dark);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
}

.section {
    margin-top: 28px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.section-head h2 {
    font-size: 20px;
}

.section-head a,
.text-link {
    color: var(--brand-dark);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
}

.section-head a:hover,
.text-link:hover {
    text-decoration: underline;
}

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

.small {
    font-size: 13px;
}

.stack > * + * {
    margin-top: 14px;
}

.two-col {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
}


/* ---------- Progress steps ---------- */

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.step-mark {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #d6d3d1;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.step.done .step-mark {
    background: var(--ok);
    border-color: var(--ok);
    color: #ffffff;
}

.step.todo .step-mark {
    border-color: var(--brand);
    color: var(--brand);
}

.step h3 {
    font-size: 15px;
    margin-bottom: 4px;
}

.step p {
    color: #57534e;
    font-size: 13px;
}

.step a {
    display: inline-block;
    margin-top: 8px;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.step a:hover {
    text-decoration: underline;
}


/* ---------- Numbers (admin overview) ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.stat {
    display: block;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-decoration: none;
}

a.stat:hover {
    border-color: var(--brand);
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stat-num {
    display: block;
    margin-top: 6px;
    font-size: 28px;
    font-weight: 700;
}

.stat.attention .stat-num {
    color: var(--brand);
}


/* ---------- Details lists ---------- */

.facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 20px;
}

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

.fact dt {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 2px;
}

.fact dd {
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.fact.wide {
    grid-column: 1 / -1;
}

.pre-line {
    white-space: pre-line;
}

.check-list {
    list-style: none;
}

.check-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 14px;
}

.check-list li:last-child {
    border-bottom: 0;
}

.ok {
    color: var(--ok);
    font-weight: 700;
}

.missing {
    color: var(--bad);
    font-weight: 700;
}


/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-dark);
}

.btn-secondary {
    background: var(--card);
    border-color: var(--brand);
    color: var(--brand-dark);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--brand-soft);
}

.btn-plain {
    background: var(--card);
    border-color: #d6d3d1;
    color: var(--text-2);
}

.btn-plain:hover:not(:disabled) {
    border-color: var(--muted);
}

.btn-danger {
    background: var(--card);
    border-color: #fca5a5;
    color: var(--bad);
}

.btn-danger:hover:not(:disabled) {
    background: var(--bad-soft);
}

.btn-small {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

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


/* ---------- Forms ---------- */

.form-section + .form-section {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--line-soft);
}

.form-section h2 {
    font-size: 17px;
    margin-bottom: 4px;
}

.form-section > p {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 14px;
}

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

.field.wide {
    grid-column: 1 / -1;
}

.field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 700;
}

.field .optional {
    color: var(--muted);
    font-weight: 400;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d6d3d1;
    border-radius: 8px;
    background: #ffffff;
    font-size: 15px;
    outline: none;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.12);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
    border-color: var(--bad);
}

.hint {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 70px;
}

.show-password {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    padding: 6px 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.show-password:hover {
    background: var(--brand-soft);
}

.form-footer {
    margin-top: 22px;
}


/* ---------- Messages ---------- */

.alert {
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 14px;
}

.alert + * {
    margin-top: 16px;
}

.alert-error {
    background: var(--bad-soft);
    border-color: #fecaca;
    color: #991b1b;
}

.alert-success {
    background: var(--ok-soft);
    border-color: #bbf7d0;
    color: #166534;
}

.alert-info {
    background: var(--info-soft);
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 50;
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    border-radius: 8px;
    background: #1c1917;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.25);
}

.toast.error {
    background: var(--bad);
}


/* ---------- Status labels ---------- */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-pending {
    background: var(--warn-soft);
    border-color: #fde68a;
    color: var(--warn);
}

.badge-approved {
    background: var(--info-soft);
    border-color: #bfdbfe;
    color: var(--info);
}

.badge-connected {
    background: var(--ok-soft);
    border-color: #bbf7d0;
    color: var(--ok);
}

.badge-closed {
    background: #f5f5f4;
    border-color: var(--line);
    color: var(--muted);
}

.badge-rejected {
    background: var(--bad-soft);
    border-color: #fecaca;
    color: var(--bad);
}


/* ---------- Empty and loading states ---------- */

.empty {
    text-align: center;
    padding: 34px 22px;
}

.empty h3 {
    font-size: 17px;
    margin-bottom: 6px;
}

.empty p {
    max-width: 520px;
    margin: 0 auto;
    color: #57534e;
    font-size: 14px;
}

.empty .actions {
    justify-content: center;
}


/* ---------- Job cards ---------- */

.list {
    display: grid;
    gap: 14px;
}

.item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.item-top h3 {
    font-size: 18px;
}

.item-sub {
    margin-top: 2px;
    color: var(--brand-dark);
    font-size: 14px;
    font-weight: 700;
}

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

.item .facts {
    margin-top: 16px;
}

.item-desc {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
    color: var(--text-2);
    font-size: 14px;
    white-space: pre-line;
}


/* ---------- Admin ---------- */

.admin-nav {
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.admin-nav .container {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.admin-nav a {
    flex-shrink: 0;
    padding: 12px 12px 11px;
    border-bottom: 3px solid transparent;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.admin-nav a:hover {
    color: var(--brand-dark);
}

.admin-nav a[aria-current="page"] {
    border-bottom-color: var(--brand);
    color: var(--brand-dark);
}

.count {
    display: inline-block;
    min-width: 20px;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--brand);
    color: #ffffff;
    font-size: 12px;
    text-align: center;
}

.toolbar {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.toolbar .field label {
    font-size: 13px;
}

.result-line {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
}

.table-wrap {
    position: relative;
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

th {
    background: #fafaf9;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

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

tbody tr:hover td {
    background: #fcfbfa;
}

td .name {
    font-weight: 700;
}

td .sub {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

td.actions-cell {
    white-space: nowrap;
    text-align: right;
}

td.actions-cell .btn + .btn {
    margin-left: 6px;
}

.table-empty {
    padding: 30px 16px;
    color: var(--muted);
    text-align: center;
}


/* ---------- Side panel (details) ---------- */

.panel {
    width: min(640px, 100%);
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    background: var(--page);
    color: var(--text);
    overflow-y: auto;
}

.panel::backdrop {
    background: rgba(28, 25, 23, 0.45);
}

.panel-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    font-size: 20px;
}

.panel-body {
    padding: 20px 22px 32px;
}

.panel-body .card + .card {
    margin-top: 14px;
}

.panel-body h3 {
    font-size: 15px;
    margin-bottom: 12px;
}


/* ---------- Auth pages ---------- */

.auth-main {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px 56px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

.auth-card.wide {
    max-width: 680px;
}

.auth-card h1 {
    font-size: 26px;
}

.auth-card .lead {
    margin: 6px 0 22px;
    color: #57534e;
    font-size: 15px;
}

.auth-card .field + .field {
    margin-top: 16px;
}

.auth-links {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
    font-size: 14px;
    color: #57534e;
}

.auth-links p + p {
    margin-top: 8px;
}

.auth-links a {
    color: var(--brand-dark);
    font-weight: 700;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}


/* ---------- Footer ---------- */

.site-footer {
    padding: 24px 0 32px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.site-footer a {
    text-decoration: underline;
}


/* ---------- Small screens ---------- */

@media (max-width: 900px) {

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

    .toolbar .field:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {

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

    .facts {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    .site-header .container {
        flex-wrap: wrap;
        padding: 12px 0;
        min-height: 0;
    }

    .header-nav a,
    .header-nav button.link {
        padding: 7px 8px;
    }

    main {
        padding-top: 24px;
    }

    .page-head h1 {
        font-size: 23px;
    }

    .card {
        padding: 18px;
    }

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

    .facts,
    .facts.two {
        grid-template-columns: 1fr 1fr;
        gap: 12px 14px;
    }

    .item-top {
        flex-direction: column;
    }

    .actions .btn {
        flex: 1 1 100%;
    }

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

    .auth-main {
        padding-top: 24px;
    }
}
