:root {
    --repinho-green: #126b3a;
    --repinho-green-dark: #0b4428;
    --repinho-green-soft: #e8f4ed;
    --wood: #9b6a36;
    --ink: #162018;
    --muted: #68746d;
    --line: #dfe7e2;
    --bg: #f5f8f6;
    --card: #ffffff;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(13, 58, 34, .12);
}

:root[data-theme="dark"],
body[data-theme="dark"] {
    --repinho-green: #29b765;
    --repinho-green-dark: #8df0b2;
    --repinho-green-soft: rgba(41, 183, 101, .16);
    --wood: #e6c17b;
    --ink: #eef8f1;
    --muted: #a7b8ad;
    --line: rgba(220, 240, 225, .16);
    --bg: #07130d;
    --card: #101f16;
    --danger: #ff8f7f;
    --shadow: 0 18px 45px rgba(0, 0, 0, .36);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top left, rgba(18, 107, 58, .12), transparent 34rem), linear-gradient(135deg, #f7faf8 0%, var(--bg) 100%);
}

:root[data-theme="dark"] body,
body[data-theme="dark"] {
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(41, 183, 101, .18), transparent 34rem),
        linear-gradient(135deg, #07130d 0%, #0b1711 100%);
}
a { color: inherit; text-decoration: none; }
.app-shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
}
.app-shell.sidebar-collapsed { grid-template-columns: 82px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100vh;
    padding: 1.1rem;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #eef7f2 100%);
    border-right: 1px solid var(--line);
    box-shadow: 10px 0 35px rgba(13, 58, 34, .08);
    z-index: 30;
}
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.brand-lockup {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-width: 0;
}
.brand-copy {
    display: grid;
    line-height: 1.15;
    white-space: nowrap;
}
.brand-copy small { color: var(--muted); margin-top: .18rem; }
.menu-toggle {
    display: inline-grid;
    gap: 4px;
    place-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(13, 58, 34, .08);
}
.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 99px;
    background: var(--repinho-green-dark);
}
.nav {
    display: grid;
    gap: .35rem;
    overflow-y: auto;
    padding-right: .15rem;
}
.nav a, .notification-menu summary, .logout-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 46px;
    padding: .75rem .85rem;
    border-radius: 16px;
    color: var(--muted);
    font-weight: 800;
    cursor: pointer;
}
.nav a:hover, .nav a.active, .notification-menu.active summary, .notification-menu[open] summary, .logout-link:hover {
    color: var(--repinho-green-dark);
    background: var(--repinho-green-soft);
}
.nav-ico {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(145deg, var(--repinho-green), var(--repinho-green-dark));
    font-size: .78rem;
    font-weight: 900;
}
.logout-link { margin-top: auto; }
.app-main {
    min-width: 0;
    padding-bottom: 1px;
}
.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .nav a span:not(.nav-ico),
.app-shell.sidebar-collapsed .logout-link span:not(.nav-ico) {
    display: none;
}
.app-shell.sidebar-collapsed .sidebar-head { justify-content: center; }
.app-shell.sidebar-collapsed .brand-lockup { display: none; }
.app-shell.sidebar-collapsed .nav a,
.app-shell.sidebar-collapsed .logout-link {
    justify-content: center;
    padding-inline: .55rem;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
}
.topbar h2 {
    margin: .15rem 0 .1rem;
    font-size: 1.35rem;
    color: var(--ink);
}
.topbar small { color: var(--muted); font-weight: 700; }
.userbar {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}
.brand, .login-brand { display: flex; align-items: center; gap: .8rem; }
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, var(--repinho-green), var(--repinho-green-dark));
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(18, 107, 58, .25);
}
.brand small, .login-brand small, .flow-card small { display: block; color: var(--muted); margin-top: .1rem; }
.topbar nav { display: flex; align-items: center; gap: .35rem; }
.topbar nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .7rem .9rem;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 600;
}
.topbar nav a:hover { background: var(--repinho-green-soft); color: var(--repinho-green-dark); }
.notification-link {
    background: #fff4d8;
    color: #68431d !important;
}
.notify-bell {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    color: #68431d;
    background: #fff4d8;
    border: 1px solid rgba(104, 67, 29, .12);
    font-size: 1.05rem;
    box-shadow: 0 10px 24px rgba(104, 67, 29, .10);
}
.notify-bell b {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 .35rem;
    border-radius: 999px;
    color: #fff;
    background: var(--danger);
    border: 2px solid #fff;
    font-size: .72rem;
    font-weight: 900;
}
.notification-menu {
    position: relative;
}
.notification-menu summary {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .7rem .9rem;
    border-radius: 999px;
    color: #68431d;
    background: #fff4d8;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.notification-menu summary::-webkit-details-marker { display: none; }
.notification-menu div {
    position: absolute;
    right: 0;
    top: calc(100% + .65rem);
    z-index: 20;
    display: grid;
    gap: .35rem;
    width: min(360px, 86vw);
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}
.notification-menu div a, .notification-menu div span {
    border-radius: 12px;
    padding: .65rem .7rem;
    color: var(--ink);
    background: #fbfdfb;
    font-weight: 700;
}
.notification-menu .all-notifications {
    color: var(--repinho-green-dark);
    background: var(--repinho-green-soft);
    text-align: center;
}
.sidebar .notification-menu { position: static; }
.sidebar .notification-menu summary {
    width: 100%;
    color: var(--muted);
    background: transparent;
}
.sidebar .notification-menu div {
    position: static;
    width: auto;
    margin-top: .35rem;
    padding: .45rem;
    box-shadow: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, .72);
}
.sidebar .notification-menu:not([open]) div { display: none; }
.sidebar .notification-menu div a, .sidebar .notification-menu div span {
    font-size: .82rem;
    font-weight: 700;
}
.nav-badge {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    padding: 0 .35rem;
    border-radius: 999px;
    color: #fff;
    background: var(--danger);
    font-size: .75rem;
    font-weight: 900;
}
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}
.login-panel, .hero-card, .upload-card, .search-card, .action-card, .board-column, .flow-card, .history-card, .empty-state {
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow);
}
.login-panel { width: min(460px, 100%); padding: 2rem; }
.login-panel h1, .hero-card h1 { margin: 1.4rem 0 .6rem; letter-spacing: -.04em; }
.login-panel p, .hero-card p, .section-title p, .flow-card p, .muted { color: var(--muted); }
.shell { width: min(1380px, calc(100% - 2rem)); margin: 2rem auto; }
.hero-card {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem;
    overflow: hidden;
    position: relative;
}
.hero-card::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -120px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(155, 106, 54, .12);
}
.eyebrow {
    color: var(--wood);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.user-summary {
    min-width: 210px;
    align-self: center;
    padding: 1rem;
    border-radius: 18px;
    background: var(--repinho-green-soft);
    position: relative;
    z-index: 1;
}
.user-summary span, .user-summary small { display: block; color: var(--muted); margin-top: .25rem; }
.button, .ghost-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 14px;
    padding: .9rem 1.1rem;
    cursor: pointer;
    font-weight: 800;
    font-size: .95rem;
}
.button {
    color: #fff;
    background: linear-gradient(135deg, var(--repinho-green), var(--repinho-green-dark));
    box-shadow: 0 12px 24px rgba(18, 107, 58, .2);
}
.ghost-button { color: var(--repinho-green-dark); background: var(--repinho-green-soft); }
.archive-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 14px;
    padding: .9rem 1.1rem;
    cursor: pointer;
    font-weight: 800;
    font-size: .95rem;
    color: #fff;
    background: linear-gradient(135deg, var(--wood), #68431d);
}
.table-link { color: var(--repinho-green); font-weight: 800; }
.hint, .flash {
    margin: 1rem 0;
    padding: .85rem 1rem;
    border-radius: 14px;
    font-size: .9rem;
    background: var(--repinho-green-soft);
    color: var(--repinho-green-dark);
}
.notification-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin: 0 0 1rem;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fffaf0;
    box-shadow: var(--shadow);
}
.notification-strip strong {
    color: #8a5a00;
    margin-right: .25rem;
}
.notification-strip a {
    display: inline-flex;
    padding: .35rem .6rem;
    border-radius: 999px;
    background: #fff4d8;
    color: #68431d;
    font-weight: 800;
    font-size: .86rem;
}
.notification-row, .audit-event {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}
.notification-row:last-child, .audit-event:last-child { border-bottom: 0; }
.notification-row strong, .audit-event strong { display: block; color: var(--ink); }
.notification-row span, .notification-row small, .audit-event span {
    display: block;
    color: var(--muted);
    margin-top: .25rem;
}
.notification-row p, .audit-event p {
    margin: .45rem 0 0;
    color: var(--muted);
}
.notification-row.unread {
    margin-inline: -.75rem;
    padding-inline: .75rem;
    border-radius: 16px;
    background: #fffaf0;
}
.audit-event {
    display: block;
}
.upload-card {
    display: block;
    margin-top: 1rem;
    padding: 1.4rem;
}
.upload-card-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1rem;
}
.upload-card-header p {
    margin: .25rem 0 0;
    color: var(--muted);
}
.action-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1.2rem;
}
.action-card h2 { margin: .25rem 0; }
.action-card p { margin: 0; color: var(--muted); }
.upload-card h2 { margin: .25rem 0 0; }
.upload-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: .8rem;
    align-items: end;
}
.upload-form .button {
    min-height: 49px;
}
.file-comment-list {
    display: grid;
    grid-column: 1 / -1;
    gap: .7rem;
}
.file-comment-list label {
    padding: .75rem;
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: #fbfdfb;
}
.search-card {
    margin-top: 1rem;
    padding: 1.2rem;
}
.search-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto auto auto;
    gap: .8rem;
    align-items: end;
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    align-items: end;
}
.filters label {
    min-width: 170px;
    flex: 1 1 180px;
}
.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}
.active-filter {
    color: #fff !important;
    background: linear-gradient(135deg, var(--repinho-green), var(--repinho-green-dark)) !important;
}
label {
    display: grid;
    gap: .45rem;
    color: var(--repinho-green-dark);
    font-weight: 700;
    font-size: .92rem;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .85rem 1rem;
    font: inherit;
    color: var(--ink);
    background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 3px solid rgba(18, 107, 58, .14);
    border-color: var(--repinho-green);
}
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin: 1.8rem 0 1rem;
}
.section-title h2 { margin: 0 0 .25rem; }
.section-title.compact { margin: 0 0 1rem; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.stat-card {
    display: grid;
    gap: .35rem;
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}
.stat-card span {
    color: var(--muted);
    font-weight: 800;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.stat-card strong {
    font-size: 2.1rem;
    line-height: 1;
}
.stat-card.danger strong { color: var(--danger); }
.stat-card.warning strong { color: #8a5a00; }
.boards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1rem;
    align-items: start;
}
.board-column {
    padding: 1rem;
    min-height: 280px;
}
.board-column.drag-over { outline: 3px solid rgba(18, 107, 58, .16); }
.board-column header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.board-column header span {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--repinho-green-soft);
    color: var(--repinho-green-dark);
    font-weight: 900;
}
.flow-card {
    display: grid;
    gap: .65rem;
    padding: 1rem;
    margin-bottom: .8rem;
    border-radius: 20px;
    box-shadow: none;
}
.flow-card[draggable="true"] { cursor: grab; }
.flow-card h3, .flow-card p { margin: 0; }
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: .3rem .55rem;
    font-size: .76rem;
    font-weight: 900;
}
.badge.ok, .badge.priority-baixa { background: var(--repinho-green-soft); color: var(--repinho-green-dark); }
.badge.warning, .badge.priority-alta { background: #fff4d8; color: #8a5a00; }
.badge.danger, .badge.priority-urgente { background: #fff0ed; color: var(--danger); }
.badge.neutral, .badge.priority-normal { background: #eef2f0; color: var(--muted); }
.file-icon {
    display: inline-grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--repinho-green-soft);
    color: var(--repinho-green-dark);
    font-weight: 900;
}
.file-list {
    display: grid;
    gap: .35rem;
    padding: .7rem;
    border-radius: 14px;
    background: #fbfdfb;
}
.empty-state { padding: 1.4rem; color: var(--muted); }
.empty-state.compact { box-shadow: none; border-style: dashed; border-radius: 18px; }
.history-card { margin-top: 1rem; padding: 1.4rem; }
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.summary-list {
    display: grid;
    gap: .8rem;
}
.summary-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem;
    border-radius: 14px;
    background: #fbfdfb;
}
.summary-list span { color: var(--muted); text-align: right; }
.attachments-grid {
    display: grid;
    grid-template-columns: 180px minmax(220px, 1fr) 220px;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}
.attachments-grid strong, .attachments-grid span {
    padding: .8rem;
    border-bottom: 1px solid var(--line);
}
.attachments-grid strong {
    color: var(--repinho-green-dark);
    background: var(--repinho-green-soft);
}
.attachments-grid span {
    color: var(--muted);
    background: #fbfdfb;
}
.attachments-grid small {
    display: block;
    margin-top: .25rem;
    color: var(--muted);
}
.attachments-grid span:nth-last-child(-n+3) {
    border-bottom: 0;
}
.flow-title-link:hover { color: var(--repinho-green); }
.timeline {
    display: grid;
    gap: 1rem;
    position: relative;
}
.timeline-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: .8rem;
}
.timeline-dot {
    width: 14px;
    height: 14px;
    margin-top: .25rem;
    border-radius: 999px;
    background: var(--repinho-green);
    box-shadow: 0 0 0 5px var(--repinho-green-soft);
}
.timeline-item span, .timeline-item p {
    display: block;
    margin: .25rem 0 0;
    color: var(--muted);
}
.critical-list {
    display: grid;
    gap: .8rem;
}
.critical-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfdfb;
}
.critical-item span {
    display: block;
    color: var(--muted);
    margin-top: .25rem;
}
.log-line { display: grid; gap: .2rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.log-line span, .log-line p { color: var(--muted); font-size: .9rem; margin: 0; }
dialog {
    width: min(520px, calc(100% - 2rem));
    border: 0;
    border-radius: 24px;
    padding: 0;
    box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(11, 68, 40, .35); backdrop-filter: blur(4px); }
.dialog-form { display: grid; gap: 1rem; padding: 1.4rem; }
.dialog-form h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: end; gap: .7rem; }

:root[data-theme="dark"] .sidebar,
body[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0f1d14 0%, #0a140e 100%);
    border-color: var(--line);
    box-shadow: 10px 0 35px rgba(0, 0, 0, .28);
}

:root[data-theme="dark"] .menu-toggle,
:root[data-theme="dark"] .notification-menu div,
:root[data-theme="dark"] .login-panel,
:root[data-theme="dark"] .hero-card,
:root[data-theme="dark"] .upload-card,
:root[data-theme="dark"] .search-card,
:root[data-theme="dark"] .action-card,
:root[data-theme="dark"] .board-column,
:root[data-theme="dark"] .flow-card,
:root[data-theme="dark"] .history-card,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] dialog,
body[data-theme="dark"] .menu-toggle,
body[data-theme="dark"] .notification-menu div,
body[data-theme="dark"] .login-panel,
body[data-theme="dark"] .hero-card,
body[data-theme="dark"] .upload-card,
body[data-theme="dark"] .search-card,
body[data-theme="dark"] .action-card,
body[data-theme="dark"] .board-column,
body[data-theme="dark"] .flow-card,
body[data-theme="dark"] .history-card,
body[data-theme="dark"] .empty-state,
body[data-theme="dark"] .stat-card,
body[data-theme="dark"] dialog {
    color: var(--ink);
    background: rgba(16, 31, 22, .96);
    border-color: var(--line);
}

:root[data-theme="dark"] .topbar,
body[data-theme="dark"] .topbar {
    background: rgba(12, 24, 17, .92);
    border-color: var(--line);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .25);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
    color: var(--ink);
    background: #09160f;
    border-color: var(--line);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder,
body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
    color: #8da096;
}

:root[data-theme="dark"] label,
:root[data-theme="dark"] .attachments-grid strong,
body[data-theme="dark"] label,
body[data-theme="dark"] .attachments-grid strong {
    color: var(--repinho-green-dark);
}

:root[data-theme="dark"] .file-list,
:root[data-theme="dark"] .summary-list div,
:root[data-theme="dark"] .critical-item,
:root[data-theme="dark"] .attachments-grid,
:root[data-theme="dark"] .attachments-grid span,
:root[data-theme="dark"] .notification-menu div a,
:root[data-theme="dark"] .notification-menu div span,
body[data-theme="dark"] .file-list,
body[data-theme="dark"] .summary-list div,
body[data-theme="dark"] .critical-item,
body[data-theme="dark"] .attachments-grid,
body[data-theme="dark"] .attachments-grid span,
body[data-theme="dark"] .notification-menu div a,
body[data-theme="dark"] .notification-menu div span {
    color: var(--ink);
    background: #0b1711;
    border-color: var(--line);
}

:root[data-theme="dark"] .attachments-grid strong,
body[data-theme="dark"] .attachments-grid strong {
    background: rgba(41, 183, 101, .14);
}

:root[data-theme="dark"] .badge.warning,
:root[data-theme="dark"] .badge.priority-alta,
body[data-theme="dark"] .badge.warning,
body[data-theme="dark"] .badge.priority-alta {
    color: #ffe2a6;
    background: rgba(230, 193, 123, .14);
}

:root[data-theme="dark"] .badge.danger,
:root[data-theme="dark"] .badge.priority-urgente,
body[data-theme="dark"] .badge.danger,
body[data-theme="dark"] .badge.priority-urgente {
    color: #ffb1a6;
    background: rgba(255, 143, 127, .14);
}

:root[data-theme="dark"] .badge.neutral,
:root[data-theme="dark"] .badge.priority-normal,
body[data-theme="dark"] .badge.neutral,
body[data-theme="dark"] .badge.priority-normal {
    color: var(--muted);
    background: rgba(238, 248, 241, .08);
}

:root[data-theme="dark"] dialog::backdrop,
body[data-theme="dark"] dialog::backdrop {
    background: rgba(0, 0, 0, .64);
}

:root[data-theme="dark"] .ghost-button,
body[data-theme="dark"] .ghost-button {
    color: var(--repinho-green-dark);
    background: rgba(41, 183, 101, .14);
}

:root[data-theme="dark"] option,
body[data-theme="dark"] option {
    color: var(--ink);
    background: #09160f;
}

@media (max-width: 900px) {
    .app-shell, .app-shell.sidebar-collapsed {
        display: block;
    }
    .sidebar {
        position: sticky;
        height: auto;
        min-height: 72px;
        padding: .75rem 1rem;
    }
    .sidebar-head { min-height: 50px; }
    .nav, .logout-link { display: none; }
    .app-shell.mobile-menu-open .nav {
        display: grid;
        max-height: calc(100vh - 170px);
        padding-top: .75rem;
    }
    .app-shell.mobile-menu-open .logout-link { display: flex; }
    .app-shell.mobile-menu-open .brand-lockup { display: flex; }
    .app-shell.sidebar-collapsed .brand-copy,
    .app-shell.sidebar-collapsed .nav a span:not(.nav-ico),
    .app-shell.sidebar-collapsed .logout-link span:not(.nav-ico) {
        display: inline;
    }
    .app-shell.sidebar-collapsed .nav a,
    .app-shell.sidebar-collapsed .logout-link {
        justify-content: flex-start;
        padding: .75rem .85rem;
    }
    .topbar, .hero-card, .upload-card, .action-card { flex-direction: column; align-items: stretch; grid-template-columns: 1fr; }
    .userbar { flex-wrap: wrap; white-space: normal; }
    .upload-form, .search-form, .detail-grid, .stats-grid { grid-template-columns: 1fr; }
    .attachments-grid { grid-template-columns: 1fr; }
    .attachments-grid strong { display: none; }
    .attachments-grid span { border-bottom: 0; }
    .attachments-grid span:nth-child(3n+1) { padding-top: 1rem; border-top: 1px solid var(--line); }
    .critical-item { flex-direction: column; }
}
