/* ValleyAI dashboard - mobile-first, no external assets. */

:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --ink: #1a1d21;
    --muted: #5c6670;
    --line: #e3e6ea;
    --brand: #1f6feb;
    --brand-dark: #1a5fce;
    --good: #1a7f37;
    --bad: #c0392b;
    --warn: #9a6700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    -webkit-text-size-adjust: 100%;
    line-height: 1.45;
}

a { color: var(--brand); }

/* ---- Top bar + nav ---- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; }
.topbar form { margin: 0; }
.topbar .logout {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.9rem;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
}

.tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 0 0.5rem;
    overflow-x: auto;
    position: sticky;
    top: 3.1rem;
    z-index: 9;
}
.tabs a {
    flex: 0 0 auto;
    padding: 0.7rem 0.9rem;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---- Layout ---- */
main { padding: 1rem; max-width: 720px; margin: 0 auto; }
h1 { font-size: 1.4rem; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.6rem; }

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

/* ---- Stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem; }
.stat .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.stat .value { font-size: 1.5rem; font-weight: 700; margin-top: 0.2rem; }
.stat .sub { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }

.pos { color: var(--good); }
.neg { color: var(--bad); }
.warn { color: var(--warn); }

/* ---- Buttons + forms ---- */
button, .btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    min-height: 44px;
}
button:active, .btn:active { background: var(--brand-dark); }
.btn-secondary { background: #eef1f4; color: var(--ink); }
.btn-danger { background: #fdecea; color: var(--bad); margin-top: 0.5rem; }
.btn-danger:active { background: #f7d7d2; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn-block { display: block; width: 100%; }

label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.7rem;
    font-size: 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}
textarea { min-height: 4rem; resize: vertical; }

details.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 1rem; }
details.form-card > summary { padding: 1rem; font-weight: 600; cursor: pointer; }
details.form-card > form { padding: 0 1rem 1rem; }

/* ---- Lists ---- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.row-main { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 0.85rem; }

.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0.12rem 0.5rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; }
.pill-upcoming { background: #e7f0ff; color: var(--brand); }
.pill-attended { background: #eef1f4; color: var(--muted); }

.banner { border-radius: 10px; padding: 0.7rem 0.9rem; margin-bottom: 1rem; font-size: 0.95rem; }
.banner-ok { background: #e8f5ec; color: var(--good); }
.banner-info { background: #eef4ff; color: var(--brand-dark); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.scroll-x { overflow-x: auto; }

/* ---- Login ---- */
main.auth { max-width: 360px; margin: 12vh auto; text-align: center; }
main.auth .brand { font-size: 2rem; margin-bottom: 0.1rem; }
main.auth .tagline { color: var(--muted); margin-top: 0; }
main.auth form { text-align: left; margin-top: 1.5rem; }
main.auth .error { background: #fdecea; color: var(--bad); border-radius: 10px; padding: 0.6rem; }

.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

/* ---- Inventory filter bar ---- */
.filter-bar input[type="search"] { margin-bottom: 0.75rem; }
.filter-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem 0.75rem; }
.filter-grid label { margin-bottom: 0.25rem; }
@media (min-width: 560px) { .filter-grid { grid-template-columns: repeat(4, 1fr); } }
