/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:   #2563eb;
    --color-primary-h: #1d4ed8;
    --color-success:   #16a34a;
    --color-danger:    #dc2626;
    --color-warning:   #d97706;
    --color-bg:        #f8fafc;
    --color-surface:   #ffffff;
    --color-border:    #e2e8f0;
    --color-text:      #1e293b;
    --color-muted:     #64748b;
    --radius:          8px;
    --shadow:          0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:       0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    background: var(--color-bg);
    color: var(--color-text);
}

/* ===== Layout ===== */
.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }

.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: .75rem 0;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow);
}
.header .container { display: flex; align-items: center; justify-content: space-between; }

.logo { font-size: 1.25rem; font-weight: 700; color: var(--color-primary); }
.logo span { color: var(--color-muted); font-weight: 400; font-size: .9em; }

.nav { display: flex; gap: .75rem; align-items: center; }
.nav-link { color: var(--color-muted); text-decoration: none; font-size: .9rem; }
.nav-link:hover { color: var(--color-primary); }

.main { padding: 2rem 1.25rem; }

/* ===== Cards ===== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 540px;
    margin: 0 auto;
}

/* ===== Forms ===== */
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-group label { font-size: .85rem; font-weight: 500; color: var(--color-muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

input, select, textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .95rem;
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea { resize: vertical; }

.form-footer { margin-top: 1rem; text-align: center; font-size: .9rem; color: var(--color-muted); }
.form-footer a { color: var(--color-primary); text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

.form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.1rem;
    border: none; border-radius: var(--radius);
    font-size: .9rem; font-weight: 500; cursor: pointer;
    transition: background .15s, transform .1s;
    text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary  { background: var(--color-primary);   color: #fff; }
.btn-primary:hover  { background: var(--color-primary-h); }

.btn-secondary { background: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger   { background: var(--color-danger);    color: #fff; }
.btn-danger:hover   { background: #b91c1c; }

/* ===== Project grid ===== */
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.view-header h2 { font-size: 1.3rem; }

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.project-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: .5rem;
    transition: box-shadow .15s;
    cursor: pointer;
}
.project-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary); }

.project-card h3 { font-size: 1rem; font-weight: 600; }
.project-card .location { font-size: .85rem; color: var(--color-muted); }

.metrics { margin-top: .5rem; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.metric { background: var(--color-bg); border-radius: 6px; padding: .5rem .75rem; }
.metric .label { font-size: .75rem; color: var(--color-muted); }
.metric .value { font-size: 1rem; font-weight: 700; }
.metric.positive .value { color: var(--color-success); }
.metric.negative .value { color: var(--color-danger); }

.badge {
    display: inline-block;
    font-size: .72rem; font-weight: 600;
    padding: .2rem .6rem;
    border-radius: 99px;
}
.badge-borrador    { background: #f1f5f9; color: var(--color-muted); }
.badge-en_analisis { background: #eff6ff; color: var(--color-primary); }
.badge-aprobado    { background: #f0fdf4; color: var(--color-success); }
.badge-rechazado   { background: #fef2f2; color: var(--color-danger); }

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    padding: .75rem 1.25rem;
    border-radius: var(--radius);
    font-size: .9rem; font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-md);
    z-index: 200;
    transition: opacity .3s;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
.toast.hidden  { display: none; }

/* ===== Utilities ===== */
.hidden { display: none !important; }
.empty-state { color: var(--color-muted); font-size: .95rem; padding: 2rem 0; }
