/* IssueFlowz base styles: shared by the sign-in pages, profile, install wizard
   and (from Phase 2) the app shell. Fluent-style spacing on the §7.1 tokens. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.45 var(--font-ui);
  color: var(--text);
  background: var(--page-bg);
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: var(--accent); }
a:hover { text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 16px;
  background: var(--titlebar-bg); color: var(--titlebar-text);
}
.topbar .wordmark { font-weight: 600; font-size: 16px; color: inherit; text-decoration: none; letter-spacing: 0.2px; }
.topbar .spacer { flex: 1; }
.topbar .menu { position: relative; }
.topbar .menu > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.22); color: inherit; font-weight: 600; font-size: 12px;
}
.topbar .menu > summary::-webkit-details-marker { display: none; }
.topbar .menu[open] > .menu-list { display: block; }
.menu-list {
  display: none; position: absolute; right: 0; top: 40px; z-index: 20; min-width: 200px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 4px;
}
.menu-list a, .menu-list button {
  display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none;
  color: inherit; font: inherit; text-decoration: none; border-radius: var(--radius); cursor: pointer;
}
.menu-list a:hover, .menu-list button:hover { background: var(--grid-row-hover); }
.menu-list .menu-head { padding: 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* Cards and page frames */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow);
}
.auth-wrap { display: flex; justify-content: center; padding: 48px 16px; }
.auth-wrap .card { width: 100%; max-width: 420px; }
.auth-wrap .card.wide { max-width: 640px; }
.page { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
.page .card + .card { margin-top: 16px; }

/* Forms */
form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="date"], select, textarea {
  width: 100%; min-height: 34px; padding: 6px 10px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 1px solid var(--accent); }
input.code { font-family: var(--font-mono); font-size: 20px; letter-spacing: 6px; text-align: center; max-width: 200px; }
.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-bottom: 8px; }
.choice input { margin-top: 3px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 16px; font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none;
}
.btn:hover { background: var(--grid-row-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 400; text-decoration: underline; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.actions .end { margin-left: auto; }

/* Messages */
.alert { padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.alert:empty { display: none; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-info { background: var(--grid-row-hover); color: var(--text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }

/* TOTP enrollment */
.totp-setup { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.totp-setup img { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: var(--radius); }
.secret { font-family: var(--font-mono); word-break: break-all; padding: 8px; background: var(--command-bg); border-radius: var(--radius); }
@media (max-width: 560px) { .totp-setup { grid-template-columns: 1fr; } }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: var(--grid-header-bg); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* Install wizard steps */
.steps { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; }
.steps li { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--command-bg); color: var(--text-muted); }
.steps li.done { color: var(--success); }
.steps li.current { background: var(--accent); color: var(--accent-text); }
.checks { list-style: none; padding: 0; margin: 0 0 12px; }
.checks li { padding: 4px 0; display: flex; gap: 8px; }
.checks .ok { color: var(--success); }
.checks .bad { color: var(--danger); }
pre.code-block { white-space: pre-wrap; word-break: break-all; background: var(--command-bg); padding: 10px; border-radius: var(--radius); font-family: var(--font-mono); font-size: 12px; }

/* Idle warning dialog */
dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow); max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.after { margin-top: 18px; }
.table td { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .table .hide-narrow { display: none; }
  .card { padding: 16px; }
}
.nowrap { white-space: nowrap; overflow-wrap: normal; }
