:root {
  --bg: #070b12;
  --surface: #0d1420;
  --surface-2: #111c2c;
  --surface-3: #17253a;
  --panel-bg: rgba(13, 20, 32, 0.92);
  --panel-bg-soft: rgba(13, 20, 32, 0.82);
  --panel-bg-raised: rgba(16, 27, 43, 0.9);
  --panel-border: rgba(117, 169, 255, 0.18);
  --line: #24334a;
  --text: #edf4ff;
  --muted: #9aa8bb;
  --blue: #2f7df6;
  --blue-2: #75a9ff;
  --cyan: #36d1dc;
  --green: #45c486;
  --amber: #e6aa3a;
  --red: #ef5d68;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(47, 125, 246, 0.18), transparent 36%),
    linear-gradient(315deg, rgba(54, 209, 220, 0.09), transparent 34%),
    var(--bg);
  color: var(--text);
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(1, 4, 9, 0.82);
  backdrop-filter: blur(8px);
}

.login-gate[hidden] {
  display: none;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid rgba(117, 169, 255, 0.24);
  border-radius: 8px;
  background: #0c1320;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 4px;
}

.login-card h1 {
  font-size: 28px;
}

.login-card small {
  color: var(--muted);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid rgba(117, 169, 255, 0.16);
  background: rgba(7, 11, 18, 0.86);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(117, 169, 255, 0.45);
  border-radius: 8px;
  background: #0f1b2d;
  color: var(--blue-2);
  font-size: 24px;
  font-weight: 800;
}

.logo-mark {
  overflow: hidden;
  padding: 4px;
  background: #000;
}

.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
  letter-spacing: 0;
}

.brand strong {
  font-size: 22px;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(117, 169, 255, 0.28);
  background: rgba(47, 125, 246, 0.14);
  color: var(--text);
}

.office-card {
  display: grid;
  gap: 8px;
  margin-top: 32px;
  padding: 16px;
  border: 1px solid rgba(117, 169, 255, 0.2);
  border-radius: 8px;
  background: rgba(17, 28, 44, 0.72);
}

.office-card span,
.office-card small,
.eyebrow {
  color: var(--muted);
}

.office-card strong {
  font-size: 18px;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.topbar-actions,
.form-actions,
.form-actions div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-action-menu {
  display: contents;
}

.topbar-action-menu summary {
  display: none;
}

.topbar-action-list {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-label {
  min-width: 250px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-label select {
  width: 100%;
  margin-top: 6px;
}

.cloud-status {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(117, 169, 255, 0.2);
  border-radius: 8px;
  background: rgba(17, 28, 44, 0.65);
  color: var(--blue-2);
  font-size: 12px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text);
}

.primary-button {
  background: var(--blue);
  box-shadow: 0 12px 28px rgba(47, 125, 246, 0.28);
}

.secondary-button,
.icon-button {
  border-color: rgba(117, 169, 255, 0.24);
  background: rgba(17, 28, 44, 0.9);
}

.danger-button {
  border-color: rgba(239, 93, 104, 0.35);
  background: rgba(239, 93, 104, 0.1);
  color: #ffb7bd;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover,
.mini-button:hover {
  border-color: rgba(117, 169, 255, 0.46);
  filter: brightness(1.06);
}

.danger-button:hover,
.danger-mini:hover {
  border-color: rgba(239, 93, 104, 0.58);
  filter: brightness(1.08);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.quick-action-panel {
  margin-bottom: 16px;
  padding: 14px;
}

.tab-action-row {
  justify-content: flex-start;
}

.metric {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 28, 44, 0.95), rgba(10, 17, 28, 0.92));
  box-shadow: var(--shadow);
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0;
  font-size: 42px;
}

.metric.urgent {
  border-color: rgba(239, 93, 104, 0.42);
}

.metric.warning {
  border-color: rgba(230, 170, 58, 0.42);
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(180px, 220px) 140px 140px;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-box,
.segmented,
select,
input,
textarea {
  border: 1px solid rgba(117, 169, 255, 0.2);
  border-radius: 8px;
  background: rgba(13, 20, 32, 0.9);
  color: var(--text);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 13px;
}

.search-box span {
  color: var(--blue-2);
  font-weight: 900;
}

.search-box input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: 0;
}

.date-filter {
  min-width: 0;
}

.date-filter input,
.date-filter select {
  width: 100%;
}

.notification-field {
  max-width: 260px;
}

.inline-number {
  display: grid;
  grid-template-columns: minmax(90px, 120px) auto;
  gap: 10px;
  align-items: center;
}

.inline-number span {
  color: var(--muted);
}

select,
input,
textarea,
.rich-text-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  padding-top: 10px;
  resize: vertical;
}

.rich-text-label {
  display: grid;
  gap: 8px;
}

.format-toolbar {
  display: flex;
  gap: 8px;
}

.format-button {
  width: 38px;
  min-height: 34px;
  padding: 0;
}

.rich-text-input {
  min-height: 112px;
  padding: 12px;
  overflow-y: auto;
  border: 1px solid rgba(117, 169, 255, 0.16);
  border-radius: 10px;
  background: rgba(7, 11, 18, 0.82);
  color: var(--text);
  outline: 0;
  line-height: 1.45;
}

.rich-text-input:focus {
  border-color: rgba(117, 169, 255, 0.56);
  box-shadow: 0 0 0 3px rgba(47, 125, 246, 0.14);
}

.rich-text-input:empty::before {
  content: attr(data-placeholder);
  color: rgba(156, 169, 189, 0.72);
}

.field-counter {
  justify-self: end;
  color: var(--muted);
  font-weight: 800;
}

.field-counter.limit {
  color: #ff9aa5;
}

.segmented {
  display: flex;
  align-items: center;
  padding: 4px;
}

.segment {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
}

.segment.active {
  background: var(--surface-3);
  color: var(--text);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(14, 23, 37, 0.96), rgba(10, 17, 28, 0.94));
  box-shadow: var(--shadow);
}

.panel.wide {
  overflow: hidden;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.metrics.tab-view.active,
.content-grid.tab-view.active {
  display: grid;
}

body[data-active-view="painel"] .controls,
body[data-active-view="painel"] .filter-actions,
body[data-active-view="clientes"] .controls,
body[data-active-view="clientes"] .filter-actions,
body[data-active-view="backup"] .controls,
body[data-active-view="auditoria"] .controls,
body[data-active-view="financeiro"] .controls {
  display: none;
}

body[data-active-view="backup"] .filter-actions,
body[data-active-view="auditoria"] .filter-actions,
body[data-active-view="financeiro"] .filter-actions {
  display: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid rgba(117, 169, 255, 0.14);
}

.panel-heading > div {
  min-width: 0;
}

.panel-heading p,
.panel-heading small {
  color: var(--muted);
  line-height: 1.35;
}

.panel-heading h2 {
  line-height: 1.15;
}

.count-pill,
.status-pill,
.priority-pill,
.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.count-pill {
  background: rgba(117, 169, 255, 0.12);
  color: var(--blue-2);
}

.status-pill {
  background: rgba(230, 170, 58, 0.12);
  color: #ffd88e;
}

.status-pill.done {
  background: rgba(69, 196, 134, 0.13);
  color: #9ff0c8;
}

.toggle-inline {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  min-height: 32px;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toggle-inline input {
  width: auto;
  min-height: 0;
  padding: 0;
}

.priority-pill.alta {
  background: rgba(239, 93, 104, 0.13);
  color: #ffb7bd;
}

.priority-pill.media {
  background: rgba(230, 170, 58, 0.12);
  color: #ffd88e;
}

.priority-pill.baixa {
  background: rgba(54, 209, 220, 0.12);
  color: #a5f6fb;
}

.type-pill {
  background: rgba(117, 169, 255, 0.1);
  color: #bdd5ff;
}

.table-wrap {
  overflow-x: auto;
  background: rgba(7, 11, 18, 0.38);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.items-table {
  min-width: 680px;
  table-layout: fixed;
}

.items-table th:nth-child(1),
.items-table td:nth-child(1) {
  width: 120px;
}

.items-table th:nth-child(2),
.items-table td:nth-child(2) {
  width: 23%;
}

.items-table th:nth-child(3),
.items-table td:nth-child(3) {
  width: 18%;
}

.items-table th:nth-child(4),
.items-table td:nth-child(4) {
  width: 18%;
}

.items-table th:nth-child(5),
.items-table td:nth-child(5) {
  width: 104px;
}

.items-table th:nth-child(6),
.items-table td:nth-child(6) {
  width: 92px;
}

.items-table th:nth-child(7),
.items-table td:nth-child(7) {
  width: 178px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(117, 169, 255, 0.12);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(13, 20, 32, 0.96);
}

.items-table th,
.items-table td {
  padding: 10px 10px;
  font-size: 12.25px;
  line-height: 1.34;
}

.items-table th:first-child,
.items-table td:first-child {
  padding-right: 16px;
}

.items-table th:nth-child(2),
.items-table td:nth-child(2) {
  padding-left: 14px;
}

.items-table td {
  overflow-wrap: anywhere;
}

.items-table td > strong {
  font-size: 12.8px;
  line-height: 1.25;
}

.items-table td small {
  font-size: 11.5px;
  line-height: 1.25;
}

.nowrap-cell {
  white-space: nowrap;
}

.table-actions.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

tbody tr {
  background: rgba(13, 20, 32, 0.76);
}

tbody tr:nth-child(even) {
  background: rgba(17, 28, 44, 0.62);
}

.items-table tbody tr:not(.client-item-group-row) {
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.items-table tbody tr:not(.client-item-group-row):hover {
  background: rgba(22, 36, 56, 0.86);
  box-shadow: inset 3px 0 0 rgba(117, 169, 255, 0.24);
}

.client-item-group-row td {
  width: auto !important;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(117, 169, 255, 0.2);
  background: linear-gradient(90deg, rgba(47, 125, 246, 0.16), rgba(5, 12, 22, 0.96) 42%);
}

.client-item-group-row span {
  display: inline-block;
  margin-right: 8px;
  color: var(--blue-2);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.client-item-group-row strong {
  display: inline;
  margin: 0;
  color: #edf5ff;
  font-size: 13px;
}

.audit-comment {
  display: block;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid rgba(230, 170, 58, 0.22);
  border-radius: 8px;
  background: rgba(230, 170, 58, 0.08);
  color: #ffe1a6;
  line-height: 1.35;
  white-space: pre-wrap;
}

.audit-comment strong {
  display: inline;
  margin: 0;
  color: #ffd88e;
}

td strong,
.task-card strong,
.agenda-item strong {
  display: block;
  margin-bottom: 4px;
}

td small,
.task-card small,
.agenda-item small {
  color: var(--muted);
}

.date-cell {
  min-width: 120px;
}

.date-cell strong {
  white-space: nowrap;
}

.last-note-inline {
  display: block;
  max-width: 360px;
  margin-top: 6px;
  white-space: normal;
  line-height: 1.35;
}

.last-note-inline strong {
  display: inline;
  margin: 0;
  color: var(--blue-2);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.item-actions {
  display: grid;
  justify-content: end;
  gap: 6px;
}

.item-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.item-action-row.secondary {
  justify-content: flex-end;
}

.mini-button {
  min-height: 32px;
  border: 1px solid rgba(117, 169, 255, 0.22);
  border-radius: 7px;
  background: rgba(17, 28, 44, 0.9);
  color: var(--text);
  padding: 0 9px;
  transition: border-color 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.items-table .mini-button {
  min-height: 29px;
  padding: 0 7px;
  font-size: 11.5px;
}

.items-table .status-pill {
  padding: 5px 8px;
  font-size: 11px;
}

.mini-button.done {
  border-color: rgba(69, 196, 134, 0.28);
  color: #9ff0c8;
}

.agenda-list,
.task-board,
.client-grid,
.procedure-list,
.notification-list,
.timeline,
.stacked-grid {
  display: grid;
  gap: 12px;
}

.agenda-list,
.task-board,
.client-grid,
.procedure-list,
.notification-list,
.timeline {
  padding: 16px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(117, 169, 255, 0.12);
}

.calendar-toolbar strong {
  text-align: center;
  text-transform: capitalize;
}

.calendar-center {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.calendar-view-switch {
  display: inline-flex;
  gap: 6px;
}

.calendar-view-switch .mini-button {
  min-height: 30px;
  padding: 7px 10px;
}

.calendar-view-switch .mini-button.active {
  border-color: rgba(117, 169, 255, 0.75);
  background: rgba(47, 125, 246, 0.24);
  color: #dfeaff;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  padding: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-grid {
  gap: 1px;
  padding: 0 14px 14px;
  background: rgba(117, 169, 255, 0.1);
}

.calendar-grid.week-mode .calendar-day {
  min-height: 142px;
}

.calendar-day {
  display: grid;
  align-content: start;
  min-height: 96px;
  border: 0;
  background: rgba(13, 20, 32, 0.96);
  color: var(--text);
  padding: 6px;
  text-align: left;
  cursor: pointer;
}

.calendar-day:hover {
  background: rgba(17, 28, 44, 0.98);
}

.calendar-day.outside-month {
  background: rgba(13, 20, 32, 0.58);
  color: rgba(237, 244, 255, 0.58);
}

.calendar-day.outside-month .calendar-date {
  opacity: 0.55;
}

.calendar-day.outside-month .calendar-event:not(.done) {
  opacity: 1;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px rgba(230, 170, 58, 0.7);
}

.calendar-date {
  justify-self: start;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 900;
}

.calendar-day.today .calendar-date {
  background: rgba(230, 170, 58, 0.18);
  color: #ffd88e;
}

.calendar-events {
  display: grid;
  gap: 4px;
  margin-top: 5px;
}

.calendar-event {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(117, 169, 255, 0.18);
  border-radius: 6px;
  padding: 4px 5px;
  font-size: 10.5px;
  line-height: 1.2;
}

.calendar-event-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
}

.calendar-event strong,
.calendar-event small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.calendar-time {
  flex: 0 0 auto;
  border-radius: 4px;
  padding: 1px 4px;
  background: rgba(7, 11, 18, 0.32);
  color: #ffffff;
  font-weight: 900;
}

.task-calendar-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1px solid rgba(191, 219, 254, 0.78);
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.58);
  color: #dbeafe;
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-decoration: none;
}

.calendar-event small {
  color: rgba(230, 238, 252, 0.74);
}

.calendar-eye {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(230, 238, 252, 0.28);
  border-radius: 999px;
  background: rgba(7, 11, 18, 0.38);
  color: #f8fbff;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.calendar-eye:hover {
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.14);
}

.calendar-event.owner-joao {
  border-color: rgba(47, 125, 246, 0.55);
  background: rgba(47, 125, 246, 0.24);
}

.calendar-event.owner-camila {
  border-color: rgba(236, 72, 153, 0.55);
  background: rgba(236, 72, 153, 0.2);
}

.calendar-event.owner-ambos {
  border-color: rgba(239, 93, 104, 0.72);
  background: rgba(239, 93, 104, 0.26);
  color: #ffd0d3;
}

.calendar-event.type-audiencia {
  border-color: rgba(245, 197, 66, 0.72);
  background: rgba(245, 197, 66, 0.24);
  color: #ffe8a4;
}

.calendar-event.type-diligencia {
  border-color: rgba(245, 197, 66, 0.72);
  background: rgba(245, 197, 66, 0.24);
  color: #ffe8a4;
}

.calendar-event.type-prazo {
  border-color: rgba(239, 93, 104, 0.78);
  background: rgba(239, 93, 104, 0.3);
  color: #ffd0d3;
}

.calendar-event.overdue-pending {
  border-color: rgba(255, 194, 64, 0.92);
  box-shadow:
    inset 3px 0 0 #ffc240,
    0 0 0 1px rgba(255, 194, 64, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.22);
  filter: saturate(1.2) brightness(1.08);
}

.calendar-overdue-badge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 194, 64, 0.22);
  color: #ffe3a1;
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
}

.deadline-alert {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: #ff2f45;
  color: white;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}

.calendar-event.done {
  opacity: 0.45;
  text-decoration: line-through;
}

.calendar-expand {
  min-height: 28px;
  margin-top: 6px;
  border: 1px solid rgba(117, 169, 255, 0.2);
  border-radius: 6px;
  background: rgba(17, 28, 44, 0.9);
  color: var(--blue-2);
  font-size: 11px;
  font-weight: 800;
}

.calendar-event.notify-now {
  box-shadow: inset 3px 0 0 var(--amber);
}

.agenda-embedded {
  border-bottom: 1px solid rgba(117, 169, 255, 0.14);
}

.compact-heading {
  padding: 14px 18px;
}

.stacked-grid {
  gap: 18px;
}

.agenda-item,
.task-card,
.notification-card,
.client-card,
.procedure-card {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-bg-raised), rgba(11, 18, 30, 0.86));
  padding: 14px;
}

.notification-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  gap: 12px;
  padding: 16px 16px 0;
}

.notification-card {
  display: grid;
  gap: 12px;
}

.notification-card.overdue {
  border-color: rgba(239, 93, 104, 0.48);
}

.notification-card.today {
  border-color: rgba(230, 170, 58, 0.5);
}

.notification-card.soon {
  border-color: rgba(47, 125, 246, 0.42);
}

.backup-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.backup-panel p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.backup-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-bg-raised), rgba(11, 18, 30, 0.86));
}

.backup-card span {
  color: var(--blue-2);
  font-weight: 800;
}

.finance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 16px 0;
}

.finance-form {
  display: grid;
  gap: 14px;
  margin: 16px;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-bg-raised), rgba(11, 18, 30, 0.86));
}

.finance-table-wrap {
  margin-top: 8px;
}

.finance-privacy-toggle {
  align-self: end;
  width: 38px;
  min-width: 38px;
  padding-inline: 0;
  font-size: 15px;
}

.finance-privacy-toggle.active {
  border-color: rgba(230, 170, 58, 0.65);
  background: rgba(230, 170, 58, 0.18);
  color: #ffe1a6;
}

#financeiro.finance-private .finance-summary span,
#financeiro.finance-private .finance-form input:not([type="hidden"]),
#financeiro.finance-private .finance-form textarea,
#financeiro.finance-private .finance-form select,
#financeiro.finance-private .finance-table tbody td:not(:last-child) {
  color: transparent !important;
  text-shadow: 0 0 10px rgba(230, 238, 252, 0.58);
  user-select: none;
}

#financeiro.finance-private .finance-table tbody .type-pill,
#financeiro.finance-private .finance-table tbody strong,
#financeiro.finance-private .finance-table tbody small {
  color: transparent !important;
}

.finance-entrada {
  border-color: rgba(54, 211, 153, 0.32);
  background: rgba(54, 211, 153, 0.1);
  color: #b7f7dc;
}

.finance-saida {
  border-color: rgba(239, 93, 104, 0.32);
  background: rgba(239, 93, 104, 0.1);
  color: #ffd0d5;
}

.finance-recebivel {
  border-color: rgba(230, 170, 58, 0.36);
  background: rgba(230, 170, 58, 0.12);
  color: #ffe1a6;
}

.client-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.procedure-card,
.client-card {
  display: grid;
  gap: 10px;
}

.client-card,
.procedure-card,
.backup-card,
.task-card,
.timeline-item {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}

.client-card.client-archived,
.client-procedure-group.client-archived {
  opacity: 0.66;
}

.client-card.client-archived .record-title strong,
.client-procedure-group.client-archived .client-procedure-header strong {
  text-decoration: line-through;
  text-decoration-thickness: 1.4px;
  text-decoration-color: rgba(237, 244, 255, 0.72);
}

.client-card small,
.procedure-card small {
  line-height: 1.38;
}

.client-procedure-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(8, 14, 23, 0.78);
  box-shadow: inset 3px 0 0 rgba(117, 169, 255, 0.18);
}

.client-procedure-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(117, 169, 255, 0.14);
}

.client-procedure-header div {
  display: grid;
  gap: 3px;
}

.client-procedure-header span:first-child {
  color: var(--blue-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.procedure-stack {
  display: grid;
  gap: 10px;
}

.procedure-timeline-panel {
  display: none;
}

.procedure-timeline-panel.open {
  display: block;
  margin-top: 8px;
}

.record-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.procedure-number-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.procedure-number-line strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.procedure-quick-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.procedure-card.procedure-closed {
  opacity: 0.64;
}

.procedure-card.procedure-closed .record-title strong,
.procedure-card.procedure-closed > small {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(237, 244, 255, 0.72);
}

.icon-mini-button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  border: 1px solid rgba(117, 169, 255, 0.26);
  border-radius: 6px;
  background: rgba(17, 28, 44, 0.88);
  color: var(--blue-2);
  font-size: 14px;
  line-height: 1;
  transition: border-color 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.icon-mini-button:hover {
  border-color: rgba(117, 169, 255, 0.55);
  filter: brightness(1.08);
}

.icon-mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.court-link-button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
  white-space: nowrap;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 14px;
}

.record-grid span,
.procedure-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.danger-mini {
  border-color: rgba(239, 93, 104, 0.3);
  color: #ffb7bd;
}

.success-mini {
  border-color: rgba(69, 196, 134, 0.45);
  background: rgba(30, 112, 72, 0.28);
  color: #9ff0c8;
}

.paid-mini {
  opacity: 0.45;
  text-decoration: line-through;
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.timeline {
  position: relative;
  padding-left: 16px;
}

.audit-actions {
  align-items: end;
  flex-wrap: wrap;
}

.audit-procedure-filter {
  flex: 1 1 280px;
}

.audit-list {
  padding: 16px;
}

.timeline-header {
  display: grid;
  gap: 4px;
  margin-bottom: 4px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-bg-raised), rgba(11, 18, 30, 0.86));
}

.timeline-header span {
  color: var(--muted);
}

.timeline-group {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(8, 14, 23, 0.78);
}

.timeline-group.focused-timeline {
  border-color: rgba(117, 169, 255, 0.45);
  box-shadow: 0 0 0 1px rgba(47, 125, 246, 0.16);
}

.timeline-events {
  position: relative;
  display: grid;
  gap: 10px;
  padding-left: 18px;
}

.timeline-events::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 3px;
  width: 1px;
  background: rgba(117, 169, 255, 0.24);
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-bg-raised), rgba(11, 18, 30, 0.86));
}

.timeline-item p {
  margin: 0;
  line-height: 1.42;
}

.timeline-item small {
  display: block;
  color: var(--muted);
}

.timeline-actions {
  margin-top: 8px;
}

.timeline-dot {
  position: absolute;
  top: 18px;
  left: -20px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--blue-2);
  border-radius: 999px;
  background: var(--bg);
}

.compact-empty {
  min-height: 94px;
}

.agenda-item.overdue {
  border-color: rgba(239, 93, 104, 0.38);
}

.agenda-item.today {
  border-color: rgba(230, 170, 58, 0.45);
}

.agenda-item.owner-joao {
  border-color: rgba(47, 125, 246, 0.5);
  background: rgba(47, 125, 246, 0.12);
}

.agenda-item.owner-camila {
  border-color: rgba(236, 72, 153, 0.5);
  background: rgba(236, 72, 153, 0.11);
}

.agenda-item.notify-now {
  box-shadow: inset 3px 0 0 var(--amber);
}

.dashboard {
  display: grid;
  gap: 18px;
}

.dashboard.tab-view {
  display: none;
}

.dashboard.tab-view.active {
  display: grid;
}

.dashboard-agenda {
  overflow: hidden;
}

.filter-panel-body {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--panel-bg);
}

.filter-panel-body small {
  color: var(--muted);
}

.task-card {
  display: grid;
  gap: 12px;
}

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

dialog {
  width: min(820px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  overflow-x: hidden;
  border: 1px solid rgba(117, 169, 255, 0.28);
  border-radius: 8px;
  background: #0c1320;
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog * {
  min-width: 0;
}

dialog.wide-dialog {
  width: min(1040px, calc(100vw - 24px));
}

dialog::backdrop {
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(3px);
}

.item-form {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.form-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.close-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(117, 169, 255, 0.22);
  border-radius: 8px;
  background: rgba(17, 28, 44, 0.82);
  color: var(--text);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-row.three {
  grid-template-columns: minmax(0, 1fr) 90px 140px;
}

.link-list {
  display: grid;
  gap: 8px;
}

.link-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

#dailyMovementsPreview {
  min-height: 360px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

.form-section-title,
.permission-note {
  color: var(--blue-2);
  font-size: 13px;
  font-weight: 800;
}

.permission-note {
  padding: 10px 12px;
  border: 1px solid rgba(230, 170, 58, 0.3);
  border-radius: 8px;
  background: rgba(230, 170, 58, 0.08);
  color: #ffd88e;
}

.last-note-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(117, 169, 255, 0.2);
  border-radius: 8px;
  background: rgba(13, 20, 32, 0.72);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.last-note-box strong {
  color: var(--blue-2);
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

.note-actions button {
  min-height: 36px;
}

.form-actions {
  justify-content: space-between;
  padding-top: 6px;
  gap: 10px;
  flex-wrap: wrap;
}

#itemDialog {
  width: min(760px, calc(100vw - 24px));
}

#itemDialog .form-row {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

#itemDialog .rich-text-input,
#itemDialog textarea,
#itemDialog input,
#itemDialog select {
  max-width: 100%;
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(117, 169, 255, 0.16);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .office-card {
    display: none;
  }

  .metrics,
  .content-grid,
  .client-grid,
  .notification-settings,
  .backup-panel,
  .finance-summary,
  .controls {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading .row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background: var(--bg);
    font-size: 14px;
  }

  .app-shell,
  .sidebar,
  .workspace,
  .topbar,
  .dashboard,
  .stacked-grid,
  .tab-view,
  .panel,
  .agenda-embedded,
  .table-wrap,
  .calendar-toolbar,
  .calendar-weekdays,
  .calendar-grid,
  .controls,
  .filter-actions {
    max-width: 100%;
  }

  button,
  input,
  select,
  textarea,
  .rich-text-input {
    max-width: 100%;
    min-width: 0;
  }

  input,
  select,
  textarea,
  .rich-text-input {
    font-size: 16px;
  }

  button {
    white-space: normal;
  }

  .workspace,
  .sidebar {
    padding: 16px 12px;
  }

  .brand {
    gap: 10px;
    margin-bottom: 18px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand strong {
    font-size: 17px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 26px;
    line-height: 1.08;
  }

  h2 {
    font-size: 16px;
  }

  .eyebrow,
  .compact-label,
  label,
  .cloud-status {
    font-size: 11.5px;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .icon-button {
    font-size: 13px;
  }

  .topbar-actions,
  .topbar-actions button,
  .compact-label,
  .topbar-action-menu,
  .topbar-action-menu summary,
  .topbar-action-list,
  .link-list-row,
  .note-actions,
  .note-actions button,
  .form-actions,
  .form-actions div,
  .audit-actions,
  .audit-actions .date-filter {
    width: 100%;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .topbar-action-menu {
    display: block;
  }

  .topbar-action-menu summary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid rgba(117, 169, 255, 0.24);
    border-radius: 8px;
    background: rgba(17, 28, 44, 0.9);
    color: var(--text);
    cursor: pointer;
    list-style: none;
  }

  .topbar-action-menu summary::-webkit-details-marker {
    display: none;
  }

  .topbar-action-menu summary::after {
    content: "v";
    margin-left: 8px;
    color: var(--blue-2);
    font-size: 13px;
  }

  .topbar-action-menu[open] summary::after {
    content: "^";
  }

  .topbar-action-list {
    display: none;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 8px;
  }

  .topbar-action-menu[open] .topbar-action-list {
    display: grid;
  }

  .topbar-actions button,
  .form-actions button {
    justify-content: center;
    min-height: 42px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .nav-item {
    justify-content: center;
    min-height: 38px;
    padding: 0 8px;
    font-size: 12px;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .metrics {
    gap: 10px;
  }

  .metric {
    min-height: 96px;
    padding: 14px;
  }

  .metric strong {
    font-size: 31px;
  }

  .metric span,
  .metric small {
    font-size: 11.5px;
  }

  .panel-heading,
  .compact-heading {
    padding: 14px;
  }

  .agenda-list,
  .task-board,
  .client-grid,
  .procedure-list,
  .notification-list,
  .timeline,
  .audit-list {
    padding: 12px;
  }

  .agenda-item,
  .task-card,
  .notification-card,
  .client-card,
  .procedure-card,
  .backup-card,
  .client-procedure-group,
  .timeline-item {
    padding: 12px;
  }

  .controls {
    gap: 9px;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .filter-actions button {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row.three {
    grid-template-columns: 1fr;
  }

  .record-grid {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar {
    grid-template-columns: 1fr;
  }

  .calendar-center {
    order: -1;
    width: 100%;
  }

  .calendar-view-switch {
    width: 100%;
  }

  .calendar-view-switch .mini-button {
    flex: 1;
  }

  .calendar-weekdays {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 8px 8px;
    font-size: 10px;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 0 8px 8px;
  }

  .calendar-day {
    min-height: 78px;
    padding: 4px;
  }

  .calendar-date {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .calendar-event {
    padding: 3px;
    font-size: 9.5px;
  }

  .calendar-event-top {
    grid-template-columns: minmax(0, 1fr) 18px;
  }

  .calendar-event strong {
    min-width: 0;
  }

  .calendar-event small {
    display: none;
  }

  .calendar-eye {
    width: 18px;
    height: 18px;
  }

  table {
    min-width: 680px;
  }

  .items-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .table-wrap {
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
  }

  .items-table,
  .items-table tbody,
  .items-table tr,
  .items-table td {
    display: block;
    width: 100% !important;
  }

  .items-table thead {
    display: none;
  }

  .items-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .items-table tr {
    border: 1px solid rgba(117, 169, 255, 0.14);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(13, 20, 32, 0.86);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  }

  .items-table td {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 9px 10px;
    border-bottom: 1px solid rgba(117, 169, 255, 0.08);
  }

  .items-table td::before {
    color: var(--blue-2);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .items-table td:nth-child(1)::before {
    content: "Data";
  }

  .items-table td:nth-child(2)::before {
    content: "Providencia";
  }

  .items-table td:nth-child(3)::before {
    content: "Procedimento";
  }

  .items-table td:nth-child(4) {
    display: none;
  }

  .items-table td:nth-child(5)::before {
    content: "Responsavel";
  }

  .items-table td:nth-child(6)::before {
    content: "Status";
  }

  .items-table td:nth-child(7)::before {
    content: "Acoes";
  }

  .items-table tr td:last-child {
    border-bottom: 0;
  }

  .client-item-group-row {
    margin-top: 6px;
    border: 0 !important;
    background: transparent !important;
  }

  .client-item-group-row td {
    display: block;
    padding: 10px 12px;
    border: 1px solid rgba(117, 169, 255, 0.18);
    border-radius: 8px;
  }

  .client-item-group-row td::before {
    content: none;
  }

  .date-cell {
    min-width: 0;
  }

  .client-procedure-header,
  .record-title,
  .task-meta,
  .row-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .procedure-number-line {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
  }

  .item-actions,
  .item-action-row {
    align-items: stretch;
    width: 100%;
  }

  .item-actions {
    gap: 8px;
  }

  .item-action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .item-action-row.secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .items-table .mini-button {
    min-height: 34px;
    font-size: 11px;
  }

  .client-card .row-actions,
  .procedure-card .row-actions,
  .backup-card .row-actions {
    align-items: stretch;
    width: 100%;
  }

  .client-card .row-actions .mini-button,
  .procedure-card .row-actions .mini-button,
  .backup-card .row-actions .mini-button {
    justify-content: center;
  }

  .status-pill,
  .priority-pill,
  .type-pill,
  .count-pill {
    font-size: 10.5px;
  }

  .last-note-box,
  .permission-note,
  .audit-comment {
    font-size: 12px;
  }

  dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 14px;
    overflow-y: auto;
  }

  .form-heading {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .workspace,
  .sidebar {
    padding: 12px 10px;
  }

  h1 {
    font-size: 23px;
  }

  body {
    font-size: 13.5px;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .icon-button {
    font-size: 12.5px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays {
    font-size: 9px;
  }

  .calendar-day {
    min-height: 64px;
  }

  .calendar-event {
    font-size: 9px;
  }

  .items-table tbody {
    padding: 8px;
  }

  .items-table td {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px;
  }

  .agenda-list,
  .task-board,
  .client-grid,
  .procedure-list,
  .notification-list,
  .timeline,
  .audit-list {
    padding: 10px;
  }
}
