/* The server-rendered access-control pages (api/auth/render.py: login,
   password, admin, refusals). The only stylesheet reachable without a session,
   so it stands alone: the tokens repeat the ones in style.css and the
   card, field and button follow the sidebar's. */

:root {
  --bg: #ffffff;
  --panel: #f7f8fa;
  --ground: #eef1f4;
  --border: #d9dde3;
  --border-hover: color-mix(in srgb, var(--border) 60%, var(--muted));
  --text: #1d2733;
  --muted: #5f6b7a;
  --accent: #0064c8;
  --accent-dark: #004e9c;
  --accent-tint: color-mix(in srgb, var(--accent) 18%, transparent);
  --focus-ring: 0 0 0 3px var(--accent-tint);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--ground);
}

body {
  display: flex;
  justify-content: center;
  padding: 12vh 16px 32px;
}

main {
  width: 100%;
  max-width: 360px;
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(29, 39, 51, 0.04),
              0 6px 16px rgba(29, 39, 51, 0.045);
  padding: 20px 22px 22px;
}

h1 {
  font-size: 20px;
  margin: 0 0 14px;
}

h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 12px;
}

p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
}

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

.who { color: var(--muted); font-size: 13px; }
.who strong { color: var(--text); overflow-wrap: anywhere; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
              background-color 0.18s ease;
}

input:hover,
select:hover { border-color: var(--border-hover); }

/* the transparent outline keeps a visible indicator in forced-colors
   mode, where box-shadow is dropped */
input:focus-visible,
select:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

button {
  width: 100%;
  margin-top: 4px;
  padding: 8px 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease,
              transform 0.12s ease;
}

button:hover { background: var(--accent-dark); }
button:active { transform: translateY(1px); }

button:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

button.secondary {
  margin: 10px 0 14px;
  font-weight: 400;
  color: var(--text);
  background: var(--panel);
  border-color: var(--border);
}

button.secondary:hover {
  background: var(--ground);
  border-color: var(--border-hover);
}

button.secondary:focus-visible { outline-color: var(--accent); }

.form-error,
.form-note {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.form-error {
  color: #c0392b;
  background: #fdf1ef;
  border: 1px solid #f3cdc7;
}

.form-note {
  background: #fff4e5;
  border: 1px solid #ffd9a8;
}

/* The admin page (api/auth/admin.py): a wider column, one card per
   account with its facts, its connector grants and the forms that change
   it folded away below. */

main.wide { max-width: 720px; }

.card {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.card.inactive h3,
.card.inactive dd { color: var(--muted); }

h3 {
  font-size: 15px;
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  vertical-align: 1px;
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: 14px;
}

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

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

table {
  width: 100%;
  margin-bottom: 10px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 6px 10px 6px 0;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--muted);
}

/* a client's name is its own text: it may break anywhere, dates may not */
td:first-child { overflow-wrap: anywhere; }

td:last-child {
  padding-right: 0;
  text-align: right;
  white-space: nowrap;
}

td form { margin: 0; }

td button.secondary {
  width: auto;
  margin: 0;
  padding: 4px 12px;
  font-size: 13px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

details { margin-top: 12px; }

summary {
  width: max-content;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
}

summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card form,
details > .hint { max-width: 320px; }

details form,
details > .hint {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

details button.secondary { margin: 4px 0 0; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  cursor: pointer;
}

.check input { margin: 2px 0 0; }

button.danger {
  background: #c0392b;
  border-color: #c0392b;
}

button.danger:hover { background: #a5301f; }
button.danger:focus-visible { outline-color: #a5301f; }
