:root {
  --ink: #17212b;
  --ink-soft: #52606d;
  --muted: #74808c;
  --line: #dce2e7;
  --line-strong: #c9d2d9;
  --surface: #ffffff;
  --canvas: #f3f5f6;
  --sidebar: #18232d;
  --sidebar-active: #253b4a;
  --blue: #1378b8;
  --blue-dark: #0d6399;
  --blue-soft: #e3f2fb;
  --green: #23865f;
  --green-soft: #e5f5ed;
  --yellow: #a86f05;
  --yellow-soft: #fff3cf;
  --red: #bd3c47;
  --red-soft: #fdebed;
  --radius: 7px;
  --sidebar-width: 248px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.45;
}

body.modal-open,
body.nav-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="checkbox"],
input[type="file"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  min-height: 100vh;
  flex-direction: column;
  background: var(--sidebar);
  color: #d6dde2;
  border-right: 1px solid #0f1820;
}

.brand {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand span {
  min-width: 0;
}

.brand strong,
.brand small {
  display: block;
  overflow-wrap: anywhere;
}

.brand strong {
  color: #fff;
  font-size: 16px;
  line-height: 1.25;
}

.brand small {
  margin-top: 2px;
  color: #76bce7;
  font-size: 12px;
}

.main-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 10px;
}

.nav-group {
  margin-bottom: 18px;
}

.nav-group-bottom {
  margin-top: auto;
  margin-bottom: 0;
}

.nav-heading {
  display: block;
  padding: 0 10px 7px;
  color: #81909a;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-link {
  position: relative;
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 9px 11px;
  border-radius: 5px;
  color: #c5ced4;
  font-weight: 500;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: #fff;
  background: var(--sidebar-active);
}

.nav-link.active::before {
  position: absolute;
  inset: 8px auto 8px -10px;
  width: 3px;
  background: #40a9e8;
  content: "";
}

.nav-link svg {
  color: #8fa1ac;
}

.nav-link.active svg {
  color: #60b6e9;
}

.workspace {
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.topbar-title h1 {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.topbar-title span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.user-chip svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.user-chip span {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-form {
  margin: 0;
}

.server-status {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.server-status svg {
  width: 16px;
  height: 16px;
}

.server-status-ok {
  color: #16734b;
  background: #e8f6ee;
  border-color: #bde6cd;
}

.server-status-offline {
  color: #8b5d12;
  background: #fff5dc;
  border-color: #f0d89c;
}

.mobile-nav-button,
.sidebar-scrim {
  display: none;
}

.content {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 24px 28px 40px;
}

.button,
.icon-button,
.text-button {
  border: 0;
  background: none;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.button-primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.button-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.button-secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.button-secondary:hover {
  background: #f7f9fa;
  border-color: #aab6bf;
}

.button-wide {
  width: 100%;
}

.button-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: var(--surface);
}

.icon-button.mobile-nav-button {
  display: none;
}

.icon-button:hover {
  color: var(--blue);
  border-color: #9bc7df;
  background: var(--blue-soft);
}

.icon-button.danger:hover {
  color: var(--red);
  border-color: #edb7bc;
  background: var(--red-soft);
}

.text-button,
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  color: var(--blue-dark);
  font-weight: 650;
}

.text-button:hover,
.text-link:hover,
.row-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.text-link svg {
  width: 15px;
  height: 15px;
}

.back-row {
  margin-bottom: 15px;
}

.alert {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid;
  border-radius: var(--radius);
  font-weight: 600;
}

.alert-success {
  color: #176947;
  background: var(--green-soft);
  border-color: #b8dfcc;
}

.alert-error {
  color: #9d2f39;
  background: var(--red-soft);
  border-color: #efbcc1;
}

.alert-info {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #9bc7df;
}

.period-form select,
.filter-bar select,
.field input,
.field select,
.search-field input,
.table-search input {
  min-height: 40px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
}

.period-form select:focus,
.filter-bar select:focus,
.field input:focus,
.field select:focus,
.search-field input:focus,
.table-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(19, 120, 184, 0.12);
}

.period-form select {
  min-width: 160px;
  padding: 8px 34px 8px 11px;
  font-weight: 600;
}

.source-banner {
  display: flex;
  min-height: 70px;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #e5cf8a;
  border-radius: var(--radius);
  background: #fff9e7;
}

.source-banner-icon {
  display: flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  color: var(--yellow);
  background: var(--yellow-soft);
  border-radius: 6px;
}

.source-banner > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.source-banner strong,
.source-banner span {
  display: block;
}

.source-banner span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
}

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

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

.stat-item {
  display: flex;
  min-width: 0;
  min-height: 94px;
  align-items: center;
  gap: 13px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-icon,
.settings-icon {
  display: flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  border-radius: 6px;
}

.stat-icon.blue,
.settings-icon.blue {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.stat-icon.green,
.settings-icon.green {
  color: var(--green);
  background: var(--green-soft);
}

.stat-icon.yellow,
.settings-icon.yellow {
  color: var(--yellow);
  background: var(--yellow-soft);
}

.stat-icon.red,
.settings-icon.red {
  color: var(--red);
  background: var(--red-soft);
}

.stat-item > div:last-child {
  min-width: 0;
}

.stat-item span,
.stat-item strong {
  display: block;
}

.stat-item span {
  color: var(--muted);
  font-size: 12px;
}

.stat-item strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

.stat-item strong.stat-date {
  font-size: 17px;
}

.dashboard-grid,
.detail-grid,
.source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-bottom: 18px;
}

.panel,
.source-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.section-heading h2,
.source-card h2,
.modal-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
}

.panel-header p,
.modal-header p,
.profile-identity p,
.action-panel p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 13px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #e8ecef;
}

th {
  color: #5d6b76;
  background: #f8f9fa;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

td {
  color: #33414b;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover:not(.detail-row) {
  background: #fbfcfd;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.cell-actions form {
  display: inline-flex;
  margin: 0;
}

.contract-intro {
  margin-bottom: 16px;
}

.contract-intro .panel-header {
  border-bottom: 0;
}

.contract-intro .panel-header p {
  max-width: 680px;
}

.contracts-table td:first-child {
  min-width: 190px;
}

.contract-actions {
  min-width: 92px;
}

.inline-contract-form {
  display: grid;
  gap: 12px;
  padding: 14px 16px 4px;
}

.inline-contract-form .button {
  justify-self: start;
}

.table-footer {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  color: var(--muted);
  background: #fafbfb;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

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

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.badge-success {
  color: #176947;
  background: var(--green-soft);
}

.badge-warning {
  color: #815604;
  background: var(--yellow-soft);
}

.badge-danger {
  color: #9d2f39;
  background: var(--red-soft);
}

.badge-neutral {
  color: #53616c;
  background: #edf1f3;
}

.compact-list {
  padding: 5px 14px;
}

.compact-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 9px 2px;
  border-bottom: 1px solid #e8ecef;
}

.compact-row:last-child {
  border-bottom: 0;
}

a.compact-row:hover .compact-main strong {
  color: var(--blue);
}

.compact-main {
  min-width: 0;
  flex: 1;
}

.compact-main strong,
.compact-main small {
  display: block;
  overflow-wrap: anywhere;
}

.compact-main small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.person-avatar,
.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0b648f;
  background: var(--blue-soft);
  font-weight: 750;
  text-transform: uppercase;
}

.person-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
}

.person-cell {
  display: flex;
  min-width: 190px;
  align-items: center;
  gap: 10px;
}

.person-cell:hover strong {
  color: var(--blue);
}

.empty-state {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin-bottom: 9px;
  color: #8aa0ad;
}

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

.empty-state span {
  margin-top: 3px;
  font-size: 12px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quick-action {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quick-action > svg:first-child {
  color: var(--blue);
}

.quick-action > svg:last-child {
  margin-left: auto;
  color: #96a2aa;
}

.quick-action span {
  min-width: 0;
  flex: 1;
}

.quick-action strong,
.quick-action small {
  display: block;
}

.quick-action small {
  color: var(--muted);
  font-size: 11px;
}

.quick-action:hover {
  border-color: #9bc7df;
  background: #fbfdfe;
}

.filter-bar {
  margin-bottom: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filters-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(170px, 0.7fr) minmax(170px, 0.7fr) auto auto auto;
  gap: 9px;
  align-items: center;
}

.search-field,
.table-search {
  position: relative;
}

.search-field svg,
.table-search svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input,
.table-search input {
  width: 100%;
  padding: 8px 10px 8px 35px;
  cursor: text;
}

.filters-form select {
  width: 100%;
  padding: 8px 30px 8px 10px;
}

.check-control {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.check-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.mono-value,
.mark-list,
.hash-text {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.mark-list {
  color: #334e5e;
  font-size: 12px;
  white-space: nowrap;
}

.mark-chip {
  display: inline-block;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--blue);
  background: var(--blue-bg, #e8f4fd);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all .15s ease;
}
button.mark-chip:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
span.mark-chip {
  color: #334e5e;
  background: var(--neutral-bg, #f1f5f8);
  cursor: default;
}

.profile-header {
  display: flex;
  min-height: 98px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  font-size: 22px;
  border-radius: 50%;
}

.profile-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.profile-title-row h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 19px;
  line-height: 1.25;
}

.profile-rate {
  min-width: 180px;
  padding-left: 20px;
  text-align: right;
  border-left: 1px solid var(--line);
}

.profile-rate span,
.profile-rate strong,
.profile-rate small {
  display: block;
}

.profile-rate span,
.profile-rate small {
  color: var(--muted);
  font-size: 11px;
}

.profile-rate strong {
  margin: 2px 0;
  font-size: 20px;
}

.profile-stats {
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 14px;
  padding: 4px;
  overflow-x: auto;
  background: #e8edef;
  border-radius: 7px;
}

.tab {
  display: inline-flex;
  min-width: max-content;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  color: #53616c;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-weight: 650;
}

.tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(23, 33, 43, 0.12);
}

.tab-panel {
  display: none;
}

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

.summary-list,
.definition-grid,
.source-facts {
  margin: 0;
}

.summary-list {
  padding: 8px 16px 14px;
}

.summary-list > div {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e8ecef;
}

.summary-list > div:last-child {
  border-bottom: 0;
}

.summary-list dt {
  color: var(--ink-soft);
}

.summary-list dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.summary-list .summary-total {
  min-height: 58px;
  margin-top: 4px;
  color: var(--ink);
  border-top: 1px solid var(--line-strong);
}

.summary-list .summary-total dt,
.summary-list .summary-total dd {
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
}

.date-tile {
  display: inline-flex;
  width: 38px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  flex-direction: column;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-radius: 5px;
}

.date-tile strong {
  line-height: 1;
}

.date-tile small {
  margin-top: 2px;
  font-size: 9px;
}

.date-tile svg {
  width: 17px;
  height: 17px;
}

.liquidation-detail {
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
}

.action-panel {
  display: flex;
  min-height: 310px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}

.action-panel h2 {
  margin: 5px 0 0;
  font-size: 28px;
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

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

.definition-grid > div {
  min-width: 0;
  padding: 12px 8px;
  border-bottom: 1px solid #e8ecef;
}

.definition-grid dt {
  color: var(--muted);
  font-size: 11px;
}

.definition-grid dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.text-danger {
  color: var(--red) !important;
}

.table-search {
  width: min(260px, 36vw);
}

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

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

.source-card {
  padding: 18px;
}

.source-card.active-source {
  border-top: 3px solid var(--blue);
}

.source-card-header {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 11px;
}

.source-card-header > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.source-card-header h2 {
  margin-top: 2px;
  font-size: 17px;
}

.source-logo {
  display: flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-radius: 6px;
}

.source-logo.excel {
  color: var(--green);
  background: var(--green-soft);
}

.source-logo.live {
  color: #176947;
  background: var(--green-soft);
}

.source-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 17px 0;
}

.source-facts > div {
  min-width: 0;
  padding: 9px;
  background: #f7f9fa;
  border-radius: 5px;
}

.source-facts dt,
.source-facts dd {
  overflow-wrap: anywhere;
}

.source-facts dt {
  color: var(--muted);
  font-size: 10px;
}

.source-facts dd {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 650;
}

.upload-form {
  display: grid;
  gap: 9px;
}

.source-actions {
  display: grid;
  gap: 8px;
}

.source-actions form {
  margin: 0;
}

.manual-import-actions {
  display: flex;
  max-width: 720px;
  flex-wrap: wrap;
  gap: 10px;
}

.manual-import-actions form {
  flex: 1 1 280px;
}

.manual-import-actions .button {
  width: 100%;
}

.source-path,
.source-error,
.source-inline-error,
.source-note {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
}

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

.source-path svg,
.source-error svg,
.source-inline-error svg,
.source-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.source-path span,
.source-error span,
.source-inline-error span,
.source-note span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-error,
.source-inline-error {
  color: var(--red);
}

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

.file-drop {
  display: flex;
  min-height: 74px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--ink-soft);
  background: #fafbfb;
  border: 1px dashed #aebac2;
  border-radius: 6px;
}

.file-drop:hover,
.file-drop.has-file {
  color: var(--blue-dark);
  background: #f5fbfe;
  border-color: var(--blue);
}

.file-drop > svg {
  width: 25px;
  height: 25px;
  color: var(--blue);
}

.file-drop span {
  min-width: 0;
  flex: 1;
}

.file-drop strong,
.file-drop small {
  display: block;
  overflow-wrap: anywhere;
}

.file-drop small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.excel-preview {
  margin-bottom: 18px;
}

.rate-input {
  width: 112px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.detail-row td {
  padding: 0;
  background: #f7f9fa;
}

.card-days {
  padding: 12px;
}

.card-days table {
  background: var(--surface);
  border: 1px solid var(--line);
}

.time-input {
  width: 86px;
  min-height: 32px;
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.holiday-check {
  width: 17px;
  height: 17px;
  accent-color: var(--yellow);
}

.settings-section {
  margin-bottom: 24px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 9px;
}

.section-heading h2 {
  margin-top: 2px;
  font-size: 16px;
}

.settings-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.settings-row {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-main {
  min-width: 0;
  flex: 1;
}

.settings-main strong,
.settings-main span {
  display: block;
  overflow-wrap: anywhere;
}

.settings-main span,
.settings-value > span:first-child {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.settings-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  text-align: right;
}

.settings-value strong {
  font-size: 18px;
}

.settings-row > form {
  display: flex;
  margin: 0;
}

.source-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 10px;
}

.source-settings-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.source-settings-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.source-path-field input {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.switch-field {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.switch-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-control {
  display: flex;
  width: 38px;
  height: 22px;
  align-items: center;
  padding: 2px;
  background: #b9c2c8;
  border-radius: 11px;
  transition: background 150ms ease;
}

.switch-control span {
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(12, 21, 28, 0.25);
  transition: transform 150ms ease;
}

.switch-field input:checked + .switch-control {
  background: var(--green);
}

.switch-field input:checked + .switch-control span {
  transform: translateX(16px);
}

.switch-field input:focus-visible + .switch-control {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.source-inline-error {
  margin-top: 9px;
  margin-bottom: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 21, 28, 0.55);
  border: 0;
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(12, 21, 28, 0.26);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  justify-content: flex-end;
  background: #fafbfb;
  border-top: 1px solid var(--line);
}

.modal-body {
  padding: 16px;
}

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

.field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  cursor: text;
}

.field select {
  cursor: pointer;
}

.field-full {
  grid-column: 1 / -1;
}

.field-hint {
  color: var(--blue);
  font-size: 12px;
  margin-top: -2px;
}

.money-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
}

.money-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(19, 120, 184, 0.12);
}

.money-input > span {
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  background: #f3f5f6;
  border-right: 1px solid var(--line);
}

.money-input input {
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters-form {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 0.6fr));
  }

  .filters-form .check-control,
  .filters-form .button,
  .filters-form .icon-button {
    grid-row: 2;
  }

  .employee-table th:nth-child(3),
  .employee-table td:nth-child(3),
  .settlements-table th:nth-child(4),
  .settlements-table td:nth-child(4) {
    display: none;
  }
}

/* Colapsa el sidebar a menu deslizable antes de perder ancho de contenido:
   a 1024px (la PC del reloj) ya gana todo el ancho para el contenido. */
@media (max-width: 1100px) {
  .sidebar {
    width: min(290px, calc(100vw - 48px));
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    width: 100%;
    height: 100%;
    background: rgba(12, 21, 28, 0.5);
    border: 0;
  }

  body.nav-open .sidebar-scrim {
    display: block;
  }

  .workspace {
    width: 100%;
    margin-left: 0;
  }

  .icon-button.mobile-nav-button {
    display: inline-flex;
  }

  .content {
    padding-right: 20px;
    padding-left: 20px;
  }

  .topbar {
    padding-right: 20px;
    padding-left: 20px;
  }
}

/* Pantallas bajas (1024x768 y similares): menos aire vertical fijo. */
@media (max-height: 800px) {
  .brand {
    min-height: 60px;
    padding: 10px 18px;
  }

  .topbar {
    min-height: 60px;
  }

  .content {
    padding-top: 16px;
  }
}

@media (max-width: 980px) {
  .dashboard-grid,
  .detail-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

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

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

  .profile-header {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: relative;
    min-height: 70px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }

  .topbar-title {
    min-height: 42px;
  }

  .topbar-title h1 {
    font-size: 18px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .content {
    padding: 16px 12px 30px;
  }

  .source-banner {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .source-banner .button {
    width: 100%;
  }

  .stats-grid,
  .stats-grid-three {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-item {
    min-height: 82px;
    gap: 9px;
    padding: 11px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .stat-item strong,
  .stat-item strong.stat-date {
    font-size: 16px;
  }

  .panel-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .panel-header .table-search {
    width: 100%;
  }

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

  .filters-form .check-control,
  .filters-form .button,
  .filters-form .icon-button {
    grid-row: auto;
  }

  .filter-bar select {
    width: 100%;
  }

  .profile-header {
    flex-direction: column;
  }

  .profile-rate {
    width: 100%;
    padding: 12px 0 0;
    text-align: left;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .profile-avatar {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .profile-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
    border-radius: 0;
  }

  .definition-grid,
  .form-grid,
  .source-facts {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: auto;
  }

  .settings-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .settings-value {
    width: calc(100% - 55px);
    margin-left: 55px;
    justify-content: flex-start;
    text-align: left;
  }

  .source-settings-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .source-settings-fields {
    grid-template-columns: 1fr;
  }

  .source-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .table-wrap {
    overflow: visible;
  }

  .table-wrap > table,
  .table-wrap > table > tbody,
  .table-wrap > table > tbody > tr,
  .table-wrap > table > tbody > tr > td {
    display: block;
    width: 100%;
  }

  .table-wrap > table > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .table-wrap > table > tbody > tr {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
  }

  .table-wrap > table > tbody > tr:last-child {
    border-bottom: 0;
  }

  .table-wrap > table > tbody > tr > td {
    display: grid;
    grid-template-columns: minmax(105px, 0.42fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 34px;
    padding: 5px 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .table-wrap > table > tbody > tr > td::before {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .table-wrap > table > tbody > tr > td[colspan] {
    display: block;
  }

  .table-wrap > table > tbody > tr > td[colspan]::before,
  .table-wrap > table > tbody > tr > td.cell-actions::before {
    display: none;
  }

  .table-wrap > table > tbody > tr > td.cell-actions {
    display: flex;
    min-height: 40px;
    justify-content: flex-end;
    padding-top: 8px;
  }

  .employee-table th:nth-child(3),
  .employee-table td:nth-child(3),
  .settlements-table th:nth-child(4),
  .settlements-table td:nth-child(4) {
    display: grid;
  }

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

  .mark-list {
    white-space: normal;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-dialog {
    width: 100%;
    max-height: 92vh;
    border-radius: 7px 7px 0 0;
  }
}

@media (max-width: 440px) {
  .stats-grid,
  .stats-grid-three {
    grid-template-columns: 1fr;
  }

  .button span {
    overflow-wrap: anywhere;
  }

  .topbar-actions .button {
    min-width: max-content;
  }

  .source-card,
  .panel-header {
    padding-right: 12px;
    padding-left: 12px;
  }
}
