* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #1a1a1a; background: #f6f7f9; }
a { color: #2053c9; text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
pre { background: #f0f0f3; padding: 0.75em 1em; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
pre.token { background: #0e1217; color: #c6d0f5; border: 1px solid #303742; }
.small { font-size: 0.85em; }

/* Topnav */
.topnav {
  display: flex; align-items: center; gap: 1.5em;
  background: #12243d; color: #fff; padding: 0.75em 1.25em; box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.topnav .brand { font-weight: 600; letter-spacing: 0.01em; }
.topnav .links { display: flex; gap: 1em; flex: 1; }
.topnav .links a { color: #dbe4ef; }
.topnav .user { display: flex; gap: 0.5em; align-items: center; color: #dbe4ef; font-size: 0.9em; }

/* Containers */
.container { max-width: 1100px; margin: 1.5em auto; padding: 0 1.25em; }
.auth-container { max-width: 400px; margin: 4em auto; padding: 0 1em; }
.auth-container h1 { text-align: center; }

/* Cards */
.card { background: #fff; border: 1px solid #e1e4eb; border-radius: 8px; padding: 1.25em; margin-bottom: 1.25em; box-shadow: 0 1px 2px rgba(0,0,0,.02); }

/* Forms */
form.card label, form label { display: block; margin-bottom: 0.75em; font-size: 0.9em; color: #3a3a3a; }
form input[type=text], form input[type=email], form input[type=password], form input[type=search], form input[type=number], form select, form textarea {
  display: block; width: 100%; margin-top: 0.25em;
  padding: 0.55em 0.7em; border: 1px solid #cfd3dc; border-radius: 4px; font-size: 0.95em; background: #fff;
}
form input:focus, form select:focus, form textarea:focus { outline: 2px solid #8fb2ff; border-color: #8fb2ff; }
form label.checkbox { display: flex; align-items: center; gap: 0.5em; }
form label.checkbox input { width: auto; }
button, .btn { border: 1px solid #cfd3dc; background: #fff; padding: 0.5em 1em; border-radius: 4px; cursor: pointer; font-size: 0.9em; color: #1a1a1a; }
button:hover, .btn:hover { background: #f0f2f5; }
button.primary, .btn.primary { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }
button.primary:hover, .btn.primary:hover { background: #172554; }
button.danger, .btn.danger { background: #b3261e; color: #fff; border-color: #b3261e; }
button.danger:hover, .btn.danger:hover { background: #8f1d17; }
button.small, .btn.small { padding: 0.25em 0.6em; font-size: 0.8em; }
.linkish { background: transparent; border: none; color: inherit; padding: 0; cursor: pointer; text-decoration: underline; }
.inline-form { display: flex; gap: 0.75em; flex-wrap: wrap; align-items: end; }
.inline-form label { flex: 1 0 180px; }

/* Filter bar */
.filter-bar { display: flex; gap: 0.5em; margin-bottom: 1em; }
.filter-bar input[type=search], .filter-bar select { max-width: 280px; }
.filter-bar button { height: auto; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e1e4eb; border-radius: 6px; overflow: hidden; }
table.list th, table.list td { padding: 0.6em 0.8em; text-align: left; border-bottom: 1px solid #eef0f4; vertical-align: top; }
table.list th { background: #f2f4f8; font-size: 0.85em; color: #4a4a4a; }
table.list td.empty { text-align: center; color: #888; padding: 1.5em; }
table.list pre { margin: 0; font-size: 0.8em; max-width: 700px; }

/* State badges */
.state { padding: 0.15em 0.55em; border-radius: 10px; font-size: 0.8em; font-weight: 600; display: inline-block; }
.state-active { background: #d6f0d6; color: #1e6b1e; }
.state-revoked { background: #f7d6d6; color: #7a1e1e; }
.state-expired { background: #fbe8c2; color: #7a551e; }

/* dl */
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 0.4em 1em; margin: 0; }
dl.kv dt { color: #666; font-size: 0.9em; }
dl.kv dd { margin: 0; }

/* Flash */
.flash { padding: 0.7em 1em; border-radius: 6px; margin-bottom: 1em; font-size: 0.95em; }
.flash.ok { background: #dff3df; color: #1e6b1e; border: 1px solid #aed9ae; }
.flash.err { background: #f7dede; color: #7a1e1e; border: 1px solid #e7a9a9; }
.flash.warn { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* Misc */
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1em; }
h1 { margin: 0 0 0.5em; }
h2 { margin: 0.25em 0 0.75em; font-size: 1.1em; }
