/*
  Design system aligned to the Insurely "Tester Program" dashboard and the
  @insurely/ui tokens. Brand fonts (Insurely Sans, Gelica), brand green, the
  dashboard palette and component shapes (pill chips/badges, flat cards, a
  data table). Re-theme from the tokens block. Fonts live in /public/fonts.
*/

@font-face {
  font-family: "Insurely Sans";
  src: url("/fonts/InsurelySans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Insurely Sans";
  src: url("/fonts/InsurelySans-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Gelica";
  src: url("/fonts/Gelica-Light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Gelica";
  src: url("/fonts/Gelica-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #f6f7f6;
  --surface: #ffffff;
  --text: #213123;
  --muted: #606060;
  --muted-2: #9f9f9f;
  --border: #eaeaea;
  --border-strong: #dedede;
  --primary: #00824c;
  --primary-hover: #005f37;
  --primary-contrast: #ffffff;

  --green-bg: #daf4dd;
  --green-text: #005f37;
  --blue-bg: #e7f0fb;
  --blue-text: #1a5fb4;
  --purple-bg: #ece4fb;
  --purple-text: #5b3fa6;
  --amber-bg: #fbedcf;
  --amber-text: #8a6100;
  --red-bg: #fdecec;
  --red-text: #c01a12;

  --radius: 12px;
  --radius-sm: 8px;
  --pill: 1000px;
  --shadow: 0 1px 2px rgba(33, 49, 35, 0.04);
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Insurely Sans", -apple-system, system-ui, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

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

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
.display {
  font-family: "Gelica", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 26px;
  margin-bottom: 6px;
}
h2 {
  font-size: 19px;
  margin-bottom: 14px;
}
.subtitle {
  color: var(--muted);
  margin-bottom: 20px;
}

/* ---- App chrome ---- */

.appbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}
.appbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand-link:hover {
  text-decoration: none;
}
.brand {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 4px;
}
.brand-tag {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}

/* ---- Layout ---- */

.container {
  max-width: 1040px;
  margin: 32px auto;
  padding: 0 20px;
}
.center-narrow {
  max-width: 520px;
  margin: 56px auto;
  padding: 0 20px;
}

/* ---- Tabs ---- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}
.tab.future {
  color: var(--muted-2);
  cursor: default;
}

/* ---- Filter chips ---- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.chip {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--muted);
}
.chip.active {
  border-color: var(--text);
  color: var(--text);
}
.chip {
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.chip:hover {
  border-color: var(--text);
}

/* ---- Toolbar (search + status filter) ---- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar-search {
  display: flex;
  gap: 8px;
  flex: 1 1 280px;
}
.toolbar-search .input {
  flex: 1;
}
.toolbar-select {
  flex: 0 0 auto;
  width: auto;
}

/* ---- Pager ---- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 16px 0 8px;
}
.pager-info {
  font-size: 13px;
  color: var(--muted);
}

/* ---- Clickable tester name ---- */

.name-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.name-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ---- Detail modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(33, 49, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(33, 49, 35, 0.22);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.detail-section {
  margin-top: 18px;
}
.detail-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.detail-value {
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 28px; /* clear the close button */
}
.edit-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

/* ---- Read-only agreed-amount callout on the pay form ---- */

.amount-callout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  background: var(--green-bg);
  color: var(--green-text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.amount-callout strong {
  font-size: 18px;
}

/* ---- Stat cards ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-num {
  font-family: "Gelica", Georgia, serif;
  font-size: 32px;
  line-height: 1.1;
  color: var(--text);
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---- Card ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  overflow: hidden;
}
.card-accent {
  height: 3px;
  background: var(--primary);
  margin: -28px -28px 24px;
}

/* ---- Forms ---- */

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.input {
  width: 100%;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(33, 49, 35, 0.08);
}
.input::placeholder {
  color: var(--muted-2);
}
.hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.row > * {
  flex: 1;
  min-width: 160px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-block;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-contrast);
  transition: background 0.12s;
}
.btn:hover {
  background: var(--primary-hover);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.btn-full {
  width: 100%;
}
.btn-pill {
  border-radius: var(--pill);
}
/* Inline, low-emphasis action (e.g. row actions in a table). */
.btn-link {
  padding: 4px 6px;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
}
.btn-link:hover {
  background: transparent;
  text-decoration: underline;
}
.btn-danger {
  color: var(--red-text);
  margin-left: 6px;
}
.btn-danger:hover {
  color: var(--red-text);
}

/* ---- Alerts ---- */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-error {
  background: var(--red-bg);
  border-color: #f3c9c7;
  color: var(--red-text);
}
.alert-success {
  background: var(--green-bg);
  border-color: #bfe2c5;
  color: var(--green-text);
}

/* ---- Trust note ---- */

.trust {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
}

/* ---- Table ---- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  text-align: left;
  padding: 13px 16px;
  font-size: 14px;
}
.table thead th {
  background: #fbfbfb;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.table tbody tr + tr td {
  border-top: 1px solid var(--border);
}
.table tbody tr:hover td {
  background: #fbfbfb;
}

/* ---- Status / market badges (pills) ---- */

.badge {
  display: inline-block;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--pill);
  background: #f0f0f0;
  color: var(--muted);
}
.badge-green {
  background: var(--green-bg);
  color: var(--green-text);
}
.badge-blue {
  background: var(--blue-bg);
  color: var(--blue-text);
}
.badge-purple {
  background: var(--purple-bg);
  color: var(--purple-text);
}
.badge-amber {
  background: var(--amber-bg);
  color: var(--amber-text);
}
.badge-red {
  background: var(--red-bg);
  color: var(--red-text);
}

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