/* ==========================================================================
   Tema visual Lineflex (v1.5) — claro e escuro
   Vale só para páginas com <body class="app-shell">; as demais seguem o style.css.
   As impressões (print.css) não usam este arquivo.
   ========================================================================== */

:root,
[data-theme="claro"] {
    --header-bg: #0B1405;
    --header-ink: #E9E4DA;
    --header-muted: #A9AE9F;
    --header-line: #23301C;
    --header-hover: #18230F;

    --bg: #F6F4F0;
    --surface: #FFFFFF;
    --surface-2: #FAF8F4;
    --border: #E6E0D6;
    --border-strong: #CFC6B8;
    --ink: #1A1F17;
    --muted: #5E6459;
    --faint: #8A8F84;

    --accent: #8C6420;
    --accent-hover: #6F4F18;
    --accent-ink: #FFFFFF;
    --accent-soft: rgba(168, 123, 45, 0.14);
    --ring: rgba(140, 100, 32, 0.22);

    --row-hover: #FBF7EF;
    --saved: #E2F2E6;

    --st-aberta-bg: #E4EDF8;      --st-aberta: #1F4F8F;
    --st-pendente-bg: #FBF0D6;    --st-pendente: #7E4E00;
    --st-separacao-bg: #E5EFEA;   --st-separacao: #2A5A44;
    --st-concluido-bg: #E2F2E6;   --st-concluido: #1C6B3A;
    --st-falta-bg: #FBE4E1;       --st-falta: #A1271B;
    --st-neutro-bg: #EEEBE5;      --st-neutro: #4A4F45;

    --fire: #C2410C;
    --fire-bg: #FFEDD5;
    --snow: #7D9AAE;

    --shadow: 0 1px 2px rgba(26, 31, 23, 0.06);
    --shadow-hover: 0 8px 20px rgba(26, 31, 23, 0.10);
    --toast-bg: #0B1405;
    --toast-ink: #F1EEE7;

    color-scheme: light;
}

[data-theme="escuro"] {
    --header-bg: #070C04;
    --header-ink: #ECE8DF;
    --header-muted: #9AA293;
    --header-line: #1C2716;
    --header-hover: #131C0E;

    --bg: #0B1006;
    --surface: #121A0E;
    --surface-2: #0E1509;
    --border: #222D1B;
    --border-strong: #34412B;
    --ink: #ECEAE4;
    --muted: #A0A799;
    --faint: #737B6C;

    --accent: #E3C26A;
    --accent-hover: #F0D58E;
    --accent-ink: #0B1405;
    --accent-soft: rgba(227, 194, 106, 0.14);
    --ring: rgba(227, 194, 106, 0.25);

    --row-hover: #18210F;
    --saved: rgba(74, 222, 128, 0.14);

    --st-aberta-bg: rgba(96, 165, 250, 0.15);    --st-aberta: #A5C8FB;
    --st-pendente-bg: rgba(250, 204, 21, 0.14);  --st-pendente: #F5D96B;
    --st-separacao-bg: rgba(134, 190, 160, 0.16); --st-separacao: #A8D5BC;
    --st-concluido-bg: rgba(74, 222, 128, 0.14); --st-concluido: #8EEAAE;
    --st-falta-bg: rgba(248, 113, 113, 0.16);    --st-falta: #FCA5A5;
    --st-neutro-bg: rgba(255, 255, 255, 0.08);   --st-neutro: #C9CCC3;

    --fire: #FDBA74;
    --fire-bg: rgba(251, 146, 60, 0.15);
    --snow: #6F8C7E;

    --shadow: none;
    --shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.4);
    --toast-bg: #1A2414;
    --toast-ink: #ECEAE4;

    color-scheme: dark;
}

/* ---------- Base ---------- */
body.app-shell {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 14px;
    padding: 0;
    min-height: 100vh;
    transition: background 0.25s ease, color 0.25s ease;
}

.app-shell h1,
.app-shell .brand-title {
    font-family: 'Poppins', 'Inter', sans-serif;
}

.app-shell .mono,
.app-shell .td-num {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.app-shell .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Barra superior da marca ---------- */
.app-shell .topbar {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-line);
    color: var(--header-ink);
    padding: 0;
    text-align: left;
}

.app-shell .topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 10px 32px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
}

.app-shell .brand {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-grow: 1;
}

.app-shell a.brand {
    color: inherit;
    text-decoration: none;
}

.app-shell .brand img {
    height: 38px;
    width: auto;
    display: block;
}

.app-shell .brand-sep {
    width: 1px;
    height: 30px;
    background: var(--header-line);
}

.app-shell .brand-title {
    color: var(--header-ink);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    margin: 0;
}

.app-shell .brand-sub {
    display: block;
    color: var(--header-muted);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 400;
}

.app-shell .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}

.app-shell .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--header-muted);
    text-decoration: none;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-shell .nav-link:hover {
    background: var(--header-hover);
    color: var(--header-ink);
}

.app-shell .nav-link.is-active {
    color: #E3C26A;
    background: var(--header-hover);
}

.app-shell .nav-badge {
    background: #C2410C;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}

.app-shell .vsep {
    width: 1px;
    height: 28px;
    background: var(--header-line);
    margin: 0 6px;
}

.app-shell .user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--header-ink);
    font-size: 13px;
    padding: 0 6px;
}

.app-shell .user-chip strong {
    font-weight: 600;
}

.app-shell .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--header-line);
    background: transparent;
    color: var(--header-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.app-shell .icon-btn:hover {
    background: var(--header-hover);
    color: var(--header-ink);
}

.app-shell .icon-btn:active {
    transform: scale(0.96);
}

/* Seletor Claro / Escuro */
.app-shell .theme-switch {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 10px;
    background: #131C0E;
    border: 1px solid var(--header-line);
}

.app-shell .theme-switch button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--header-muted);
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.app-shell .theme-switch button[aria-pressed="true"] {
    background: #E3C26A;
    color: #0B1405;
}

.app-shell .theme-switch button:not([aria-pressed="true"]):hover {
    color: var(--header-ink);
}

/* ---------- Conteúdo ---------- */
.app-shell .page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app-shell .page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.app-shell .page-head h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.app-shell .sync {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.app-shell .dot-ok {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22A05A;
    box-shadow: 0 0 0 3px rgba(34, 160, 90, 0.18);
}

/* Botão Atualizar (substitui o estilo antigo do cabeçalho roxo) */
.app-shell #lastUpdateInfo #refreshBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.app-shell #lastUpdateInfo #refreshBtn:hover {
    background: var(--accent-soft);
    transform: none;
    box-shadow: none;
}

.app-shell #lastUpdateInfo #refreshBtn.has-update {
    background: #F5D96B !important;
    color: #3D2A00 !important;
    border: none !important;
    animation: pulse-soft 1.6s ease-in-out infinite;
    box-shadow: none;
}

.app-shell #updateAvailable {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--st-pendente-bg);
    color: var(--st-pendente);
    font-size: 12px;
    font-weight: 600;
    animation: none;
}

.app-shell #matrizCacheInfo {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--st-neutro-bg);
    color: var(--muted);
    font-size: 12px;
}

.app-shell .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app-shell .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.app-shell .btn:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-hover);
}

.app-shell .btn:active {
    transform: scale(0.98);
}

.app-shell .btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.app-shell .btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ---------- Cartões de status (filtros) ---------- */
.app-shell .stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    justify-content: stretch;
    overflow: visible;
    padding: 0;
}

.app-shell .stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--ink);
    text-align: left;
    box-shadow: var(--shadow);
    backdrop-filter: none;
    animation: rise 0.5s ease both;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.25s ease;
}

.app-shell .stat-card:nth-child(2) { animation-delay: 0.05s; }
.app-shell .stat-card:nth-child(3) { animation-delay: 0.1s; }
.app-shell .stat-card:nth-child(4) { animation-delay: 0.15s; }
.app-shell .stat-card:nth-child(5) { animation-delay: 0.2s; }
.app-shell .stat-card:nth-child(6) { animation-delay: 0.25s; }

.app-shell .stat-card.clickable-stat {
    cursor: pointer;
    border: 1px solid var(--border);
}

.app-shell .stat-card.clickable-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-strong);
}

.app-shell .stat-card.clickable-stat.active {
    transform: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.app-shell .stat-card .label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    opacity: 1;
}

.app-shell .stat-card .value {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 26px;
    font-weight: 500;
    color: var(--ink);
}

.app-shell .stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--muted);
}

.app-shell .stat-aberta .stat-dot    { background: var(--st-aberta); }
.app-shell .stat-pendente .stat-dot  { background: var(--st-pendente); }
.app-shell .stat-separacao .stat-dot { background: var(--st-separacao); }
.app-shell .stat-concluido .stat-dot { background: var(--st-concluido); }
.app-shell .stat-falta .stat-dot     { background: var(--st-falta); }

/* ---------- Painel com busca e tabela ---------- */
.app-shell .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: rise 0.5s 0.15s ease both;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.app-shell .filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border-bottom: 1px solid var(--border);
}

.app-shell .search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 320px;
    max-width: 520px;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-shell .search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.app-shell #searchInput {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
}

.app-shell .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.app-shell .table-container {
    padding: 0;
    overflow-x: auto;
}

.app-shell .table-container::-webkit-scrollbar-track { background: var(--surface-2); }
.app-shell .table-container::-webkit-scrollbar-thumb { background: var(--border-strong); }
.app-shell .table-container::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.app-shell #solicitacoesTable {
    font-size: 14px;
    color: var(--ink);
}

.app-shell #solicitacoesTable thead {
    background: var(--surface-2);
    color: var(--muted);
}

.app-shell #solicitacoesTable th {
    padding: 11px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.app-shell #solicitacoesTable th:first-child,
.app-shell #solicitacoesTable td:first-child {
    padding-left: 16px;
}

.app-shell #solicitacoesTable td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.app-shell #solicitacoesTable tbody tr {
    transition: background 0.15s ease;
}

.app-shell #solicitacoesTable tbody tr:hover {
    background: var(--row-hover);
}

.app-shell .sortable-header:hover {
    background: var(--accent-soft) !important;
    color: var(--ink);
}

.app-shell .sortable-header::after {
    content: '⇅';
    font-size: 11px;
    opacity: 0.4;
    margin-left: 6px;
}

.app-shell #solicitacoesTable td.td-desc { min-width: 220px; }
.app-shell #solicitacoesTable td:first-child { font-size: 13px; }
.app-shell #solicitacoesTable td:nth-child(2) {
    white-space: normal;
    min-width: 130px;
    max-width: 200px;
}

.app-shell .td-muted { color: var(--muted); }
.app-shell .td-code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 500;
    color: var(--accent);
}
.app-shell .td-desc { font-weight: 500; }
.app-shell .td-center { text-align: center; }

/* Etiquetas de status */
.app-shell .status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--st-neutro-bg);
    color: var(--st-neutro);
}

.app-shell .status-aberta                 { background: var(--st-aberta-bg);    color: var(--st-aberta); }
.app-shell .status-pendente               { background: var(--st-pendente-bg);  color: var(--st-pendente); }
.app-shell .status-em-separacao,
.app-shell .status-impresso               { background: var(--st-separacao-bg); color: var(--st-separacao); }
.app-shell .status-concluido              { background: var(--st-concluido-bg); color: var(--st-concluido); }
.app-shell .status-falta,
.app-shell .status-falta-parcial,
.app-shell .status-divergencia-de-estoque { background: var(--st-falta-bg);     color: var(--st-falta); }

/* Alta demanda / normal */
.app-shell .demanda-alta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--fire-bg);
    color: var(--fire);
    font-size: 12px;
    font-weight: 700;
}

.app-shell .demanda-alta svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.5;
}

[data-theme="escuro"] .app-shell .demanda-alta {
    animation: glow 2.4s ease-in-out infinite;
}

.app-shell .demanda-normal {
    display: inline-flex;
    color: var(--snow);
}

/* ---------- Rodapé ---------- */
.app-shell .app-footer {
    text-align: center;
    padding: 8px 16px 32px;
    color: var(--faint);
    font-size: 12px;
}

.app-shell .app-footer a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.app-shell .app-footer a:hover {
    text-decoration: underline;
}

/* ---------- Avisos (toasts) ---------- */
.app-shell #toastContainer {
    position: fixed;
    top: auto;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-shell .toast {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 280px;
    max-width: 520px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--toast-bg);
    color: var(--toast-ink);
    border-left: 4px solid #4ADE80;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    font-weight: 500;
    animation: toast-in 0.3s ease-out both;
}

.app-shell .toast.is-leaving { animation: toast-out 0.3s ease-in both; }
.app-shell .toast-success { border-left-color: #4ADE80; }
.app-shell .toast-error   { border-left-color: #F87171; }
.app-shell .toast-warning { border-left-color: #FACC15; }
.app-shell .toast-info    { border-left-color: #E3C26A; }

.app-shell .toast-text { flex: 1; }

.app-shell .toast-action {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #E3C26A;
    color: #0B1405;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* Contador de inatividade */
.app-shell #inactivityCounter {
    background: var(--toast-bg) !important;
    color: var(--toast-ink) !important;
    border: 1px solid var(--header-line);
    left: 24px;
    right: auto !important;
    bottom: 24px !important;
}

/* ---------- Animações ---------- */
@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

@keyframes toast-out {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(16px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0); }
    50%      { box-shadow: 0 0 0 4px rgba(251, 146, 60, 0.18); }
}

@keyframes pulse-soft {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 217, 107, 0.6); }
    50%      { box-shadow: 0 0 0 6px rgba(245, 217, 107, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .app-shell *,
    .app-shell *::before,
    .app-shell *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- Celular ---------- */
@media (max-width: 768px) {
    .app-shell .topbar-inner,
    .app-shell .page {
        padding-left: 16px;
        padding-right: 16px;
    }

    .app-shell .brand img { height: 30px; }
    .app-shell .brand-sep,
    .app-shell .brand-title { display: none; }

    /* Cabeçalho compacto */
    .app-shell .topbar-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
    .app-shell .vsep { display: none; }
    .app-shell .nav { gap: 4px; }
    .app-shell .nav-link { padding: 6px 8px; font-size: 13px; min-height: 36px; }
    .app-shell .theme-switch button { height: 30px; padding: 0 10px; font-size: 12px; min-height: 0; }
    .app-shell .user-chip { font-size: 12px; padding: 0; }
    .app-shell .icon-btn { width: 36px; height: 36px; min-height: 0; }

    /* Neutraliza regras antigas do style.css que encolhiam a linha de atualização */
    .app-shell #lastUpdateInfo { font-size: 13px !important; }
    .app-shell #lastUpdateInfo #refreshBtn { font-size: 13px !important; padding: 4px 8px !important; min-height: 0; }

    .app-shell .page { padding-top: 20px; }
    .app-shell .page-head h1 { font-size: 22px; }
    .app-shell .actions,
    .app-shell .actions .btn { width: 100%; }
    .app-shell .actions .btn { justify-content: center; }

    .app-shell .stats-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-shell #solicitacoesTable th:first-child,
    .app-shell #solicitacoesTable td:first-child {
        background: var(--surface);
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
    }

    .app-shell #solicitacoesTable thead th:first-child {
        background: var(--surface-2);
    }

    .app-shell #toastContainer {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .app-shell .toast { min-width: 0; }
}

/* ==========================================================================
   Janelas (modais) — fase 2
   ========================================================================== */
.app-shell .modal-overlay {
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 8, 3, 0.55);
    backdrop-filter: blur(4px);
}

.app-shell .modal-card {
    width: 100%;
    max-height: 86vh;
    overflow-y: auto;
    padding: 24px 28px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    animation: modal-in 0.25s ease-out both;
}

.app-shell .modal-card--sm { max-width: 440px; }
.app-shell .modal-card--md { max-width: 560px; }
.app-shell .modal-card--lg { max-width: 720px; }
.app-shell .modal-card--xl { max-width: 960px; }

.app-shell .modal-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.app-shell .modal-title {
    margin: 0;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
}

.app-shell .modal-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-shell .modal-close:hover {
    background: var(--accent-soft);
    color: var(--ink);
}

.app-shell .modal-body {
    color: var(--muted);
    line-height: 1.65;
}

.app-shell .modal-body strong { color: var(--ink); }

.app-shell .modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.app-shell .btn-sm {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

/* Campos de formulário dentro das janelas */
.app-shell .field { margin-bottom: 14px; }

.app-shell .field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--ink);
}

.app-shell .field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
}

.app-shell .field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.app-shell .field small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

/* Histórico de atualizações: o conteúdo vem do main.js com estilos fixos — ajustamos ao tema */
.app-shell #changelogContent { color: var(--muted) !important; }
.app-shell #changelogContent h3 {
    color: var(--accent) !important;
    border-bottom-color: var(--border) !important;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 600;
}
.app-shell #changelogContent ul,
.app-shell #changelogContent li { color: var(--muted) !important; }
.app-shell #changelogContent strong { color: var(--ink); }
.app-shell #changelogContent > div > div { border-top-color: var(--border) !important; }
.app-shell #changelogContent code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--ink);
}

.app-shell .whats-new-notice {
    margin-bottom: 20px;
    padding: 12px 15px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--ring);
    color: var(--ink);
    line-height: 1.6;
}

.app-shell .whats-new-notice a { color: var(--accent); font-weight: 600; }

/* Boas-vindas e aviso MATRIZ (conteúdo gerado pelo main.js) */
.app-shell #welcomeContent,
.app-shell #estoqueMatrizAvisoContent { color: var(--muted) !important; }
.app-shell #welcomeContent > div,
.app-shell #estoqueMatrizAvisoContent > div {
    background: var(--surface-2) !important;
    border-left-color: var(--accent) !important;
}
.app-shell #welcomeContent p,
.app-shell #welcomeContent li,
.app-shell #estoqueMatrizAvisoContent p,
.app-shell #estoqueMatrizAvisoContent li { color: var(--muted) !important; }

/* Gestor — faltas */
.app-shell .gestor-falta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.app-shell #gestorFaltaModal .gestor-falta-table thead tr { background: var(--surface-2); }

.app-shell #gestorFaltaModal .gestor-falta-table thead th {
    position: static;
    padding: 10px 8px;
    color: var(--muted) !important;
    background: transparent !important;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.app-shell #gestorFaltaModal .gestor-falta-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--ink);
    max-width: none;
}

.app-shell #gestorFaltaModal .gestor-falta-table th:nth-child(n+4),
.app-shell #gestorFaltaModal .gestor-falta-table td:nth-child(n+4) { text-align: center; }

.app-shell .empty-cell {
    padding: 20px !important;
    text-align: center !important;
    color: var(--muted) !important;
}

/* Alerta de reposição (classes do style.css, recoloridas pelo tema) */
.app-shell .reposicao-alert-overlay { background: rgba(5, 8, 3, 0.55); }
.app-shell .reposicao-alert-card {
    background: var(--surface);
    border: 1px solid var(--border);
    animation: modal-in 0.25s ease-out both;
}
.app-shell .reposicao-alert-card-header { background: var(--header-bg); }
.app-shell .reposicao-alert-title {
    color: #E3C26A;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 600;
}
.app-shell .reposicao-alert-subline { color: var(--header-muted); }
.app-shell .reposicao-alert-intro { color: var(--muted); }
.app-shell #reposicaoAlertModal .reposicao-alert-table {
    border-color: var(--border);
    box-shadow: none;
}
.app-shell #reposicaoAlertModal .reposicao-alert-table thead { background: var(--surface-2) !important; }
.app-shell #reposicaoAlertModal .reposicao-alert-table thead th {
    color: var(--muted) !important;
    border-bottom: 1px solid var(--border);
}
.app-shell #reposicaoAlertModal .reposicao-alert-table tbody td {
    background: var(--surface);
    color: var(--ink);
    border-bottom-color: var(--border);
}
.app-shell #reposicaoAlertModal .reposicao-alert-table tbody tr:hover td { background: var(--row-hover); }
.app-shell #reposicaoAlertModal .reposicao-alert-table .reposicao-col-qty {
    background: var(--st-concluido-bg);
    color: var(--st-concluido);
}
.app-shell .reposicao-alert-actions {
    background: var(--surface-2);
    border-top-color: var(--border);
}
.app-shell .reposicao-alert-sound-hint { color: var(--muted); }
.app-shell .reposicao-alert-btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: none;
}
.app-shell .reposicao-alert-btn--primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 16px var(--ring);
}
.app-shell .reposicao-alert-btn--secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-strong);
}
.app-shell .reposicao-alert-btn--secondary:hover {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--accent);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

/* Caixas de seleção e botões de opção no dourado da marca */
.app-shell input[type="checkbox"],
.app-shell input[type="radio"] {
    accent-color: var(--accent);
}
