/* ==========================================================================
   Salaria — sistema de disseny
   CSS propi amb variables. Mòbil-first, responsive, sense build.
   ========================================================================== */

:root {
    /* Marca (verd/teal) */
    --brand-50:  #ecfdf5;
    --brand-100: #d1fae5;
    --brand-200: #a7f3d0;
    --brand-400: #34d399;
    --brand-500: #10b981;
    --brand-600: #059669;
    --brand-700: #047857;
    --brand-800: #065f46;

    --accent:    #0ea5e9;
    --success:   #10b981;
    --danger:    #ef4444;
    --danger-bg: #fef2f2;

    /* Neutres */
    --bg:        #f6f8f7;
    --surface:   #ffffff;
    --surface-2: #f9fafb;
    --text:      #0f1e1a;
    --muted:     #5b6b66;
    --border:    #e5eae8;

    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(6,95,70,.06);
    --shadow:    0 4px 16px rgba(6,95,70,.07);
    --shadow-lg: 0 12px 40px rgba(6,95,70,.14);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }

/* --- Botons --------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .62rem 1.05rem; border-radius: var(--radius-sm);
    font-size: .92rem; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all .15s ease;
    white-space: nowrap; font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-700); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: .8rem 1.2rem; font-size: 1rem; }
.btn-sm { padding: .42rem .8rem; font-size: .85rem; }

/* --- Formularis ----------------------------------------------------------- */
.field { margin-bottom: 1.1rem; }
.label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.input {
    width: 100%; padding: .7rem .85rem; font-size: .95rem; font-family: inherit;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus {
    outline: none; border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-100);
}
.checkbox-row {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .9rem; color: var(--muted); cursor: pointer;
}
.checkbox-row input { width: 1rem; height: 1rem; accent-color: var(--brand-600); }

/* --- Alertes -------------------------------------------------------------- */
.alert { padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1.1rem; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }

/* --- Login (split responsive) --------------------------------------------- */
.auth-wrap {
    min-height: 100vh; min-height: 100dvh;
    display: grid; grid-template-columns: 1fr;
}
.auth-brand {
    display: none;
    flex-direction: column; justify-content: space-between;
    padding: 2.5rem;
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-800) 100%);
    color: #fff;
}
.auth-brand h1 { font-size: 1.9rem; margin-bottom: .6rem; }
.auth-brand p { color: rgba(255,255,255,.85); max-width: 34ch; }
.auth-brand .logo { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; }
.auth-copy { font-size: .82rem; color: rgba(255,255,255,.7); }

.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: rgba(255,255,255,.15); color: #fff; font-weight: 800;
}

.auth-points { list-style: none; padding: 0; margin: 1.25rem 0 0; }
.auth-points li { display: flex; align-items: center; gap: .55rem; padding: .3rem 0; color: rgba(255,255,255,.9); font-size: .95rem; }
.auth-points .dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 999px;
    background: rgba(255,255,255,.2); font-size: .7rem; flex: none;
}

.locale-switcher select {
    padding: .35rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-size: .82rem; font-family: inherit; cursor: pointer;
}

.auth-form-side {
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card .head { margin-bottom: 1.5rem; }
.auth-card .head h2 { font-size: 1.5rem; }
.auth-card .head p { color: var(--muted); margin-top: .3rem; font-size: .92rem; }

@media (min-width: 860px) {
    .auth-wrap { grid-template-columns: 1.1fr 1fr; }
    .auth-brand { display: flex; }
}

/* --- Capçalera app -------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1.25rem;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.topbar-brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; }
.topbar-brand .brand-mark { background: var(--brand-600); }
.topbar-user { display: flex; align-items: center; gap: .9rem; }
.topbar-name { font-size: .9rem; color: var(--muted); }

/* --- Contingut ------------------------------------------------------------ */
.container { max-width: 880px; margin: 0 auto; padding: 1.75rem 1.25rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.6rem; }
.page-head p { margin-top: .35rem; }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 1.1rem; margin-bottom: .5rem; }

.meta-list { margin: 1.25rem 0 0; display: grid; gap: .6rem; }
.meta-list div { display: flex; gap: .75rem; font-size: .92rem; }
.meta-list dt { min-width: 90px; color: var(--muted); margin: 0; }
.meta-list dd { margin: 0; font-weight: 600; }

/* --- App shell / navegació ------------------------------------------------ */
.topbar { flex-wrap: wrap; gap: .75rem; }
.topnav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topnav a {
    padding: .45rem .7rem; border-radius: var(--radius-sm);
    font-size: .9rem; font-weight: 600; color: var(--muted);
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--brand-50); color: var(--brand-700); }
.chip {
    display: inline-block; padding: .25rem .6rem; border-radius: 999px;
    background: var(--brand-50); color: var(--brand-700);
    font-size: .8rem; font-weight: 600;
}

/* --- KPIs ----------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: .25rem;
}
.kpi-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.kpi-value.ok { color: var(--brand-700); }
.kpi-value.danger { color: var(--danger); }
.kpi-sub { font-size: .8rem; }

/* --- Taules --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .6rem .7rem; border-bottom: 1px solid var(--border); text-align: left; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
.table tbody tr:hover { background: var(--surface-2); }
.table-num td, .table-num th { text-align: right; }
.table-num td:first-child, .table-num th:first-child { text-align: left; }
.table .row-total td { background: var(--brand-50); font-weight: 600; }
.table td.danger { color: var(--danger); font-weight: 600; }

/* --- Badges --------------------------------------------------------------- */
.badge { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-success { background: var(--success-bg, #ecfdf5); color: var(--brand-700); }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* --- Alertes addicionals -------------------------------------------------- */
.alert-success { background: var(--brand-50); color: var(--brand-800); border: 1px solid var(--brand-200); }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.field-error { color: var(--danger); font-size: .82rem; margin-top: .3rem; }
.req { color: var(--danger); }

/* --- Grids de formulari --------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* --- Assistent d'importació ---------------------------------------------- */
.steps { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.step {
    padding: .4rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.step.active { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.step.done { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; margin-top: 1rem; }

/* --- Paginació ------------------------------------------------------------ */
.pager { display: flex; align-items: center; gap: .75rem; }
.pager-btn { padding: .4rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 700; }
.pager-btn.disabled { color: var(--muted-2, #94a3b8); }
.pager-info { font-size: .85rem; color: var(--muted); }

/* --- Landing -------------------------------------------------------------- */
.landing { max-width: 1000px; margin: 0 auto; padding: 1.25rem; }
.lp-nav { display: flex; justify-content: space-between; align-items: center; padding: .5rem 0 2rem; }
.lp-brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; }
.lp-brand .brand-mark { background: var(--brand-600); }
.lp-hero { text-align: center; padding: 2rem 0 3rem; }
.lp-tag {
    display: inline-block; padding: .35rem .8rem; border-radius: 999px;
    background: var(--brand-50); color: var(--brand-700); font-size: .82rem; font-weight: 600; margin-bottom: 1.25rem;
}
.lp-hero h1 { font-size: 2.4rem; max-width: 18ch; margin: 0 auto 1rem; line-height: 1.1; }
.lp-lead { font-size: 1.1rem; color: var(--muted); max-width: 52ch; margin: 0 auto 1.75rem; }
.lp-cta { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.lp-note { font-size: .85rem; color: var(--muted); }
.lp-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0 3rem; }
.lp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); }
.lp-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.lp-pricing { text-align: center; margin-bottom: 3rem; }
.lp-pricing h2 { font-size: 1.6rem; margin-bottom: 1.5rem; }
.lp-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.lp-plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: left; }
.lp-plan.featured { border-color: var(--brand-500); box-shadow: var(--shadow); }
.lp-price { font-size: 2rem; font-weight: 700; color: var(--brand-700); margin: .5rem 0 1rem; }
.lp-price span { font-size: .9rem; color: var(--muted); font-weight: 500; }
.lp-plan ul { list-style: none; padding: 0; margin: 0; }
.lp-plan li { padding: .35rem 0; border-bottom: 1px solid var(--border-2, #eef0f5); font-size: .9rem; }
.lp-foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 0; border-top: 1px solid var(--border); }
@media (max-width: 640px) { .lp-hero h1 { font-size: 1.8rem; } }
