:root {
  --bg: #f3f5f2; --surface: #fff; --border: #d5ddd4; --text: #17231c; --muted: #5b6b61; --primary: #1f5c43; --primary-hover: #17493a;
  --danger: #b42318; --danger-soft: #fdecea; --ok-soft: #e3f0e8; --info-soft: #e8f2fb;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif; color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
main { max-width: 440px; margin: 0 auto; padding: 32px 16px 48px; }
main.wide { max-width: 640px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-bottom: 18px; }
.brand b { display: block; font-size: 1.3rem; font-family: 'Roboto Slab', Georgia, serif; color: #1b3a2c; }
.brand small { color: var(--muted); font-size: .78rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: 0 1px 2px rgba(16,32,24,.06), 0 2px 8px rgba(16,32,24,.06); }
h1 { font-size: 1.35rem; margin: 0 0 16px; }
h2 { font-size: 1.05rem; margin: 26px 0 10px; padding-top: 18px; border-top: 1px solid var(--border); }
p { line-height: 1.5; }
form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.field small { font-weight: 400; color: var(--muted); }
input, select { font: inherit; font-weight: 400; padding: 12px; min-height: 46px; border: 1px solid var(--border); border-radius: 10px; background: #fff; width: 100%; }
input:focus, select:focus { outline: 3px solid #8ab8e6; outline-offset: 1px; border-color: var(--primary); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; line-height: 1.4; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: inherit; font-weight: 600; min-height: 46px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #f1b5ae; }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: .88rem; }
.btn-google { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .9rem; margin-top: 16px; }
a { color: var(--primary); }
.msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .92rem; line-height: 1.45; }
.msg-error { background: var(--danger-soft); color: #7a1a12; }
.msg-ok { background: var(--ok-soft); color: #134a32; }
.msg-info { background: var(--info-soft); color: #0c3c66; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.qr { display: block; margin: 8px auto; width: 200px; height: 200px; image-rendering: pixelated; }
.secret, .codes { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border-radius: 8px; padding: 10px; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; text-align: center; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--ok-soft); color: #134a32; font-size: .78rem; font-weight: 600; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 18px; }

/* choice after sign-in (administrators) */
main:has(.welcome) { max-width: 760px; padding-top: 40px; }
.welcome-head { text-align: center; margin: 8px 0 26px; }
.welcome-head h1 { font-size: 1.85rem; margin: 10px 0 6px; letter-spacing: -.01em; }
.welcome-head p { color: var(--muted); margin: 0; font-size: 1.05rem; }
.badge-admin-role { display: inline-block; padding: 3px 12px; border-radius: 99px; background: #e9e8fb; color: #3d3a9e; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.choice { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface);
  text-decoration: none; color: var(--text); box-shadow: 0 1px 2px rgba(16,32,24,.05), 0 4px 16px rgba(16,32,24,.05); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.choice::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--tone); }
.choice-app { --tone: #3a7d4f; --tone-soft: #e3f0e8; }
.choice-admin { --tone: #3d3a9e; --tone-soft: #e9e8fb; }
.choice-aviid { --tone: #1d4e89; --tone-soft: #e3ecf7; }
.choice-hlektrothermiki { --tone: #0a1e30; --tone-soft: #e3eef7; }
.choice:hover { transform: translateY(-2px); border-color: var(--tone); box-shadow: 0 8px 28px rgba(16,32,24,.12); }
.choice:focus-visible { outline: 3px solid #8ab8e6; outline-offset: 3px; }
.choice-icon { margin: 4px 0 6px; display: flex; }
.choice-icon svg { display: block; }
.choice-title { font-size: 1.25rem; font-weight: 700; }
.choice-text { color: var(--muted); font-size: .94rem; line-height: 1.5; }
.choice-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.choice-facts span { background: var(--tone-soft); color: var(--tone); border-radius: 99px; padding: 3px 10px; font-size: .8rem; }
.choice-facts b { font-weight: 700; }
.choice-facts .warn { color: #8a5a00; }
.choice-cta { margin-top: auto; padding-top: 14px; font-weight: 700; color: var(--tone); display: inline-flex; gap: 6px; }
.choice-primary .choice-cta { background: var(--tone); color: #fff; padding: 10px 16px; border-radius: 10px; margin-top: auto; }
.choice-primary { border-color: color-mix(in srgb, var(--tone) 40%, var(--border)); }
.welcome-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; padding: 14px 4px 0; border-top: 1px solid var(--border); font-size: .9rem; }
.welcome-links { display: inline-flex; gap: 18px; align-items: center; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
@media (max-width: 560px) {
  main:has(.welcome) { padding-top: 20px; }
  .welcome-head h1 { font-size: 1.5rem; }
  .welcome-foot { flex-direction: column; align-items: flex-start; }
}

/* admin dashboard */
main.full { max-width: 1120px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.top .brand { margin-bottom: 0; }
.topnav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.btn-ghost { border-color: transparent; background: transparent; }
h3 { font-size: .98rem; margin: 20px 0 8px; }
.lead { line-height: 1.6; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stats div { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.stats b { display: block; font-size: 1.5rem; }
.stats span { color: var(--muted); font-size: .85rem; }
.panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.panel summary { cursor: pointer; font-weight: 600; color: var(--primary); min-height: 30px; display: flex; align-items: center; }
.panel[open] summary { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid2 .span2, .grid2 > fieldset, .grid2 > p { grid-column: 1 / -1; margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
legend { font-weight: 600; font-size: .92rem; padding: 0 6px; }
.panel-form { background: var(--bg); border-radius: 12px; padding: 14px; margin-top: 12px; }
.filters { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.filters input { flex: 1 1 240px; width: auto; }
.filters select { flex: 0 1 180px; width: auto; }
.table-wrap { overflow-x: auto; }
table.users td { vertical-align: middle; }
table.users tr.off td { opacity: .6; }
table.kv th { width: 180px; color: var(--muted); font-weight: 600; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
form.inline { display: inline-flex; }
.badge-admin { background: #e5e4fb; color: #33308a; }
.badge-danger { background: var(--danger-soft); color: #7a1a12; }
.badge-warn { background: #fdf3d8; color: #6b4a00; }
.badge-gift { background: #fbe6f1; color: #7a1f52; }
.badge-muted { background: var(--bg); color: var(--muted); }
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  table.kv th { width: auto; }
  table.users thead { display: none; }
  table.users tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  table.users td { display: block; border: 0; padding: 3px 0; }
}

/* per-app sign-in routes (/login/4forest, /login/aviid, /login/admin) */
.login-app { display: flex; align-items: center; gap: 12px; margin: -4px 0 18px; padding: 12px 14px; border-radius: 12px; background: var(--tone-soft); border-left: 5px solid var(--tone); }
.login-app-icon { display: flex; flex: none; }
.login-app-icon svg { width: 40px; height: 40px; display: block; }
.login-app b { display: block; font-size: 1.08rem; color: var(--text); }
.login-app small { color: var(--muted); font-size: .84rem; }

/* sign-in and other single-card pages: logo and form in the middle of the screen */
main.centered { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-top: 24px; padding-bottom: 24px; }
main.centered .top { justify-content: center; }
main.centered .brand { margin-bottom: 0; }

/* product keys (members' page) */
.pkey { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .95rem; font-weight: 600; letter-spacing: .03em; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; display: inline-block; user-select: all; overflow-wrap: anywhere; }
.keyform { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 16px 0 8px; }
.keyform .field { flex: 1 1 260px; margin: 0; }
.keyform input { font-family: ui-monospace, Menlo, Consolas, monospace; text-transform: uppercase; letter-spacing: .04em; }
.pklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pk { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.pk-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.pk-state { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: #e5eefb; color: #2457a6; }
.pk-used .pk-state { background: var(--ok-soft); color: #134a32; }
.pk-revoked { opacity: .7; }
.pk-revoked .pk-state { background: var(--danger-soft); color: #7a1a12; }

/* subscriptions page (/subscribe) */
.sub-list { display: flex; flex-direction: column; gap: 16px; margin: 16px 0; }
.sub-app h2 { margin: 0 0 6px; }
.sub-app.sub-focus { border-color: var(--primary, #1f5c43); box-shadow: 0 0 0 2px rgba(31, 92, 67, .15); }
.sub-buy { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.plans { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.plans legend { font-weight: 600; font-size: .92rem; margin-bottom: 8px; padding: 0; }
.plan { flex: 1 1 200px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.plan input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; }
.plan small { display: block; color: var(--muted); font-size: .8rem; }
.plan:has(input:checked) { border-color: var(--primary, #1f5c43); background: rgba(31, 92, 67, .06); }
.warn { color: #8a5a00; }
