:root {
    --bg: #f3f0eb;
    --bg-2: #ebe6de;
    --surface: #fffcf7;
    --sidebar: #1c2429;
    --sidebar-2: #243038;
    --text: #1a2228;
    --muted: #6b7680;
    --border: #ddd5c8;
    --accent: #e85d04;
    --accent-2: #f48c06;
    --ok: #2a9d6a;
    --warn: #c77d0a;
    --danger: #c0392b;
    --info: #2c7da0;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(28, 36, 41, 0.08);
    --font: "DM Sans", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background:
        radial-gradient(ellipse 80% 50% at 100% -10%, rgba(232, 93, 4, 0.08), transparent),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    color: var(--text);
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0.02em; }
.ok { color: var(--ok); }
.danger { color: var(--danger); }

.app {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--sidebar) 0%, #151b1f 100%);
    color: #f5f1ea;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.75rem;
    padding: 0 0.35rem;
}
.brand strong { display: block; font-size: 1.05rem; }
.brand small { color: #9aa6b0; }
.brand-mark {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; overflow: auto; }
.nav a {
    color: #c5ced6;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav a:hover, .nav a.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}
.nav a.active {
    background: rgba(232, 93, 4, 0.22);
    color: #ffd8b0;
}
.nav-label {
    margin: 1rem 0 0.35rem;
    padding: 0 0.85rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7d8a94;
}
.sidebar-foot {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.user-chip {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}
.user-chip > span {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: grid; place-items: center;
    font-weight: 700;
}
.user-chip strong { display: block; font-size: 0.9rem; }
.user-chip small { color: #9aa6b0; }
.logout { color: #9aa6b0; font-size: 0.9rem; }

.main { padding: 1.5rem 1.75rem 2.5rem; min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.topbar h1 { margin: 0; font-size: 1.65rem; letter-spacing: -0.02em; }
.subtitle { margin: 0.25rem 0 0; color: var(--muted); }
.topbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.content { display: flex; flex-direction: column; gap: 1.25rem; }

.stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}
.stat-warn { border-color: #efc27a; background: #fff8ec; }
.stat-label { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: 0.35rem; }
.stat-value { font-size: 1.45rem; letter-spacing: -0.02em; }
.stat-note { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.8rem; }
.stat-note.danger { color: var(--danger); }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow);
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.05rem; }
.empty { color: var(--muted); margin: 0.5rem 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
th, td { text-align: left; padding: 0.7rem 0.55rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(232, 93, 4, 0.03); }
.row-warn td { background: #fff8ec; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-ok { background: #e4f6ee; color: #1f7a52; }
.badge-warn { background: #fff0d6; color: #9a6508; }
.badge-info { background: #e3f2f8; color: #1f6280; }
.badge-danger { background: #fde8e6; color: #a12b20; }
.badge-muted { background: #eceff1; color: #54616b; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.55rem 0.95rem;
    border-radius: 9px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: #c9bfb0; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: #fff;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-danger { background: #fde8e6; border-color: #f0c2bc; color: var(--danger); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: end;
}
.toolbar input[type="search"],
.toolbar input[type="date"],
.toolbar input[type="number"],
.toolbar select,
.form input, .form select, .form textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    font: inherit;
    color: var(--text);
}
.toolbar input[type="search"] { min-width: 240px; flex: 1; }
.toolbar label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.check { flex-direction: row !important; align-items: center; gap: 0.4rem !important; color: var(--text) !important; }

.form { display: flex; flex-direction: column; gap: 0.85rem; }
.form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; font-weight: 500; color: var(--muted); }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.5rem; align-items: center; }
.form-inline { gap: 0.75rem; }
.form-inline h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.mini-edit { margin-top: 0.75rem; min-width: 280px; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.timeline li {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: #faf7f2;
    border: 1px solid var(--border);
}
.timeline time {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--accent);
}
.timeline strong { display: block; }
.timeline span, .timeline small { color: var(--muted); font-size: 0.88rem; }
.timeline-lg li {
    grid-template-columns: 52px 1fr auto auto auto auto;
}
.timeline .grow { min-width: 0; }
.inline-form { display: inline; margin: 0; }
.date-nav { align-items: center; }

.list-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.list-cards li {
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #faf7f2;
}
.list-cards strong { display: block; }
.list-cards span, .list-cards small { color: var(--muted); }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.info-grid span { display: block; color: var(--muted); font-size: 0.8rem; }
.info-grid strong { font-size: 0.98rem; }

.totals { display: flex; flex-direction: column; gap: 0.55rem; }
.totals > div { display: flex; justify-content: space-between; gap: 1rem; }
.totals .total-line {
    border-top: 1px solid var(--border);
    padding-top: 0.65rem;
    margin-top: 0.25rem;
    font-size: 1.1rem;
}

.kanban {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}
.kanban-col {
    background: rgba(255,255,255,0.45);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    min-height: 180px;
}
.kanban-col h3 {
    margin: 0 0 0.75rem;
    font-size: 0.92rem;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
}
.kanban-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.55rem;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(28,36,41,0.05);
    transition: transform .15s, border-color .15s;
}
.kanban-card:hover { transform: translateY(-2px); border-color: var(--accent-2); text-decoration: none; }
.kanban-card.urgent { border-left: 3px solid var(--danger); }
.kanban-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.kanban-card span, .kanban-card em { color: var(--muted); font-size: 0.85rem; font-style: normal; }

.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.bar-list li { display: grid; grid-template-columns: 110px 1fr 40px; gap: 0.65rem; align-items: center; }
.bar { height: 10px; background: #ebe4d8; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.alert-ok { background: #e4f6ee; color: #1f7a52; border: 1px solid #b8e4cf; }
.alert-danger { background: #fde8e6; color: #a12b20; border: 1px solid #f0c2bc; }

/* Login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}
.login-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(28,36,41,0.92), rgba(28,36,41,0.75)),
        radial-gradient(circle at 20% 20%, rgba(232,93,4,0.35), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(244,140,6,0.25), transparent 35%),
        #1c2429;
    z-index: 0;
}
.login-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    background: var(--surface);
    border-radius: 18px;
    padding: 1.75rem;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}
.login-brand { margin-bottom: 1.25rem; }
.login-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.login-desc { margin: 0 0 1.25rem; color: var(--muted); }
.login-hint { margin: 1rem 0 0; color: var(--muted); font-size: 0.85rem; text-align: center; }
.login-accounts {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.login-accounts p { margin: 0; line-height: 1.45; }
.login-accounts strong { color: var(--text); }
.login-accounts code {
    font-family: var(--mono);
    font-size: 0.78rem;
    background: #ebe6de;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    color: var(--text);
}

.btn-whatsapp {
    background: #25d366 !important;
    border-color: #1ebe57 !important;
    color: #fff !important;
}
.btn-whatsapp:hover { filter: brightness(1.05); }
.share-box {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.share-box input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 0.85rem;
}
.share-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(3, 1fr); }
    .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav-label { width: 100%; margin-top: 0.5rem; }
    .grid-2, .form-grid, .info-grid { grid-template-columns: 1fr; }
    .timeline-lg li { grid-template-columns: 52px 1fr; }
    .timeline-lg li > *:nth-child(n+3) { grid-column: 2; }
}
@media (max-width: 640px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .main { padding: 1rem; }
    .topbar { flex-direction: column; }
}
