:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --border: #e4e6ef;
  --text: #1c1d2b;
  --text-muted: #6b6f85;
  --accent: #5b5bf0;
  --accent-light: #eceaff;
  --accent-text: #4740d4;
  --green: #1a9c6b;
  --green-bg: #e3f7ee;
  --amber: #b4760a;
  --amber-bg: #fdf1dd;
  --red: #d64545;
  --red-bg: #fbe8e8;
  --grey: #5a5d70;
  --grey-bg: #e9eaf0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 43, 0.04), 0 8px 24px rgba(20, 20, 43, 0.06);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #14151f;
  --surface: #1c1d29;
  --border: #30303f;
  --text: #ecedf5;
  --text-muted: #9698ab;
  --accent: #8080f8;
  --accent-light: #2a2a4e;
  --accent-text: #b1afff;
  --green: #35c98c;
  --green-bg: #113a2b;
  --amber: #e3ac45;
  --amber-bg: #3b2d10;
  --red: #ef6f6f;
  --red-bg: #3c1e1e;
  --grey: #a3a5b8;
  --grey-bg: #262734;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.15s ease, color 0.15s ease;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------------- Top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-script, .nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.status-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px transparent;
  transition: background 0.2s, box-shadow 0.2s;
}
.status-light.on {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-bg);
}
.status-light.off {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-bg);
}

.icon-btn-round {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn-round:hover { background: var(--bg); color: var(--text); }
.icon-btn-round.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ---------------- Layout ---------------- */

.body-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 0;
}

/* ---------------- Sidebar ---------------- */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.sidebar-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
  width: 100%;
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.case-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.case-card {
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: background 0.12s ease;
}
.case-card:hover { background: var(--bg); }
.case-card.active {
  background: var(--accent-light);
  border-color: var(--accent);
}

.case-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.case-card-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-card-id {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.case-card-meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
}
.status-dot.lead { background: var(--accent); }
.status-dot.negociando { background: var(--amber); }
.status-dot.fechado { background: var(--green); }
.status-dot.inativo { background: var(--grey); }

.case-list-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------------- Detail ---------------- */

.detail {
  overflow-y: auto;
  min-height: 0;
  padding: 32px 40px 60px;
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
  text-align: center;
}
.empty-state svg { opacity: 0.4; }

.case-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 20px;
}

.case-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.case-header .sub {
  color: var(--text-muted);
  font-size: 13.5px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.status-select {
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  cursor: pointer;
  outline: none;
}
.status-select.lead { color: var(--accent-text); background: var(--accent-light); border-color: var(--accent); }
.status-select.negociando { color: var(--amber); background: var(--amber-bg); border-color: var(--amber); }
.status-select.fechado { color: var(--green); background: var(--green-bg); border-color: var(--green); }
.status-select.inativo { color: var(--grey); background: var(--grey-bg); border-color: var(--border); }

.badges {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 96px;
  box-shadow: var(--shadow);
}
.badge .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.badge .value {
  font-size: 18px;
  font-weight: 700;
}
.badge.score .value { color: var(--accent-text); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.resumo-text {
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.6;
}

.ia-analise-text {
  font-size: 14.5px;
  line-height: 1.6;
}
.ia-analise-text .ia-par { white-space: pre-wrap; }
.ia-analise-text .ia-titulo {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 6px;
}
.ia-analise-text .ia-titulo:first-child { margin-top: 0; }

.resumo-edit-textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  padding: 12px;
  font-size: 14.5px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  background: var(--bg);
  color: var(--text);
}

.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------------- Checklist ---------------- */

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.hidden-done { display: none; }

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item .texto {
  flex: 1;
  font-size: 14px;
}
.checklist-item.done .texto {
  text-decoration: line-through;
  color: var(--text-muted);
}

.checklist-item .texto-edit {
  flex: 1;
  font-size: 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 4px 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  opacity: 0.5;
  transition: opacity 0.12s, color 0.12s;
}
.checklist-item:hover .icon-btn,
.doc-row:hover .icon-btn,
.dossie-entry:hover .icon-btn {
  opacity: 1;
}
.icon-btn:hover { color: var(--accent-text); background: var(--accent-light); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-bg); }
.icon-btn.icon-btn-label {
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  align-items: center;
}

/* ---------------- Dados do cliente ---------------- */

.dados-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.dados-item.span-2 { grid-column: 1 / -1; }
.dados-item .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}
.dados-item .value { font-size: 14px; }
.empty-value { color: var(--text-muted); }

.subsection-label {
  margin: 18px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dados-grid.editing input,
.dados-grid.editing select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.dados-grid.editing input:focus,
.dados-grid.editing select:focus { border-color: var(--accent); }

.warn-text { color: var(--amber); }

.add-plus-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.add-plus-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent-text);
  border: none;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.add-plus-btn:hover { background: var(--accent); color: white; }

.add-form {
  display: none;
  flex: 1 1 100%;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.add-form.open { display: flex; }

.add-form input,
.add-form textarea {
  flex: 1;
  border: 1px solid var(--accent);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--bg);
  color: var(--text);
}
.add-form textarea { width: 100%; min-height: 90px; resize: vertical; }

.btn {
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-text); }
.btn.secondary {
  background: var(--accent-light);
  color: var(--accent-text);
}
.btn.secondary:hover { background: var(--accent); color: white; }
.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--text); }
.btn.danger-outline {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}
.btn.danger-outline:hover { background: var(--red-bg); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------------- Dossie ---------------- */

.dossie-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.dossie-entry:last-child { border-bottom: none; }
.dossie-entry .texto { white-space: pre-wrap; font-size: 14px; }
.dossie-entry .ts { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.dossie-entry .texto-edit {
  width: 100%;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 8px;
  background: var(--bg);
  color: var(--text);
  min-height: 60px;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  margin-top: 14px;
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.doc-row:last-child { border-bottom: none; }
.doc-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  cursor: pointer;
}
.doc-row-main .name {
  color: var(--text);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-row-main:hover .name { color: var(--accent-text); }
.doc-row-main[data-action="none"] { cursor: default; }
.doc-row-main[data-action="none"]:hover .name { color: var(--text); }
.doc-row .meta { font-size: 11.5px; color: var(--text-muted); margin-left: 24px; }
.doc-row-right { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.doc-row a { color: inherit; text-decoration: none; display: flex; }

.empty-hint {
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 0;
}

/* ---------------- Modal (preview de documentos) ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0.6);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  width: min(900px, 92vw);
  height: min(80vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  gap: 12px;
}
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: auto;
}
.modal-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.modal-body embed, .modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 300;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { background: var(--red); color: white; }

/* ---------------- Login ---------------- */

.hidden { display: none !important; }

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 400;
  padding: 20px;
}
.auth-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-card .brand { font-size: 24px; text-align: center; }
.auth-subtitle { margin: 0; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-error { color: var(--red); font-size: 13px; min-height: 18px; }

.auth-card input,
.settings-form input,
.settings-form textarea,
.settings-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.auth-card input:focus,
.settings-form input:focus { border-color: var(--accent); }

/* ---------------- Views (script / configuracoes) ---------------- */

.view-title {
  margin: 0 0 24px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.script-top {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: stretch;
}
.script-top .card { flex: 1; min-width: 260px; margin-bottom: 20px; }

.unlocks-big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.unlocks-big.low { color: var(--red); }
.unlocks-big small { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.view-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.script-state { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin-bottom: 14px; }

.log-console {
  margin: 0;
  height: clamp(280px, calc(100vh - 400px), 640px);
  padding: 12px 14px;
  overflow-y: auto;
  background: #16171f;
  border: 1px solid #2c2d3d;
  border-radius: 10px;
  color: #c9cadd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.settings-form { display: flex; flex-direction: column; gap: 12px; max-width: 360px; }
.settings-form .field { display: flex; flex-direction: column; gap: 5px; }
.settings-msg { font-size: 13px; min-height: 18px; }
.settings-msg.error { color: var(--red); }
.settings-msg.ok { color: var(--green); }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover td { background: var(--bg); }
.role-tag {
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  padding: 2px 8px;
  background: var(--grey-bg);
  color: var(--grey);
}
.role-tag.admin { background: var(--accent-light); color: var(--accent-text); }
.filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; color: var(--text-muted); }
.filter-row select {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

/* ---------------- Agenda / tarefas ---------------- */

.nav-calendar { position: relative; display: flex; }
.nav-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  pointer-events: none;
}

.case-card-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.task-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-light);
  border-radius: 9px;
  padding: 1px 7px;
}
.task-badge svg { width: 11px; height: 11px; }

.texto-wrap { flex: 1; min-width: 0; }
.task-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-light);
  border-radius: 8px;
  padding: 2px 8px;
}
.task-chip svg { width: 12px; height: 12px; }
.task-chip.overdue { color: var(--red); background: var(--red-bg); }
.task-chip.done { color: var(--text-muted); background: var(--grey-bg); }

.modal-content.small { width: min(440px, 92vw); height: auto; }
.modal-form { padding: 18px 20px 20px; max-width: none; }
.task-item-text { font-size: 13.5px; color: var(--text-muted); }
.modal-form .edit-actions { justify-content: flex-end; flex-wrap: wrap; }

.cal-layout { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.cal-title { font-weight: 700; font-size: 15px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekday { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); padding-bottom: 4px; }
.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
}
.cal-day:hover { background: var(--bg); }
.cal-day.today { border-color: var(--accent); font-weight: 700; }
.cal-day.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-day.blank { cursor: default; pointer-events: none; }
.cal-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
}
.cal-day.selected .cal-count { background: #fff; color: var(--accent-text); }
.cal-count.overdue { background: var(--red); color: #fff; }
.cal-count.all-done { background: var(--grey); color: #fff; }

.agenda-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.agenda-task:last-child { border-bottom: none; }
.agenda-task input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.agenda-time { font-weight: 700; font-size: 13.5px; min-width: 46px; color: var(--accent-text); }
.agenda-body { flex: 1; min-width: 0; }
.agenda-text { font-size: 14px; }
.agenda-task.done .agenda-text { text-decoration: line-through; color: var(--text-muted); }
.agenda-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.agenda-link { background: none; border: none; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer; font-weight: 600; }
.agenda-link:hover { text-decoration: underline; }

.settings-form.wide { max-width: none; }
.settings-form textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
