html { padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }

/* Layout: cabeçalho com resumo do dia, abas por tipo de aviso, lista de cartões que abrem para comentários e resolução. */
:root {
  --bg: #EDF0F2;
  --surface: #FFFFFF;
  --surface-2: #F5F7F8;
  --ink: #16222A;
  --muted: #5A6A74;
  --line: #D3DBE0;
  --accent: #0B6E78;
  --accent-ink: #FFFFFF;
  --open: #9A5208;
  --open-bg: #FBEBD3;
  --prog: #2457A6;
  --prog-bg: #DCE7F8;
  --done: #1F7A45;
  --done-bg: #DDF1E4;
  --urgent: #B3261E;
  --urgent-bg: #FBE0DD;
  --f-display: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F171C; --surface: #17222A; --surface-2: #1D2B34; --ink: #E6EDF1; --muted: #93A4AF; --line: #2B3A44;
    --accent: #4FC1CC; --accent-ink: #08262A;
    --open: #F0B46A; --open-bg: #3A2A12; --prog: #8DB4F2; --prog-bg: #172C4D;
    --done: #7FD0A0; --done-bg: #123422; --urgent: #F4A29B; --urgent-bg: #43191A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F171C; --surface: #17222A; --surface-2: #1D2B34; --ink: #E6EDF1; --muted: #93A4AF; --line: #2B3A44;
  --accent: #4FC1CC; --accent-ink: #08262A;
  --open: #F0B46A; --open-bg: #3A2A12; --prog: #8DB4F2; --prog-bg: #172C4D;
  --done: #7FD0A0; --done-bg: #123422; --urgent: #F4A29B; --urgent-bg: #43191A;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  padding-block: 20px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
h1 { font-family: var(--f-display); font-size: 1.9rem; line-height: 1.1; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
.date { color: var(--muted); font-size: 0.9rem; }
.date::first-letter { text-transform: uppercase; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; display: flex; flex-direction: column; min-width: 92px; }
.stat b { font-family: var(--f-display); font-size: 1.4rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat.urg b { color: var(--urgent); }

.tabs-scroll { overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; min-width: max-content; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .n { background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; font-size: 0.75rem; padding: 0 7px; font-variant-numeric: tabular-nums; }
.tab .n.hot { background: var(--urgent-bg); color: var(--urgent); border-color: transparent; }

.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { background: none; border: 0; padding: 7px 14px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 8px 16px; font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.done { background: var(--done); color: #fff; }
.btn.small { padding: 5px 11px; font-size: 0.85rem; }
.btn.danger { background: transparent; border: 1px solid var(--urgent); color: var(--urgent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
:root[data-theme="dark"] .btn.done { color: #08200F; }


form.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
form.panel .full { grid-column: 1 / -1; }
form.panel label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; color: var(--muted); min-width: 0; }
form.panel input, form.panel select, form.panel textarea, .comment-box textarea, .search { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-weight: 400; color: var(--ink); width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 72px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) { form.panel { grid-template-columns: 1fr; } }

.list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.card-head { width: 100%; text-align: left; background: none; border: 0; padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; }
.card-top { display: flex; align-items: flex-start; gap: 8px; }
.card-top .card-head { flex: 1; width: auto; min-width: 0; }
.copy { flex-shrink: 0; margin: 12px 12px 0 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; font-size: 0.78rem; cursor: pointer; }
.copy:hover { border-color: var(--accent); }
.card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.card.resolvido .card-title { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 0.82rem; }
.meta .where { color: var(--ink); font-weight: 600; }
.pill { display: inline-block; border-radius: 99px; padding: 1px 10px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.pill.aberto { background: var(--open-bg); color: var(--open); }
.pill.andamento { background: var(--prog-bg); color: var(--prog); }
.pill.resolvido { background: var(--done-bg); color: var(--done); }
.pill.urgente { background: var(--urgent-bg); color: var(--urgent); }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.ccount { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ccount.novo { color: var(--done); font-weight: 700; }
.card.proposta { border-style: dashed; }
.plabel-tag { font-size: 0.78rem; font-weight: 600; color: var(--prog); text-transform: uppercase; letter-spacing: 0.06em; }
.plabel { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; color: var(--muted); max-width: 340px; }
.plabel input { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-weight: 400; color: var(--ink); width: 100%; min-width: 0; }
.card-body { border-top: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.texto { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.thread li { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; min-width: 0; }
.thread li.evt { background: none; padding: 0 12px; color: var(--muted); font-size: 0.82rem; }
.thread li.bot { background: var(--surface); border: 1px dashed var(--line); }
.thread li.bot .who { color: var(--prog); }
.thread .tpill { margin-left: 8px; }
.thread .who { font-weight: 600; font-size: 0.82rem; }
.thread .when { color: var(--muted); font-size: 0.78rem; margin-left: 8px; }
.thread p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-box { display: flex; flex-direction: column; gap: 8px; }

.texto a, .thread a, .sol-steps a { color: var(--accent); text-decoration: underline; overflow-wrap: anywhere; }
form.panel .note { margin: 0; }
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 28px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; font-family: var(--f-display); font-size: 1.1rem; color: var(--ink); margin-bottom: 4px; }
.note { color: var(--muted); font-size: 0.85rem; }
.sol-steps { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.sol-when { margin: 0; color: var(--muted); }
.search { max-width: 340px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 20; max-width: 90vw; }
@media (prefers-reduced-motion: no-preference) { .card { transition: border-color 0.15s; } .card:hover { border-color: var(--accent); } }

.whobar { font-size: 0.82rem; color: var(--muted); display: flex; gap: 6px; justify-content: flex-end; align-items: center; min-height: 1.2em; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: inherit; }
.login { max-width: 380px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.login form.panel { grid-template-columns: 1fr; }
