/* Count Encompass License Service — internal admin screens. Colors come only from brand-tokens.css. */
:root {
  --bg: var(--ie-light-grey);
  --surface: var(--ie-white);
  --text: var(--ie-charcoal);
  --muted: var(--ie-mid-grey);
  --line: #e2e2e2;
  --primary: var(--ie-brand-red);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { font-family: var(--ie-font-heading); font-weight: 700; margin: 0 0 .25rem; }
h1 { font-size: 1.6rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1.1rem; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.optional { color: var(--muted); font-weight: 400; font-size: .8rem; }

/* Shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--ie-charcoal); color: var(--ie-white);
  display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.5rem; flex-wrap: wrap;
}
.topbar::after { content: ""; }
.brand { display: flex; align-items: center; gap: .8rem; color: var(--ie-white); }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; }
.brand .product { font-weight: 300; letter-spacing: .02em; border-left: 1px solid #555; padding-left: .8rem; }
.brand .product b { font-weight: 700; color: var(--ie-highlight-red); }
.topnav { display: flex; gap: .25rem; flex: 1; }
.topnav a { color: #ddd; padding: .4rem .8rem; border-radius: 6px; }
.topnav a:hover { background: #3a3a3a; text-decoration: none; }
.topnav a.active { background: var(--primary); color: var(--ie-white); }
.signout { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: #ccc; margin: 0; }
.content { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.crumbs { margin: 0 0 .5rem; font-size: .9rem; color: var(--muted); }
.section-title { margin: 2rem 0 .75rem; }

/* Cards and forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.card > p { margin: .25rem 0 1rem; }
.card-key { border: 2px solid var(--primary); }
.card-danger { border-color: #e9c4c4; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.25rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
input, textarea, select {
  font: inherit; font-weight: 400; color: var(--text);
  border: 1px solid #cfcfcf; border-radius: 6px; padding: .55rem .7rem; background: var(--ie-white); width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--ie-highlight-red); outline-offset: 0; border-color: transparent; }
.form-actions { margin-top: 1.1rem; display: flex; gap: .6rem; }
.quick { display: flex; gap: .35rem; flex-wrap: wrap; }
.quick button {
  font: inherit; font-size: .8rem; font-weight: 500; border: 1px solid #cfcfcf; background: var(--bg);
  border-radius: 999px; padding: .15rem .65rem; cursor: pointer; color: var(--text);
}
.quick button:hover { border-color: var(--primary); color: var(--primary); }
.quick button.selected { border-color: var(--primary); background: var(--primary); color: #fff; }

.type-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; margin: .75rem 0 1.25rem; }
.type-option {
  font: inherit; text-align: left; cursor: pointer; background: var(--ie-white); color: var(--text);
  border: 1px solid #cfcfcf; border-radius: var(--radius); padding: .8rem .9rem; display: flex; flex-direction: column; gap: .25rem;
}
.type-option span { font-size: .82rem; color: var(--muted); }
.type-option:hover { border-color: var(--primary); }
.type-option.selected { border: 2px solid var(--primary); padding: calc(.8rem - 1px) calc(.9rem - 1px); background: #fff7f7; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; border-radius: 6px;
  padding: .55rem 1.1rem; border: 1px solid transparent; white-space: nowrap;
  display: inline-block; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--ie-white); }
.btn-primary:hover:not(:disabled) { background: var(--ie-tagline-red); }
.btn-secondary { background: var(--ie-charcoal); color: var(--ie-white); }
.btn-ghost { background: transparent; border-color: #cfcfcf; color: var(--text); }
.btn-ghost-light { background: transparent; border-color: #666; color: #eee; padding: .3rem .8rem; }
.btn-danger { background: var(--ie-status-cancelled); color: var(--ie-white); }
.btn-danger-outline { background: transparent; border-color: var(--ie-status-cancelled); color: var(--ie-status-cancelled); }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; }

/* Status */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; color: var(--ie-white); vertical-align: middle; letter-spacing: .02em; }
.badge-active { background: var(--ie-status-active); }
.badge-trial { background: var(--ie-status-trial); }
.badge-cancelled { background: var(--ie-status-cancelled); }
.badge-neutral { background: var(--ie-status-neutral); }
.alert { padding: .7rem .9rem; border-radius: 6px; margin: .75rem 0; }
.alert-error { background: #fbeaea; color: var(--ie-brand-red); border: 1px solid #efc6c6; }
.alert-ok { background: #e9f5ec; color: var(--ie-status-active); border: 1px solid #c3e2cb; }

/* Tables */
.toolbar { margin-bottom: 1rem; }
.search { max-width: 420px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #fafafa; }
tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.row-link:hover { background: #fafafa; }
.row-muted td { color: var(--muted); }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * { margin-left: .35rem; }
.empty { background: var(--surface); border: 1px dashed #cfcfcf; border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted); }

/* License facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.facts > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; }
.facts span { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.notes { background: var(--surface); border-left: 3px solid var(--line); padding: .5rem .9rem; }

/* Keys and QR */
.key-row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: .75rem 0; }
.key { font-size: 1.35rem; font-weight: 700; letter-spacing: .06em; background: var(--bg); padding: .5rem .9rem; border-radius: 6px; user-select: all; }
.key-long { font-size: .8rem; letter-spacing: 0; word-break: break-all; flex: 1; min-width: 0; font-weight: 400; }
.qr svg { width: 240px; height: 240px; display: block; }

/* Login */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--ie-charcoal); }
.login-card { background: var(--surface); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 380px; }
.login-card h1 { font-size: 1.3rem; display: block; }
.login-card h1 span { color: var(--primary); }
.login-card form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.login-logo { width: 56px; height: 56px; margin-bottom: .5rem; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fbeaea; color: var(--ie-brand-red); padding: .7rem 1.5rem; z-index: 10; }

@media (max-width: 640px) {
  .content { padding: 1.25rem 1rem 2rem; }
  .topbar { padding: .6rem 1rem; }
  .brand .product { display: none; }
  .topnav { order: 3; flex-basis: 100%; }
  .topnav a, .signout { white-space: nowrap; }
  .signout { margin-left: auto; }
}

h1:focus { outline: none; }

/* Public pages (no login), e.g. /activate */
.public-shell { min-height: 100vh; background: var(--ie-white); display: flex; flex-direction: column; align-items: center; }
.public-page { width: 100%; max-width: 680px; padding: 2rem 1.25rem 2.5rem; }
.public-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; }
.public-brand img { width: 40px; height: 40px; }
.public-brand .tag { background: var(--ie-brand-red); color: var(--ie-white); font-weight: 700; border-radius: 999px; padding: .15rem .7rem; }
.public-brand .word { font-family: var(--ie-font-heading); font-weight: 700; font-size: 1.6rem; color: var(--ie-charcoal); }
.public-page h1 { font-size: 1.7rem; display: block; margin-bottom: .5rem; }
.public-page .lead { color: var(--muted); font-size: 1.05rem; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 1.75rem 0; }
.steps li { counter-increment: step; position: relative; padding-left: 3rem; margin-bottom: 1.25rem; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ie-brand-red); color: var(--ie-white); font-weight: 700; display: grid; place-items: center; }
.steps h2, .public-page .card h2 { font-size: 1.05rem; margin-bottom: .2rem; }
.steps p { margin: 0; }
.public-page .card { background: var(--ie-light-grey); border: 0; }
.public-page .help { color: var(--muted); }
.public-footer { color: var(--muted); font-size: .8rem; padding: 1.5rem; text-align: center; }
.public-page .unlock { display: grid; gap: .9rem; margin-top: 1.5rem; }
.public-page .unlock button { justify-self: start; }
.btn-download { font-size: 1.05rem; padding: .8rem 1.4rem; }
.public-page .hash { word-break: break-all; font-size: .8rem; }
