:root {
  --ink: #14181f;
  --muted: #4a5563;
  --ground: #eef1f4;
  --card: #ffffff;
  --line: #d5dbe2;
  --field: #8793a1;
  --navy: #10243a;
  --accent: #0a62b8;
  --ok: #17693f;
  --warn: #8a5200;
  --bad: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--ground);
}

.mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: 13px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 8px 32px;
  background: var(--navy);
  color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand strong { font-size: 17px; }
.brand span { font-size: 13px; color: #c9d6e3; }

main { max-width: 1280px; margin: 0 auto; padding: 32px 32px 48px; }

h1 { margin: 0 0 6px; font-size: 26px; }
h2 { margin: 0; font-size: 16px; }
p { margin: 0; }
.lead { color: var(--muted); max-width: 680px; margin-bottom: 24px; }
.hint { font-size: 13px; color: var(--muted); }

.layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.layout > .wide { flex: 3 1 560px; min-width: 0; }
.layout > .side { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.card.pad { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 16px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); }

.auth { max-width: 420px; margin: 48px auto 0; }

label { display: block; font-size: 13px; font-weight: 600; color: #2a3340; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--field);
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { padding: 10px 12px; min-height: 72px; resize: vertical; }
input[type="file"] { padding: 9px 12px; }
.fields { display: flex; flex-wrap: wrap; gap: 16px; }
.fields > div { flex: 1 1 140px; min-width: 0; }
.grow { flex: 1 1 220px; min-width: 0; }

button { font: inherit; cursor: pointer; }
.btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn:disabled { border-color: var(--field); background: var(--ground); color: var(--muted); cursor: default; }
.link { min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 600; }
.link.danger { color: var(--bad); }
.link-light { min-height: 44px; padding: 0 10px; border: 0; background: none; color: #fff; font-size: 13px; text-decoration: underline; }

:focus-visible { outline: 3px solid #5aa2e6; outline-offset: 2px; }

.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; text-align: right; white-space: nowrap; }
td .sub { font-size: 12px; color: var(--muted); }
.strong { font-weight: 600; }
.status-active { color: var(--ok); font-weight: 600; }
.status-pending { color: var(--warn); font-weight: 600; }
.status-revoked, .status-expired { color: var(--bad); font-weight: 600; }
.empty { padding: 28px 20px; color: var(--muted); }

.notice { padding: 12px 14px; border-radius: 6px; font-size: 14px; }
.notice.error { border: 1px solid var(--bad); background: #fdf3f2; color: #7a1a14; }
.notice.success { border: 1px solid var(--ok); background: #eef8f2; color: #0f4a2c; }
.notice .mono { font-size: 15px; font-weight: 600; }

.history { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.history li { padding: 6px 0; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .topbar { padding: 8px 16px; }
  main { padding: 24px 16px 40px; }
}

td .mono { white-space: nowrap; }
