/* === ACP Check — paleta verde + preto chumbo, layout em gaveta === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* preto chumbo levemente esverdeado */
    --bg:          #14171a;
    --bg-2:        #181c1f;
    --bg-3:        #1d2225;
    --bg-4:        #232a2e;
    --bg-5:        #2a3236;

    --line:        rgba(255,255,255,0.04);
    --line-soft:   rgba(255,255,255,0.06);

    --text:        #e7ece8;
    --text-dim:    #9ba59f;
    --text-mute:   #6b746e;

    /* verde único, usado em tudo que precisa de acento */
    --accent:      #4ade80;
    --accent-2:    #22c55e;
    --accent-soft: rgba(74,222,128,0.10);
    --accent-line: rgba(74,222,128,0.25);

    --danger:      #ef4444;
    --warn:        #f59e0b;

    --radius:      14px;
    --radius-sm:   10px;
    --shadow:      0 8px 30px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
}
body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
    font-size: 15.5px;
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01";
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:active { color: var(--accent-2); }

/* === Topbar === */
.topbar {
    position: sticky;
    top: 0; z-index: 50;
    background: rgba(20,23,26,0.88);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}
.topbar-inner {
    padding: 10px 14px 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "brand   actions"
        "progress progress";
    gap: 10px 12px;
    align-items: center;
    max-width: 760px;
    margin: 0 auto;
}
.brand { grid-area: brand; min-width: 0; }
.brand-title {
    font-weight: 600;
    font-size: 15.5px;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: -0.01em;
}
.brand-sub {
    font-size: 11.5px;
    color: var(--text-mute);
    margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { grid-area: actions; display: flex; align-items: center; gap: 8px; }
.progress { grid-area: progress; }
.progress-stats {
    display: flex;
    gap: 0;
    margin-bottom: 6px;
    background: var(--bg-3);
    border-radius: 10px;
    overflow: hidden;
}
.stat {
    flex: 1;
    text-align: center;
    padding: 7px 4px;
    line-height: 1.1;
    border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat b {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    font-feature-settings: "tnum";
}
.stat i {
    display: block;
    font-style: normal;
    font-size: 10.5px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}
.stat.done b { color: var(--accent); }
.progress-bar {
    height: 4px;
    background: var(--bg-3);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width .3s ease;
    border-radius: 999px;
}
.save-indicator {
    font-size: 11px;
    color: var(--text-mute);
    min-width: 48px;
    text-align: right;
}
.save-indicator.saving { color: var(--warn); }
.save-indicator.error  { color: var(--danger); }
.save-indicator.saved  { color: var(--accent); }

/* === Layout === */
.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 12px 12px 80px;
}

/* === Seções (gaveta nível 1) === */
.sec {
    background: var(--bg-2);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}
.sec[open] { background: var(--bg-2); }
.sec > .sec-head {
    list-style: none;
    cursor: pointer;
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
    transition: background .15s;
}
.sec > .sec-head::-webkit-details-marker { display: none; }
.sec > .sec-head:active { background: var(--bg-3); }
.sec-head .chev {
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-mute);
    transition: transform .2s ease;
    flex-shrink: 0;
}
.sec[open] > .sec-head .chev { transform: rotate(90deg); color: var(--accent); }
.sec-head .sec-title {
    flex: 1;
    font-weight: 600;
    font-size: 15.5px;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.sec-head .sec-count {
    background: var(--bg-3);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    font-feature-settings: "tnum";
    white-space: nowrap;
}
.sec-head .sec-count.full {
    background: var(--accent-soft);
    color: var(--accent);
}
.sec-body {
    padding: 0 14px 14px;
}
.sec-desc {
    color: var(--text-dim);
    font-size: 13px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: var(--accent-soft);
    border-left: 2px solid var(--accent);
    border-radius: 6px;
    line-height: 1.5;
}

/* === Subseções (gaveta nível 2) === */
.sub {
    background: var(--bg-3);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    overflow: hidden;
}
.sub > .sub-head {
    list-style: none;
    cursor: pointer;
    padding: 12px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}
.sub > .sub-head::-webkit-details-marker { display: none; }
.sub-head .chev {
    width: 20px; height: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-mute);
    transition: transform .2s ease;
    flex-shrink: 0;
}
.sub[open] > .sub-head .chev { transform: rotate(90deg); color: var(--accent); }
.sub-head .sub-title {
    flex: 1;
    font-weight: 500;
    font-size: 13.5px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.sub-head .sub-count {
    background: var(--bg-4);
    color: var(--text-mute);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    font-feature-settings: "tnum";
    white-space: nowrap;
}
.sub-head .sub-count.full { background: var(--accent-soft); color: var(--accent); }
.sub-body { padding: 0 12px 12px; }
.sub-desc {
    color: var(--text-mute);
    font-size: 12.5px;
    margin: 0 0 8px;
    padding: 0 2px;
}

/* === Item === */
.item {
    padding: 14px 0 10px;
    border-top: 1px solid var(--line);
}
.sub-body > .item:first-child { border-top: none; padding-top: 8px; }

.item-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 9px;
    line-height: 1.4;
    cursor: default;
}
.item-label-text { flex: 1; }
.item-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--bg-4);
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-top: 1px;
}
.item-tag.video { background: var(--bg-4); color: var(--text-dim); }
.item-tag.photo { background: var(--accent-soft); color: var(--accent); }

/* completed indicator */
.item .check-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--bg-5);
    flex-shrink: 0;
    margin-top: 6px;
    transition: background .2s;
}
.item.completed .check-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* === Fields === */
.field {
    width: 100%;
    background: var(--bg-4);
    border: 1px solid transparent;
    color: var(--text);
    border-radius: 10px;
    font-size: 15.5px;
    padding: 11px 13px;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, background .15s;
}
.field::placeholder { color: var(--text-mute); }
.field:focus {
    border-color: var(--accent);
    background: var(--bg-5);
}
.textarea-field { resize: vertical; min-height: 64px; line-height: 1.5; }
.select-field {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239ba59f' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* === Photos (drawer universal) === */
.photos-block {
    margin-top: 10px;
    background: var(--bg-4);
    border-radius: 10px;
    padding: 10px;
}
.photos-block.primary {
    background: transparent;
    padding: 0;
}
.photos-input { display: none; }
.btn-camera {
    width: 100%;
    background: transparent;
    border: 1px dashed var(--accent-line);
    color: var(--accent);
    font-weight: 600;
    padding: 12px;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-camera:active { background: var(--accent-soft); border-color: var(--accent); }
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 6px;
    margin-top: 8px;
}
.photos-grid:empty { margin-top: 0; }
.photo-thumb {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    background: #0e1112;
}
.photo-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.photo-del {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.7);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.photo-del:active { background: var(--danger); }
.photos-progress { font-size: 12px; color: var(--warn); margin-top: 6px; }

/* === Item actions + drawers === */
.item-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.action-chip {
    background: transparent;
    border: 1px solid var(--line-soft);
    color: var(--text-dim);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background .15s, color .15s, border-color .15s;
}
.action-chip:active { background: var(--bg-4); }
.action-chip.active {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}

.obs-wrap { margin-top: 8px; }
.obs-field {
    width: 100%;
    background: var(--bg-4);
    border: 1px solid transparent;
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
    outline: none;
}
.obs-field::placeholder { color: var(--text-mute); }
.obs-field:focus { border-color: var(--accent); }

/* === Buttons gerais === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-3);
    color: var(--text);
    border: none;
    padding: 9px 13px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .05s;
    user-select: none;
    font-weight: 500;
}
.btn:active { transform: scale(.97); }
.btn-primary {
    background: var(--accent);
    color: #0c130e;
    font-weight: 600;
}
.btn-primary:active { background: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-big {
    padding: 14px 18px;
    font-size: 15.5px;
    width: 100%;
    border-radius: 12px;
}

/* === Acordeão expand/collapse all === */
.expand-controls {
    display: flex;
    gap: 8px;
    margin: 6px 0 10px;
}
.expand-controls .btn {
    flex: 1;
    background: transparent;
    color: var(--text-dim);
    font-size: 12px;
    padding: 7px;
    border: 1px solid var(--line-soft);
}

/* === Footer === */
.footer {
    margin-top: 18px;
    padding: 12px 8px 24px;
    text-align: center;
}
.footer-note {
    color: var(--text-mute);
    font-size: 12px;
    margin: 10px 0 0;
    line-height: 1.5;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-4);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 13.5px;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity .2s, transform .2s;
    pointer-events: none;
    z-index: 100;
    max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #3a1a1a; color: #ffd7d7; }
.toast.ok    { background: var(--accent-soft); color: var(--accent); }

@media (min-width: 720px) {
    .topbar-inner {
        grid-template-columns: minmax(220px, 320px) 1fr auto;
        grid-template-areas: "brand progress actions";
    }
}
