:root {
  --bg: #f5f6f8;
  --ink: #182d35;
  --muted: #6e7d86;
  --border: #e1e7eb;
  --teal: #087e82;
  --soft: #e5f3f1;
  --amber: #9c6219;
  --red: #b74840;
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.65 var(--font);
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  outline-offset: 3px;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
  padding: 9px 15px;
  border-radius: 8px;
  font-weight: 550;
}
button:hover {
  border-color: var(--teal);
  color: var(--teal);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}
.primary:hover {
  color: white;
  background: #066c70;
}
.danger {
  color: var(--red);
}
.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--teal);
}
a {
  color: var(--teal);
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 28px;
  letter-spacing: -1px;
  margin-bottom: 6px;
}
h2 {
  font-size: 20px;
  margin-bottom: 16px;
}
h3 {
  font-size: 15px;
  margin-bottom: 12px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 16px 0 28px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: -0.6px;
}
.logo span {
  font-size: 20px;
  color: var(--ink);
}
.nav {
  border: 0;
  background: transparent;
  font-weight: 500;
}
.nav.active {
  color: var(--teal);
  background: var(--soft);
}
.topbar {
  min-height: 62px;
  border-bottom: 1px solid var(--border);
  background: white;
  padding: 10px max(22px, calc((100% - 1160px) / 2));
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
}
.topbar nav, .account-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.account-actions {
  margin-left: auto;
}
#content {
  max-width: 1232px;
  margin: auto;
  padding: 32px 36px 60px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  gap: 15px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 15px;
}
.card-head h2,
.card-head h3 {
  margin: 0;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
th {
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th:first-child,
td:first-child {
  padding-left: 0;
}
tbody tr:last-child td {
  border: 0;
}
td b {
  display: block;
  font-weight: 600;
}
.badge {
  font-size: 11px;
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  background: #edf0f4;
  color: #617481;
  white-space: nowrap;
}
.badge.active,
.badge.sent,
.badge.approved {
  background: var(--soft);
  color: var(--teal);
}
.badge.paused,
.badge.unknown,
.badge.open {
  background: #fff3e2;
  color: var(--amber);
}
.badge.cancelled,
.badge.failed {
  background: #fbecea;
  color: var(--red);
}
.empty {
  text-align: center;
  padding: 45px 20px;
  color: var(--muted);
}
.empty strong {
  display: block;
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 8px;
}
.empty .actions {
  justify-content: center;
  margin-top: 20px;
}
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: 20px;
}
.stack > *:last-child {
  margin-bottom: 0;
}
.notice {
  border-left: 3px solid #e2ae65;
  background: #fff8ef;
  padding: 13px 16px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #8c632e;
}
.raw {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f7f9fa;
  border-radius: 6px;
  padding: 15px;
  font-size: 13px;
  margin: 12px 0;
}
.meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 20px;
}
.timeline {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.timeline:last-child {
  border: 0;
}
.timeline p {
  margin: 4px 0;
}
.tabs {
  display: flex;
  gap: 8px;
  overflow: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  padding-bottom: 12px;
}
.tabs button {
  border: 0;
  background: none;
  white-space: nowrap;
}
.tabs button.active {
  color: var(--teal);
  background: var(--soft);
}
label {
  display: block;
  font-size: 12px;
  font-weight: 550;
  margin-bottom: 16px;
}
input,
textarea,
select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccd7df;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  margin-top: 6px;
}
textarea {
  min-height: 98px;
  resize: vertical;
}
label .hint {
  font-weight: 400;
  color: var(--muted);
}
input[type="checkbox"] {
  display: inline;
  width: auto;
  margin-right: 8px;
}
.inquiry-lines {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  min-width: 0;
}
.inquiry-lines label {
  overflow-wrap: anywhere;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.span2 {
  grid-column: 1/-1;
}
dialog {
  width: min(650px, 95vw);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  max-height: 90vh;
}
dialog::backdrop {
  background: #102a3990;
}
.intake-actions {
  flex-wrap: wrap;
}
.intake-table input {
  min-width: 105px;
  margin: 0;
}
.intake-settings {
  margin-top: 16px;
}
.intake-settings summary {
  margin-bottom: 12px;
}
dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-head h2 {
  margin: 0;
}
.icon {
  font-size: 23px;
  padding: 0 10px;
  border: 0;
}
#dialog-error,
#login-error {
  color: var(--red);
  white-space: pre-wrap;
  font-size: 13px;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(130deg, #e3eeef, #f5f6f8 60%);
}
.login-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 48px;
  width: min(520px, 92vw);
}
.login-card form {
  margin: 30px 0;
}
[data-login-mode="password"] #login-form {
  display: none;
}
.login-card button {
  width: 100%;
}
#toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 12px 24px;
  border-radius: 9px;
  z-index: 30;
  max-width: 90vw;
}
.filter {
  max-width: 300px;
  margin: 0;
}
.count {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--soft);
  color: var(--teal);
}
[hidden] {
  display: none !important;
}
details summary {
  cursor: pointer;
  color: var(--muted);
}
details pre {
  white-space: pre-wrap;
  font-size: 11px;
  max-height: 250px;
  overflow: auto;
}
.money {
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 650;
}
.flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
@media (max-width: 1000px) {
  #content {
    padding: 25px 22px;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 650px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 15px;
  }
  .topbar nav {
    order: 1;
    width: 100%;
  }
  .nav {
    padding: 8px 10px;
  }
  #content {
    padding: 22px 15px;
  }
  h1 {
    font-size: 23px;
  }
  .page-head {
    align-items: flex-start;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span2 {
    grid-column: auto;
  }
  .card {
    padding: 18px;
  }
  .login-card {
    padding: 30px;
  }
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
