:root {
  --bg: #f4fbfa;
  --surface: #ffffff;
  --surface-soft: #e9faf6;
  --ink: #17312f;
  --muted: #627772;
  --line: #d5ebe6;
  --brand: #00a88f;
  --brand-dark: #007d73;
  --accent: #16b8e5;
  --sun: #f8c93c;
  --coral: #ff6f61;
  --danger: #d9364b;
  --ok: #139b5f;
  --warn: #d48a00;
  --shadow: 0 18px 46px rgba(0, 125, 115, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 251, 250, 0.94)),
    linear-gradient(90deg, rgba(0, 168, 143, 0.12), rgba(22, 184, 229, 0.1) 48%, rgba(248, 201, 60, 0.08));
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.35;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  border: 0;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

button:active {
  transform: translateY(1px);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 122, 107, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(195, 111, 54, 0.14), transparent 44%),
    var(--bg);
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1,
.view-title h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.login-panel p,
.view-title p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #2f3d39;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 74px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(31, 122, 107, 0.2);
  border-color: var(--brand);
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #edf4f1;
  color: var(--brand-dark);
  border: 1px solid #cfe1da;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger {
  background: #faeaea;
  color: var(--danger);
}

.message {
  margin-top: 14px;
  min-height: 22px;
  color: var(--danger);
  font-size: 14px;
}

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

.sidebar {
  background: #152523;
  color: #f7fbf8;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  background: #f7fbf8;
  display: grid;
  place-items: center;
  color: #152523;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span {
  display: block;
  color: #aec1bd;
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  min-height: 42px;
  border-radius: 6px;
  color: #dbe8e4;
  background: transparent;
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: #b7c8c4;
  font-size: 13px;
}

.content {
  min-width: 0;
  padding: 24px;
}

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

.view-title {
  min-width: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.toolbar .field {
  margin-top: 0;
  min-width: min(180px, 100%);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.commission-split {
  display: grid;
  grid-template-columns: minmax(300px, var(--commission-form-width, 380px)) 12px minmax(0, 1fr);
  align-items: start;
}

.commission-split > .panel {
  min-width: 0;
}

.splitter {
  width: 12px;
  min-height: 100%;
  cursor: col-resize;
  position: relative;
}

.splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  background: var(--line);
}

.splitter:hover::before,
.splitter.active::before {
  background: var(--brand);
}

.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(32, 42, 39, 0.06);
}

.panel {
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

th,
td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: #43514d;
  font-size: 12px;
  text-transform: uppercase;
  background: #f1f5f2;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  background: #edf1ef;
  color: #42504c;
}

.pill.ok {
  background: #e7f4eb;
  color: var(--ok);
}

.pill.warn {
  background: #fff3dd;
  color: var(--warn);
}

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

.form-grid .span {
  grid-column: 1 / -1;
}

.permission-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(82px, 1fr));
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfffe;
}

.permission-grid label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.permission-grid input {
  width: auto;
  min-height: 0;
}

.actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

td .actions {
  margin-top: 0;
  gap: 6px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tabs button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 700;
}

.tabs button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.tabs.compact {
  margin-bottom: 12px;
}

.tabs.compact button {
  min-height: 32px;
  font-size: 13px;
}

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

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(32, 42, 39, 0.06);
  min-width: 0;
}

.dashboard-card.span-2 {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 18px;
}

.period-controls {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.period-controls label {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.period-controls select,
.period-controls input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  color: var(--ink);
  max-width: 100%;
}

.alert-card {
  border-color: #e4b4b4;
  background: #fff8f8;
}

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

.alert-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #efc8c8;
  background: #fff;
  border-radius: 6px;
  padding: 10px;
}

.alert-row strong {
  min-width: 0;
}

.alert-row span {
  color: var(--danger);
  font-weight: 700;
}

.alert-row em {
  color: #fff;
  background: var(--danger);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.mini-bars {
  display: grid;
  gap: 10px;
}

.mini-bar {
  display: grid;
  gap: 6px;
}

.mini-bar div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.mini-bar strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-bar span {
  color: var(--muted);
  font-weight: 700;
}

.mini-bar i {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: var(--brand);
}

.goal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.goal-filters select,
.goal-filters input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  color: var(--ink);
  max-width: 100%;
}

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

.goal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 12px;
}

.goal-card h3,
.goal-card p {
  margin: 0;
}

.goal-card p {
  margin-top: 4px;
  color: var(--muted);
}

.goal-progress {
  height: 10px;
  border-radius: 999px;
  background: #edf1ef;
  overflow: hidden;
}

.goal-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.goal-card.red .goal-progress i {
  background: var(--danger);
}

.goal-card.dark .goal-progress i {
  background: #111;
}

.goal-card.star .goal-progress i,
.goal-card.super .goal-progress i {
  background: #d9a514;
}

.goal-celebration {
  min-height: 46px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 800;
}

.goal-celebration span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
}

.goal-celebration.red span,
.goal-celebration.dark span {
  border-radius: 999px;
  animation: glow 1.1s ease-in-out infinite alternate;
}

.goal-celebration.red span {
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger);
}

.goal-celebration.dark span {
  background: #111;
  box-shadow: 0 0 12px #111;
}

.goal-celebration.stars span,
.goal-celebration.super span {
  color: #d9a514;
  font-size: 28px;
  animation: spin-star 1.6s linear infinite;
}

.goal-celebration.super span {
  width: 34px;
  height: 34px;
  font-size: 42px;
  text-shadow: 0 0 16px #d9a514;
}

@keyframes glow {
  from { transform: scale(0.85); opacity: 0.65; }
  to { transform: scale(1.15); opacity: 1; }
}

@keyframes spin-star {
  from { transform: rotate(0deg) scale(0.9); }
  to { transform: rotate(360deg) scale(1.08); }
}

body {
  font-size: 15px;
}

.login-screen {
  background:
    linear-gradient(140deg, rgba(0, 168, 143, 0.18), transparent 42%),
    linear-gradient(320deg, rgba(22, 184, 229, 0.18), transparent 46%),
    linear-gradient(180deg, #ffffff, var(--bg));
}

.login-panel,
.panel,
.card,
.dashboard-card,
.metric,
.table-wrap {
  border-color: rgba(0, 168, 143, 0.18);
  box-shadow: var(--shadow);
}

.login-panel,
.panel,
.dashboard-card {
  position: relative;
  overflow: hidden;
}

.login-panel::before,
.panel::before,
.dashboard-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--accent), var(--sun));
}

.login-panel h1,
.view-title h1 {
  color: #0f3935;
}

.field label,
.period-controls label {
  color: #315a55;
}

.field input,
.field select,
.field textarea,
.period-controls select,
.period-controls input,
.goal-filters select,
.goal-filters input {
  border-color: #cfe8e3;
  background: #fbfffe;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.period-controls select:focus,
.period-controls input:focus,
.goal-filters select:focus,
.goal-filters input:focus {
  outline: 3px solid rgba(22, 184, 229, 0.18);
  border-color: var(--accent);
}

.primary {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 10px 22px rgba(0, 168, 143, 0.24);
}

.primary:hover {
  background: linear-gradient(135deg, var(--brand-dark), #0a9fca);
}

.secondary {
  background: #e8fbf5;
  color: var(--brand-dark);
  border-color: #bdebe0;
}

.secondary:hover {
  background: #d7f7ee;
}

.ghost {
  background: #ffffff;
  color: var(--brand-dark);
  border-color: #cfe8e3;
}

.danger {
  background: #fff0f2;
  border: 1px solid #ffc7d0;
}

.shell {
  grid-template-columns: 268px minmax(0, 1fr);
}

.sidebar {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-right: 1px solid rgba(0, 168, 143, 0.18);
  box-shadow: 12px 0 30px rgba(0, 125, 115, 0.07);
}

.brand {
  padding: 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e9faf6, #effbff);
  border: 1px solid #d3eee8;
}

.brand-logo {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 168, 143, 0.28);
}

.brand span,
.sidebar-footer {
  color: var(--muted);
}

.nav {
  gap: 8px;
}

.nav button {
  color: #315a55;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(0, 168, 143, 0.22);
}

.content {
  padding: 28px;
}

.shell {
  transition: grid-template-columns 180ms ease;
}

.sidebar {
  transition: width 180ms ease, padding 180ms ease;
}

.brand-copy,
.nav-full,
.sidebar-footer span {
  transition: opacity 140ms ease, width 180ms ease;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid #cfe8e3;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}

.sidebar-toggle:hover {
  background: #e8fbf5;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.nav-primary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell.sidebar-collapsed {
  grid-template-columns: 112px minmax(0, 1fr);
}

.shell.sidebar-collapsed .sidebar {
  padding-inline: 10px;
}

.shell.sidebar-collapsed .brand {
  justify-content: center;
  padding: 8px;
}

.shell.sidebar-collapsed .brand-copy,
.shell.sidebar-collapsed .sidebar-footer span,
.shell.sidebar-collapsed .nav-full {
  display: none;
}

.shell.sidebar-collapsed .brand-logo {
  width: 40px;
  height: 40px;
}

.shell.sidebar-collapsed .nav button {
  justify-content: center;
  padding: 0;
  text-align: center;
}

.shell.sidebar-collapsed .sidebar-footer {
  justify-items: center;
}

.shell.sidebar-collapsed #logout {
  width: 100%;
  padding-inline: 0;
  font-size: 12px;
}

.topbar {
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(0, 168, 143, 0.14);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 125, 115, 0.06);
}

.metric {
  background:
    linear-gradient(180deg, #ffffff, #f7fffd);
}

.metric span {
  color: #4b7770;
}

.metric strong {
  color: #0f3935;
}

.table-wrap {
  background: #fff;
}

th {
  background: #e8fbf5;
  color: #24625c;
}

tr:hover td {
  background: #fbfffe;
}

.pill {
  background: #e9faf6;
  color: var(--brand-dark);
}

.pill.ok {
  background: #e4f8ed;
  color: var(--ok);
}

.pill.warn {
  background: #fff5d8;
  color: #9a6400;
}

.tabs button {
  border-color: #cfe8e3;
  background: #fff;
}

.tabs button.active {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-color: transparent;
}

.dashboard-card {
  background: linear-gradient(180deg, #ffffff, #fbfffe);
}

.alert-card {
  border-color: #ffc7d0;
  background: #fff7f8;
}

.alert-row {
  border-color: #ffd0d7;
}

.mini-bar i {
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.goal-card {
  border-color: #d5ebe6;
  background: linear-gradient(180deg, #fff, #fbfffe);
}

.goal-card.super {
  border-color: #ffe28a;
  background: linear-gradient(180deg, #fffdf3, #ffffff);
}

.installments,
.commission-lines {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.installment-history-line {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 220px;
}

.installment-history-line + .installment-history-line {
  margin-top: 6px;
}

.installment-history-line span {
  min-width: 0;
}

.mini-action {
  min-height: 30px;
  padding-inline: 10px;
  font-size: 12px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.attachment-list a {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.report-filters {
  margin-bottom: 18px;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-row label {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 700;
}

.check-row input {
  width: auto;
  min-height: 0;
}

.report-grid {
  margin-bottom: 16px;
}

.report-section {
  margin-top: 16px;
}

.global-search {
  position: relative;
}

.global-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.global-search input::placeholder {
  color: #94a3b8;
}

.search-results {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: 44px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-results button {
  display: grid;
  gap: 3px;
  padding: 9px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.search-results button:hover {
  background: var(--surface-soft);
}

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

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
}

.modal-card {
  width: min(460px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal-card h2,
.modal-card p {
  margin: 0;
}

.modal-card p {
  color: var(--muted);
}

.modal-card input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.modal-choices {
  display: grid;
  gap: 8px;
}

.floating-backdrop {
  align-items: start;
  overflow-y: auto;
}

.floating-page {
  width: min(980px, 100%);
  margin: 22px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.floating-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.floating-head h2,
.floating-head p {
  margin: 0;
}

.floating-head p {
  margin-top: 4px;
  color: var(--muted);
}

.floating-body {
  padding: 18px;
}

.icon-close {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 22px;
}

.module-history-panel {
  min-height: 360px;
}

.line-item {
  display: grid;
  grid-template-columns: 72px 1fr 1fr;
  gap: 8px;
  align-items: end;
}

.commission-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.8fr 1fr;
  gap: 8px;
  align-items: end;
}

.empty {
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.print-page {
  background: #fff;
  color: #111;
  padding: 28px;
}

.print-page h1 {
  margin: 0 0 4px;
}

.print-page .muted {
  color: #555;
  margin-bottom: 20px;
}

.hide {
  display: none !important;
}

/* Modern SaaS dashboard theme */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #172033;
  --muted: #6b7280;
  --line: #e6eaf0;
  --brand: #635bff;
  --brand-dark: #4f46e5;
  --accent: #00d4ff;
  --sun: #fbbf24;
  --coral: #fb7185;
  --danger: #e11d48;
  --ok: #059669;
  --warn: #d97706;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

.login-screen {
  background:
    radial-gradient(circle at top left, rgba(99, 91, 255, 0.16), transparent 34%),
    linear-gradient(180deg, #ffffff, var(--bg));
}

.login-panel,
.panel,
.card,
.dashboard-card,
.metric,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel::before,
.panel::before,
.dashboard-card::before {
  display: none;
}

.shell {
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, #111827 0%, #0f172a 52%, #0b1120 100%);
  color: #eef2ff;
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 14px 0 34px rgba(15, 23, 42, 0.16);
}

.brand {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.brand-logo {
  background: linear-gradient(135deg, var(--brand), #7c3aed 55%, var(--accent));
  color: #fff;
  box-shadow: 0 12px 24px rgba(99, 91, 255, 0.28);
}

.brand strong {
  color: #ffffff;
}

.brand span,
.sidebar-footer {
  color: #9ca3af;
}

.nav button {
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 44px;
}

.nav button.active,
.nav button:hover {
  color: #ffffff;
  background: rgba(99, 91, 255, 0.18);
  border-color: rgba(129, 140, 248, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.12);
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
}

.sidebar-toggle:hover {
  background: rgba(99, 91, 255, 0.22);
  color: #ffffff;
}

.sidebar-footer .ghost,
#logout {
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  border-color: rgba(255, 255, 255, 0.12);
}

.content {
  padding: 32px;
}

.topbar {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.view-title h1,
.login-panel h1 {
  color: #0f172a;
  font-weight: 800;
}

.view-title p,
.login-panel p,
.empty {
  color: var(--muted);
}

.field label,
.period-controls label {
  color: #475569;
  font-size: 12px;
  letter-spacing: 0;
}

.field input,
.field select,
.field textarea,
.period-controls select,
.period-controls input,
.goal-filters select,
.goal-filters input {
  background: #ffffff;
  border-color: #d9dee8;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.period-controls select:focus,
.period-controls input:focus,
.goal-filters select:focus,
.goal-filters input:focus {
  outline: 3px solid rgba(99, 91, 255, 0.14);
  border-color: var(--brand);
}

.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px rgba(99, 91, 255, 0.24);
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #ffffff;
  color: #334155;
  border-color: #d9dee8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.ghost {
  background: #ffffff;
  color: #334155;
  border-color: #d9dee8;
}

.danger {
  background: #fff1f2;
  color: var(--danger);
  border: 1px solid #fecdd3;
}

.metric {
  background: #ffffff;
}

.metric span {
  color: #64748b;
}

.metric strong {
  color: #0f172a;
  font-weight: 800;
}

th {
  background: #f8fafc;
  color: #64748b;
}

td {
  color: #1f2937;
}

tr:hover td {
  background: #f8fafc;
}

.pill {
  background: #eef2ff;
  color: var(--brand-dark);
}

.pill.ok {
  background: #dcfce7;
  color: var(--ok);
}

.pill.warn {
  background: #fff7ed;
  color: var(--warn);
}

.tabs button {
  border-color: #d9dee8;
  background: #ffffff;
  color: #334155;
}

.tabs button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.dashboard-card,
.goal-card {
  background: #ffffff;
}

.alert-card {
  border-color: #fecdd3;
  background: #fff7f8;
}

.alert-row {
  border-color: #ffe4e6;
}

.mini-bar i {
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.shell.sidebar-collapsed {
  grid-template-columns: 104px minmax(0, 1fr);
}

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

  .shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    z-index: 3;
    padding: 12px;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }

  .shell.sidebar-collapsed .sidebar {
    padding: 12px;
  }

  .brand {
    min-height: 48px;
  }

  .shell.sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  .shell.sidebar-collapsed .brand-copy,
  .shell.sidebar-collapsed .sidebar-footer span,
  .shell.sidebar-collapsed .nav-full {
    display: block;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .nav button {
    background: rgba(255, 255, 255, 0.04);
    color: #dbe4f0;
  }

  .nav-primary {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .nav button {
    text-align: center;
    padding: 0 14px;
    min-width: max-content;
  }

  .shell.sidebar-collapsed .nav button {
    display: flex;
    padding: 0 14px;
  }

  .sidebar-footer {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .content {
    padding: 18px;
  }

  .grid.two,
  .commission-split,
  .dashboard,
  .goal-grid,
  .grid.three,
  .summary {
    grid-template-columns: 1fr;
  }

  .commission-split {
    display: block;
  }

  .dashboard-card.span-2 {
    grid-column: auto;
  }

  .card-head,
  .alert-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .splitter {
    display: none;
  }

  .period-controls,
  .goal-filters {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 12px;
  }

  .login-screen {
    padding: 14px;
  }

  .login-panel,
  .panel,
  .dashboard-card,
  .floating-body,
  .floating-head {
    padding: 14px;
  }

  .floating-backdrop {
    padding: 0;
  }

  .floating-page {
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .view-title h1,
  .login-panel h1 {
    font-size: 24px;
  }

  .topbar,
  .toolbar,
  .card-head,
  .goal-filters,
  .period-controls {
    display: grid;
    width: 100%;
  }

  .toolbar .field,
  .period-controls select,
  .period-controls input,
  .goal-filters select,
  .goal-filters input {
    width: 100%;
  }

  .form-grid,
  .line-item,
  .commission-row,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .summary {
    gap: 10px;
  }

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

  table {
    min-width: 680px;
  }

  th,
  td {
    padding: 10px;
  }

  .primary,
  .secondary,
  .ghost,
  .danger {
    width: 100%;
  }

  .mini-action {
    width: auto;
  }

  .actions {
    display: grid;
  }

  td .actions {
    display: flex;
  }
}

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

  .brand {
    padding: 8px;
  }

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

  .brand span,
  .sidebar-footer {
    font-size: 12px;
  }

  .nav button {
    min-height: 40px;
    padding: 0 12px;
  }

  .metric {
    padding: 12px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .shell,
  .login-screen {
    display: none !important;
  }

  .print-page {
    display: block !important;
  }
}
