:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e5e9ef;
    --text: #172033;
    --text-secondary: #667085;
    --text-muted: #98a2b3;
    --sidebar: #111827;
    --sidebar-text: #d1d5db;
    --sidebar-muted: #7f8a9b;
    --sidebar-hover: #1f2937;
    --accent: #2563eb;
    --accent-soft: #eff6ff;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

.app {
    min-height: 100vh;
    display: flex;
}


/* SIDEBAR */

.sidebar {
    width: 245px;
    flex: 0 0 245px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.brand {
    height: 76px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 19px;
}

.brand-name {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: white;
}

.brand-subtitle {
    font-size: 10px;
    color: var(--sidebar-muted);
    letter-spacing: 0.2em;
    margin-top: 2px;
}

.navigation {
    padding: 20px 12px;
    flex: 1;
}

.nav-section {
    color: var(--sidebar-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 14px 12px 7px;
}

.nav-item {
    height: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    margin: 2px 0;
    border-radius: 8px;
    color: var(--sidebar-text);
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: #1d4ed8;
    color: white;
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-bottom {
    padding: 15px 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.admin-link {
    height: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--sidebar-muted);
}

.admin-link:hover {
    background: var(--sidebar-hover);
    color: white;
}


/* MAIN */

.main {
    min-width: 0;
    flex: 1;
}

.topbar {
    height: 76px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.breadcrumb {
    display: flex;
    gap: 9px;
    align-items: center;
    color: var(--text-muted);
}

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

.breadcrumb-separator {
    color: #c5cbd4;
}

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

.icon-button,
.user-button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.icon-button {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 18px;
}

.icon-button:hover {
    background: var(--surface-soft);
}

.user-button {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 7px;
    border-radius: 9px;
}

.user-button:hover {
    background: var(--surface-soft);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-name {
    font-weight: 600;
}


/* CONTENT */

.content {
    max-width: 1500px;
    margin: 0 auto;
    padding: 34px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.025em;
}

.page-header p {
    margin: 7px 0 0;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    border-radius: 8px;
    font-weight: 600;
}

.button.secondary {
    background: white;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.button.secondary:hover {
    background: var(--surface-soft);
}


/* STATS */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 21px;
    box-shadow: var(--shadow);
}

.stat-label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 30px;
    line-height: 1;
    font-weight: 750;
    margin-top: 10px;
    letter-spacing: -0.04em;
}

.stat-description {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 8px;
}


/* PANELS */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
    gap: 18px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.large-panel {
    grid-row: span 2;
}

.panel-header {
    min-height: 72px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    margin: 0;
    font-size: 15px;
}

.panel-header p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.panel-link {
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
}


/* JOB LIST */

.job-row {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 91px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.job-row:last-child {
    border-bottom: 0;
}

.job-row:hover {
    background: var(--surface-soft);
}

.match-score {
    width: 61px;
    height: 61px;
    flex: 0 0 61px;
    border-radius: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.match-score strong {
    font-size: 16px;
}

.match-score span {
    font-size: 8px;
    font-weight: 800;
    margin-top: 2px;
}

.score-high {
    color: var(--success);
    background: var(--success-soft);
}

.score-good {
    color: var(--accent);
    background: var(--accent-soft);
}

.job-info {
    min-width: 0;
    flex: 1;
}

.job-info h3 {
    font-size: 14px;
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-meta {
    display: flex;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.job-tags {
    margin-top: 8px;
}

.tag {
    display: inline-flex;
    background: #f1f5f9;
    color: #475569;
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 10px;
    font-weight: 600;
}

.job-arrow {
    color: #c1c7d0;
    font-size: 20px;
}


/* COMPACT LIST */

.compact-list,
.fetch-list {
    padding: 7px 20px;
}

.compact-row,
.fetch-row {
    display: flex;
    align-items: center;
    min-height: 58px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.compact-row:last-child,
.fetch-row:last-child {
    border-bottom: 0;
}

.compact-icon {
    width: 31px;
    height: 31px;
    border-radius: 7px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.compact-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.compact-info strong {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-info span {
    color: var(--text-secondary);
    font-size: 11px;
}


/* FETCH */

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 8px;
}

.status-success {
    background: var(--success);
}

.status-running {
    background: var(--accent);
}

.status-partial {
    background: var(--warning);
}

.status-failed {
    background: var(--danger);
}

.fetch-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fetch-info strong {
    font-size: 12px;
}

.fetch-info span {
    font-size: 11px;
    color: var(--text-secondary);
}

.status-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}


/* EMPTY */

.empty-state {
    min-height: 280px;
    padding: 50px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    margin: 14px 0 5px;
    font-size: 15px;
}

.empty-state p {
    max-width: 400px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
}

.empty-small {
    padding: 28px 20px;
    color: var(--text-secondary);
    font-size: 12px;
}


/* MOBILE */

.menu-button {
    display: none;
    border: 0;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.mobile-overlay {
    display: none;
}

@media (max-width: 1000px) {
    .sidebar {
        width: 220px;
        flex-basis: 220px;
    }

    .content {
        padding: 25px;
    }

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

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

    .large-panel {
        grid-row: auto;
    }
}

@media (max-width: 700px) {

    .sidebar {
        position: fixed;
        z-index: 100;
        left: -260px;
        top: 0;
        bottom: 0;
        width: 245px;
        transition: left 0.2s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-overlay {
        position: fixed;
        z-index: 90;
        inset: 0;
        background: rgba(0,0,0,0.35);
    }

    .mobile-overlay.visible {
        display: block;
    }

    .topbar {
        padding: 0 17px;
        height: 64px;
    }

    .menu-button {
        display: block;
        margin-right: 12px;
    }

    .breadcrumb {
        flex: 1;
    }

    .user-name {
        display: none;
    }

    .content {
        padding: 21px 15px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .header-actions {
        display: none;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 25px;
    }

    .job-row {
        padding: 13px 15px;
        gap: 11px;
    }

    .match-score {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }

    .job-meta {
        flex-wrap: wrap;
    }

    .job-arrow {
        display: none;
    }
}


/* LOGIN */

.login-page {
    min-height: 100vh;
    background: var(--bg);
}

.login-container {
    width: min(420px, calc(100% - 30px));
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

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

.login-brand .brand-mark {
    background: var(--accent);
}

.login-brand .brand-name {
    color: var(--text);
}

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

.login-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 30px;
    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.07),
        0 2px 5px rgba(15, 23, 42, 0.04);
}

.login-heading {
    margin-bottom: 25px;
}

.login-heading h1 {
    margin: 0;
    font-size: 23px;
    letter-spacing: -0.025em;
}

.login-heading p {
    margin: 7px 0 0;
    color: var(--text-secondary);
}

.form-field {
    margin-bottom: 17px;
}

.form-field label {
    display: block;
    font-size: 12px;
    font-weight: 650;
    margin-bottom: 7px;
}

.form-field input {
    width: 100%;
    height: 43px;
    padding: 0 12px;
    border: 1px solid #d6dbe3;
    border-radius: 8px;
    background: white;
    color: var(--text);
    font: inherit;
    outline: none;
}

.form-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-button {
    width: 100%;
    height: 43px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    margin-top: 4px;
}

.login-button:hover {
    background: #1d4ed8;
}

.login-error {
    padding: 11px 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: var(--danger);
    font-size: 12px;
    margin-bottom: 17px;
}

.login-footer {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 18px;
}


/* =========================================================
   JOBS
   ========================================================= */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 28px;
}

.page-header h1 {
    margin: 4px 0 6px;
}

.page-subtitle {
    margin: 0;
    color: var(--text-muted);
}

.page-header-stat {
    text-align: right;
}

.page-header-stat strong {
    display: block;
    font-size: 28px;
    line-height: 1;
}

.page-header-stat span {
    color: var(--text-muted);
    font-size: 13px;
}

.job-filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)) auto auto;
    gap: 10px;
    margin-bottom: 22px;
}

.job-filters input,
.job-filters select {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    outline: none;
}

.job-filters input:focus,
.job-filters select:focus {
    border-color: var(--accent);
}

.filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 17px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.clear-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.jobs-list {
    display: grid;
    gap: 10px;
}

.job-card {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    transition: border-color .15s ease, transform .15s ease;
}

.job-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.job-card-main {
    min-width: 0;
    flex: 1;
}

.job-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.job-title {
    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
}

.job-title:hover {
    color: var(--accent);
}

.job-company {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 14px;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 13px;
    color: var(--text-muted);
    font-size: 13px;
}

.job-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 13px;
}

.skill-tag {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 7px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1;
}

.status-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.status-active {
    background: rgba(34, 197, 94, .12);
    color: #16a34a;
}

.status-closed {
    background: rgba(239, 68, 68, .12);
    color: #dc2626;
}

.status-unknown {
    background: rgba(148, 163, 184, .14);
    color: #64748b;
}

.job-card-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
    min-width: 90px;
}

.job-date {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.job-open {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.empty-state {
    padding: 70px 20px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    text-align: center;
    background: var(--surface);
}

.empty-icon {
    margin-bottom: 12px;
    font-size: 32px;
    opacity: .6;
}

.empty-state h2 {
    margin: 0 0 6px;
}

.empty-state p {
    margin: 0 0 20px;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.pagination a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}


/* =========================================================
   JOB DETAIL
   ========================================================= */

.detail-back {
    margin-bottom: 22px;
}

.detail-back a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.job-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
}

.job-detail-main,
.detail-panel {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.job-detail-main {
    padding: 28px;
}

.detail-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-top: 6px;
}

.detail-title-row h1 {
    margin: 0;
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.15;
}

.detail-company {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 16px;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    margin-top: 28px;
    padding: 18px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.detail-meta > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    color: var(--text-muted);
    font-size: 12px;
}

.detail-meta strong {
    font-size: 14px;
}

.detail-section {
    margin-top: 30px;
}

.section-heading {
    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 0;
    font-size: 18px;
}

.job-description {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
}

.job-description p {
    margin: 0 0 15px;
}

.job-skills-large {
    margin-top: 0;
}

.job-detail-side {
    display: grid;
    align-content: start;
    gap: 12px;
}

.detail-panel {
    padding: 20px;
}

.detail-panel h3 {
    margin: 0 0 18px;
    font-size: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 11px 0;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.info-row:first-of-type {
    border-top: 0;
}

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

.info-row strong {
    text-align: right;
    font-weight: 600;
}

.detail-panel-muted p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}


/* =========================================================
   JOB MOBILE
   ========================================================= */

@media (max-width: 1100px) {
    .job-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-search {
        grid-column: 1 / -1;
    }
}

@media (max-width: 800px) {
    .job-detail-layout {
        grid-template-columns: 1fr;
    }

    .job-detail-side {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .page-header {
        align-items: flex-start;
    }

    .page-header-stat {
        display: none;
    }

    .job-filters {
        grid-template-columns: 1fr;
    }

    .filter-search {
        grid-column: auto;
    }

    .job-card {
        flex-direction: column;
        gap: 16px;
    }

    .job-card-heading {
        flex-direction: column;
    }

    .job-card-side {
        flex-direction: row;
        align-items: center;
        min-width: 0;
    }

    .detail-title-row {
        flex-direction: column;
    }

    .detail-meta {
        grid-template-columns: 1fr;
    }

    .job-detail-main {
        padding: 20px;
    }

    .job-detail-side {
        grid-template-columns: 1fr;
    }
}
