@font-face {
    font-family: "Oswald";
    src: url("../fonts/Oswald-Variable.ttf") format("truetype-variations");
    font-weight: 200 700;
    font-display: swap;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter-Variable.ttf") format("truetype-variations");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --ink: #0b0708;
    --surface: #17100f;
    --surface-2: #1f1614;
    --line: #2d1e1c;
    --ember: #e8394a;
    --ember-deep: #8c1f2a;
    --ember-glow: rgba(232, 57, 74, 0.35);
    --bone: #f3eae6;
    --ash: #a8908d;
    --ash-dim: #6f5c5a;
    --success: #6fc787;
    --danger: #ff5a5a;

    /* Nomes usados pelas telas herdadas do mobile (web/js/*), mantidos como alias pra não precisar
       reescrever nenhum seletor CSS ao portar o JS quase verbatim. */
    --bg: var(--ink);
    --panel: var(--surface);
    --control: var(--surface-2);
    --button: var(--surface-2);
    --button-hover: #2a1c1a;
    --text: var(--bone);
    --text-dim: var(--ash);
    --accent: var(--ember);
    --accent-glow: var(--ember-glow);
    --border: var(--line);
    --warning: #5e3618;

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--ink);
    color: var(--bone);
    font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
    height: 100%;
}

#app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
nav.sidebar-nav {
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
}

nav.sidebar-nav .brand {
    font-family: "Oswald", sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    letter-spacing: 0.02em;
    color: var(--bone);
    padding: 0 12px 24px;
}
nav.sidebar-nav .brand span { color: var(--ember); }

nav.sidebar-nav button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    background: none;
    border: none;
    color: var(--ash);
    font-size: 0.92rem;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
nav.sidebar-nav button .ic { font-size: 1.05rem; width: 20px; text-align: center; }
nav.sidebar-nav button:hover { background: var(--surface-2); color: var(--bone); }
nav.sidebar-nav button.active { background: var(--surface-2); color: var(--bone); }
nav.sidebar-nav button.active::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--ember);
    box-shadow: 0 0 12px var(--ember-glow);
}

.sidebar-foot {
    margin-top: auto;
    padding: 14px 12px 0;
    border-top: 1px solid var(--line);
    font-size: 0.78rem;
    color: var(--ash-dim);
}
.sidebar-foot #user-email-label { margin-bottom: 8px; word-break: break-all; }
.sidebar-foot #sair-button {
    width: 100%;
    background: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ash);
    padding: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}
.sidebar-foot #sair-button:hover { color: var(--bone); border-color: var(--ash-dim); }

/* ---------- Main content ---------- */
main {
    padding: 32px 40px 56px;
    max-width: 1180px;
    width: 100%;
}

.view { display: none; }
.view.active { display: block; }

#banner-gerenciando {
    background: var(--ember-deep);
    color: var(--bone);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
#banner-gerenciando button {
    background: rgba(0, 0, 0, 0.25);
    border: none;
    color: var(--bone);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.8rem;
}

h2.section-title {
    font-family: "Oswald", sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ash);
    margin: 30px 0 14px;
}
h2.section-title:first-child { margin-top: 0; }

/* ---------- Cards / listas / formulários — mesma API de classe do mobile ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.card .label { font-size: 0.78rem; color: var(--ash); margin-bottom: 6px; }
.card .value {
    font-family: "Oswald", sans-serif;
    font-weight: 600;
    font-size: 1.7rem;
    letter-spacing: 0.01em;
}

button, .btn {
    background: var(--surface-2);
    color: var(--bone);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 16px;
    font-size: 0.92rem;
    font-family: "Inter", sans-serif;
    cursor: pointer;
    transition: background 0.15s ease;
}
button:not(:disabled):hover { background: #2a1c1a; }

button.primary {
    background: var(--ember);
    border-color: var(--ember);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 14px var(--ember-glow);
}
button.primary:not(:disabled):hover { background: #f04b5c; }

button.danger { background: var(--warning); }
button:disabled { opacity: 0.5; cursor: default; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

input, select, textarea {
    width: 100%;
    background: var(--ink);
    color: var(--bone);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: "Inter", sans-serif;
    margin-bottom: 10px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ember);
    box-shadow: 0 0 0 2px var(--ember-glow);
}

label { font-size: 0.8rem; color: var(--ash); display: block; margin-bottom: 4px; }

.list-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 13px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .subtitle { font-size: 0.8rem; color: var(--ash); }
.list-item.alerta { background: var(--warning); }
.list-item.done { border: 1px solid var(--success); background: rgba(111, 199, 135, 0.1); }
.list-item.done .title { text-decoration: line-through; color: var(--ash); }
.list-item input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ember); flex-shrink: 0; }

.empty-state { color: var(--ash); text-align: center; padding: 30px 10px; font-size: 0.9rem; }

.error-message { color: var(--danger); font-size: 0.85rem; margin: 8px 0; min-height: 1.2em; }

.progress-bar {
    background: var(--surface-2);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ember-deep), var(--ember));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.hidden { display: none !important; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 3, 3, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.modal-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-title { font-family: "Oswald", sans-serif; font-size: 1.15rem; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; color: var(--ash); font-size: 1.4rem; line-height: 1; padding: 0 4px; cursor: pointer; }

/* ---------- Login ---------- */
.center-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: var(--ink);
}

.brand-hero {
    font-family: "Oswald", sans-serif;
    font-weight: 600;
    font-size: 2.4rem;
    letter-spacing: 0.02em;
    color: var(--bone);
}
.brand-hero span { color: var(--ember); }
.brand-hero small {
    display: block;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ash);
    margin-top: 6px;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 26px 22px;
}
.login-box a.toggle-link {
    display: block;
    text-align: center;
    color: var(--ember);
    margin-top: 14px;
    font-size: 0.85rem;
    cursor: pointer;
}

@media (max-width: 860px) {
    #app { grid-template-columns: 1fr; }
    nav.sidebar-nav {
        position: static;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        align-items: center;
    }
    nav.sidebar-nav .brand { display: none; }
    nav.sidebar-nav button.active::before { display: none; }
    .sidebar-foot { display: none; }
    main { padding: 20px; }
}
