/* ============================================================
   GoWork — stile "cartoon brutalist"
   Bold outlines, colori piatti, ombre piene sfalsate.
   ============================================================ */

:root {
    --ink: #1b1b1b;
    --paper: #fdf3e2;
    --card: #ffffff;
    --yellow: #ffd43b;
    --yellow-soft: #ffe58a;
    --coral: #ff6b6b;
    --green: #51cf66;
    --blue: #4dabf7;
    --purple: #b197fc;
    --gray: #e9e4d8;
    --muted: #6b6459;
    --border: 3px solid var(--ink);
    --shadow: 5px 5px 0 var(--ink);
    --shadow-sm: 3px 3px 0 var(--ink);
    --radius: 12px;
    --radius-sm: 8px;
    --font: "Segoe UI", "Trebuchet MS", Verdana, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.35rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: #000; }

.muted { color: var(--muted); }
.pre-line { white-space: pre-line; }

/* ---- Struttura ---- */
.shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    width: 100%;
}

.layout-dashboard {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.dashboard-main { min-width: 0; }

/* ---- Navbar ---- */
.navbar {
    background: var(--card);
    border-bottom: var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    font-size: 1.45rem;
    font-weight: 900;
    text-decoration: none;
    background: var(--yellow);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 0.1rem 0.6rem;
    transform: rotate(-1.5deg);
    display: inline-block;
}
.brand span { color: #fff; -webkit-text-stroke: 1.2px var(--ink); }
.brand-sm { font-size: 1.1rem; transform: rotate(-1.5deg); }

.nav-links {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.nav-links > a { font-weight: 700; text-decoration: none; }
.nav-links > a:hover { text-decoration: underline; }
.nav-user { background: var(--yellow-soft); border: 2px solid var(--ink); border-radius: 999px; padding: 0.15rem 0.7rem; }

.nav-toggle {
    display: none;
    margin-left: auto;
    font-size: 1.3rem;
    background: var(--yellow);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 0.15rem 0.6rem;
    cursor: pointer;
}

.inline-form { display: inline; }

/* ---- Bottoni ---- */
.btn {
    display: inline-block;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ink);
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.btn-primary { background: var(--yellow); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { color: #fff; }
.btn-danger { background: var(--coral); }
.btn-ghost { background: var(--card); }
.btn-sm { font-size: 0.8rem; padding: 0.3rem 0.7rem; box-shadow: 2px 2px 0 var(--ink); }
.btn-lg { font-size: 1.05rem; padding: 0.7rem 1.5rem; }
.btn-block { display: block; width: 100%; }

/* ---- Card ---- */
.card {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card-link { display: block; text-decoration: none; transition: transform 0.08s ease, box-shadow 0.08s ease; }
.card-link:hover { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 var(--ink); }

.card-accent { background: var(--yellow-soft); }
.card-accent-alt { background: #d7f5e2; }

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ---- Griglie ---- */
.grid { display: grid; gap: 1.25rem; }
.grid .card { margin-bottom: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-detail { grid-template-columns: 1.6fr 1fr; }
.align-start { align-items: start; }
.stack > * + * { margin-top: 1rem; }
.stack .card { margin-bottom: 0; }
.stack-sm > * + * { margin-top: 0.5rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.split .card { margin-bottom: 0; }

.section { margin-top: 2.5rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-head h1 { margin-bottom: 0; }
.section-title { display: inline-block; background: var(--purple); border: var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 0.15rem 0.75rem; transform: rotate(-1deg); }

/* ---- Hero ---- */
.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 2rem;
    align-items: center;
    padding: 2.5rem 0 1rem;
}
.kicker {
    display: inline-block;
    background: var(--green);
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 0.15rem 0.8rem;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}
.hero h1 { font-size: 2.5rem; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }

.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat-card {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.9rem 1rem;
    text-align: center;
}
.stat-card strong { display: block; font-size: 1.7rem; font-weight: 900; }
.stat-card span { font-size: 0.82rem; color: var(--muted); font-weight: 700; }
.hero-stats .stat-card:nth-child(1) { background: var(--yellow-soft); transform: rotate(-2deg); }
.hero-stats .stat-card:nth-child(2) { background: #d7f5e2; transform: rotate(1.5deg); }
.hero-stats .stat-card:nth-child(3) { background: #e5dbff; transform: rotate(-1deg); }
.hero-stats .stat-card:nth-child(4) { background: #d0ebff; transform: rotate(2deg); }
.stat-row { margin-bottom: 1.25rem; }

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    background: var(--yellow);
    border: var(--border);
    border-radius: 50%;
    font-weight: 900;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.6rem;
}

.check-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.check-list li { padding-left: 1.6rem; position: relative; margin-bottom: 0.35rem; font-weight: 600; }
.check-list li::before { content: "✔"; position: absolute; left: 0; font-weight: 900; }

/* ---- Badge ---- */
.badge {
    display: inline-block;
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 0.05rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    background: var(--card);
    text-decoration: none;
}
.badge-lg { font-size: 0.95rem; padding: 0.15rem 0.8rem; box-shadow: 2px 2px 0 var(--ink); }
.badge-green { background: var(--green); }
.badge-yellow { background: var(--yellow); }
.badge-red { background: var(--coral); }
.badge-blue { background: var(--blue); }
.badge-purple { background: var(--purple); }
.badge-gray { background: var(--gray); }
.badge-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }

/* ---- Form ---- */
form { margin: 0; }
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }

label { display: block; font-weight: 800; margin-bottom: 0.3rem; font-size: 0.92rem; }
label small { font-weight: 600; color: var(--muted); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
    width: 100%;
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.7rem;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: var(--shadow-sm);
    background: #fffdf5;
}
textarea { resize: vertical; }
input[type="file"] { font-size: 0.9rem; }

.field-error { color: #c92a2a; font-weight: 700; font-size: 0.85rem; margin: 0.3rem 0 0; }
.checkbox-group label { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 600; }
.checkbox-group input { margin-top: 0.25rem; }

.filter-bar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.filter-bar .form-group { flex: 1 1 160px; margin-bottom: 0; }
.filter-bar .btn { flex: 0 0 auto; }

/* ---- Auth ---- */
.auth-card { max-width: 520px; margin: 2rem auto; }
.auth-switch { margin-top: 1rem; text-align: center; }

.role-picker { border: var(--border); border-radius: var(--radius-sm); padding: 0.75rem; margin: 0 0 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.role-picker legend { font-weight: 800; padding: 0 0.4rem; }
.role-option { display: block; cursor: pointer; }
.role-option input { position: absolute; opacity: 0; }
.role-option span {
    display: block;
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.7rem;
    background: var(--card);
}
.role-option small { display: block; color: var(--muted); font-weight: 600; }
.role-option input:checked + span { background: var(--yellow); box-shadow: var(--shadow-sm); }

/* ---- Skill picker ---- */
.skill-cat { margin-top: 1.1rem; border-bottom: 2px dashed var(--ink); padding-bottom: 0.2rem; }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.6rem; }
.skill-pick {
    border: 2px solid var(--ink);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: var(--card);
}
.skill-pick.selected { background: var(--yellow-soft); box-shadow: var(--shadow-sm); }
.skill-pick-name { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; margin: 0; cursor: pointer; flex: 1; }
.skill-pick select { width: auto; font-size: 0.82rem; padding: 0.2rem 0.4rem; border-width: 2px; }
.skill-pick select:disabled { opacity: 0.35; }
.skill-pick-simple { cursor: pointer; font-weight: 700; justify-content: flex-start; }

/* ---- Liste e tabelle ---- */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 0.5rem 0; border-bottom: 2px dashed var(--gray); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.mini-list li:last-child { border-bottom: none; }

.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; flex-wrap: wrap; }
.skill-name { font-weight: 700; }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
    text-align: left;
    background: var(--yellow);
    border-bottom: var(--border);
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.table td { padding: 0.65rem 0.9rem; border-bottom: 2px solid var(--gray); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fffbee; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn, .actions-cell .inline-form { margin-right: 0.25rem; }

.select-badge { width: auto; font-weight: 800; font-size: 0.82rem; padding: 0.2rem 0.5rem; border-radius: 999px; border-width: 2px; }

/* ---- Job rows / match ---- */
.job-row { display: flex; gap: 1rem; justify-content: space-between; }
.job-row-main { flex: 1; min-width: 0; }
.job-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; flex: 0 0 auto; }

.match-card { background: #e5dbff; }
.match-score { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }

.cover-letter {
    margin: 0.75rem 0;
    padding: 0.6rem 0.9rem;
    background: var(--paper);
    border: 2px dashed var(--ink);
    border-radius: var(--radius-sm);
    font-style: italic;
}
.actions-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.state-form { display: flex; align-items: center; gap: 0.4rem; }
.state-form select { width: auto; padding: 0.25rem 0.5rem; font-size: 0.85rem; }

/* ---- Progress ---- */
.progress {
    height: 18px;
    border: var(--border);
    border-radius: 999px;
    background: var(--card);
    overflow: hidden;
    margin: 0.6rem 0;
}
.progress-fill { height: 100%; background: var(--green); border-right: 3px solid var(--ink); transition: width 0.3s ease; }
.progress-fill[style*="width: 0%"] { border-right: none; }
.progress-buttons { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.completeness-card { background: var(--yellow-soft); }

/* ---- Flash ---- */
.flash-stack { max-width: 1100px; margin: 1rem auto 0; padding: 0 1.25rem; display: grid; gap: 0.6rem; }
.flash {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 0.6rem 0.9rem;
    font-weight: 700;
    animation: flash-in 0.25s ease;
}
.flash-success { background: var(--green); }
.flash-error { background: var(--coral); }
.flash-warning { background: var(--yellow); }
.flash-close { background: none; border: none; font-size: 1.3rem; font-weight: 900; cursor: pointer; line-height: 1; }
.flash.hide { opacity: 0; transform: translateY(-6px); transition: all 0.3s ease; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---- Dettagli ---- */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.company-logo, .logo-preview img {
    width: 84px; height: 84px;
    object-fit: contain;
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 6px;
}
.logo-preview { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.price-tag { font-size: 1.6rem; font-weight: 900; }

/* ---- Sidebar ---- */
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.75rem;
    position: sticky;
    top: 80px;
}
.sidebar a {
    text-decoration: none;
    font-weight: 800;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
}
.sidebar a:hover { border-color: var(--ink); background: var(--yellow-soft); }
.sidebar a.active { background: var(--yellow); border-color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---- Vari ---- */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.error-page { text-align: center; padding: 3rem 1rem; }
.error-code {
    font-size: 5rem;
    font-weight: 900;
    display: inline-block;
    background: var(--coral);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.5rem 2rem;
    transform: rotate(-2deg);
    margin-bottom: 1.5rem;
}
.error-page .hero-actions { justify-content: center; }

.pagination { display: flex; gap: 0.4rem; margin-top: 1.5rem; flex-wrap: wrap; }
.page {
    display: inline-block;
    min-width: 2.2rem;
    text-align: center;
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-weight: 800;
    text-decoration: none;
    background: var(--card);
    box-shadow: 2px 2px 0 var(--ink);
}
.page.current { background: var(--yellow); }

/* ---- Footer ---- */
.footer { background: var(--ink); color: #fff; border-top: var(--border); margin-top: 2rem; }
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.footer p { color: #cfc9be; margin: 0.5rem 0 0; }
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { color: #fff; font-weight: 700; }
.footer-copy { font-size: 0.85rem; }

/* ---- Responsive (mobile-first breakpoint 768px, TODO Fase 8) ---- */
@media (max-width: 768px) {
    h1 { font-size: 1.55rem; }
    .hero { grid-template-columns: 1fr; padding-top: 1.25rem; }
    .hero h1 { font-size: 1.8rem; }
    .grid-2, .grid-3, .grid-detail, .split { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .layout-dashboard { grid-template-columns: 1fr; }

    .sidebar nav { flex-direction: row; overflow-x: auto; position: static; padding: 0.5rem; }
    .sidebar a { white-space: nowrap; font-size: 0.85rem; }

    .nav-toggle { display: inline-block; }
    .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-top: 0.5rem; }
    .nav-links.open { display: flex; }
    .nav-links > a, .nav-links .btn, .nav-links .inline-form { text-align: center; }
    .nav-links .inline-form .btn { width: 100%; }

    .job-row { flex-direction: column; }
    .job-row-meta { flex-direction: row; align-items: center; justify-content: flex-start; }

    /* tabelle → card impilate */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { border-bottom: var(--border); padding: 0.5rem 0; }
    .table tr:last-child { border-bottom: none; }
    .table td { border-bottom: none; padding: 0.35rem 0.9rem; }
    .table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--muted);
    }
}

/* ---- Selettore temi (anteprima) ---- */
.theme-switcher {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--card);
    border: var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    padding: 0.3rem 0.6rem;
}
.theme-switcher label { margin: 0; font-size: 0.8rem; font-weight: 900; }
.theme-switcher select { width: auto; border-width: 2px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; padding: 0.15rem 0.4rem; }
