/*
 * Camada visual incremental (2026-08).
 * Mantém o CSS legado estável e concentra aqui os novos componentes/tokens.
 */

:root {
  color-scheme: light;

  /* Design System — Light */
  --bg-primary: #eceff4;
  --bg-secondary: #e6ebf2;
  --bg-tertiary: #dde4ee;
  --surface: #f5f7fb;
  --surface-raised: #fbfcfe;
  --surface-hover: #eef2f7;
  --surface-selected: #deebff;
  --surface-subtle: #f1f4f8;

  --border-primary: #bcc9da;
  --border-secondary: #d1d9e4;
  --border-strong: #aab8cb;
  --focus-ring: #2563eb;
  --selection-border: #0f6fec;

  --text-primary: #172033;
  --text-secondary: #526077;
  --text-muted: #7a8799;
  --text-on-accent: #f8fbff;

  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eaf2ff;
  --success: #18864b;
  --warning: #b77905;
  --danger: #c43d3d;
  --info: #2876b9;

  --team-remote: #2f6fd8;
  --team-remote-strong: #2359b8;
  --team-field: #d75a38;
  --team-field-strong: #b9422d;

  --status-c-strong: #2c9c4b;
  --status-c-row: #b7e37a;
  --status-p-strong: #2b84e7;
  --status-p-row: #98d1ff;
  --status-t-strong: #9270e5;
  --status-t-row: #ccb6ff;
  --status-a-strong: #ea8921;
  --status-a-row: #ffbf78;
  --status-u-strong: #d4b000;
  --status-u-row: #ffe127;
  --status-u-text: #4b3a00;
  --status-row-text: #111827;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .035);
  --shadow-sm: 0 5px 16px rgba(15, 23, 42, .055);
  --shadow-md: 0 14px 36px rgba(15, 23, 42, .10);
  --shadow-overlay: 0 24px 60px rgba(15, 23, 42, .18);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Compatibilidade com o CSS legado. */
  --bg: var(--bg-primary);
  --panel: var(--surface);
  --panel-solid: var(--surface-raised);
  --line: var(--border-secondary);
  --line-strong: var(--border-primary);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--accent-primary);
  --blue-dark: var(--accent-hover);
  --red: var(--danger);
  --red-dark: #9f312b;
  --green-row: var(--status-c-row);
  --blue-row: var(--status-p-row);
  --orange-row: var(--status-a-row);
  --yellow-row: var(--status-u-row);
  --green-strong: var(--status-c-strong);
  --blue-strong: var(--status-p-strong);
  --orange-strong: var(--status-a-strong);
  --yellow-strong: var(--status-u-strong);
  --yellow-text: var(--status-u-text);
  --glpi: var(--accent-primary);
  --shadow: var(--shadow-md);
  --soft-shadow: var(--shadow-sm);
  --radius: var(--radius-lg);

  --ui-radius-sm: var(--radius-sm);
  --ui-radius-md: var(--radius-md);
  --ui-radius-lg: var(--radius-lg);
  --ui-focus: 0 0 0 3px rgba(37, 99, 235, .18);
  --topbar-height: 69px;
}

html[data-theme="escuro"] {
  color-scheme: dark;

  /* Design System — Dark: neutro, sem preto puro e sem excesso de azul. */
  --bg-primary: #10151d;
  --bg-secondary: #141a23;
  --bg-tertiary: #1a212c;
  --surface: #171e28;
  --surface-raised: #1b232e;
  --surface-hover: #222b37;
  --surface-selected: #1d3150;
  --surface-subtle: #151b24;

  --border-primary: #34404f;
  --border-secondary: #27313d;
  --border-strong: #465466;
  --focus-ring: #6b9cff;
  --selection-border: #73a2ff;

  --text-primary: #edf2f7;
  --text-secondary: #b8c2cf;
  --text-muted: #8591a1;
  --text-on-accent: #f7faff;

  --accent-primary: #5e8ff0;
  --accent-hover: #79a5ff;
  --accent-soft: #1d3150;
  --success: #58b77a;
  --warning: #d7ae45;
  --danger: #e26a6a;
  --info: #6aa8dc;

  --team-remote: #315fae;
  --team-remote-strong: #274d8d;
  --team-field: #ad4b35;
  --team-field-strong: #8e3b2d;

  --status-c-strong: #55bb6f;
  --status-c-row: #356438;
  --status-p-strong: #69b2ec;
  --status-p-row: #2b5877;
  --status-t-strong: #b59cf0;
  --status-t-row: #5a4382;
  --status-a-strong: #f0a255;
  --status-a-row: #7a4d1d;
  --status-u-strong: #f0d43f;
  --status-u-row: #8a7600;
  --status-u-text: #2f2802;
  --status-row-text: #10151d;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .16);
  --shadow-sm: 0 5px 18px rgba(0, 0, 0, .16);
  --shadow-md: 0 16px 38px rgba(0, 0, 0, .22);
  --shadow-overlay: 0 26px 64px rgba(0, 0, 0, .36);

  --bg: var(--bg-primary);
  --panel: var(--surface);
  --panel-solid: var(--surface-raised);
  --line: var(--border-secondary);
  --line-strong: var(--border-primary);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--accent-primary);
  --blue-dark: var(--accent-hover);
  --red: var(--danger);
  --red-dark: #8e3b2d;
  --green-row: var(--status-c-row);
  --blue-row: var(--status-p-row);
  --orange-row: var(--status-a-row);
  --yellow-row: var(--status-u-row);
  --green-strong: var(--status-c-strong);
  --blue-strong: var(--status-p-strong);
  --orange-strong: var(--status-a-strong);
  --yellow-strong: var(--status-u-strong);
  --yellow-text: var(--status-u-text);
  --glpi: #8cb7ff;
  --shadow: var(--shadow-md);
  --soft-shadow: var(--shadow-sm);
  --ui-focus: 0 0 0 3px rgba(107, 156, 255, .22);
}

body {
  background: var(--bg);
}

.topbar {
  gap: 14px;
  padding: 10px 16px;
  background: rgba(248, 250, 253, .96);
  backdrop-filter: blur(12px);
}

.brand { min-width: 190px; }
.brand strong { font-size: 17px; }
.actions { gap: 8px; flex-wrap: nowrap; min-width: 0; }

.period-controls {
  border-radius: var(--ui-radius-md);
  background: var(--panel-solid);
}

.select,
.year-input,
.search,
.btn {
  height: 38px;
  border-radius: var(--ui-radius-sm);
  box-shadow: none;
}

.btn {
  font-weight: 700;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}

.btn:hover {
  transform: none;
  box-shadow: none;
  border-color: #94a3b8;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
}

.btn.primary:hover { filter: brightness(.96); }

.icon-btn {
  min-width: 38px;
  padding-inline: 9px;
}

.search-wrap {
  position: relative;
  min-width: 260px;
  flex: 1 1 360px;
  max-width: 430px;
}

.search-control {
  display: flex;
  height: 38px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--panel-solid);
}

.search-control:focus-within {
  border-color: var(--blue);
  box-shadow: var(--ui-focus);
}

.search-scope {
  width: 68px;
  border: 0;
  border-right: 1px solid var(--line);
  outline: 0;
  padding: 0 6px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.search-control .search {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.search-results {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(440px, 60vh);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--ui-radius-md);
  background: var(--panel-solid);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
}

.search-result-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result-item:last-child { border-bottom: 0; }
.search-result-item:hover,
.search-result-item:focus-visible { background: rgba(37, 99, 235, .07); outline: 0; }
.search-result-day { font-weight: 800; color: var(--blue); }
.search-result-main strong { display: block; font-size: 12px; }
.search-result-main span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.search-result-card { color: var(--muted); font-size: 10px; text-align: right; }
.search-empty { margin: 0; padding: 14px; color: var(--muted); font-size: 12px; }

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-sm);
  color: var(--muted);
  background: var(--panel-solid);
  font-size: 11px;
  font-weight: 750;
  cursor: default;
  white-space: nowrap;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

.sync-status.is-saving .sync-dot { background: #f59e0b; animation: syncPulse 1s ease-in-out infinite; }
.sync-status.is-error { color: #b91c1c; border-color: #fecaca; background: #fff7f7; cursor: pointer; }
.sync-status.is-error .sync-dot { background: #ef4444; }
.sync-status.is-conflict { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.sync-status.is-conflict .sync-dot { background: #f59e0b; }
@keyframes syncPulse { 50% { opacity: .35; } }

.top-menu { position: relative; }
.top-menu > summary { list-style: none; }
.top-menu > summary::-webkit-details-marker { display: none; }
.top-menu[open] > summary { border-color: var(--blue); box-shadow: var(--ui-focus); }
.top-menu-panel {
  position: absolute;
  z-index: 70;
  right: 0;
  top: calc(100% + 7px);
  display: grid;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--ui-radius-md);
  background: var(--panel-solid);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
}
.menu-action {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}
.menu-action:hover,
.menu-action:focus-visible { background: rgba(100, 116, 139, .10); outline: 0; }
.menu-action.danger { color: #b91c1c; }

.day-strip {
  top: var(--topbar-height);
  background: rgba(238, 243, 251, .96);
  backdrop-filter: blur(10px);
}

.page { padding-top: 18px; }
.page-head { margin-bottom: 14px; }
.date-heading { min-width: 190px; }
.date-nav { display: flex; align-items: center; gap: 9px; }
.date-nav h1 { font-size: clamp(28px, 2.4vw, 38px); }
.day-nav-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--text);
  background: var(--panel-solid);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}
.day-nav-btn:hover { border-color: var(--blue); color: var(--blue); }

.summary { gap: 8px; }
.summary button {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-md);
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: none;
  text-align: left;
  cursor: pointer;
}
.summary button:hover { border-color: #94a3b8; }
.summary button.active { box-shadow: inset 0 0 0 1px currentColor; }
.summary strong { font-size: 23px; }
.summary span { font-size: 10px; }

.legend {
  border-radius: var(--ui-radius-md);
  background: var(--panel-solid);
  box-shadow: none;
}

.sheet-grid { gap: 10px; }
.sheet-card {
  border-radius: var(--ui-radius-md);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .07);
}

.card-name { min-height: 41px; }
.card-name input { font-size: 11px; font-weight: 800; }
.counters b { font-weight: 800; box-shadow: none; }

.sheet-table { font-size: 11px; }
.cell-input { font-size: 11px; font-weight: 700; }
.status-btn { font-size: 10px; font-weight: 800; }

/* A ação de continuidade do card fica legível sem ocupar uma nova coluna. */
.next-day-btn { font-size: 8.5px; font-weight: 800; }
.next-day-btn::before { content: 'Copiar '; }

/* Foco visível para teclado sem atrapalhar o clique normal. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.cell-input:focus-visible { outline-offset: -2px; background: rgba(37, 99, 235, .055); }
.status-btn:focus-visible { outline-offset: -1px; }

.cliente-cell { padding-right: 22px !important; }
.cliente-cell .client-input { padding-right: 0; }
.comment-action-btn {
  position: absolute;
  z-index: 2;
  right: 2px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  color: #64748b;
  background: transparent;
  cursor: pointer;
  opacity: .42;
}
.comment-action-btn:hover,
.comment-action-btn:focus-visible { opacity: 1; background: rgba(100, 116, 139, .12); }
.comment-action-btn.has-content { color: #a16207; opacity: 1; background: rgba(250, 204, 21, .20); }
.comment-action-btn svg { width: 12px; height: 12px; }
.cliente-cell.has-comment::after { display: none; }

.ticket-cell { position: relative; }
.ticket-cell.is-duplicate::after {
  content: '!';
  position: absolute;
  right: 2px;
  top: 2px;
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  color: #7c2d12;
  background: #fed7aa;
  font-size: 9px;
  font-weight: 900;
}
.ticket-cell.is-duplicate .ticket-input { padding-right: 13px; }

tr.remote-update-pending td {
  box-shadow: inset 0 1px 0 #f59e0b, inset 0 -1px 0 #f59e0b;
}

tr.save-error td {
  box-shadow: inset 0 1px 0 #ef4444, inset 0 -1px 0 #ef4444;
}

tr.search-result-highlight td {
  animation: search-row-highlight 1.5s ease-out;
}

@keyframes search-row-highlight {
  0%, 35% { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .78); }
  100% { box-shadow: inset 0 0 0 0 rgba(37, 99, 235, 0); }
}

.search-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

/* Texto automático em fundos personalizados para manter contraste. */
td.custom-cell-color .cell-input { color: var(--custom-cell-text, #0f172a) !important; }

.conflict-dialog,
.help-dialog {
  width: min(680px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-lg);
  padding: 0;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .24);
}
.conflict-dialog::backdrop,
.help-dialog::backdrop { background: rgba(15, 23, 42, .42); }
.conflict-body { padding: 18px; }
.conflict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.conflict-grid section { min-width: 0; }
.conflict-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.conflict-preview { min-height: 110px; padding: 12px; border: 1px solid var(--line); border-radius: var(--ui-radius-md); background: rgba(100,116,139,.055); font-size: 12px; line-height: 1.55; }
.conflict-preview strong { color: var(--text); }

.shortcut-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 9px 14px;
  align-items: center;
  padding: 18px;
}
.shortcut-grid kbd {
  min-width: 76px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(100,116,139,.07);
  text-align: center;
  font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.shortcut-grid span { color: var(--muted); font-size: 12px; }

.period-skeleton {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius-md);
  background: linear-gradient(90deg, rgba(148,163,184,.09), rgba(148,163,184,.18), rgba(148,163,184,.09));
  background-size: 240% 100%;
  animation: skeletonMove 1.3s linear infinite;
}
@keyframes skeletonMove { to { background-position: -240% 0; } }

/* Overrides escuros legados removidos; o Design System abaixo é a fonte única do tema. */

@media (max-width: 1280px) {
  .actions { flex-wrap: wrap; }
  .search-wrap { order: 3; flex-basis: 320px; }
  .online-users { order: 4; }
}

@media (max-width: 860px) {
  .topbar { align-items: flex-start; }
  .brand { min-width: 0; padding-top: 8px; }
  .actions { flex: 1; justify-content: flex-end; }
  .search-wrap { flex-basis: 100%; max-width: none; order: 20; }
  .online-users { width: auto; order: initial; }
  .summary { grid-template-columns: repeat(5, minmax(88px, 1fr)); width: 100%; max-width: none; overflow-x: auto; }
  .summary button { min-width: 96px; }
}

@media (max-width: 720px) {
  .topbar { position: sticky; padding: 8px 10px; }
  .brand { width: 100%; }
  .actions { width: 100%; justify-content: flex-start; }
  .period-controls { width: auto; }
  .search-wrap { width: 100%; flex-basis: 100%; }
  .sync-status { margin-left: 0; }
  .online-users { width: auto; order: initial; justify-content: flex-start; }
  .page { padding: 14px 10px; }
  .page-head { align-items: flex-start; }
  .conflict-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .period-controls { width: 100%; justify-content: space-between; }
  .period-controls label { flex: 1; }
  .period-controls .select { min-width: 0; width: 100%; }
  .year-input { width: 84px; }
  .top-menu { margin-left: 0; }
  .page-head { display: grid; }
  .summary { grid-template-columns: repeat(5, 96px); }
  .shortcut-grid { grid-template-columns: 1fr; }
  .shortcut-grid kbd { width: max-content; }
}


/* ==========================================================================\n   Design System 2026.08 — refinamento compartilhado Light / Dark\n   ========================================================================== */

html,
body { background: var(--bg-primary); color: var(--text-primary); }
body {
  background-image: none;
  font-size: 13px;
  line-height: 1.4;
}

/* Componentes base */
.topbar {
  gap: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-secondary);
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(12px);
}
.brand { min-width: 184px; }
.brand strong { color: var(--text-primary); font-size: 16px; font-weight: 750; letter-spacing: -.02em; }
.actions { gap: 7px; }

.period-controls {
  min-height: 38px;
  gap: 7px;
  padding: 3px 5px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  box-shadow: none;
}
.period-controls label { color: var(--text-muted); font-size: 10px; letter-spacing: .055em; }

.select,
.year-input,
.search,
.btn,
.search-control,
.sync-status,
.day-nav-btn {
  height: 36px;
  border-color: var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: var(--surface-raised);
  box-shadow: none;
}
.select,
.year-input,
.search { font-size: 12px; font-weight: 650; }
.select { min-width: 112px; }
.year-input { width: 80px; }
.select:hover,
.year-input:hover,
.search:hover,
.btn:hover,
.day-nav-btn:hover { border-color: var(--border-strong); }
.select:disabled,
.year-input:disabled,
.search:disabled,
.btn:disabled { opacity: .48; cursor: not-allowed; }

.btn {
  padding-inline: 11px;
  font-size: 12px;
  font-weight: 700;
  transition: color .12s ease, background-color .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn:hover { transform: none; box-shadow: none; background: var(--surface-hover); }
.btn:active:not(:disabled) { background: var(--bg-tertiary); }
.btn.primary { color: var(--text-on-accent); border-color: var(--accent-primary); background: var(--accent-primary); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); filter: none; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.danger,
.menu-action.danger { color: var(--danger); }
.btn.danger { border-color: color-mix(in srgb, var(--danger) 32%, var(--border-primary)); background: color-mix(in srgb, var(--danger) 7%, var(--surface-raised)); }
.icon-btn { width: 36px; min-width: 36px; padding: 0; }
.theme-toggle { width: auto; min-width: 88px; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Busca e sincronização */
.search-wrap { min-width: 250px; max-width: 420px; }
.search-control { border: 1px solid var(--border-primary); overflow: hidden; }
.search-control:focus-within { border-color: var(--focus-ring); box-shadow: var(--ui-focus); }
.search-scope { color: var(--text-secondary); border-right-color: var(--border-secondary); background: var(--surface-subtle); }
.search-control .search { height: 34px; background: transparent; }
.search::placeholder { color: var(--text-muted); opacity: .9; }
.search-results,
.top-menu-panel {
  border-color: var(--border-primary);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}
.search-result-item { color: var(--text-primary); border-bottom-color: var(--border-secondary); }
.search-result-item:hover,
.search-result-item:focus-visible { background: var(--surface-hover); }
.search-result-day { color: var(--accent-primary); }
.search-result-main span,
.search-result-card,
.search-empty { color: var(--text-muted); }

.sync-status { color: var(--text-secondary); background: var(--surface-subtle); font-size: 10.5px; font-weight: 700; }
.sync-dot { background: var(--success); }
.sync-status.is-saving .sync-dot { background: var(--warning); }
.sync-status.is-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border-primary)); background: color-mix(in srgb, var(--danger) 8%, var(--surface-raised)); }
.sync-status.is-error .sync-dot { background: var(--danger); }
.sync-status.is-conflict { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 38%, var(--border-primary)); background: color-mix(in srgb, var(--warning) 8%, var(--surface-raised)); }
.sync-status.is-conflict .sync-dot { background: var(--warning); }

.top-menu[open] > summary { border-color: var(--focus-ring); box-shadow: var(--ui-focus); }
.menu-action { color: var(--text-primary); font-weight: 650; }
.menu-action:hover,
.menu-action:focus-visible { background: var(--surface-hover); }

/* Dias */
.day-strip {
  top: var(--topbar-height);
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-primary);
  background: color-mix(in srgb, var(--bg-secondary) 97%, transparent);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.45);
  backdrop-filter: blur(10px);
}
.day-btn {
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  color: var(--text-secondary);
  background: var(--surface-raised);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
  font-size: 11px;
  font-weight: 800;
  transition: color .12s ease, background-color .12s ease, border-color .12s ease;
}
.day-btn:hover { transform: none; color: var(--text-primary); border-color: var(--accent-primary); background: var(--surface-hover); }
.day-btn small { color: var(--text-muted); font-size: 8px; font-weight: 750; }
.day-btn.today::before { inset: 3px; border: 1px solid var(--accent-primary); border-radius: 7px; opacity: .6; }
.day-btn.active {
  color: var(--text-on-accent);
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .16);
}
.day-btn.active small { color: color-mix(in srgb, var(--text-on-accent) 82%, transparent); }
.day-btn.has-data::after { width: 5px; height: 5px; right: 4px; bottom: 4px; background: var(--success); box-shadow: 0 0 0 2px var(--surface-raised); }
.day-btn.active.has-data::after { background: var(--text-on-accent); box-shadow: none; }
.day-btn.weekend { color: #94502c; border-color: #d8b39d; background: #f5ebe4; }
.day-btn.weekend small { color: #ad6742; }
.day-btn.weekend.active { color: #fff8f3; border-color: #c96734; background: #c96734; box-shadow: 0 4px 12px rgba(179, 82, 36, .15); }

/* Cabeçalho do dia */
.page { padding: 18px 18px 24px; }
.page-head { margin-bottom: 12px; }
.eyebrow { color: var(--text-muted); font-size: 10px; font-weight: 750; letter-spacing: .07em; }
.date-heading { min-width: 190px; }
.date-nav { gap: 8px; }
.date-nav h1 { margin: 0; color: var(--text-primary); font-size: clamp(28px, 2.3vw, 38px); font-weight: 780; letter-spacing: -.045em; }
.weekday-label { margin-top: 5px; color: var(--text-secondary); font-size: 11px; font-weight: 700; letter-spacing: .07em; }
.day-nav-btn { width: 32px; height: 32px; font-size: 22px; background: transparent; }
.day-nav-btn:hover { color: var(--accent-primary); border-color: var(--accent-primary); background: var(--accent-soft); }

/* Indicadores */
.summary {
  grid-template-columns: repeat(6, minmax(100px, 1fr));
  gap: 7px;
  max-width: 860px;
}
.summary button {
  position: relative;
  min-height: 58px;
  padding: 9px 11px 8px 13px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--surface-raised);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
  overflow: hidden;
  transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.summary button::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--summary-accent, var(--text-muted)); }
.summary button:hover { border-color: var(--border-primary); background: var(--surface-hover); }
.summary button.active { border-color: color-mix(in srgb, var(--summary-accent, var(--accent-primary)) 52%, var(--border-primary)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--summary-accent, var(--accent-primary)) 28%, transparent); }
.summary strong { color: var(--summary-accent, var(--text-primary)); font-size: 22px; font-weight: 780; letter-spacing: -.035em; }
.summary span { margin-top: 4px; color: var(--text-muted); font-size: 9px; font-weight: 750; letter-spacing: .055em; }
.summary-total { --summary-accent: #67758a; }
.summary-c { --summary-accent: var(--status-c-strong); }
.summary-p { --summary-accent: var(--status-p-strong); }
.summary-t { --summary-accent: var(--status-t-strong); }
.summary-a { --summary-accent: var(--status-a-strong); }
.summary-u { --summary-accent: var(--status-u-strong); }

/* Legenda */
.legend {
  gap: 10px 14px;
  margin-bottom: 18px;
  padding: 9px 12px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: var(--surface-raised);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  font-size: 11px;
}
.dot { width: 9px; height: 9px; margin-right: 5px; border: 1px solid color-mix(in srgb, currentColor 26%, transparent); }
.dot.c { background: var(--status-c-strong); }
.dot.p { background: var(--status-p-strong); }
.dot.t { background: var(--status-t-strong); }
.dot.a { background: var(--status-a-strong); }
.dot.u { background: var(--status-u-strong); }
.hint { color: var(--text-muted); font-size: 10.5px; }

/* Seções e cards */
.team-section {
  margin-bottom: 22px;
  padding: 13px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}
.team-title { margin-bottom: 10px; }
.team-title h2 { color: var(--text-primary); font-size: 18px; font-weight: 750; letter-spacing: -.025em; }
.sheet-grid { gap: 9px; grid-template-columns: repeat(5, minmax(330px, 1fr)); }
.sheet-card {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .05);
}
.card-name { min-height: 39px; padding: 6px 7px 6px 10px; }
.remote .card-name { background: var(--team-remote); }
.field .card-name { background: var(--team-field); }
.card-name input { color: var(--text-on-accent); font-size: 11px; font-weight: 750; letter-spacing: .015em; }
.card-name input::placeholder { color: rgba(248, 251, 255, .72); }
.remove-card-btn { border-color: rgba(255,255,255,.28); background: rgba(0,0,0,.10); }
.remove-card-btn:hover { background: #ba3c3c; }

.counters { gap: 3px; }
.counters b {
  min-width: 23px;
  padding: 3px 4px;
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: none;
  font-size: 9px;
  font-weight: 800;
}
.counters .counter-c { background: var(--status-c-strong); }
.counters .counter-p { background: var(--status-p-strong); }
.counters .counter-t { background: var(--status-t-strong); }
.counters .counter-a { background: var(--status-a-strong); }
.counters .counter-u { color: #493b06; background: #e3c02e; }

/* Tabela operacional: densidade preservada, ticket dimensionado para 10 dígitos. */
.sheet-table { font-size: 11px; background: var(--surface-raised); }
.sheet-table tbody tr:last-child td { border-bottom-color: var(--border-primary); }
.sheet-table th,
.sheet-table td { height: 28px; padding: 0 5px; border-right-color: var(--border-primary); border-bottom-color: var(--border-primary); }
.sheet-table td.status-cell { padding: 0; text-align: center; }
.sheet-table th { height: 34px; color: var(--text-on-accent); font-size: 9px; font-weight: 800; letter-spacing: .035em; }
.remote .sheet-table th { background: var(--team-remote-strong); }
.field .sheet-table th { background: var(--team-field-strong); }
.col-ticket { width: 96px; }
.col-cliente { width: auto; }
.col-status { width: 25px; }
.col-glpi { width: 72px; }
.ticket-input { font-variant-numeric: tabular-nums; letter-spacing: .015em; }
.cell-input { height: 26px; color: var(--text-primary); font-size: 11px; font-weight: 650; }
.cell-input::placeholder { color: var(--text-muted); opacity: .55; }
.cell-input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; background: color-mix(in srgb, var(--accent-soft) 58%, transparent); }

.status-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 23px; padding: 0; margin: 0 auto; border-radius: 6px; color: var(--text-primary); font-size: 9.5px; font-weight: 800; text-align: center; line-height: 1; }
.status-btn:hover { background: color-mix(in srgb, var(--text-primary) 10%, transparent); }
.status-btn.active { color: #f8fbff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.10); }
.status-c-btn.active { color: var(--status-c-strong); background: var(--status-c-row); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status-c-strong) 36%, transparent); }
.status-p-btn.active { color: var(--status-p-strong); background: var(--status-p-row); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status-p-strong) 36%, transparent); }
.status-t-btn.active { color: var(--status-t-strong); background: var(--status-t-row); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status-t-strong) 36%, transparent); }
.status-a-btn.active { color: var(--status-a-strong); background: var(--status-a-row); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status-a-strong) 36%, transparent); }
.status-btn.urgent-active.active { color: #423600; background: #efd23d; box-shadow: inset 0 0 0 1px #b99d00; }
.urgent-input { display: block; width: 100%; height: 23px; padding: 0; text-align: center; color: #423600; background: #ffe74d; box-shadow: inset 0 0 0 2px #d4b000; }

/* O preenchimento da linha comunica status; borda comunica seleção/foco. */
tr.status-c td { background: var(--status-c-strong); }
tr.status-p td { background: var(--status-p-strong); }
tr.status-t td { background: var(--status-t-strong); }
tr.status-a td { background: var(--status-a-strong); }
tr.status-u td { background: var(--status-u-row); }
tr.status-c td,
tr.status-p td,
tr.status-t td,
tr.status-a td { color: var(--status-row-text); }
tr.status-c td .cell-input,
tr.status-p td .cell-input,
tr.status-t td .cell-input,
tr.status-a td .cell-input { color: var(--status-row-text); }
tr.status-c td .comment-action-btn,
tr.status-p td .comment-action-btn,
tr.status-t td .comment-action-btn,
tr.status-a td .comment-action-btn { color: color-mix(in srgb, var(--status-row-text) 62%, transparent); }
tr:not(.status-c):not(.status-p):not(.status-t):not(.status-a):not(.status-u):hover td { background: var(--surface-hover); }
tr[class*="status-"]:hover td { filter: brightness(.94); }

tr.status-u td .cell-input,
tr.status-u td .glpi-link,
tr.status-u td .glpi-empty { color: var(--status-u-text); }

td.cell-selected {
  position: relative;
  background: color-mix(in srgb, var(--surface-selected) 84%, transparent) !important;
  box-shadow: inset 0 0 0 2px var(--selection-border) !important;
}
td.cell-selected .cell-input { color: var(--text-primary); background: transparent !important; }
tr.remote-update-pending td { box-shadow: inset 0 1px 0 var(--warning), inset 0 -1px 0 var(--warning); }
tr.save-error td { box-shadow: inset 0 1px 0 var(--danger), inset 0 -1px 0 var(--danger); }

.glpi-link { color: var(--accent-primary); background: var(--accent-soft); font-size: 9.5px; font-weight: 750; line-height: 20px; }
.glpi-link:hover { color: var(--accent-hover); text-decoration: none; }
.glpi-empty { color: var(--text-muted); opacity: .65; }
.next-day-btn { border-color: rgba(255,255,255,.30); color: var(--text-on-accent); background: rgba(255,255,255,.10); font-size: 8px; font-weight: 750; }
.next-day-btn:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.card-footer { gap: 6px; padding: 7px; border-top: 0; background: var(--surface-subtle); }
.card-footer button { height: 30px; border-color: var(--border-primary); border-radius: var(--radius-sm); color: var(--text-secondary); background: var(--surface-raised); font-size: 10px; font-weight: 750; transition: border-color .12s ease, color .12s ease, background-color .12s ease; }
.card-footer button:hover { transform: none; color: var(--accent-primary); border-color: var(--accent-primary); background: var(--accent-soft); }

/* Comentários, pintura e duplicidade */
.comment-action-btn { color: var(--text-muted); }
.comment-action-btn:hover,
.comment-action-btn:focus-visible { background: var(--surface-hover); }
.comment-action-btn.has-content { color: var(--warning); background: color-mix(in srgb, var(--warning) 13%, transparent); }
.ticket-cell.is-duplicate::after { color: #8a3b12; background: #f6d2b8; }
td.custom-cell-color .cell-input { color: var(--custom-cell-text, var(--text-primary)) !important; }

/* Avatares */
.online-users { border-color: transparent; background: transparent; box-shadow: none; }
.online-label { color: var(--text-muted); font-size: 9px; }
.online-avatar,
.online-extra { border: 2px solid var(--surface-raised); box-shadow: 0 0 0 1px var(--border-primary); }
.online-avatar.is-me { box-shadow: 0 0 0 2px var(--accent-primary); }
.user-badge { border-color: var(--border-primary); background: var(--surface-raised); color: var(--text-primary); box-shadow: none; }
.user-badge.profile-only::after { color: #eef2f7; background: #242c37; box-shadow: var(--shadow-md); }

/* Overlays, dialogs e feedback */
.logs-dialog,
.usuarios-dialog,
.comment-dialog,
.reminder-dialog,
.card-transfer-dialog,
.glpi-dialog,
.conflict-dialog,
.help-dialog {
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-overlay);
}
.logs-dialog::backdrop,
.usuarios-dialog::backdrop,
.comment-dialog::backdrop,
.reminder-dialog::backdrop,
.card-transfer-dialog::backdrop,
.glpi-dialog::backdrop,
.conflict-dialog::backdrop,
.help-dialog::backdrop { background: rgba(9, 13, 19, .50); }
.dialog-head { border-bottom-color: var(--border-secondary); background: var(--surface-subtle); }
.conflict-preview,
.shortcut-grid kbd { border-color: var(--border-primary); background: var(--surface-subtle); }
.shortcut-grid span,
.conflict-label { color: var(--text-secondary); }
.toast { border-color: var(--border-primary); border-radius: var(--radius-md); color: #edf2f7; background: #252d38; box-shadow: var(--shadow-md); }
.period-skeleton { border-color: var(--border-secondary); background: linear-gradient(90deg, var(--surface-subtle), var(--bg-tertiary), var(--surface-subtle)); background-size: 240% 100%; }

html:not([data-theme="escuro"]) .topbar { border-bottom-color: var(--border-primary); box-shadow: 0 1px 0 rgba(255,255,255,.65); }
html:not([data-theme="escuro"]) .period-controls,
html:not([data-theme="escuro"]) .search-control,
html:not([data-theme="escuro"]) .sync-status,
html:not([data-theme="escuro"]) .top-menu-panel,
html:not([data-theme="escuro"]) .summary button,
html:not([data-theme="escuro"]) .day-nav-btn,
html:not([data-theme="escuro"]) .select,
html:not([data-theme="escuro"]) .year-input,
html:not([data-theme="escuro"]) .search,
html:not([data-theme="escuro"]) .btn,
html:not([data-theme="escuro"]) .card-footer button,
html:not([data-theme="escuro"]) .user-badge { border-color: var(--border-primary); }
html:not([data-theme="escuro"]) .sheet-table thead th { box-shadow: inset 0 -1px 0 rgba(255,255,255,.12); }
html:not([data-theme="escuro"]) .glpi-link { background: #e6eefc; }
/* Tema escuro: diferenças de superfície no lugar de sombras e azul-marinho excessivo. */
html[data-theme="escuro"] body { background: var(--bg-primary); }
html[data-theme="escuro"] .topbar { background: color-mix(in srgb, var(--surface) 96%, transparent); border-bottom-color: var(--border-secondary); box-shadow: none; }
html[data-theme="escuro"] .day-strip { background: color-mix(in srgb, var(--bg-secondary) 96%, transparent); border-bottom-color: var(--border-primary); }
html[data-theme="escuro"] .period-controls,
html[data-theme="escuro"] .search-control,
html[data-theme="escuro"] .search-results,
html[data-theme="escuro"] .sync-status,
html[data-theme="escuro"] .top-menu-panel,
html[data-theme="escuro"] .summary button,
html[data-theme="escuro"] .day-nav-btn,
html[data-theme="escuro"] .select,
html[data-theme="escuro"] .year-input,
html[data-theme="escuro"] .search,
html[data-theme="escuro"] .btn,
html[data-theme="escuro"] .card-footer button,
html[data-theme="escuro"] .user-badge,
html[data-theme="escuro"] .online-users { color: var(--text-primary); border-color: var(--border-primary); background: var(--surface-raised); }
html[data-theme="escuro"] .btn.ghost { background: transparent; }
html[data-theme="escuro"] .btn:hover,
html[data-theme="escuro"] .menu-action:hover,
html[data-theme="escuro"] .search-result-item:hover { background: var(--surface-hover); }
html[data-theme="escuro"] .day-btn { color: var(--text-secondary); background: var(--surface); border-color: var(--border-primary); }
html[data-theme="escuro"] .day-btn:hover { color: var(--text-primary); background: var(--surface-hover); }
html[data-theme="escuro"] .day-btn.weekend { color: #e5a073; border-color: #60412f; background: #2d211b; }
html[data-theme="escuro"] .day-btn.weekend small { color: #c98760; }
html[data-theme="escuro"] .day-btn.weekend.active { color: #fff5ed; border-color: #ad5b32; background: #9d4f2b; }
html[data-theme="escuro"] .team-section { box-shadow: none; }
html[data-theme="escuro"] .sheet-card { box-shadow: none; }
html[data-theme="escuro"] .cell-input { color: var(--text-primary); }
html[data-theme="escuro"] .cell-input:focus,
html[data-theme="escuro"] .cell-input:focus-visible { background: color-mix(in srgb, var(--accent-soft) 58%, transparent); }
/* Patch 2026.08.25.5.1: somente as linhas A/U do tema escuro recebem tons mais vivos. */
html[data-theme="escuro"] tr.status-a td { background: #ea8921; }
html[data-theme="escuro"] tr.status-u td { background: #ffe127; }

html[data-theme="escuro"] .status-btn.active { color: #f6f8fb; }
html[data-theme="escuro"] .status-c-btn.active { color: var(--status-c-strong); }
html[data-theme="escuro"] .status-p-btn.active { color: var(--status-p-strong); }
html[data-theme="escuro"] .status-t-btn.active { color: var(--status-t-strong); }
html[data-theme="escuro"] .status-a-btn.active { color: var(--status-a-strong); }
html[data-theme="escuro"] .status-btn.urgent-active.active { color: #312900; background: var(--status-u-strong); box-shadow: inset 0 0 0 1px #9e8800; }
html[data-theme="escuro"] .urgent-input { color: #1f1a00; background: var(--status-u-strong); box-shadow: inset 0 0 0 2px #ad9616; }
html[data-theme="escuro"] td.cell-selected { background: color-mix(in srgb, var(--surface-selected) 82%, transparent) !important; box-shadow: inset 0 0 0 2px var(--selection-border) !important; }
html[data-theme="escuro"] td.cell-selected .cell-input { background: transparent !important; color: var(--text-primary); }
html[data-theme="escuro"] .glpi-link { color: #a9c8ff; background: #23324a; }
html[data-theme="escuro"] .card-footer { background: var(--surface-subtle); }
html[data-theme="escuro"] .counters .counter-u { color: #30290a; background: #d8bc48; }
html[data-theme="escuro"] tr.status-u td .cell-input,
html[data-theme="escuro"] tr.status-u td .glpi-link,
html[data-theme="escuro"] tr.status-u td .glpi-empty { color: #221c00; }
html[data-theme="escuro"] .sync-status.is-error { color: #f1a1a1; border-color: #6a3838; background: #312123; }
html[data-theme="escuro"] .sync-status.is-conflict { color: #e2c777; border-color: #66572a; background: #302b1c; }

@media (max-width: 1700px) {
  .sheet-grid { grid-template-columns: repeat(3, minmax(330px, 1fr)); }
  .summary { grid-template-columns: repeat(3, minmax(105px, 1fr)); max-width: 650px; }
}
@media (max-width: 1080px) {
  .sheet-grid { grid-template-columns: repeat(2, minmax(330px, 1fr)); }
  .summary { width: 100%; max-width: none; grid-template-columns: repeat(3, minmax(100px, 1fr)); }
}
@media (max-width: 860px) {
  .summary { display: flex; width: 100%; overflow-x: auto; scrollbar-width: thin; }
  .summary button { flex: 0 0 104px; min-width: 104px; }
}
@media (max-width: 720px) {
  .topbar { padding: 8px 10px; }
  .brand { width: 100%; padding-top: 0; }
  .actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .period-controls { width: auto; }
  .search-wrap { width: 100%; max-width: none; flex-basis: 100%; order: 20; }
  .page { padding: 12px 10px 20px; }
  .page-head { align-items: flex-start; }
  .team-section { padding: 10px; }
  .sheet-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .period-controls { width: 100%; }
  .period-controls label { flex: 1; }
  .period-controls .select { width: 100%; min-width: 0; }
  .year-input { width: 82px; }
  .page-head { display: grid; gap: 10px; }
  .summary { display: flex; }
  .legend { align-items: flex-start; }
  .hint { flex-basis: 100%; }
  .col-ticket { width: 94px; }
  .col-status { width: 25px; }
}
