/*
 * Shared styling for the overview, sign-in and portal pages.
 *
 * A restrained corporate palette: one neutral ramp, one accent, no decorative
 * gradients or animation. Tokens are defined once here so a buyer can rebrand
 * the whole product by editing the block below.
 */

:root {
  --page:       #f7f8fa;
  --surface:    #ffffff;
  --surface-2:  #fbfcfd;
  --ink:        #1f2933;
  --muted:      #5c6773;
  --faint:      #8a94a0;
  --line:       #dfe3e8;
  --accent:     #1d4ed8;
  --accent-ink: #ffffff;
  --danger:     #b42318;
  --success:    #027a48;
  --warning:    #b54708;
  --code-bg:    #f2f4f7;
  --radius:     4px;
  --max:        1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page:       #14181d;
    --surface:    #1b2027;
    --surface-2:  #1f252d;
    --ink:        #e6e9ed;
    --muted:      #9aa4b0;
    --faint:      #78828e;
    --line:       #2b323b;
    --accent:     #6f9dff;
    --accent-ink: #0f1318;
    --danger:     #f97066;
    --success:    #6ce9a6;
    --warning:    #fdb022;
    --code-bg:    #10141a;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }

/* ---- Header ------------------------------------------------------------- */

header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
header .wrap { display: flex; align-items: center; gap: 2rem; min-height: 60px; }
.brand { font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; color: var(--ink); }
.brand:hover { text-decoration: none; }
header nav { margin-left: auto; display: flex; gap: 1.75rem; font-size: 0.9375rem; align-items: center; }
header nav a { color: var(--muted); }
header nav a:hover { color: var(--ink); text-decoration: none; }
header nav a.current { color: var(--ink); font-weight: 500; }

/* ---- Hero --------------------------------------------------------------- */

.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 4.5rem 0;
}
.hero h1 {
  margin: 0 0 1rem;
  font-size: 2.125rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 34rem;
}
.hero p { margin: 0 0 2rem; color: var(--muted); font-size: 1.0625rem; max-width: 40rem; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ---- Numbered steps ----------------------------------------------------- */

.steps { counter-reset: step; margin: 0; padding: 0; list-style: none; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.5rem 2.75rem;
  border-left: 1px solid var(--line);
  margin-left: 0.75rem;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: -0.8125rem;
  top: 0;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.steps h3 { margin: 0 0 0.25rem; font-size: 0.9375rem; font-weight: 600; }
.steps p { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.9375rem; }

/* ---- Typography --------------------------------------------------------- */

section { padding: 3.5rem 0; }
section > .wrap > h2 { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
section > .wrap > .lede { margin: 0 0 2rem; color: var(--muted); max-width: 42rem; }

/* ---- Buttons and forms -------------------------------------------------- */

.button {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-family: inherit;
}
.button:hover { text-decoration: none; opacity: 0.92; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.button.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.button.small { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

label { display: block; font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.375rem; color: var(--ink); }
.hint { font-weight: 400; color: var(--faint); font-size: 0.75rem; margin-left: 0.25rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9375rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.field { margin-bottom: 1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9375rem; }
.checkbox input { width: auto; }
.checkbox label { margin: 0; font-weight: 400; }

/* ---- Panels and cards --------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.panel h2, .panel h3 { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 600; }
.panel .lede { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9375rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card { background: var(--surface); padding: 1.5rem; }
.card h3 { margin: 0 0 0.5rem; font-size: 0.9375rem; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 0.9375rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.stat { background: var(--surface); padding: 1.125rem 1.25rem; }
.stat .value { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.stat .label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 0.125rem; }

/* ---- Tables ------------------------------------------------------------- */

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.9375rem; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .button { margin-left: 0.25rem; }

.tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.ok { color: var(--success); border-color: currentColor; }
.tag.bad { color: var(--danger); border-color: currentColor; }
.tag.warn { color: var(--warning); border-color: currentColor; }

/* ---- Code --------------------------------------------------------------- */

pre {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color: var(--ink);
}
code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.8125rem; }

/* ---- Messages ----------------------------------------------------------- */

.message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}
.message.error { color: var(--danger); border-color: currentColor; }
.message.success { color: var(--success); border-color: currentColor; }
.message.info { color: var(--muted); }
.message:empty { display: none; }

/* ---- Licence section ---------------------------------------------------- */

.licence {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.licence-price, .licence-includes { background: var(--surface); padding: 1.75rem; }
.licence-label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.licence-amount { display: block; font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; margin: 0.25rem 0 0.125rem; }
.licence-note { display: block; color: var(--muted); font-size: 0.875rem; margin-bottom: 1.25rem; }
.licence-includes h3 { margin: 0 0 0.75rem; font-size: 0.9375rem; font-weight: 600; }
.licence-includes ul { margin: 0; padding-left: 1.125rem; color: var(--muted); font-size: 0.9375rem; }
.licence-includes li { margin-bottom: 0.375rem; }

/* ---- Sign-in ------------------------------------------------------------ */

.signin-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.5rem; }
.signin-card { width: 100%; max-width: 24rem; }
.signin-card .panel { margin: 0; }
.signin-head { text-align: center; margin-bottom: 1.5rem; }
.signin-head .name { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
.signin-head .sub { color: var(--muted); font-size: 0.875rem; margin-top: 0.125rem; }

/* ---- Portal layout ------------------------------------------------------ */

.portal { padding: 2rem 0 4rem; }
.portal-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.portal-head h1 { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.portal-head .who { color: var(--muted); font-size: 0.875rem; }
.portal-head .spacer { margin-left: auto; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  color: var(--muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 500; border-bottom-color: var(--accent); }

.hidden { display: none !important; }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); font-size: 0.9375rem; }

/* ---- Modal -------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 19, 24, 0.45);
  display: grid; place-items: center;
  padding: 1.5rem;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 32rem;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.75rem;
}
.modal h2 { margin: 0 0 0.25rem; font-size: 1.0625rem; font-weight: 600; }
.modal .lede { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9375rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ---- Footer ------------------------------------------------------------- */

footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.875rem;
}
footer .wrap { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
footer nav { margin-left: auto; display: flex; gap: 1.5rem; }

@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; }
  .licence { grid-template-columns: 1fr; }
  header nav { gap: 1rem; font-size: 0.875rem; }
}

/* ---- Contact ------------------------------------------------------------ */

.contact-note { font-size: 0.8125rem; color: var(--faint); margin-top: 0.375rem !important; }
.contact-address { margin-top: 1.25rem; color: var(--muted); font-size: 0.9375rem; }
#contact .card p:first-of-type { font-size: 1rem; font-weight: 500; }
