:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5b6b7c;
  --border: #d8e0e8;
  --brand: #0f6e56;
  --brand-hover: #0b5643;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --draft: #667085;
  --in_progress: #175cd3;
  --completed: #027a48;
  --cancelled: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.container {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand:hover { text-decoration: none; color: var(--brand); }

nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
}

nav a:hover { color: var(--brand); text-decoration: none; }

main {
  flex: 1;
  padding: 1.75rem 0 3rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  background: var(--surface);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0.15rem 0 0.25rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.breadcrumb {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

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

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--brand-hover);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #f0f3f6;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover { background: #912018; color: #fff; }

button.link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--brand);
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: capitalize;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem 1.15rem;
  margin-bottom: 1.25rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.row-actions {
  display: flex;
  gap: 0.75rem;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
  background: #eef2f6;
  color: var(--draft);
}

.badge-draft { background: #f2f4f7; color: var(--draft); }
.badge-in_progress { background: #eff8ff; color: var(--in_progress); }
.badge-completed { background: #ecfdf3; color: var(--completed); }
.badge-cancelled { background: var(--danger-bg); color: var(--cancelled); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.detail-list {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.55rem 0.75rem;
  margin: 0;
}

.detail-list.tight { margin-top: 1.25rem; }
.detail-list dt { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.detail-list dd { margin: 0; }

.form-panel form {
  display: grid;
  gap: 0.9rem;
  max-width: 560px;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input, textarea, select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(15, 110, 86, 0.25);
  border-color: var(--brand);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.empty {
  color: var(--muted);
  margin: 0.5rem 0;
}

.field-hint {
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--muted);
}

.url-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prose {
  white-space: pre-wrap;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .detail-list { grid-template-columns: 1fr; }
  th:nth-child(n+4), td:nth-child(n+4) { display: none; }
}

/* Auth / account */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
  background:
    radial-gradient(circle at top left, rgba(15, 110, 86, 0.12), transparent 40%),
    var(--bg);
}

.auth-shell {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.auth-brand {
  text-align: center;
  width: 100%;
}

.auth-brand .brand {
  display: inline-block;
  font-size: 1.35rem;
}

.auth-tagline {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1.5rem 1.4rem 1.6rem;
}

.auth-card h1 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.5rem;
}

/* Clerk is the single card — no nested white box around it */
.clerk-mount {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 0;
}

.clerk-mount .cl-rootBox,
.clerk-mount .cljobs-clerk-root {
  width: 100% !important;
  max-width: 100%;
  margin: 0 auto;
}

.clerk-mount .cl-card,
.clerk-mount .cljobs-clerk-card,
.clerk-mount .cl-cardBox {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  box-sizing: border-box;
}

.clerk-status {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
}

.clerk-status[hidden] { display: none; }

.error-text { color: var(--danger); }

#clerk-error {
  width: 100%;
  margin-top: 0;
}

.callout {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: #f0f3f6;
  border: 1px solid var(--border);
  font-size: 0.92rem;
}

.callout.danger {
  background: var(--danger-bg);
  border-color: #fecdca;
  color: var(--danger);
}

.callout code {
  font-size: 0.85em;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.avatar, .avatar-sm, .avatar-fallback {
  border-radius: 999px;
  object-fit: cover;
  background: #e8eef3;
}

.avatar { width: 64px; height: 64px; }
.avatar-sm { width: 28px; height: 28px; }

.avatar-fallback {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--brand);
}

.account-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.account-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.claims {
  margin: 0;
  padding: 0.9rem 1rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.45;
}

.header-inner {
  flex-wrap: wrap;
}

