﻿:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-2: #f0f3f2;
  --ink: #202326;
  --muted: #687071;
  --line: #d7dddc;
  --line-2: #e8eceb;
  --accent: #256e67;
  --accent-soft: #d6eee9;
  --accent-row: rgba(202, 235, 226, .95);
  --warning: #8b641c;
  --warning-soft: #fff4d7;
  --blue: #2f5f9b;
  --blue-soft: #e8f0ff;
  --blue-row: rgba(218, 232, 252, .96);
  --analysis: #9b4a4a;
  --analysis-soft: #fae7e4;
  --analysis-row: rgba(249, 224, 220, .97);
  --violet: #6950a1;
  --violet-soft: #eee9fb;
  --done: #287347;
  --done-soft: #e4f4e9;
  --danger: #9c3d3d;
  --danger-soft: #fae8e8;
  --shadow-soft: 0 7px 22px rgba(21, 31, 32, .08);
  --shadow-tab: 0 -2px 10px rgba(21, 31, 32, .08);
  --ui-font-size: 12px;
  --row-min-height: 26px;
  --control-height: 22px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--ui-font-size);
}

body[data-text-level="1"] {
  --ui-font-size: 13px;
  --row-min-height: 28px;
  --control-height: 24px;
}

body[data-text-level="2"] {
  --ui-font-size: 14px;
  --row-min-height: 30px;
  --control-height: 26px;
}

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

button {
  cursor: pointer;
}

button:disabled,
select:disabled,
textarea:read-only,
input:disabled {
  cursor: default;
  opacity: .62;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 30%, rgba(37, 110, 103, .12), transparent 34%), rgba(247, 247, 244, .92);
  backdrop-filter: blur(8px);
}

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

.login-card {
  width: min(480px, calc(100vw - 36px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 28px 75px rgba(20, 30, 32, .22);
}

.login-card > strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.login-users {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.auth-login-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

.auth-login-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 700;
}

.auth-login-form input {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.auth-login-form input:focus {
  outline: 2px solid rgba(37, 110, 103, .18);
  border-color: #86bbb2;
}

.auth-login-help {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.login-user {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f6f8f7);
  color: var(--ink);
  padding: 10px;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.login-user:hover {
  border-color: #9ec4bd;
  background: #f0faf7;
}

.login-user span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 850;
}

.login-user strong {
  font-size: 15px;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  padding: 8px 10px 10px;
  gap: 5px;
}

.app-top,
.list-context,
.filters,
.grid-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.app-top {
  height: 38px;
  min-height: 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 13px;
  overflow: hidden;
}

.brand-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.brand-line strong {
  font-size: inherit;
}

.brand-line span {
  color: var(--muted);
  font-size: inherit;
}

.hint,
.context-main span {
  color: var(--muted);
  font-size: 12px;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  white-space: nowrap;
  position: relative;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  background: linear-gradient(180deg, #ffffff, #f3f7f6);
  color: #3b4445;
  font-weight: 750;
}

.app-top .button,
.app-top .user-badge {
  height: 24px;
  font-size: 13px;
}

.button,
.chip,
.icon-button,
.row-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 7px;
  height: 24px;
  padding: 0 8px;
  font-weight: 650;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.button.danger {
  border-color: #d8b9b9;
  background: var(--danger-soft);
  color: var(--danger);
}

.button.subtle,
.chip {
  background: var(--panel-2);
}

.text-size-btn {
  width: 30px;
  padding: 0;
  font-weight: 850;
}

.chip {
  white-space: nowrap;
  font-size: 12px;
}

.review-sort {
  height: 22px;
  width: 150px;
  border: 1px solid #d9e1df;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  padding: 0 7px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 2px;
  align-items: end;
  min-width: 0;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-button {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-bottom-color: #c6cfcd;
  background: #ecefed;
  border-radius: 7px 7px 0 0;
  padding: 0 10px;
  color: #404849;
  white-space: nowrap;
  max-width: min(310px, calc(100vw - 24px));
  box-shadow: var(--shadow-tab);
  transform: translateY(2px);
}

.tab-close {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  color: #6d7475;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.tab-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.tab-button.active {
  height: 32px;
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  border-bottom-color: var(--panel);
  font-weight: 780;
  transform: translateY(0);
}

.tab-count {
  min-width: 24px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0 6px;
  border-radius: 999px;
  background: #dde5e3;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.tab-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-context {
  min-height: 27px;
  border-radius: 0 8px 8px 8px;
  border-top-color: #eef2f1;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.context-main {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.context-main strong {
  font-size: 13px;
  white-space: nowrap;
}

.context-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-metrics {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #fafbfb;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  color: var(--ink);
}

.filters {
  min-height: 28px;
  display: grid;
  grid-template-columns: minmax(250px, 1.3fr) repeat(4, minmax(130px, .55fr)) repeat(4, auto);
  gap: 6px;
  align-items: center;
  padding: 4px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f9fbfa);
}

.search input,
.filters select {
  width: 100%;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 0 8px;
  min-width: 0;
}

.grid-shell {
  min-height: 0;
  border-radius: 8px;
  display: grid;
  grid-template-rows: 26px minmax(0, 1fr);
  overflow: hidden;
  box-shadow: 0 11px 30px rgba(21, 31, 32, .1);
}

.grid-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.grid-head-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.process-grid {
  min-height: 0;
  overflow: auto;
}

.table {
  min-width: 1220px;
}

.table-row {
  display: grid;
  grid-template-columns: 285px minmax(140px, .7fr) minmax(153px, .7fr) minmax(128px, .5fr) 64px 88px 116px 54px 174px 38px;
  align-items: center;
  min-height: var(--row-min-height);
  border-bottom: 1px solid var(--line-2);
}

.table-row.header {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 28px;
  background: #eff2f1;
  color: #495152;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  box-shadow: 0 2px 7px rgba(21, 31, 32, .06);
}

.table-row:not(.header):hover {
  background: #f5faf8;
}

.table-row.locked {
  background: linear-gradient(90deg, var(--analysis-row) 0%, rgba(252, 235, 232, .94) 56%, rgba(255, 255, 255, .98) 82%);
}

.table-row.locked.mine {
  box-shadow: inset 4px 0 0 var(--analysis);
}

.table-row.locked:not(.mine) {
  background: linear-gradient(90deg, rgba(247, 230, 227, .98) 0%, rgba(252, 241, 239, .94) 56%, rgba(255, 255, 255, .98) 82%);
}

.cell {
  min-width: 0;
  padding: 2px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-right: 1px solid #f0f2f1;
}

.cell.npu {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.npu-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sentence-flag {
  width: 18px;
  min-width: 18px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #c3cbc8;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: .72;
}

.sentence-flag:hover:not(:disabled) {
  background: #fff2b8;
  color: #b68100;
  opacity: 1;
}

.sentence-flag.active {
  color: #ffc400;
  font-size: 15px;
  opacity: 1;
  text-shadow: 0 0 0 #9b7100, 0 1px 2px rgba(159, 112, 0, .25);
}

.sentence-flag:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.duplicate-list-indicator {
  width: 17px;
  min-width: 17px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  filter: grayscale(1);
  pointer-events: none;
}

.duplicate-list-indicator.active {
  opacity: 1;
  filter: saturate(1.35);
  pointer-events: auto;
}

.copy-npu-btn {
  width: 18px;
  min-width: 18px;
  height: 20px;
  position: relative;
  display: inline-block;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #6a7475;
  padding: 0;
  cursor: pointer;
  opacity: .72;
}

.copy-npu-btn:hover {
  background: #eef3f1;
  color: #465153;
  opacity: 1;
}

.copy-npu-btn::before,
.copy-npu-btn::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: transparent;
}

.copy-npu-btn::before {
  left: 4px;
  top: 4px;
  opacity: .55;
}

.copy-npu-btn::after {
  left: 7px;
  top: 7px;
}

.cell.days,
.cell.time {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
}

.cell.sortable {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.cell.sortable span {
  min-width: 42px;
  text-align: right;
}

.cell.sortable.active {
  color: var(--accent);
  background: rgba(214, 238, 233, .5);
}

.sort-btn {
  width: 22px;
  min-width: 22px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #c3cfcd;
  border-radius: 5px;
  background: linear-gradient(180deg, #ffffff, #edf3f1);
  color: #435052;
  padding: 0;
  font-weight: 900;
  line-height: 1;
}

.cell.sortable.active .sort-btn {
  border-color: #8bb9b1;
  background: var(--accent-soft);
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.status-select {
  width: 100%;
  height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 0 5px;
  font-size: inherit;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
}

.status-select.status-pendente {
  border-color: #d8c47b;
  background: #fff7dd;
  color: #75580f;
}

.status-select.status-em_analise,
.status-select.status-acompanhar {
  border-color: #d49a93;
  background: var(--analysis-soft);
  color: var(--analysis);
}

.status-select.status-juiz {
  border-color: #b8a2df;
  background: var(--violet-soft);
  color: var(--violet);
}

.status-select.status-finalizado,
.status-select.status-arquivado {
  border-color: #86bd99;
  background: var(--done-soft);
  color: var(--done);
}

.lock-cell,
.action-cell,
.select-cell {
  display: flex;
  align-items: center;
  gap: 5px;
}

.lock-cell {
  justify-content: center;
}

.select-cell {
  justify-content: center;
}

.action-cell {
  justify-content: flex-start;
  gap: 4px;
}

.row-btn {
  width: 25px;
  height: var(--control-height);
  padding: 0;
  font-size: inherit;
}

.row-btn.wide {
  width: auto;
  min-width: 42px;
  padding: 0 7px;
}

.row-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.row-btn.warning {
  border-color: #d0aa3e;
  background: #fff1bf;
  color: var(--warning);
}

.row-btn.blue {
  border-color: #a996d2;
  background: var(--violet-soft);
  color: var(--violet);
}

.row-btn.done {
  border-color: #9bc6aa;
  background: var(--done-soft);
  color: var(--done);
}

.row-btn.pending-mine {
  border-color: #5fa978;
  background: white;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(40, 115, 71, .18);
}

.row-btn.danger {
  border-color: #d89090;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 800;
}

.lock-btn {
  width: 26px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  font-size: 12px;
}

.select-toggle {
  width: 24px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #edf3f1);
  color: var(--muted);
  padding: 0;
  font-weight: 900;
}

.select-toggle.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.row-check {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.lock-btn.active {
  border-color: #d49a93;
  background: var(--analysis-soft);
  color: var(--analysis);
}

.lock-btn.mine {
  border-color: var(--analysis);
  box-shadow: inset 0 0 0 1px rgba(155, 74, 74, .16);
}

.flag {
  min-width: 60px;
  height: 18px;
  padding: 0 4px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f7faf9;
  color: #586361;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
}

.modal {
  width: min(620px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: white;
  box-shadow: 0 22px 65px rgba(26, 31, 32, .23);
}

.small-modal {
  width: min(560px, calc(100vw - 32px));
}

.users-modal {
  width: min(900px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(12, 16, 18, .38);
}

.modal form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-head strong {
  display: block;
  font-size: 13px;
}

.modal-help {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.modal-kicker {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 800;
}

.modal label {
  display: grid;
  gap: 5px;
  color: #4a5253;
  font-weight: 700;
  font-size: 12px;
}

.modal label[hidden],
[hidden] {
  display: none !important;
}

.modal input,
.modal textarea,
.modal select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
  color: var(--ink);
  background: #fbfcfb;
}

.modal textarea {
  resize: vertical;
}

.user-create-grid {
  display: grid;
  grid-template-columns: minmax(145px, 1.1fr) minmax(190px, 1.35fr) minmax(140px, .95fr) minmax(110px, .75fr);
  gap: 8px;
  align-items: end;
}

.users-list {
  display: grid;
  gap: 6px;
  max-height: min(330px, 42vh);
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 6px;
  background: #fbfcfb;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 132px 104px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #fff;
}

.user-row.inactive {
  color: var(--muted);
  background: #f3f5f4;
}

.user-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-main strong,
.user-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-main span {
  color: var(--muted);
  font-size: 11px;
}

.user-role-select {
  min-height: 32px;
  padding: 4px 8px;
}

@media (max-width: 760px) {
  .user-create-grid,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-role-select,
  .user-row .button {
    width: 100%;
  }
}

.empty-state.compact {
  padding: 12px;
}

.icon-button {
  width: 30px;
  padding: 0;
  background: var(--panel-2);
}

.import-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.replace-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: linear-gradient(180deg, #fbfcfb, #f3f7f6);
}

.replace-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  color: var(--ink) !important;
}

.check-row input {
  width: 15px !important;
  height: 15px;
  accent-color: var(--accent);
}

.conflict-list {
  display: grid;
  gap: 12px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.conflict-group {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: #fbfcfb;
}

.conflict-group > strong {
  font-size: 12px;
}

.conflict-group > p {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.conflict-item {
  display: grid !important;
  grid-template-columns: 18px 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px !important;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: white;
}

.conflict-item input {
  width: 15px !important;
  height: 15px;
  accent-color: var(--accent);
}

.conflict-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--done-soft);
  color: var(--done);
  font-weight: 900;
}

.conflict-item.finalized .conflict-mark {
  background: var(--done-soft);
  color: var(--done);
}

.conflict-item.missing .conflict-mark {
  background: var(--warning-soft);
  color: var(--warning);
}

.conflict-item strong,
.conflict-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conflict-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

@media (max-width: 980px) {
  .app {
    height: auto;
    min-height: 100vh;
  }

  .list-context {
    align-items: stretch;
    flex-direction: column;
  }

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

  .process-grid {
    max-height: 70vh;
  }
}

