:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e7e9ee;
  --text: #1a1d24;
  --muted: #6b7280;
  --accent: #6366f1;
  --accent-soft: #eef0fe;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #d97706;
  --rec: #e11d48;
  --shadow: 0 1px 3px rgba(20, 24, 40, 0.06), 0 1px 2px rgba(20, 24, 40, 0.04);
}
* { box-sizing: border-box; }
/* o atributo `hidden` tem que vencer qualquer display de classe/id (senão modal/telas não escondem) */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
a { color: var(--accent); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); width: 100%; max-width: 380px; padding: 28px; }
.brand-lg { font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.login-card h1 { font-size: 20px; margin: 0 0 18px; }
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12.5px; }
input, select { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); font-size: 14px; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
.btn { padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.block { width: 100%; margin-top: 4px; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }
.switch { color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.msg { color: var(--rec); font-size: 12.5px; min-height: 16px; margin: 10px 0 0; }

/* ---------- App shell ---------- */
#mainView { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; padding: 4px 8px 18px; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { padding: 9px 12px; border-radius: 9px; color: var(--text); font-weight: 600; font-size: 13.5px; }
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.side-user { font-weight: 700; font-size: 13px; padding: 0 8px 6px; }
.side-link { display: block; padding: 4px 8px; color: var(--muted); font-size: 12.5px; }

.content { flex: 1; padding: 26px 32px; max-width: 1100px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.page-head h2 { font-size: 22px; margin: 0; }
.search { max-width: 340px; margin: 0; }
.hint-bar { background: var(--accent-soft); color: #4245b8; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; margin: 14px 0 20px; }

/* ---------- Meeting list ---------- */
.date-group { margin-bottom: 22px; }
.date-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.meeting-row { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; margin-bottom: 8px; cursor: pointer; transition: border-color .12s, transform .05s; }
.meeting-row:hover { border-color: var(--accent); }
.meeting-row .dur { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; min-width: 46px; }
.meeting-row .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.meeting-row .mid { flex: 1; min-width: 0; }
.meeting-row .m-title { font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meeting-row .m-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.processing, .badge.transcribing, .badge.summarizing { background: var(--accent-soft); color: var(--accent); }
.badge.error { background: #fdecec; color: var(--rec); }
.badge.gray { background: var(--bg); color: var(--muted); }
.badge.cliente { background: var(--ok-soft); color: var(--ok); }
.badge.gestor { background: var(--accent-soft); color: var(--accent); }
.badge.interna { background: var(--bg); color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 40px; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- Detail ---------- */
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.detail-head h1 { font-size: 22px; margin: 0 0 6px; }
.detail-head .meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.assign-bar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 16px 0; box-shadow: var(--shadow); }
.assign-bar h3 { margin: 0 0 10px; font-size: 13px; }
.assign-bar .row { align-items: flex-end; }
.assign-bar .esc-ok { color: var(--ok); font-weight: 600; }
.assign-bar .hint { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 20px 0 18px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 6px; margin-right: 12px; color: var(--muted); font-weight: 600; cursor: pointer; font-size: 14px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { }
.card2 { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card2 h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card2 .body { line-height: 1.6; white-space: pre-wrap; }
.items { margin: 0; padding-left: 18px; }
.items li { margin-bottom: 7px; line-height: 1.5; }
.owner { color: var(--accent); font-weight: 600; }
.copy { float: right; font-size: 11px; color: var(--muted); border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 9px; cursor: pointer; }

.preset-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.preset-label { color: var(--muted); font-size: 12.5px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 6px 13px; font-size: 12.5px; cursor: pointer; font-weight: 600; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.gen-out { background: var(--accent-soft); border: 1px solid #dfe1fb; border-radius: 12px; padding: 16px; margin-bottom: 16px; line-height: 1.6; white-space: pre-wrap; }

/* transcrição */
.speaker-editor { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.speaker-editor .hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.spk-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.spk-row .spk-tag { font-weight: 700; color: var(--accent); min-width: 84px; font-size: 12px; }
.spk-row input { flex: 1; margin: 0; }
.spk-saved { color: var(--ok); font-size: 12px; min-width: 16px; }
.utt { margin-bottom: 14px; }
.utt .spk { font-weight: 700; font-size: 12.5px; color: var(--accent); }
.utt .ts { color: var(--muted); font-weight: 400; margin-left: 6px; }
.utt .txt { margin-top: 2px; line-height: 1.55; }

/* chat IA */
.chat-log { min-height: 220px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 80%; padding: 11px 14px; border-radius: 14px; line-height: 1.55; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.err { align-self: flex-start; background: #fdecec; color: var(--rec); border: 1px solid #f5c6c6; }
.chat-empty { color: var(--muted); text-align: center; padding: 30px; }
.chat-input { display: flex; gap: 8px; }
.chat-input input { margin: 0; }
.chat-input .btn { white-space: nowrap; }

.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* usuários */
.urow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.urow input, .urow select { margin: 0; flex: 1; min-width: 130px; }
.urow .chk { display: flex; align-items: center; gap: 5px; margin: 0; white-space: nowrap; color: var(--text); }
.urow .chk input { flex: none; width: auto; }
.utable { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.utable th, .utable td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.utable th { background: var(--bg); color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.utable tr:last-child td { border-bottom: none; }
.utable .uacts { display: flex; gap: 6px; flex-wrap: wrap; }
.utable .mini { padding: 4px 9px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text); }
.utable .mini:hover { border-color: var(--accent); color: var(--accent); }
.utable .mini.danger:hover { border-color: var(--rec); color: var(--rec); }
.tag-admin { background: var(--accent-soft); color: var(--accent); padding: 1px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.tag-off { background: #fdecec; color: var(--rec); padding: 1px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 24, 40, 0.45); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--panel); border-radius: 14px; padding: 24px; width: 100%; max-width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal h3 { margin: 0 0 16px; font-size: 17px; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .content { padding: 18px; }
  .utable { display: block; overflow-x: auto; }
}
