/* ============================================================
   LexGestor — estilos
   ============================================================ */

:root {
  --navy: #0e2542;
  --navy-2: #15345c;
  --navy-3: #1d4475;
  --gold: #c9a227;
  --gold-2: #e3bd4a;
  --gold-soft: #f8ecc4;
  --bg: #f3f5f9;
  --card: #ffffff;
  --card-2: #fafbfd;
  --text: #152033;
  --text-2: #3d4a5f;
  --muted: #718096;
  --line: #e2e8f1;
  --line-2: #cfd8e6;
  --hover: #f7f9fc;
  --shadow: 0 1px 2px rgba(15, 37, 66, .04), 0 10px 28px -16px rgba(15, 37, 66, .16);
  --shadow-lg: 0 24px 80px -20px rgba(15, 37, 66, .28);
  --radius: 16px;
  --blue: #2f6fed;
  --blue-soft: #eaf1ff;
  --green: #128a5b;
  --green-soft: #e4f6ee;
  --red: #cf3d3d;
  --red-soft: #fdecec;
  --amber: #b47b0a;
  --amber-soft: #fdf3da;
  --purple: #7a4ddb;
  --purple-soft: #f0eaff;
  --sidebar-w: 264px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

body.dark {
  --bg: #0a1524;
  --card: #101f34;
  --card-2: #132640;
  --text: #e6edf7;
  --text-2: #c3ccda;
  --muted: #8fa0b8;
  --line: #1f3450;
  --line-2: #2a4467;
  --hover: #152a45;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .6);
  --shadow-lg: 0 28px 90px -20px rgba(0, 0, 0, .7);
  --blue: #6a9bff;
  --blue-soft: #14294d;
  --green: #3ac98e;
  --green-soft: #0f3328;
  --red: #ff7373;
  --red-soft: #3a1b1e;
  --amber: #f0b34a;
  --amber-soft: #3a2d13;
  --purple: #a684ff;
  --purple-soft: #241b3f;
  --gold-soft: #3a3018;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
::selection { background: rgba(201, 162, 39, .3); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.text-danger { color: var(--red) !important; }
.text-green { color: var(--green) !important; }

 
*:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- layout ---------- */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background:
    radial-gradient(1200px 400px at -20% -10%, rgba(201, 162, 39, .16), transparent 60%),
    linear-gradient(180deg, #0b2038 0%, #0d2745 100%);
  color: #c9d5e6;
  display: flex;
  flex-direction: column;
  z-index: 50;
  border-right: 1px solid rgba(255, 255, 255, .05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #d8b445, #a9851c);
  color: #14243a;
  box-shadow: 0 6px 18px -6px rgba(201, 162, 39, .7);
  flex: 0 0 auto;
}
.brand-mark-lg { width: 48px; height: 48px; border-radius: 14px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 18px; letter-spacing: -.02em; }
.brand-text small {
  color: #9fb2ca;
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 168px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 9px; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #7288a4;
  padding: 16px 12px 7px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #c5d1e2;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s, transform .15s;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(201, 162, 39, .22), rgba(201, 162, 39, .04));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav-item .ico { flex: 0 0 auto; opacity: .9; }
.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #172033;
  font-size: 10.5px;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
  padding: 9px 10px;
  border-radius: 12px;
}
.sidebar-user-info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.sidebar-user-info strong { color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { color: #93a7c0; font-size: 10.5px; }
.sidebar-note {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  color: #7d92ab;
  font-size: 10px;
  margin-top: 10px;
}
.icon-btn-dark { color: #a9bbd1; border-color: transparent; background: transparent; }
.icon-btn-dark:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-title { min-width: 180px; }
.topbar-title h2 { font-size: 16.5px; }
.topbar-title p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 460px;
  margin-left: 10px;
}
.topbar-search span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.topbar-search input {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  padding: 0 14px 0 38px;
  font-size: 12.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .14); background: var(--card); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 11.5px;
  font-family: ui-monospace, Consolas, monospace;
  cursor: pointer;
  transition: all .15s;
}
.timer-pill:hover { border-color: var(--line-2); color: var(--text); }
.timer-pill.running { background: var(--green-soft); color: var(--green); border-color: transparent; }
.timer-pill.running .ico { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.mobile-menu { display: none; }

.user-menu { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 4px 8px 4px 4px;
  cursor: pointer;
  color: var(--text);
}
.user-chip:hover { background: var(--hover); border-color: var(--line); }
.user-chip-text { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-chip-text strong { font-size: 12.5px; }
.user-chip-text small { font-size: 10px; color: var(--muted); }
.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 80;
}
.user-menu.open .dropdown { display: block; animation: pop .16s ease; }
.dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.dropdown button:hover { background: var(--hover); color: var(--text); }
.dropdown button.danger { color: var(--red); }
.dropdown button.danger:hover { background: var(--red-soft); }

.content { flex: 1; padding: 28px; max-width: 1500px; width: 100%; margin: 0 auto; }
.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px 22px;
  color: var(--muted);
  font-size: 10.5px;
  flex-wrap: wrap;
}
.app-footer .link-btn { font-size: 10.5px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 25px; line-height: 1.15; }
.page-head p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 39px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(14, 37, 66, .6);
}
.btn-primary:hover { background: var(--navy-3); box-shadow: 0 8px 20px -8px rgba(14, 37, 66, .7); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a2438; font-weight: 700; }
.btn-gold:hover { filter: brightness(1.04); }
.btn-ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--text-2);
}
.btn-ghost:hover { border-color: var(--line-2); color: var(--text); background: var(--hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-sm { height: 33px; padding: 0 11px; font-size: 11.5px; border-radius: 8px; }
.btn-lg { height: 46px; font-size: 13.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--line-2); }
.icon-btn.ok:hover { background: var(--green-soft); color: var(--green); border-color: transparent; }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); border-color: transparent; }
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }
.mini-action {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-2);
  background: var(--card);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.mini-action:hover { border-color: var(--gold); color: var(--text); background: var(--gold-soft); }

/* ---------- cartões ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 14.5px; }
.card-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.card-body { padding: 18px 20px; }
.card-body.no-pad { padding: 0; }
.chip {
  font-size: 10.5px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
  font-weight: 600;
}

/* ---------- avatar ---------- */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.avatar-txt {
  background: linear-gradient(145deg, var(--navy-2), var(--navy));
  color: #fff;
  font-weight: 700;
  letter-spacing: .02em;
  border: 0;
}
.avatar-xl { width: 84px !important; height: 84px !important; font-size: 26px !important; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  line-height: 1.5;
}
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-gray { background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.badge-gold { background: var(--gold-soft); color: #8d6c09; }
body.dark .badge-gold { color: var(--gold-2); }

/* ---------- avisos ---------- */
.alert-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.alert-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.alert-strip:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.alert-strip.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, var(--line)); background: var(--red-soft); }
.alert-strip.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 25%, var(--line)); background: var(--amber-soft); }
.alert-strip.info { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 25%, var(--line)); background: var(--blue-soft); }
.alert-strip strong { font-weight: 800; }

/* ---------- autenticação ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  background: var(--bg);
}
.auth-brand {
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(201, 162, 39, .2), transparent 55%),
    radial-gradient(800px 600px at 110% 110%, rgba(47, 111, 237, .22), transparent 60%),
    linear-gradient(160deg, #0b2038 0%, #0d2745 55%, #0a1c31 100%);
  color: #fff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute;
  width: 560px;
  height: 560px;
  border: 1px solid rgba(201, 162, 39, .15);
  border-radius: 50%;
  right: -220px;
  bottom: -220px;
  box-shadow: 0 0 0 60px rgba(201, 162, 39, .04), 0 0 0 140px rgba(201, 162, 39, .025);
  pointer-events: none;
}
.auth-brand-top { display: flex; align-items: center; gap: 14px; font-size: 20px; letter-spacing: -.02em; }
.auth-brand-main { max-width: 540px; margin: 40px 0; position: relative; z-index: 1; }
.auth-eyebrow {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--gold-2);
  font-weight: 800;
  margin-bottom: 16px;
}
.auth-brand-main h1 {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.1;
  letter-spacing: -.035em;
  margin-bottom: 16px;
}
.auth-brand-main p { color: #b9c7d9; font-size: 14.5px; line-height: 1.65; max-width: 460px; }
.auth-features { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 10px; color: #d5dfec; font-size: 13px; }
.auth-features .ico { color: var(--gold-2); flex: 0 0 auto; }
.auth-brand-foot {
  font-size: 11px;
  color: #8fa3bc;
  border-top: 1px solid rgba(255, 255, 255, .09);
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 540px;
}
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 42px 32px; position: relative; }
.auth-theme { position: absolute; top: 24px; right: 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h2 { font-size: 26px; letter-spacing: -.025em; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.auth-form { display: grid; gap: 14px; }
.auth-form .field { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.auth-error { color: var(--red); font-size: 12px; min-height: 0; font-weight: 600; }
.auth-error:empty { display: none; }
.auth-hint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  display: flex;
  gap: 7px;
  align-items: flex-start;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
.auth-hint .ico { flex: 0 0 auto; margin-top: 1px; }
.auth-legal { margin-top: 28px; text-align: center; font-size: 10px; color: var(--muted); }
.setup-tag {
  display: inline-block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 800;
  color: var(--gold);
  background: var(--gold-soft);
  border-radius: 20px;
  padding: 4px 9px;
  margin-bottom: 12px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.45;
}
.check-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--gold);
  flex: 0 0 auto;
  cursor: pointer;
}
.check-line em { font-style: normal; color: var(--muted); }

/* ============================================================
   Componentes
   ============================================================ */

/* ---------- formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
  display: block;
}
.field .req { color: var(--red); }
.field-help { color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.form-control {
  width: 100%;
  min-height: 39px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 12.8px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-control:hover { border-color: var(--line-2); }
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, .15);
}
textarea.form-control { min-height: 90px; resize: vertical; line-height: 1.55; }
select.form-control { appearance: none; cursor: pointer; padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2.4' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.form-control.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.select-sm { height: 33px; min-height: 33px; font-size: 11.5px; padding: 4px 28px 4px 10px; border-radius: 8px; width: auto; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
body.dark input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.form-sep { margin: 6px 0 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.field-row .field { margin: 0; }

/* ---------- imagem ---------- */
.image-field-wrap { display: flex; flex-direction: column; gap: 8px; }
.image-field {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--card-2);
}
.image-field img {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--line);
  flex: 0 0 auto;
  border: 1px solid var(--line);
}
.image-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.image-actions label.btn { cursor: pointer; }
.image-actions small { color: var(--muted); font-size: 10px; }

/* ---------- tabelas ---------- */
.table-card { overflow: hidden; }
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  background: var(--card);
}
.search-field { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.search-field .form-control { padding-left: 34px; height: 33px; min-height: 33px; font-size: 12px; border-radius: 8px; }
.search-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.toolbar-spacer { flex: 1; }
.table-actions-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table thead th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 800;
  padding: 10px 14px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: relative;
}
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { color: var(--text); }
.data-table thead th.sorted { color: var(--text); }
.sort-dir { font-size: 8px; color: var(--gold); }
.data-table thead th.th-actions { text-align: right; }
.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text-2);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--hover); }
.data-table tbody tr.row-late td { background: color-mix(in srgb, var(--red-soft) 55%, transparent); }
.data-table tbody tr.row-late:hover td { background: var(--red-soft); }
.data-table.compact tbody td, .data-table.compact thead th { padding: 8px 12px; }
.data-table.compact { font-size: 12px; }
.empty-cell { text-align: center; color: var(--muted); padding: 34px 14px !important; font-size: 12.5px; }
.td-actions { text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { width: 29px; height: 29px; border-radius: 7px; border-color: transparent; background: transparent; }
.row-actions .icon-btn:hover { border-color: var(--line); background: var(--card); }
.row-actions .icon-btn.ok { color: var(--green); }
.row-actions .icon-btn.ok:hover { background: var(--green-soft); }
.row-actions .icon-btn.danger { color: var(--muted); }
.row-actions .icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
  background: var(--card-2);
}
.foot-total { font-size: 11.5px; color: var(--text-2); }
.foot-total strong { color: var(--text); }
.cell-main { display: block; color: var(--text); font-weight: 600; font-size: 12.5px; line-height: 1.35; }
.cell-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; line-height: 1.35; }
.cell-user { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12px; }
.cell-user.big { gap: 10px; }
.cell-user.big .avatar { width: 34px; height: 34px; }
.cell-user.big > div { display: flex; flex-direction: column; }
.link-strong {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.link-strong:hover { color: var(--blue); text-decoration: underline; }
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 20px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
}
.check-on { color: var(--green); display: inline-flex; }
.task-title { display: flex; align-items: flex-start; gap: 9px; }
.task-dot, .mini-dot, .and-dot, .pub-dot {
  flex: 0 0 auto;
  border-radius: 50%;
  display: inline-block;
}
.task-dot { width: 9px; height: 9px; margin-top: 5px; background: var(--blue); }
.task-dot.ok { background: var(--green); }
.task-dot.late { background: var(--red); }
.doc-title { display: flex; align-items: center; gap: 7px; }
.doc-title .ico { color: var(--muted); flex: 0 0 auto; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { display: flex; align-items: center; gap: 14px; padding: 16px 17px; }
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--card-2);
  color: var(--text-2);
}
.tone-navy { background: linear-gradient(145deg, var(--navy-2), var(--navy)); color: #fff; }
.tone-gold { background: linear-gradient(145deg, var(--gold-2), var(--gold)); color: #1c2638; }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-purple { background: var(--purple-soft); color: var(--purple); }
.kpi-body { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 20px; letter-spacing: -.03em; color: var(--text); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 10.5px; color: var(--muted); }

/* ---------- resumos ---------- */
.summary-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.summary-item {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  border-right: 1px solid var(--line);
  min-width: 108px;
}
.summary-item span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.summary-item strong { font-size: 16px; letter-spacing: -.02em; }
.summary-note {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  padding: 8px 14px;
  min-width: 240px;
  line-height: 1.45;
}
.summary-note .ico { flex: 0 0 auto; color: var(--blue); }
.summary-note .link-btn { font-size: 11px; }

/* ---------- painel ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.dash-panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dash-mini { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.chart-box { position: relative; height: 250px; }
.chart-box.sm { height: 220px; }
.chart-offline {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 11.5px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  padding: 20px;
  line-height: 1.6;
}
.list-body { padding: 6px; max-height: 380px; overflow-y: auto; }
.list-body::-webkit-scrollbar { width: 6px; }
.list-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  color: var(--text-2);
  font-family: inherit;
  transition: background .13s;
}
.list-item:hover { background: var(--hover); }
.list-item.static { cursor: default; }
.list-item.static:hover { background: transparent; }
.list-item > .ico { color: var(--muted); flex: 0 0 auto; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-main strong {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-main small { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-chip {
  width: 38px;
  height: 42px;
  border-radius: 9px;
  background: var(--card-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 1.05;
}
.date-chip b { font-size: 14px; color: var(--text); }
.date-chip small { font-size: 9px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.date-chip.late { background: var(--red-soft); border-color: transparent; }
.date-chip.late b, .date-chip.late small { color: var(--red); }
.pub-dot { width: 9px; height: 9px; background: var(--gold); }
.pub-dot.read { background: var(--line-2); }
.and-dot { width: 8px; height: 8px; background: var(--blue); }

/* ---------- automação ---------- */
.automation-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(201, 162, 39, .14), transparent 60%),
    linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #e3ebf6;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.automation-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 260px; }
.automation-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: rgba(201, 162, 39, .18);
  color: var(--gold-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.automation-main h3 { font-size: 14.5px; color: #fff; }
.automation-main p { font-size: 11.5px; color: #b2c2d6; margin-top: 3px; max-width: 620px; line-height: 1.55; }
.automation-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.automation-stats div { display: flex; flex-direction: column; }
.automation-stats strong { font-size: 19px; color: #fff; letter-spacing: -.02em; }
.automation-stats span { font-size: 10px; color: #9ab0c9; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- agenda ---------- */
.agenda-layout { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 14px; align-items: start; }
.calendar-card { overflow: hidden; }
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.cal-title h3 { font-size: 16px; text-transform: capitalize; }
.cal-title h3 span { color: var(--muted); font-weight: 600; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { background: var(--card-2); border-bottom: 1px solid var(--line); }
.cal-dow-cell {
  padding: 8px 6px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.cal-body { background: var(--line); gap: 1px; }
.cal-cell {
  background: var(--card);
  min-height: 104px;
  padding: 6px;
  cursor: pointer;
  transition: background .12s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.cal-cell:hover { background: var(--hover); }
.cal-cell.out { background: color-mix(in srgb, var(--card-2) 80%, transparent); opacity: .55; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--gold); }
.cal-cell-top { display: flex; align-items: center; justify-content: space-between; }
.cal-num { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.cal-cell.today .cal-num {
  background: var(--gold);
  color: #1b2537;
  border-radius: 20px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
}
.cal-count {
  font-size: 9px;
  font-weight: 800;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 20px;
  padding: 1px 5px;
}
.cal-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-event {
  border: 0;
  text-align: left;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 600;
  padding: 3px 5px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  border-left: 2px solid transparent;
}
.cal-event.compromisso { background: var(--blue-soft); color: var(--blue); border-left-color: var(--blue); }
.cal-event.tarefa { background: var(--amber-soft); color: var(--amber); border-left-color: var(--amber); }
.cal-event.done { opacity: .5; text-decoration: line-through; }
.cal-event b { font-weight: 800; }
.cal-more { font-size: 9px; color: var(--muted); padding-left: 4px; font-weight: 600; }
.calendar-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.calendar-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.dot.comp { background: var(--blue); }
.dot.task { background: var(--amber); }
.calendar-hint { margin-left: auto; }
.calendar-hint .ico { color: var(--blue); }
.agenda-side { position: sticky; top: 84px; }

/* ---------- cronômetro ---------- */
.timer-card {
  display: flex;
  align-items: center;
  gap: 22px;
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(47, 111, 237, .12), transparent 60%),
    var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.timer-card.running {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(18, 138, 91, .14), transparent 60%),
    var(--card);
}
.timer-left { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.timer-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
  color: var(--muted);
}
.timer-card.running .timer-eyebrow { color: var(--green); }
.timer-display {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--text);
}
.timer-card.running .timer-display { color: var(--green); }
.timer-meta { display: flex; flex-direction: column; gap: 1px; }
.timer-meta strong { font-size: 12px; color: var(--text-2); }
.timer-meta span { font-size: 11px; color: var(--muted); }
.timer-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.timer-form .form-control { width: auto; min-width: 190px; height: 38px; }
.timer-controls { display: flex; gap: 8px; }

/* ---------- modelos ---------- */
.section-head { margin: 26px 0 14px; }
.section-head h2 { font-size: 17px; }
.section-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.template-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.template-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.template-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gold-soft);
  color: #8d6c09;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
body.dark .template-icon { color: var(--gold-2); }
.template-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.template-info strong { font-size: 12.5px; }
.template-info span { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.template-actions { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }

/* ---------- relatórios ---------- */
.filter-card { margin-bottom: 16px; padding: 15px 18px; }
.report-filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.report-filters .field { min-width: 160px; }
.report-filters .btn { height: 39px; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.report-summary { display: grid; gap: 10px; }
.report-summary div { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 9px; }
.report-summary div:last-child { border-bottom: 0; padding-bottom: 0; }
.report-summary span { font-size: 11.5px; color: var(--muted); }
.report-summary strong { font-size: 14px; }

/* ---------- configurações ---------- */
.config-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.config-side { display: grid; gap: 14px; }
.config-text { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.config-text strong { color: var(--text-2); }
.backup-status {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 11px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text-2);
}
.backup-status.ok { background: var(--green-soft); border-color: transparent; color: var(--green); }
.backup-status.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.backup-status .ico { flex: 0 0 auto; }
.backup-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.backup-actions .btn { flex: 1; min-width: 130px; }
.config-side .btn-block { margin-bottom: 6px; }
.config-note { font-size: 10.5px; color: var(--muted); line-height: 1.55; display: flex; gap: 6px; margin-top: 12px; }
.config-note .ico { flex: 0 0 auto; margin-top: 1px; color: var(--blue); }
.theme-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.about-list { display: grid; gap: 8px; }
.about-list div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; }
.about-list span { color: var(--muted); }
.about-list strong { color: var(--text-2); font-weight: 600; }
.permission-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--blue-soft);
  color: var(--text-2);
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 11.5px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.permission-note .ico { flex: 0 0 auto; color: var(--blue); margin-top: 1px; }
.permission-note strong { color: var(--text); }

/* ---------- detalhes ---------- */
.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  min-width: 0;
}
.info-item span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.info-item strong { font-size: 12px; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.detail-note {
  background: var(--gold-soft);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 14px;
}
.detail-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.detail-stats > div {
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 6px;
  background: var(--card);
}
.detail-stats span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.detail-stats strong { display: block; font-size: 15px; margin-top: 3px; letter-spacing: -.02em; }
.detail-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.detail-section-head h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.timeline { display: grid; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 12px; position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
  flex: 0 0 auto;
  margin-top: 5px;
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.timeline-item div { display: flex; flex-direction: column; gap: 1px; }
.timeline-item strong { font-size: 12px; font-weight: 600; }
.timeline-item small { font-size: 10.5px; color: var(--muted); }
.mini-list { display: grid; gap: 5px; }
.mini-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.mini-row .mini-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.mini-row .link-strong { font-size: 11.5px; }
.mini-dot { width: 8px; height: 8px; background: var(--blue); }
.mini-dot.ok { background: var(--green); }
.mini-dot.late { background: var(--red); }

/* ---------- modais ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 36, .55);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px 32px;
  overflow-y: auto;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.99); } }
.modal {
  width: 100%;
  max-width: 620px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: pop .18s ease;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1080px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16.5px; letter-spacing: -.02em; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--card-2);
  flex-wrap: wrap;
  border-radius: 0 0 18px 18px;
}
.foot-hint { flex: 1; font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-width: 180px; }
.foot-hint .ico { flex: 0 0 auto; }

/* ---------- confirmação ---------- */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 36, .55);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade .13s ease;
}
.confirm-box {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: pop .16s ease;
}
.confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.confirm-icon.danger { background: var(--red-soft); color: var(--red); }
.confirm-box h3 { font-size: 16px; margin-bottom: 6px; }
.confirm-box p { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.confirm-box p + p { margin-top: 8px; }
.warn-text { color: var(--red); font-size: 11.5px; }
.confirm-label { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--text-2); margin-top: 14px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- toasts ---------- */
#toastRoot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 11px;
  padding: 11px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  color: var(--text-2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-icon { display: flex; flex: 0 0 auto; }
.toast-msg { flex: 1; line-height: 1.45; }
.toast-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; padding: 2px; border-radius: 5px; flex: 0 0 auto; }
.toast-x:hover { background: var(--hover); color: var(--text); }
.toast-success { border-left-color: var(--green); }
.toast-success .toast-icon { color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-error .toast-icon { color: var(--red); }
.toast-warn { border-left-color: var(--amber); }
.toast-warn .toast-icon { color: var(--amber); }
.toast-info { border-left-color: var(--blue); }
.toast-info .toast-icon { color: var(--blue); }

/* ---------- estados vazios ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
}
.empty-state .ico { color: var(--line-2); margin-bottom: 2px; }
.empty-state h3 { font-size: 13px; color: var(--text-2); }
.empty-state p { font-size: 11.5px; max-width: 340px; line-height: 1.55; }
.empty-state .btn { margin-top: 8px; }

/* ---------- editor de documentos ---------- */
.doc-editor { display: flex; flex-direction: column; gap: 12px; }
.doc-meta { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.doc-meta .form-control { height: 38px; min-height: 38px; font-size: 12px; }
.doc-title-input { font-weight: 700; }
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  flex-wrap: wrap;
}
.tool-group { display: flex; align-items: center; gap: 2px; padding-right: 8px; border-right: 1px solid var(--line); }
.tool-group:last-child { border-right: 0; padding-right: 0; }
.tool-btn {
  min-width: 30px;
  height: 29px;
  padding: 0 7px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tool-btn:hover { background: var(--card); border-color: var(--line); color: var(--text); }
.tool-right { margin-left: auto; border-right: 0; gap: 5px; padding-right: 0; }
.editor-sheet {
  min-height: 460px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 46px 52px;
  background: #fff;
  color: #14213a;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.75;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(15, 37, 66, .04);
}
.editor-sheet:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .13); }
.editor-sheet p { margin: 0 0 12px; text-align: justify; text-align-last: left; text-justify: inter-word; }
.editor-sheet h2, .editor-sheet h3 { text-align: center; margin: 0 0 14px; font-family: inherit; color: #14213a; }
.editor-sheet h2 { font-size: 19px; }
.editor-sheet h3 { font-size: 16px; }
.editor-sheet ul, .editor-sheet ol { margin: 0 0 12px 22px; padding: 0; }
.editor-sheet li { margin-bottom: 5px; }
body.dark .editor-sheet { background: #fbfcfe; }

/* ---------- sidebar overlay ---------- */
.sidebar-overlay { display: none; }

/* ============================================================
   Área de impressão (oculta na tela)
   ============================================================ */

#printHeader, #printDoc { display: none; }

.print-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid #0e2542; }
.print-logo { width: 54px; height: 54px; object-fit: contain; }
.print-logo-ph {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: #0e2542;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.print-brand strong { display: block; font-size: 15pt; color: #0e2542; letter-spacing: -.02em; }
.print-brand span { display: block; font-size: 8.5pt; color: #526076; }
.print-doc-title { font-size: 13pt; font-weight: 700; margin: 14px 0 4px; color: #14213a; }
.print-meta { font-size: 7.5pt; color: #718096; margin-bottom: 10px; }

/* ============================================================
   Responsivo
   ============================================================ */

@media (max-width: 1280px) {
  .dash-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1120px) {
  .dash-panels { grid-template-columns: 1fr 1fr; }
  .agenda-layout { grid-template-columns: 1fr; }
  .agenda-side { position: static; }
  .config-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 250px; }
  .sidebar { transform: translateX(-100%); transition: transform .24s ease; box-shadow: none; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 24px 0 60px rgba(4, 12, 24, .45); }
  body.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 20, 36, .45);
    z-index: 45;
    animation: fade .2s ease;
  }
  .app-main { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar-title { min-width: 0; flex: 1; }
  .topbar-title h2 { font-size: 15px; }
  .topbar-title p { display: none; }
  .topbar-search { display: none; }
  .content { padding: 18px 16px 24px; }
  .app-footer { padding: 12px 16px 18px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-panels { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-wrap { min-height: 100vh; padding: 32px 20px; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 16px 16px 12px; }
  .modal-foot { padding: 12px 16px; }
  .editor-sheet { padding: 28px 22px; }
  .doc-meta { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .page-head h1 { font-size: 21px; }
  .report-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item { flex: 1; min-width: 90px; padding: 8px 11px; }
  .summary-note { border-top: 1px solid var(--line); flex-basis: 100%; }
  .automation-stats { width: 100%; justify-content: space-between; gap: 10px; }
  .timer-form { width: 100%; }
  .timer-form .form-control { flex: 1; min-width: 140px; }
  .cal-cell { min-height: 76px; }
  .cal-event { font-size: 8.5px; }
  .form-grid { gap: 12px; }
  .form-grid > .field { grid-column: span 12 !important; }
  .field-row { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .content { padding: 14px 12px 22px; }
  .topbar { height: 62px; padding: 0 12px; }
  .user-chip-text { display: none; }
  .timer-pill { display: none; }
  .topbar-actions { gap: 5px; }
  .kpi-grid, .kpi-grid-5 { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .kpi-value { font-size: 15px; }
  .kpi-label { font-size: 9px; }
  .kpi-sub { display: none; }
  .dash-mini { grid-template-columns: 1fr 1fr; }
  .page-head { margin-bottom: 16px; gap: 12px; }
  .page-head > div:first-child { flex-basis: 100%; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .table-toolbar { padding: 10px; }
  .search-field { max-width: none; flex-basis: 100%; }
  .data-table { font-size: 11.5px; min-width: 640px; }
  .data-table thead th, .data-table tbody td { padding: 9px 10px; }
  .data-table.compact { min-width: 0; }
  .summary-row { overflow-x: auto; flex-wrap: nowrap; }
  .summary-item { min-width: 104px; }
  .summary-note { display: none; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 94vh; }
  .modal-lg, .modal-xl { max-width: none; }
  .modal-foot { border-radius: 0; }
  .modal-foot .btn { flex: 1; }
  .foot-hint { display: none; }
  .modal-foot .btn-primary { flex: 1.6; }
  .editor-sheet { padding: 20px 16px; font-size: 14px; min-height: 340px; max-height: 46vh; }
  .doc-meta .form-control { font-size: 11.5px; }
  .editor-toolbar { gap: 4px; padding: 5px; }
  .tool-group { padding-right: 5px; }
  .tool-btn { min-width: 26px; height: 27px; padding: 0 4px; font-size: 11px; }
  .tool-right { width: 100%; margin-left: 0; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 5px; margin-top: 2px; }
  .agenda-layout { gap: 10px; }
  .calendar-toolbar { flex-wrap: wrap; }
  .cal-cell { min-height: 58px; padding: 3px; }
  .cal-num { font-size: 10px; }
  .cal-events { display: none; }
  .cal-count { font-size: 8px; }
  .calendar-legend { font-size: 9.5px; gap: 10px; }
  .calendar-hint { display: none; }
  .automation-card { padding: 15px; gap: 14px; }
  .automation-main h3 { font-size: 13px; }
  .automation-main p { font-size: 10.5px; }
  .automation-card > .btn { width: 100%; }
  .timer-card { padding: 15px; gap: 14px; }
  .timer-display { font-size: 27px; }
  .timer-controls, .timer-controls .btn { width: 100%; }
  .config-side .btn-block, .backup-actions .btn { width: 100%; }
  .report-filters .field { flex: 1; min-width: 130px; }
  .report-filters .btn { width: 100%; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .info-item { padding: 7px 9px; }
  .detail-badges { margin-bottom: 10px; }
  .detail-section { margin-top: 14px; padding-top: 12px; }
  .toast { font-size: 11.5px; }
  #toastRoot { right: 10px; left: 10px; bottom: 10px; max-width: none; }
  .auth-form-wrap { padding: 24px 16px; }
  .auth-card h2 { font-size: 22px; }
  .auth-theme { top: 14px; right: 14px; }
  .sidebar { width: 82vw; max-width: 300px; }
}

@media (max-width: 420px) {
  .kpi-grid, .kpi-grid-5 { grid-template-columns: 1fr; }
  .dash-mini { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .user-chip { padding: 3px; }
}

/* ============================================================
   Impressão
   ============================================================ */

@media print {
  @page { size: A4; margin: 16mm 14mm; }

  html, body {
    background: #fff !important;
    color: #000 !important;
    height: auto !important;
    font-size: 10pt;
  }

  .no-print, .sidebar, .topbar, .app-footer, .sidebar-overlay, .toast,
  #toastRoot, #modalRoot, .confirm-backdrop, .table-toolbar, .row-actions,
  .page-actions, .cal-nav, .calendar-toolbar, .backup-actions,
  .config-side .btn, .btn, .icon-btn, .timer-pill, .user-menu,
  .mini-action, .alert-strip, .filter-card, .permission-note,
  .table-foot, th.th-actions, .td-actions, .section-head .btn,
  .detail-section-head .link-btn, .editor-toolbar, .modal-backdrop { display: none !important; }

  body { margin: 0 !important; }
  .app-shell, .app-main { margin: 0 !important; padding: 0 !important; min-height: 0 !important; display: block !important; }
  .content { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .card { box-shadow: none !important; border: 1px solid #c9d2de !important; break-inside: avoid; }
  .kpi { break-inside: avoid; }
  .kpi-value { color: #000 !important; }
  .page-head { margin-bottom: 12px !important; }
  .page-head h1 { font-size: 18pt; color: #0e2542 !important; }
  .page-head p { color: #526076 !important; }
  .data-table { font-size: 8.5pt; min-width: 0 !important; }
  .data-table thead th { background: #eef2f8 !important; color: #0e2542 !important; border-bottom: 1px solid #8fa0b8 !important; }
  .data-table tbody td { color: #14213a !important; border-bottom: 1px solid #dbe2ec !important; }
  .data-table tbody tr { break-inside: avoid; }
  .data-table tbody tr:hover td, .data-table tbody tr.row-late td { background: transparent !important; }
  .table-scroll { overflow: visible !important; }
  .badge { border: 1px solid #b9c4d4 !important; background: transparent !important; color: #14213a !important; }
  .chart-box { height: 220px; break-inside: avoid; }
  .dash-grid, .dash-panels, .report-grid, .kpi-grid, .kpi-grid-5 { display: grid !important; gap: 8px !important; }
  .report-grid { grid-template-columns: 1fr 1fr !important; }
  .detail-stats, .summary-row { display: flex !important; }
  .list-body { max-height: none !important; overflow: visible !important; }
  .list-item { cursor: default !important; }
  a { color: inherit !important; text-decoration: none !important; }
  .doc-print, .doc-print * { color: #000 !important; }

  /* impressão de página: cabeçalho + conteúdo */
  body.printing #printHeader { display: block !important; margin-bottom: 10mm; }
  body.printing .app-shell { display: block !important; }
  body.printing .content { display: block !important; }

  /* impressão de documento: somente cabeçalho + documento */
  body.print-doc .app-shell { display: none !important; }
  body.print-doc #printHeader { display: block !important; margin-bottom: 8mm; }
  body.print-doc #printDoc { display: block !important; }

  #printHeader { color: #14213a; }
  #printDoc { color: #000; }

  .doc-print {
    font-family: var(--serif), Georgia, "Times New Roman", serif;
    font-size: 11.5pt;
    line-height: 1.7;
    text-align: justify;
    text-align-last: left;
  }
  .doc-print h2, .doc-print h3, .doc-print h1 { text-align: center; color: #000 !important; }
  .doc-print h1 { font-size: 15pt; }
  .doc-print h2 { font-size: 13pt; }
  .doc-print h3 { font-size: 12pt; }
  .doc-print p { margin: 0 0 9pt; }
  .doc-print ul, .doc-print ol { margin: 0 0 9pt 20pt; }
  .doc-print img { max-width: 100%; }

  .print-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; margin: 8pt 0 14pt; }
  .print-table th, .print-table td { border: 1px solid #b9c4d4; padding: 5pt 6pt; text-align: left; vertical-align: top; }
  .print-table th { background: #eef2f8 !important; color: #0e2542; font-size: 8pt; }
  .print-table tr { break-inside: avoid; }

  .doc-print h1, .doc-print h2, #printDoc h1, #printDoc h2 { page-break-after: avoid; }
  .print-sign { margin-top: 22pt; font-size: 9pt; color: #526076; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- scrollbars (tela) ---------- */
@media screen {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--bg); }
  ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
}
