/* Account, checkout and admin screens. Builds on the tokens in site.css. */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 40px 0 64px; }
.app .nav-cta form { margin: 0; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13.5px; }
.app-footer a { color: var(--muted); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -.025em; }
.page-head p { color: var(--muted); margin-top: 6px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.crumb { font-size: 14px; color: var(--dim); margin-bottom: 8px; display: inline-block; }
.crumb:hover { color: var(--text); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.panel + .panel, .stack > * + * { margin-top: 20px; }
.panel h2 { font-size: 17px; margin-bottom: 16px; }
.panel h2 small { color: var(--dim); font-weight: 500; font-size: 14px; margin-left: 6px; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols > * + * { margin-top: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi span { color: var(--dim); font-size: 13px; }
.kpi b { display: block; font-size: 28px; letter-spacing: -.03em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 32px 12px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 13.5px; }
.mono { font-family: var(--mono); font-size: 13.5px; }
.data .mono { white-space: nowrap; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.data th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tr:last-child td { border-bottom: 0; }
.data td.num, .data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data a.row-link { color: var(--text); font-weight: 600; }
.data a.row-link:hover { color: var(--accent); }
.data .actions { text-align: right; white-space: nowrap; }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.pill-active, .pill-paid { color: #a7f3d0; background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .3); }
.pill-pending { color: #fde68a; background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .3); }
.pill-expired, .pill-cancelled, .pill-dev { color: #cbd5e1; background: rgba(148, 163, 184, .1); border-color: var(--line-2); }
.pill-suspended, .pill-refunded { color: #fed7aa; background: rgba(251, 146, 60, .12); border-color: rgba(251, 146, 60, .3); }
.pill-revoked, .pill-failed { color: #fecaca; background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .3); }

/* Definition lists */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; font-size: 14.5px; margin: 0; }
dl.facts dt { color: var(--dim); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Forms */
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label, .field .label { font-size: 13.5px; font-weight: 600; color: #cbd5e1; }
.field .hint { font-size: 12.5px; color: var(--dim); }
.field .error { font-size: 13px; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
    width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--bg-2);
    border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
input[aria-invalid=true] { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: center; font-size: 14.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }
.btn-danger { border-color: rgba(248, 113, 113, .4); color: #fecaca; background: rgba(248, 113, 113, .08); }
.btn-danger:hover { background: rgba(248, 113, 113, .16); border-color: rgba(248, 113, 113, .6); }
button.btn { cursor: pointer; font-family: inherit; }
.inline { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; }

/* Auth card */
.auth { max-width: 440px; margin: 24px auto; }
.auth h1 { font-size: 28px; letter-spacing: -.02em; margin-bottom: 6px; }
.auth > p { color: var(--muted); margin-bottom: 24px; }
.auth .alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14.5px; }
.auth .alt a, .link { color: var(--accent); }

/* Flash */
.flash { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font-size: 14.5px; }
.flash svg { flex: none; }
.flash.ok { background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .3); color: #d1fae5; }
.flash.err { background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .35); color: #fee2e2; }
.flash.warn { background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .3); color: #fef3c7; }

.key-reveal { display: grid; gap: 14px; padding: 20px; border-radius: var(--radius); margin-bottom: 20px; background: linear-gradient(180deg, rgba(52, 211, 153, .1), rgba(15, 22, 41, .6)); border: 1px solid rgba(52, 211, 153, .45); }
.key-reveal p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.key-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.key-row code { flex: 1 1 280px; font-size: clamp(15px, 2.4vw, 19px); letter-spacing: .06em; padding: 12px 14px; border-radius: 10px; background: rgba(2, 6, 16, .7); border: 1px solid var(--line-2); overflow-wrap: anywhere; user-select: all; }

/* Checkout */
.pay-options { display: grid; gap: 12px; }
.pay-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; transition: border-color .15s, background .15s; }
.pay-option:has(input:checked) { border-color: var(--accent); background: rgba(52, 211, 153, .06); }
.pay-option input { accent-color: var(--accent); width: 18px; height: 18px; }
.pay-option b { font-size: 16px; }
.pay-option .left { display: flex; gap: 14px; align-items: center; }
.summary-price { font-size: 36px; font-weight: 800; letter-spacing: -.03em; }

.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.price-grid .field { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.gw { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.gw:last-child { border-bottom: 0; }

@media (max-width: 1000px) {
    .cols { grid-template-columns: minmax(0, 1fr); }
    .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .app-main { padding: 28px 0 48px; }
    .panel { padding: 18px; }
    .table-wrap { margin: 0 -18px; padding: 0 18px; }
    .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    dl.facts { grid-template-columns: 1fr; gap: 2px; }
    dl.facts dd { margin-bottom: 8px; }
}
