/* Unbounded Admin — shared styles.
   Matches the customer portal's design system (go-unbounded-portal):
   flat surfaces, square corners throughout, navy primary (#091A28),
   Instrument Sans headings + Roboto Mono body/labels. */

:root {
  --bg: #F7F7FF;
  --surface: #ffffff;
  --ink: #1E2348;      /* headings */
  --body: #666666;     /* body copy */
  --muted: #6B7280;    /* table/label secondary text */
  --border: #CED1D4;

  --primary: #091A28;
  --primary-hover: #22313D;

  --ok-bg: #D1FAE5; --ok-fg: #065F46; --ok-dot: #10B981;
  --warn-bg: #FEF3C7; --warn-fg: #92400E; --warn-dot: #F59E0B;
  --danger-bg: #FEE2E2; --danger-fg: #991B1B; --danger-dot: #EF4444;
  --neutral-bg: #F3F4F6; --neutral-fg: #6B7280; --neutral-dot: #9CA3AF;
  --info-bg: #E0E7FF; --info-fg: #3730A3; --info-dot: #6366F1;

  --notice-ok-bg: #E6F4EC; --notice-ok-border: #A7CDB6; --notice-ok-fg: #0f5132;
  --notice-err-bg: #FBEAE8; --notice-err-border: #E4B4AD; --notice-err-fg: #842029;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, monospace;
  background: var(--bg);
  color: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Instrument Sans', system-ui, sans-serif;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 0;
}

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

.mono { font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, monospace; }

/* ---------- Shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.sidebar-logo {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img { width: 140px; height: auto; display: block; }
.sidebar-nav { flex: 1; padding: 16px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover { background: #F3F4F6; color: var(--ink); text-decoration: none; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who p { margin: 0; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .logout-btn {
  background: none;
  border: none;
  padding: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
}
.sidebar-user .logout-btn:hover { color: var(--primary); }
.sidebar-user .logout-btn svg { width: 20px; height: 20px; }

.main { flex: 1; overflow-x: hidden; }
.page { padding: 32px; max-width: 1200px; }

/* ---------- Headers ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.subtle { color: var(--muted); font-size: 14px; }
.crumb { font-size: 14px; margin-bottom: 16px; }
.crumb a { color: var(--muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 24px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }

/* ---------- Toolbar / search ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.search-wrap { position: relative; flex: 1; min-width: 260px; }
.search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: #9CA3AF; pointer-events: none;
}
.search-wrap .input { width: 100%; padding-left: 38px; }

.input, .select {
  font: inherit;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(9, 26, 40, 0.12);
}

.btn {
  font: inherit;
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-hover); }
.btn.secondary {
  background: #F3F4F6;
  color: var(--ink);
}
.btn.secondary:hover { background: #E5E7EB; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Tables ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { border-bottom: 1px solid var(--border); background: var(--bg); }
thead th {
  text-align: left;
  padding: 14px 20px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
tbody { display: table-row-group; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 14px 20px; vertical-align: middle; color: var(--ink); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--bg); }
td .strong { font-weight: 600; }
td .dim { color: var(--muted); font-size: 13px; }

/* ---------- Badges (dot-indicator, matches dashboard status pills) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; flex-shrink: 0; }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge.ok .dot { background: var(--ok-dot); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.warn .dot { background: var(--warn-dot); }
.badge.danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge.danger .dot { background: var(--danger-dot); }
.badge.info { background: var(--info-bg); color: var(--info-fg); }
.badge.info .dot { background: var(--info-dot); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.badge.neutral .dot { background: var(--neutral-dot); }

/* ---------- Pagination ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}
.pager .buttons { display: flex; gap: 8px; }

/* ---------- States ---------- */
.state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
  font-size: 14px;
}
.error-banner {
  background: var(--notice-err-bg);
  border: 1px solid var(--notice-err-border);
  color: var(--notice-err-fg);
  padding: 14px 20px;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 20px;
}
.login-head { text-align: center; margin-bottom: 40px; }
.login-head img { width: 200px; height: auto; margin: 0 auto 40px; display: block; }
.login-head h1 {
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.login-head p {
  color: var(--body);
  font-size: 15px;
  max-width: 380px;
  margin: 0 auto;
}
.login-form-wrap { max-width: 400px; width: 100%; margin: 0 auto; }
.login-form-wrap form { display: flex; flex-direction: column; gap: 24px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}
.field .input { width: 100%; padding: 14px 18px; font-size: 15px; }
.login-form-wrap .btn {
  width: 100%;
  padding: 16px;
  font-size: 15px;
}
.login-divider { margin-top: 28px; text-align: center; }
.login-divider span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.login-footer { margin-top: 28px; text-align: center; font-size: 13px; color: var(--body); }

.notice {
  padding: 14px 20px;
  font-size: 14px;
  margin-bottom: 20px;
}
.notice.success { background: var(--notice-ok-bg); border: 1px solid var(--notice-ok-border); color: var(--notice-ok-fg); }
.notice.error { background: var(--notice-err-bg); border: 1px solid var(--notice-err-border); color: var(--notice-err-fg); }
