:root {
    --bg: #f4f6fa;
    --panel: #fff;
    --panel-2: #f8fafc;
    --line: #dbe3ee;
    --line-2: #cbd5e1;
    --text: #0f172a;
    --muted: #475569;
    --faint: #94a3b8;
    --accent: #0284c7;
    --accent-h: #0369a1;
    --accent-hl: rgba(2, 132, 199, .12);
    --good: #16a34a;
    --warn: #b45309;
    --bad: #dc2626;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
    --inp-bg: #fff;
    --inp-text: #0f172a;
    --inp-ph: #94a3b8;
    --inp-bd: #cbd5e1;
    --inp-bd-f: #38bdf8;
    --inp-ring: rgba(56, 189, 248, .2);
    --transition: .18s cubic-bezier(.16, 1, .3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html,
body {
    height: 100%;
    font-size: 15px
}

body {
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit
}

img,
svg {
    display: block
}

.hidden {
    display: none !important
}

/* AUTH */
#authScreen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px;
    width: min(420px, 100%);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .25)
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px
}

.auth-logo svg {
    flex-shrink: 0
}

.auth-logo span {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.025em
}

.auth-card p {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 24px;
    font-size: 14px
}

.auth-error {
    color: var(--bad);
    font-size: 13px;
    margin-top: 12px;
    line-height: 1.5
}

/* LAYOUT */
.app {
    display: flex;
    height: 100vh
}

.sidebar {
    width: 380px;
    min-width: 300px;
    max-width: 44vw;
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    flex-shrink: 0
}

.sidebar-head {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    overflow-y: auto;
    flex-shrink: 1
}

.s-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px
}

.s-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.15
}

.s-eyebrow {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
    font-weight: 500
}

.s-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px
}

.s-meta button {
    background: none;
    border: 0;
    color: var(--accent);
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    padding: 0
}

.progress-wrap {
    margin-top: 10px
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--faint);
    margin-bottom: 6px
}

.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #7c3aed);
    transition: width .3s ease
}

.case-list {
    overflow-y: auto;
    flex: 1;
    content-visibility: auto;
    min-height: 220px;
}

.case-item {
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    cursor: pointer;
    transition: background var(--transition);
    position: relative
}

.case-item:hover {
    background: #f0f7ff
}

.case-item.active {
    background: #e0f2fe;
    border-left: 4px solid var(--accent);
    padding-left: 12px
}

.ci-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px
}

.ci-num {
    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
    margin-bottom: 5px
}

.ci-sub {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.45
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0
}

.sidebar-loading {
    padding: 12px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--faint);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* CONTENT */
.content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column
}

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    position: sticky;
    top: 0;
    z-index: 9
}

.btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-weight: 750;
    font-size: 13px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08)
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .12)
}

.btn:active {
    transform: translateY(0)
}

.btn-good {
    background: var(--good);
    color: #fff
}

.btn-dark {
    background: #334155;
    color: #fff
}

.btn-blue {
    background: var(--accent);
    color: #fff
}

.btn-warn {
    background: var(--warn);
    color: #fff
}

.btn-danger {
    background: #dc2626;
    color: #fff
}

.btn-ghost {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line-2)
}

.toolbar .ml-auto {
    margin-left: auto
}

.autosave-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer
}

.autosave-label input {
    cursor: pointer
}

.save-ok {
    font-size: 12px;
    font-weight: 800;
    color: var(--good)
}

.page-content {
    padding: 20px 24px 32px;
    flex: 1
}

/* PANELS */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow)
}

.panel-inner {
    padding: 16px
}

/* WORKSPACE */
.ws-hero {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 20px
}

.ws-h2 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.2;
    margin-bottom: 8px
}

.ws-meta {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.7
}

.ws-summary {
    min-width: 260px;
    max-width: 340px;
    flex-shrink: 0;
    width: 100%
}

.ws-meta-grid {
    display: grid;
    gap: 5px;
    font-size: 13px;
    color: var(--muted)
}

.ws-meta-grid strong {
    color: var(--text)
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
    gap: 16px
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px
}

.inp-wrap input,
.inp-wrap select,
.inp-wrap textarea,
.editor {
    width: 100%;
    background: var(--inp-bg);
    color: var(--inp-text);
    border: 1px solid var(--inp-bd);
    border-radius: 12px;
    padding: 11px 13px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    line-height: 1.5
}

.inp-wrap input::placeholder,
.inp-wrap textarea::placeholder {
    color: var(--inp-ph)
}

.inp-wrap select {
    appearance: none
}

.inp-wrap input:focus,
.inp-wrap select:focus,
.inp-wrap textarea:focus,
.editor:focus {
    border-color: var(--inp-bd-f);
    box-shadow: 0 0 0 4px var(--inp-ring)
}

.editor {
    min-height: 220px;
    padding: 14px;
    overflow: auto;
    line-height: 1.65;
    cursor: text
}

/* DOCS & MOVS */
table {
    width: 100%;
    border-collapse: collapse
}

th,
td {
    padding: 9px 10px;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    font-size: 13px
}

th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--faint);
    background: var(--panel-2);
    cursor: pointer;
    user-select: none
}

th:hover {
    color: var(--accent)
}

th .sort-arrow {
    margin-left: 4px;
    opacity: .5
}

th.sorted .sort-arrow {
    opacity: 1;
    color: var(--accent)
}

.doc-btns {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.docbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 9px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  border-radius: 9px;
}

.docbtn:hover {
    background: #f0f7ff;
    border-color: var(--accent)
}

.movs-search {
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--inp-bd);
    background: var(--inp-bg);
    color: var(--inp-text);
    outline: none;
    font-size: 13px;
    margin-bottom: 10px;
    transition: border-color var(--transition), box-shadow var(--transition)
}

.movs-search:focus {
    border-color: var(--inp-bd-f);
    box-shadow: 0 0 0 4px var(--inp-ring)
}

.mov-item {
    padding: 10px 0;
    border-bottom: 1px solid #eef2f7
}

.mov-item:last-child {
    border: 0;
    padding-bottom: 0
}

.mov-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px
}

.mov-date {
    font-size: 11px;
    color: var(--text);
    font-weight: 600;
    white-space: nowrap
}

.mov-tipo {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent)
}

.mov-desc {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text)
}

.empty {
    color: var(--faint);
    font-size: 13px;
    padding: 12px 0
}

/* MISC */
.search {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--inp-bd);
    background: var(--inp-bg);
    color: var(--inp-text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition)
}

.search::placeholder {
    color: var(--inp-ph)
}

.search:focus {
    border-color: var(--inp-bd-f);
    box-shadow: 0 0 0 4px var(--inp-ring)
}

.mono {
    font-variant-numeric: tabular-nums
}

.scroll-sentinel {
    height: 1px
}

.skeleton-row {
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7
}

.skel {
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, #eef2f7 25%, #f8fbff 50%, #eef2f7 75%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite
}

@keyframes shimmer {
    0% {
        background-position: 100% 0
    }

    100% {
        background-position: -100% 0
    }
}

.chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #eef2f7;
    color: var(--muted)
}

.docs-search {
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--inp-bd);
    background: var(--inp-bg);
    color: var(--inp-text);
    outline: none;
    font-size: 13px;
    margin-bottom: 10px;
    transition: border-color var(--transition), box-shadow var(--transition)
}

.docs-search:focus {
    border-color: var(--inp-bd-f);
    box-shadow: 0 0 0 4px var(--inp-ring)
}

@media(max-width:980px) {
    .sidebar {
        width: 320px
    }

    .two-col {
        grid-template-columns: 1fr
    }

    .page-content {
        padding: 14px
    }
}

@media(max-width:720px) {
    body {
        overflow: auto
    }

    .app {
        flex-direction: column;
        height: auto;
        min-height: 100vh
    }

    .sidebar {
        width: 100%;
        max-width: none;
        min-width: 0;
        max-height: 44vh
    }

    .content {
        min-height: 56vh
    }
}

.fw-container {
    font-family: 'Segoe UI', sans-serif;
}

.fw-container iframe {
    display: block;
}


/* Container que simula a folha de papel */
.doc-page-container {
    background: #ffffff;
    max-width: 800px;
    margin: 40px auto;
    /* Centraliza a folha */
    padding: 60px;
    /* Espaçamento interno das margens */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-height: 1000px;
    /* Altura mínima similar a uma A4 */
    border-radius: 2px;
    font-family: 'Times New Roman', Times, serif;
    /* Fonte clássica jurídica */
    line-height: 1.6;
    color: #000;
}

/* Garante que o fundo da página seja diferente para destacar a folha */
.modal-overlay {
    background: rgba(240, 242, 245, 0.95);
    overflow-y: auto;
}

.doc-plain-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.65;
    color: #1f2937;
    margin: 0;
}

.col-acao {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  padding: 6px 8px;
  text-align: center;
}

.doc-nome {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.docs-table th,
.docs-table td {
  padding: 10px 12px;
  overflow: hidden;
  vertical-align: middle;
}

.docs-table th:nth-child(1),
.docs-table td:nth-child(1) {
  width: 56px;
  white-space: nowrap;
}

.docs-table th:nth-child(2),
.docs-table td:nth-child(2) {
  width: 148px;
  white-space: nowrap;
}

.docs-table th:nth-child(4),
.docs-table td:nth-child(4) {
  width: 80px;
  white-space: nowrap;
}

.docs-table th:nth-child(3),
.docs-table td:nth-child(3) {
  min-width: 0;
}

.analysis-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.analysis-actions .btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.analysis-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .12);
}

.analysis-actions .btn:active {
  transform: translateY(0);
}

.analysis-actions .btn-ghost {
  background: #fff;
  color: #334155;
  border: 1px solid #dbe3ee;
}

.analysis-actions .btn-dark {
  background: #334155;
  color: #fff;
  border: 1px solid #334155;
}

.analysis-actions .btn-blue {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border: 1px solid #0369a1;
}

.analysis-actions .btn .icon {
  font-size: 13px;
  line-height: 1;
}

.pending-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.pending-filter input {
  accent-color: var(--accent);
  cursor: pointer;
}

.status-counts {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-size: 12px;
  user-select: none;
}

.sc-item:hover {
  background: var(--accent-hl);
  border-color: var(--line);
}

.sc-item.active {
  background: var(--accent-hl);
  border-color: var(--accent);
}

.sc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sc-label {
  flex: 1;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-count {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}

.sc-count.loading {
  color: var(--faint);
}

/* ═══════════════════════════════════════════════════════════
   COMPONENTES COMPARTILHADOS P1 + P2
   ═══════════════════════════════════════════════════════════ */

/* ── Cabeçalho unificado ───────────────────────────────────── */
.app-header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 44px; flex-shrink: 0;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.app-header .app-logo { flex-shrink: 0; }
.app-header .app-title {
  font-weight: 700; font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.app-header .app-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.app-header a { font-size: 12px; color: var(--faint); text-decoration: none; }
.app-header a:hover { color: var(--accent); }
.app-header .app-div { color: var(--faint); font-size: 12px; }
.app-header .app-user {
  font-size: 11px; color: var(--faint); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 120px;
}
.app-header .app-logout {
  background: none; border: none; cursor: pointer;
  font-size: 11px; color: var(--accent); font-weight: 700; padding: 0;
}

/* ── Filtros rápidos (sempre visíveis) ─────────────────────── */
.quick-filters {
  flex-shrink: 0; padding: 8px 14px 6px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.quick-filters .qf-search {
  width: 100%; height: 30px; border: 1px solid var(--inp-bd); border-radius: 8px;
  padding: 0 10px; font-size: 12px; background: var(--inp-bg);
  color: var(--inp-text); outline: none; transition: border .15s; margin-bottom: 7px;
}
.quick-filters .qf-search:focus { border-color: var(--inp-bd-f); box-shadow: 0 0 0 3px var(--inp-ring); }
.qf-row {
  display: flex; align-items: center; gap: 5px; margin-bottom: 5px; flex-wrap: wrap;
}
.qf-label { font-size: 10px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }

/* ── Barra de chips de filtros ativos ─────────────────────── */
.active-chips-bar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 5px 14px; border-bottom: 1px solid var(--line);
  background: var(--panel-2); flex-shrink: 0; min-height: 0;
}
.active-chips-bar:empty { display: none; }
.active-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px 2px 9px; border-radius: 999px;
  background: var(--accent-hl); border: 1px solid rgba(2,132,199,.25);
  font-size: 11px; color: var(--accent); font-weight: 600; white-space: nowrap;
}
.active-chip-del {
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: 13px; line-height: 1; padding: 0 1px;
  opacity: .65; transition: opacity .1s;
}
.active-chip-del:hover { opacity: 1; }

/* ── Toggle de filtros avançados ──────────────────────────── */
.adv-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 6px 14px; border: none;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; flex-shrink: 0;
  transition: background .12s; text-align: left; gap: 6px;
}
.adv-toggle:hover { background: var(--bg); }
.adv-toggle-left { display: flex; align-items: center; gap: 6px; }
.adv-count {
  display: inline-flex; align-items: center; padding: 0 6px; height: 16px;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 800;
}
.adv-arrow { font-size: 9px; transition: transform .2s; flex-shrink: 0; }
.adv-toggle.open .adv-arrow { transform: rotate(90deg); }

/* ── Corpo de filtros avançados ────────────────────────────── */
.adv-body {
  overflow-y: auto; background: var(--panel); flex-shrink: 0;
  /* max() garante mínimo de 80px; min() impede que adv-body espreme o case-list */
  max-height: min(42vh, max(80px, calc(100vh - 630px)));
  border-bottom: 1px solid var(--line);
}
.adv-section-label {
  font-size: 10px; font-weight: 700; color: var(--faint); text-transform: uppercase;
  letter-spacing: .06em; padding: 8px 14px 3px;
}

/* ── Barra de presets ─────────────────────────────────────── */
.preset-bar { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.preset-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 0 9px; height: 24px; border: 1px solid var(--line-2); border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.preset-btn:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); }
.preset-btn.save-btn { border-style: dashed; }
.preset-dropdown { position: relative; }
.preset-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 300;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  min-width: 230px; padding: 4px 0;
}
.preset-menu-empty { padding: 10px 14px; font-size: 12px; color: var(--faint); }
.preset-item {
  display: flex; align-items: center; padding: 7px 10px 7px 14px;
  cursor: pointer; font-size: 12px; color: var(--text); transition: background .1s; gap: 6px;
}
.preset-item:hover { background: var(--panel-2); }
.preset-item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-item-meta { font-size: 10px; color: var(--faint); flex-shrink: 0; }
.preset-item-del {
  background: none; border: none; cursor: pointer; color: var(--faint);
  font-size: 14px; line-height: 1; padding: 0 3px; flex-shrink: 0; transition: color .1s;
}
.preset-item-del:hover { color: var(--bad); }
.preset-save-row {
  padding: 6px 10px 6px 14px; border-top: 1px solid var(--line); margin-top: 2px;
  display: flex; gap: 5px; align-items: center;
}
.preset-save-row input {
  flex: 1; height: 26px; border: 1px solid var(--inp-bd); border-radius: 6px;
  padding: 0 8px; font-size: 12px; background: var(--inp-bg); color: var(--inp-text); outline: none;
}
.preset-save-row input:focus { border-color: var(--inp-bd-f); }
.preset-save-row button {
  height: 26px; padding: 0 10px; border: none; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.preset-save-row button:hover { background: var(--accent-h); }

/* ── Responsividade por altura de viewport ───────────────────
   Garante que o layout não corte conteúdo em telas 1600×900
   e seja flexível para diferentes proporções de TV.
   ─────────────────────────────────────────────────────────── */
@media (max-height: 860px) {
  .page-content { padding: 12px 20px 24px; }
  .toolbar      { padding: 10px 20px; }
  .ws-hero      { margin-bottom: 12px; }
}

@media (max-height: 768px) {
  .app-header   { height: 38px; }
  .page-content { padding: 8px 16px 20px; }
  .toolbar      { padding: 8px 16px; }
  .ws-h2        { font-size: 20px; }
  .case-list    { min-height: 140px; }
}