:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #1a2332;
  --ink-soft: #5b6b82;
  --border: #e2e8f0;
  --brand: #0d5c63;
  --brand-dark: #094449;
  --brand-soft: #e6f2f3;

  --active: #0f8a5f;
  --active-bg: #e6f6ef;
  --extended: #1a73c2;
  --extended-bg: #e7f1fb;
  --due: #c47f00;
  --due-bg: #fdf3e0;
  --expired: #b23b3b;
  --expired-bg: #fbeaea;
  --fail: #b23b3b;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); }

header.topbar {
  background: var(--brand);
  color: #fff;
  padding: 18px 24px;
  box-shadow: var(--shadow);
}
header.topbar .inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
header.topbar .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
/* Logo knocked out to white so the black artwork reads on the teal bar. */
header.topbar .brand-logo {
  height: 34px;
  width: auto;
  filter: brightness(0) invert(1);
  display: block;
}
header.topbar .brand .divider {
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, 0.3);
  margin: 4px 0;
}
header.topbar h1 { font-size: 1.25rem; margin: 0; font-weight: 700; letter-spacing: 0.2px; }
header.topbar .tag { font-size: 0.85rem; opacity: 0.85; }
header.topbar nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.9;
  margin-left: 18px;
}
header.topbar nav a:hover { opacity: 1; text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

.intro {
  background: var(--brand-soft);
  border: 1px solid #cfe4e5;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 22px;
  font-size: 0.92rem;
  color: #16414a;
}
.intro strong { color: var(--brand-dark); }

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}
.muted { color: var(--ink-soft); font-size: 0.85rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #fafbfc; font-weight: 600; color: var(--ink-soft); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; }
tbody tr:hover { background: #fafcff; }
tbody tr.clickable { cursor: pointer; }
td.wrap, th.wrap { white-space: normal; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.active { color: var(--active); background: var(--active-bg); }
.badge.extended { color: var(--extended); background: var(--extended-bg); }
.badge.due { color: var(--due); background: var(--due-bg); }
.badge.expired { color: var(--expired); background: var(--expired-bg); }
.badge.failed { color: var(--expired); background: var(--expired-bg); }
.badge.pass { color: var(--active); background: var(--active-bg); }
.badge.fail { color: var(--fail); background: var(--expired-bg); }

.days-pill { font-weight: 600; }
.days-pill.neg { color: var(--expired); }
.days-pill.warn { color: var(--due); }
.days-pill.ok { color: var(--active); }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-soft); }

/* Forms (admin) */
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 40px; }

.section-title {
  padding: 14px 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.form-actions { padding: 0 18px 18px; display: flex; gap: 10px; align-items: center; }

button.btn {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
button.btn:hover { background: var(--brand-dark); }
button.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
button.btn.danger { background: #fff; color: var(--expired); border: 1px solid var(--expired); }
button.btn.small { padding: 6px 12px; font-size: 0.82rem; }

.notice { padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; margin: 0 18px 14px; }
.notice.error { background: var(--expired-bg); color: var(--expired); }
.notice.success { background: var(--active-bg); color: var(--active); }

.token-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 14px 18px; background: #fafbfc; border-bottom: 1px solid var(--border);
}
.token-bar input { padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; min-width: 220px; }

/* Modal / detail */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,0.45);
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 720px;
  box-shadow: 0 12px 40px rgba(16,24,40,0.25); overflow: hidden;
}
.modal .modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal .modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal .modal-head .close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--ink-soft); line-height: 1; }
.modal .modal-body { padding: 20px; }

.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.summary-grid .cell { background: #fafbfc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.summary-grid .cell .k { font-size: 0.75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.4px; }
.summary-grid .cell .v { font-size: 1.05rem; font-weight: 700; margin-top: 3px; }

footer.foot { text-align: center; color: var(--ink-soft); font-size: 0.82rem; padding: 30px 20px 40px; }

@media (max-width: 560px) {
  header.topbar h1 { font-size: 1.05rem; }
  main { padding: 16px; }
}
