:root {
  --blue-950: #063a57;
  --blue-800: #075b86;
  --blue-700: #0576b0;
  --blue-600: #0a8ed1;
  --blue-500: #00a0eb;
  --blue-300: #6dcbf7;
  --sky-50: #f1f9fd;
  --sky-100: #e3f3fc;
  --ink-700: #33394a;
  --slate-400: #8b93a5;
  --slate-300: #d8d3c7;
  --slate-200: #dee1e8;
  --success: #2f7a4d;
  --success-bg: #e7f3eb;
  --warn: #9a6b1e;
  --warn-bg: #fbf0dc;
  --danger: #b3453a;
  --danger-bg: #fbebe9;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink-700);
  background: var(--sky-50);
  font-family: Inter, Arial, sans-serif;
}

a {
  color: inherit;
}

.auth-body {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 64px;
  color: #fff;
  background: radial-gradient(120% 140% at 15% 10%, var(--blue-700) 0%, var(--blue-950) 65%);
}

.brand,
.mobile-brand {
  color: #fff;
  font-family: Fraunces, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
}

.brand span {
  color: var(--blue-300);
}

.brand-copy {
  max-width: 460px;
}

.brand img {
  max-height:75px;
  width:auto;
  display:block;
  margin: 0 auto;
}

.eyebrow,
.tag {
  color: var(--blue-300);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin: 16px 0;
  color: var(--blue-300);
  font-family: Fraunces, Georgia, serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1.18;
}

.brand-copy p,
.brand-footer {
  color: #c7cedd;
  line-height: 1.65;
}

.auth-card-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card {
  width: min(100%, 420px);
}

.mobile-brand {
  display: none;
  margin-bottom: 28px;
  color: var(--navy-950);
}

.row-action{
  margin-left: 5px;
}

h1,
h2,
h3 {
  color: var(--navy-950);
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
}

h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

h3 {
  margin: 0 0 18px;
  font-size: 20px;
}

.sub,
.hint {
  color: var(--slate-500);
  font-size: 14px;
}

.hint {
  margin-top: 18px;
  font-size: 12px;
}

label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--ink-700);
  background: #fff;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(0, 160, 235, .18);
}

input[type="button"] {
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 18px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary {
  color: #fff;
  background: var(--blue-950);
}

.btn.primary:hover {
  background: var(--blue-700);
}

.btn.ghost {
  border-color: var(--slate-300);
  color: var(--blue-800);
  background: #fff;
}

.btn.full {
  width: 100%;
  margin-top: 22px;
}

.alert {
  margin-bottom: 18px;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  display: block;
  position: relative;
}

.alert.success {
  color: var(--success);
  background: var(--success-bg);
}

.alert.error {
  color: var(--danger);
  background: var(--danger-bg);
}

.alert.warning {
  color: var(--warn);
  background: var(--warn-bg);
}

.app-shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
  color: #fff;
  background: var(--blue-950);
}

.sidebar .tag {
  margin: 6px 0 34px;
}

.nav-item,
.sidebar-logout button {
  display: flex;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 11px 12px;
  color: #c7cedd;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 3px;
}

.nav-item.active,
.nav-item:hover,
.sidebar-logout button:hover {
  color: #fff;
  background: var(--blue-700);
}

.sidebar-logout {
  margin-top: 6px;
}

.sidebar-foot {
  display: block;
  color: #8fa0c4;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-foot.active,
.sidebar-foot:hover {
  color: var(--blue-300);
}

.changelog-entry {
  display: grid;
  padding: 24px;
}

.changelog-entry-header {
    gap: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
}
.changelog-entry h4 {
  margin: 0;
}

.mobile-version-link {
  display: none;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-bottom: 1px solid var(--slate-200);
  padding: 20px 32px;
  background: #fff;
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue-500);
}

.mobile-nav {
  display: none;
}

.mobile-logout {
  margin: 0;
}

.mobile-logout button {
  display: flex;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--blue-800);
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.content {
  padding: 32px;
}

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

.stat-card,
.table-card,
.form-card {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: #fff;
}

.stat-card {
  padding: 18px 20px;
}

.stat-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--slate-500);
  font-size: 13px;
}

.stat-card strong {
  color: var(--navy-950);
  font-family: Fraunces, Georgia, serif;
  font-size: 30px;
  font-weight: 500;
}

.section {
  margin-top: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 20px;
}

.toolbar {
  margin-bottom: 16px;
}

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

.filter-toolbar input[type="search"] {
  flex: 1 1 300px;
  max-width: 440px;
}

.filter-toolbar select {
  flex: 0 1 190px;
  max-width: 220px;
}

.filter-toolbar .btn {
  flex: 0 0 auto;
}

.table-card {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #f1efe9;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 0.8rem;
}

td {
    padding: 7px 9px 7px 15px;
}
th {
  padding: 14px 18px;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fcfbf8;
}

tr[data-row-link] {
  cursor: pointer;
}

.strong {
  color: var(--navy-950);
  font-weight: 800;
}

.ref {
  color: var(--navy-700);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.empty {
  padding: 34px;
  color: var(--slate-500);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.pill.pending,
.pill.invited {
  color: var(--warn);
  background: var(--warn-bg);
}

.pill.review {
  color: var(--navy-700);
  background: #eaeef5;
}

.pill.draft,
.pill.uploaded,
.pill.invoiced,
.pill.issued {
  color: var(--warn);
  background: var(--warn-bg);
}

.pill.formalized,
.pill.completed,
.pill.paid,
.pill.active {
  color: var(--success);
  background: var(--success-bg);
}

.pill.blocked,
.pill.canceled,
.pill.suspended {
  color: var(--danger);
  background: var(--danger-bg);
}

.form-panel {
  max-width: 860px;
}

.form-card {
  padding: 24px;
}

.form-section {
  min-width: 0;
  border: 0;
  border-top: 1px solid var(--slate-200);
  margin: 0 0 22px;
  padding: 20px 0 0;
}

.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.form-section legend {
  padding: 0 10px 0 0;
  color: var(--navy-950);
  font-family: Fraunces, Georgia, serif;
  font-size: 19px;
  font-weight: 500;
}

.form-card.compact {
  align-self: start;
}

.compact-form {
  margin-bottom: 22px;
}

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

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

.segmented-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.radio-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  padding: 0 14px;
  background: #fff;
  cursor: pointer;
}

.radio-card input {
  width: auto;
  accent-color: var(--gold-500);
}

.radio-card:has(input:checked) {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(184, 135, 61, .12);
}

.field-help {
  margin: 0 0 12px;
  color: var(--slate-500);
  font-size: 13px;
}

.file-drop {
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius);
  padding: 18px;
  background: #fcfbf8;
}

.file-drop label {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

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

.actions-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 24px;
}

.tab-btn {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 18px;
  color: var(--slate-500);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab-btn.active {
  border-bottom-color: var(--gold-500);
  color: var(--navy-950);
}

.tab-panel {
  display: none;
}

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

.two-cols {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

.auto-create-grid {
  grid-template-columns: minmax(140px, 220px) minmax(120px, 160px) auto;
  align-items: end;
}

.form-end {
  align-self: end;
  padding-bottom: 0;
}

.invoice-upload {
  margin-top: 18px;
}

.inline-form select {
  min-width: 140px;
  padding: 7px 9px;
  font-size: 13px;
}

.invoice-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-text {
  margin-top: 6px;
  font-size: 9px;
  white-space: normal;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.report-actions {
  justify-content: space-between;
}

.commission-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.commission-summary div {
  min-width: 170px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
}

.commission-summary span,
.commission-summary small {
  display: block;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 700;
}

.commission-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--navy-950);
  font-size: 18px;
}

.check-cell {
  width: 46px;
  text-align: center;
}

.check-cell input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold-500);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.pagination-summary,
.page-current {
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 700;
}

.pagination-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--navy-800);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.page-link:hover {
  border-color: var(--gold-500);
  color: var(--navy-950);
}

.page-link.disabled {
  color: var(--slate-300);
  cursor: not-allowed;
}

.page-current {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
}

.status-inline-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.status-inline-form textarea {
  grid-column: 1 / -1;
  min-width: 220px;
  font-size: 13px;
}

.table-link {
  color: inherit;
  text-decoration: none;
}

.table-link:hover {
  color: var(--navy-700);
  text-decoration: underline;
}

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

.detail-panel {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 22px;
  background: #fff;
}

.detail-panel h3 {
  margin-bottom: 14px;
}

.detail-list {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

.detail-list dt {
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  color: var(--ink-700);
  overflow-wrap: anywhere;
}

.detail-text {
  margin: 0 0 22px;
  line-height: 1.6;
}

.inline-edit {
  border-top: 1px solid var(--slate-200);
  margin-top: 18px;
  padding-top: 18px;
}

.inline-edit-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.inline-edit-row input {
  max-width: 180px;
}

.inline-edit-row select {
  max-width: 220px;
}

.status-reason {
  margin-top: 12px;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid #f1efe9;
  padding: 10px 0;
}

.file-list small {
  color: var(--slate-500);
  white-space: nowrap;
}

.state-page {
  max-width: 520px;
  margin: 60px auto;
  text-align: center;
}

@media (max-width: 920px) {
  .auth-shell,
  .app-shell,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .brand-panel,
  .sidebar {
    display: none;
  }

  .mobile-brand {
    display: block;
  }

  .mobile-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    overflow-x: visible;
    padding-bottom: 2px;
  }

  .mobile-nav .nav-item,
  .mobile-logout button {
    width: auto;
    flex: 0 1 auto;
    border: 1px solid var(--slate-200);
    color: var(--navy-800);
    background: #fff;
    white-space: nowrap;
  }

  .mobile-nav .nav-item.active,
  .mobile-nav .nav-item:hover,
  .mobile-logout button:hover {
    border-color: var(--blue-500);
    color: #fff;
    background: var(--blue-500);
  }

  .mobile-version-link {
    display: block;
    width: max-content;
    margin: 0 0 0 auto;
    padding: 0 4px;
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-version-link.active,
  .mobile-version-link:hover {
    color: var(--gold-700);
  }

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

@media (max-width: 620px) {
  .content,
  .topbar {
    padding: 20px;
  }

  .topbar-main {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .user-chip span:first-child {
    display: none;
  }

  .stats-grid,
  .form-grid,
  .auto-create-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-toolbar input[type="search"],
  .filter-toolbar select,
  .filter-toolbar .btn {
    flex-basis: auto;
    max-width: none;
    width: 100%;
  }

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

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

  .invoice-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .table-card {
    overflow-x: visible;
  }

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: grid;
    gap: 12px;
  }

  .responsive-table tr {
    border: 1px solid #f1efe9;
    border-radius: var(--radius);
    padding: 12px;
    background: #fff;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border-bottom: 0;
    padding: 8px 0;
    white-space: normal;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--slate-500);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .responsive-table td.empty {
    display: block;
    padding: 18px;
    text-align: center;
  }

  .responsive-table td.empty::before {
    content: none;
  }

  .responsive-table .check-cell {
    width: 100%;
    text-align: left;
  }

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

  .status-inline-form textarea {
    min-width: 0;
    width: 100%;
  }

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

  .pagination-links {
    justify-content: flex-start;
  }

  .commission-summary div {
    width: 100%;
  }
}

.alert .close{
	  font-size: 1.375rem;
    padding: 0 6px 4px;
    line-height: 0.9em;
    position: absolute;
    top: 50%;
    display: table;
    margin-top: -0.7rem;
    right: 0.25rem;
    color: #333333;
    opacity: 0.3;
    background: inherit;
}

.alert .close:hover{
    cursor: pointer;
}