/* BTPL Licensing admin - design system (no build step, no external assets) */
:root {
  --navy: #14365C; --blue: #2B6CB8; --blue-dk: #1f5496; --green: #3E9C35; --green-bg: #e7f5e6;
  --red: #c53030; --red-bg: #fde8e8; --amber: #b7791f; --amber-bg: #fff4d6; --gray: #64748b; --gray-bg: #eef2f6;
  --bg: #f4f6f9; --card: #ffffff; --line: #e3e8ef; --text: #1e293b; --muted: #64748b;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 650; }
h3 { font-size: .95rem; margin: 0 0 .5rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: .92em; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 100; }

/* layout */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 56px; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--navy); font-weight: 800; }
.search { flex: 1; max-width: 560px; }
.search input { width: 100%; height: 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; padding: 0 12px; font-size: .95rem; }
.search input::placeholder { color: rgba(255,255,255,.65); }
.search input:focus { outline: 2px solid #fff; background: #fff; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.3rem; cursor: pointer; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: #fff; }
.menu summary::-webkit-details-marker { display: none; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--blue); font-weight: 650; }
.menu-panel { position: absolute; right: 0; top: 42px; background: #fff; color: var(--text); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16,24,40,.18); min-width: 230px; padding: 6px; }
.menu-panel a, .menu-panel .linklike { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel .linklike:hover { background: var(--gray-bg); text-decoration: none; }
.menu-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: .9rem; }
.sidenav { position: fixed; top: 56px; left: 0; bottom: 0; width: 220px; background: #fff; border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; z-index: 20; overflow-y: auto; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text); font-weight: 500; }
.sidenav a:hover { background: var(--gray-bg); text-decoration: none; }
.sidenav a.active { background: #e8f0fb; color: var(--blue-dk); }
.sidenav a .pill { margin-left: auto; }
.sidenav-foot { margin-top: auto; font-size: .8rem; color: var(--muted); padding: 10px 12px; }
.main { padding: 24px; }
.has-nav .main { margin-left: 220px; margin-top: 56px; }
.no-nav .main { max-width: 440px; margin: 8vh auto; }
@media (max-width: 900px) {
  .has-nav .main { margin-left: 0; padding: 16px; }
  .sidenav { transform: translateX(-100%); transition: transform .15s; }
  .sidenav.open { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.3); }
  .nav-toggle { display: block; }
  .search { display: none; }
  .hide-sm { display: none; }
}

/* page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head .grow { flex: 1; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; } .card-head .spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: 2px; }
.stat.warn .value { color: var(--amber); } .stat.bad .value { color: var(--red); } .stat.good .value { color: var(--green); }
a.stat { color: inherit; } a.stat:hover { text-decoration: none; border-color: var(--blue); }

/* definition lists */
.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; } .kv dd { margin: 0; overflow-wrap: anywhere; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* badges / pills */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge-active, .badge-ok { background: var(--green-bg); color: #276421; }
.badge-expired, .badge-rejected, .badge-blocked, .badge-revoked, .badge-error, .badge-denied, .badge-compromised { background: var(--red-bg); color: #9b2c2c; }
.badge-suspended, .badge-pending, .badge-pending_approval, .badge-not_started, .badge-warn { background: var(--amber-bg); color: #8a5a0b; }
.badge-deactivated, .badge-inactive, .badge-retired, .badge-muted, .badge-disabled { background: var(--gray-bg); color: #475569; }
.badge-permanent, .badge-info, .badge-manual { background: #e8f0fb; color: var(--blue-dk); }
.pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.pill-warn { background: var(--amber); color: #fff; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--gray-bg); text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn-primary:hover { background: var(--blue-dk); }
.btn-danger { background: #fff; border-color: #f3b4b4; color: var(--red); } .btn-danger:hover { background: var(--red-bg); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; } .btn-success:hover { filter: brightness(.95); }
.btn-sm { height: 30px; padding: 0 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* forms */
label { display: block; font-weight: 550; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; height: 38px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
textarea { height: auto; min-height: 90px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
input[aria-invalid=true] { border-color: var(--red); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.radio-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; display: block; }
.radio-card:has(input:checked) { border-color: var(--blue); background: #f2f7fd; box-shadow: 0 0 0 1px var(--blue); }
.radio-card input { margin-right: 6px; }
.radio-card .sub { font-size: .82rem; color: var(--muted); display: block; margin-top: 2px; }
.inline-form { display: inline; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }

/* flash */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash-success { background: var(--green-bg); border-color: #b8e0b4; color: #22581d; }
.flash-error { background: var(--red-bg); border-color: #f3b4b4; color: #8b1e1e; }
.flash-info { background: #e8f0fb; border-color: #bcd3f0; color: var(--blue-dk); }
.flash-warn { background: var(--amber-bg); border-color: #f1d58c; color: #7a4f0a; }

/* key display */
.key-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: #0f2540; color: #fff; border-radius: var(--radius); padding: 16px 18px; }
.key-box .key { font-family: var(--mono); font-size: 1.45rem; letter-spacing: .06em; font-weight: 600; word-break: break-all; }
.copy-btn { height: 30px; padding: 0 10px; border-radius: 6px; border: 1px solid #cbd5e1; background: #fff; color: var(--text); font: inherit; font-size: .82rem; cursor: pointer; }
.copy-btn.copied { background: var(--green-bg); border-color: var(--green); color: #22581d; }
.key-box .copy-btn { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.1); color: #fff; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); }
.timeline .when { font-size: .8rem; color: var(--muted); }
.timeline .what { font-weight: 550; }

/* wizard */
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; counter-reset: s; }
.steps span { counter-increment: s; font-size: .82rem; padding: 5px 10px; border-radius: 999px; background: var(--gray-bg); color: var(--muted); }
.steps span::before { content: counter(s) ". "; }
.steps span.done { background: var(--green-bg); color: #276421; }
.steps span.now { background: var(--blue); color: #fff; }

/* misc */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { width: auto; min-width: 150px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: .9rem; }
.pager a, .pager span { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager span.cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 10px 30px rgba(16,24,40,.08); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 700; font-size: 1.15rem; color: var(--navy); }
.error-page { text-align: center; padding: 60px 20px; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--navy); line-height: 1; }
.warn-box { background: var(--amber-bg); border: 1px solid #f1d58c; border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.danger-box { background: var(--red-bg); border: 1px solid #f3b4b4; border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.qr { background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 8px; display: inline-block; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: var(--mono); font-size: 1rem; }
.progress { height: 8px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); }
dialog { border: 0; border-radius: 12px; padding: 0; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,23,42,.5); }
dialog .dlg { padding: 20px; }
dialog h3 { margin-top: 0; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
@media print { .topbar, .sidenav, .actions, .btn { display: none !important; } .has-nav .main { margin: 0; } }
