/*
 * Portal-only components.
 *
 * Tokens, typography and the nav come from the marketing site's
 * /assets/styles.css, which Caddy serves from the same origin — this file only
 * adds what the client area needs on top, so the two never drift into two
 * different-looking products.
 *
 * The stat/workflow/btn/message blocks below were previously inlined inside
 * website/portal/index.html, where nothing else could reach them.
 */

:root {
  --green: #4d7c5a;
  --red: #b14b3a;
}

body { background: var(--off-white); color: var(--charcoal); font-family: var(--sans); }

/* ------------------------------------------------------------- chrome --- */

.topbar { background: var(--charcoal); padding: 1.25rem 2rem; }
.topbar__inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar__logo {
  font-weight: 600; font-size: 1rem; letter-spacing: .05em;
  color: var(--off-white); text-transform: uppercase; text-decoration: none;
}
.topbar__logo span { color: var(--accent); }
.topbar__nav { display: flex; gap: 1.5rem; }
.topbar__nav a {
  font-size: .8rem; color: rgba(253,252,251,.7); text-decoration: none;
  letter-spacing: .03em; text-transform: uppercase; transition: color .2s;
}
.topbar__nav a:hover { color: var(--off-white); }

.page { max-width: 960px; margin: 0 auto; padding: 3rem 2rem 5rem; }
.page__title, .client-name {
  font-family: var(--serif); font-size: 2.2rem; font-weight: 400; margin: 0 0 .5rem;
}
.page__sub { color: var(--mid-grey); margin: 0 0 2.5rem; }
.greeting {
  margin-bottom: .4rem; font-size: .85rem; color: var(--mid-grey);
  letter-spacing: .06em; text-transform: uppercase;
}
.greeting .back { color: var(--mid-grey); text-decoration: none; }
.greeting .back:hover { color: var(--charcoal); }
.section-title {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 400;
  margin: 3rem 0 1rem;
}
.foot {
  border-top: 1px solid var(--border); padding: 2rem;
  text-align: center; font-size: .85rem; color: var(--mid-grey);
}
.foot a { color: var(--accent); }

/* -------------------------------------------------------------- stats --- */

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); margin-bottom: 1rem;
}
.stat { background: var(--off-white); padding: 1.5rem 1.25rem; }
.stat__value { font-family: var(--serif); font-size: 1.9rem; line-height: 1; }
.stat__label {
  margin-top: .5rem; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--mid-grey);
}

/* ---------------------------------------------------------- workflows --- */

.workflows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.workflow {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.25rem .25rem; border-bottom: 1px solid var(--border);
}
.workflow__label { font-weight: 500; }
.workflow__note { margin-top: .3rem; font-size: .85rem; color: var(--mid-grey); }
.workflow__actions { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.workflow__status {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .8rem; color: var(--mid-grey);
}
.workflow__toggle { margin: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--green { background: var(--green); }
.dot--grey { background: var(--mid-grey); }

.empty { color: var(--mid-grey); padding: 1.5rem 0; }

/* ------------------------------------------------------------ buttons --- */

.btn, .authform__btn {
  display: inline-block; border: 1px solid var(--charcoal); background: var(--charcoal);
  color: var(--off-white); padding: .55rem 1.1rem; border-radius: 4px;
  font-size: .85rem; font-family: var(--sans); cursor: pointer;
  text-decoration: none; transition: background .2s, color .2s, border-color .2s;
}
.btn:hover, .authform__btn:hover { background: var(--deep, #1a1f1f); }
.btn--outline { background: transparent; color: var(--charcoal); }
.btn--outline:hover { background: var(--warm-grey); }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn:disabled, .authform__btn:disabled { opacity: .6; cursor: default; }
.authform__btn--link { display: inline-block; }

/* ----------------------------------------------------------- messages --- */

.message {
  padding: .9rem 1.1rem; margin-bottom: 1.5rem; border-radius: 4px;
  border: 1px solid var(--border); background: var(--warm-grey); font-size: .9rem;
}
.message--error { border-color: var(--red); background: #fdf2f0; color: #7d2f22; }

/* -------------------------------------------------------- auth screens -- */

.authbox { max-width: 420px; margin: 2rem auto 0; }
.authbox--wide { max-width: 560px; }
.authbox__title { font-family: var(--serif); font-size: 1.9rem; font-weight: 400; margin: 0 0 .6rem; }
.authbox__sub { color: var(--mid-grey); margin: 0 0 2rem; line-height: 1.6; }
.authbox__foot { margin-top: 1.5rem; font-size: .9rem; }
.authbox__foot a, .authbox__note a { color: var(--accent); }
.authbox__note {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--mid-grey); line-height: 1.6;
}

.authform label {
  display: block; margin-bottom: .4rem; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--mid-grey);
}
.authform input[type="email"], .authform input[type="password"],
.authform input[type="text"], .authform input[type="file"], .authform select {
  width: 100%; padding: .8rem .9rem; margin-bottom: 1.25rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: var(--sans); font-size: 1rem; background: #fff;
}
.authform input:focus, .authform select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 135, 59, .15);
}
.authform__code { font-size: 1.4rem !important; letter-spacing: .3em; text-align: center; }
.authform__btn { width: 100%; text-align: center; padding: .85rem 1.1rem; }
.authform--inline .authform__btn { width: auto; }
.authform__hint {
  margin: -.75rem 0 1.5rem; font-size: .82rem; color: var(--mid-grey); line-height: 1.5;
}
.cf-turnstile { margin-bottom: 1.25rem; }

.steps-list { margin: 0 0 1.5rem 1.1rem; line-height: 1.7; }
.qr { display: block; margin: 0 auto 1rem; border: 1px solid var(--border); border-radius: 6px; }
.secret {
  display: inline-block; margin-top: .4rem; padding: .35rem .6rem;
  background: var(--warm-grey); border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em;
}
.codes {
  list-style: none; margin: 0 0 2rem; padding: 1.25rem;
  border: 1px solid var(--border); border-radius: 6px; background: var(--warm-grey);
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem 1.5rem;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1rem;
}

/* --------------------------------------------------------------- tool --- */

.quota {
  padding: .9rem 1.1rem; margin-bottom: 2rem; border-radius: 4px;
  background: var(--warm-grey); border: 1px solid var(--border); font-size: .9rem;
}

/* -------------------------------------------------------------- admin --- */

.panel {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 1.5rem; margin-bottom: 2rem;
}
.panel h2 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin: 0 0 1rem; }
.panel h3 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--mid-grey); margin: 1.75rem 0 .6rem;
}
.panel h3:first-of-type { margin-top: 0; }
.panel__head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.panel__note { font-size: .85rem; color: var(--mid-grey); margin: -.5rem 0 1rem; }
.slug {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .75rem; color: var(--mid-grey); margin-left: .5rem;
}

.grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
.grid th {
  text-align: left; font-weight: 500; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--mid-grey);
  padding: .5rem .6rem .5rem 0; border-bottom: 1px solid var(--border);
}
.grid td { padding: .65rem .6rem .65rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid--dense td, .grid--dense th { padding: .35rem .6rem .35rem 0; font-size: .82rem; }
.grid .muted { color: var(--mid-grey); }

.pill {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
}
.pill--on   { background: #e8f4ea; color: #2d6a3a; }
.pill--warn { background: #f5e9d8; color: #8b5e1a; }
.pill--off  { background: #f2e3e0; color: #7d2f22; }

.row-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.row-actions form { margin: 0; }
.row-actions button {
  border: 1px solid var(--border); background: #fff; color: var(--charcoal);
  padding: .25rem .55rem; border-radius: 4px; font-size: .75rem;
  font-family: var(--sans); cursor: pointer;
}
.row-actions button:hover { background: var(--warm-grey); border-color: var(--mid-grey); }

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

/* ------------------------------------------------------ impersonation --- */

.imp-banner {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--charcoal); color: var(--off-white);
  border-left: 4px solid var(--accent);
  padding: .75rem 1.25rem; font-size: .85rem;
}
.imp-banner b { color: var(--accent); }
.imp-banner form { margin: 0; }
.imp-banner button {
  background: transparent; border: 1px solid rgba(253,252,251,.4);
  color: var(--off-white); padding: .35rem .8rem; border-radius: 4px;
  font-size: .78rem; font-family: var(--sans); cursor: pointer;
}
.imp-banner button:hover { border-color: var(--accent); color: var(--accent); }
/* Obvious even in a screenshot, which a banner alone is not. */
body.is-impersonating { box-shadow: inset 0 0 0 3px var(--accent); min-height: 100vh; }

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 760px) {
  .page { padding: 2rem 1.25rem 4rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .workflow { flex-direction: column; align-items: flex-start; gap: .9rem; }
  .workflow__actions { width: 100%; flex-wrap: wrap; }
  .two-up { grid-template-columns: 1fr; }
  .panel__head { flex-direction: column; }
  .codes { grid-template-columns: 1fr; }
  .grid, .grid thead, .grid tbody, .grid th, .grid td, .grid tr { display: block; }
  .grid thead { display: none; }
  .grid tr { border-bottom: 1px solid var(--border); padding: .6rem 0; }
  .grid td { border: none; padding: .2rem 0; }
}

/* Checkbox line on the 2FA screen — the inputs above it are full-width blocks,
   so this needs to opt out of that to sit next to its label. */
.checkline {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .75rem; cursor: pointer;
  text-transform: none; letter-spacing: normal; font-size: .95rem;
  color: var(--charcoal);
}
.checkline input[type="checkbox"] {
  width: auto; margin: 0; accent-color: var(--accent);
}
