/* Bexel License Server admin UI. One file, no build step.
   Palette and type from the Bexel brand guide. Super Green #00BC74 is an accent only (white text on it
   fails WCAG AA): buttons use the 70% tint #007D4D, hover #005E3A. */
@font-face { font-family: Ubuntu; font-weight: 300; font-style: normal; font-display: swap; src: url("../fonts/Ubuntu-Light.ttf") format("truetype"); }
@font-face { font-family: Ubuntu; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/Ubuntu-Regular.ttf") format("truetype"); }
@font-face { font-family: Ubuntu; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/Ubuntu-Medium.ttf") format("truetype"); }

:root {
    --green: #00BC74; --green-70: #007D4D; --green-80: #005E3A; --green-10: #CCF2E3;
    --purple: #7939B9; --blue-10: #E1DDFF; --blue-text: #4737A9;
    --ink: #2D2A26; --ink-75: #625F5C; --muted: #73716E; --line: #D5D4D4; --bg: #F7F7F6; --white: #FFFFFF;
    --yellow-10: #FEF4DA; --yellow-text: #7D6323;
    --orange-10: #FDE4D7; --orange-text: #A34F25; --orange-deep: #7B3C1C;
    --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font: 400 15px/1.55 Ubuntu, system-ui, sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3 { font-weight: 400; margin: 0; line-height: 1.25; }
h1 { font-size: 28px; } h2 { font-size: 20px; margin-bottom: 14px; }
p { margin: 0 0 10px; }
a { color: var(--purple); }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; }
ul.plain { margin: 0; padding-left: 1.1em; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.sidebar :focus-visible { outline-color: var(--white); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; z-index: 10; border-radius: 4px; }
.skip:focus { left: 8px; }
.icon { flex: none; vertical-align: -4px; color: var(--ink-75); }

/* Shell: black sidebar + content column */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex: none; background: var(--ink); color: var(--white); padding: 24px 16px; align-self: stretch; }
.sidebar-inner { position: sticky; top: 24px; }
.sidebar-head { margin-bottom: 28px; padding: 0 8px; }
.brand img { display: block; width: 120px; height: auto; }
.menu-btn { display: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; color: var(--white); text-decoration: none; border-left: 3px solid transparent; }
.nav a .icon, .menu-btn .icon { color: var(--white); }
.nav a:hover { background: rgba(255, 255, 255, .1); }
.nav a.active { background: rgba(255, 255, 255, .12); border-left-color: var(--green); }
.column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--white); border-bottom: 1px solid var(--line); padding: 12px 32px; min-height: 64px; }
.crumbs { font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs nav { display: inline; }
.crumbs a { color: var(--muted); }
.page-title { color: var(--ink); font-size: 15px; }
.user { display: flex; align-items: center; gap: 12px; }
.user form { margin: 0; }
main { width: 100%; max-width: 1120px; padding: 28px 32px 56px; margin: 0 auto; }
main:focus { outline: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; }
.meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form.inline, form.inline { display: inline; margin: 0; }
.count { display: inline-block; min-width: 24px; padding: 0 8px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; vertical-align: 3px; }

/* Cards, stats */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { display: block; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius); padding: 16px 20px; text-decoration: none; color: var(--ink); }
.stat:hover { border-color: var(--ink-75); }
.stat-active { border-top-color: var(--green); } .stat-waiting { border-top-color: #E8B93C; } .stat-expired { border-top-color: #CC632F; } .stat-total { border-top-color: var(--ink); }
.stat-label { display: block; color: var(--muted); font-size: 13px; }
.stat-value { display: block; font-size: 36px; font-weight: 300; line-height: 1.2; }
.empty { color: var(--muted); padding: 8px 0; margin: 0; }
.card.flush .empty { padding: 24px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; font-size: 13px; color: var(--muted); background: var(--bg); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td strong { font-weight: 500; }
td.valid .small, .nowrap { white-space: nowrap; }
td.lead { overflow-wrap: break-word; }
td.lead .small { overflow-wrap: anywhere; }
.table-wrap th, .table-wrap td { padding-left: 12px; padding-right: 12px; }
.actions-col .btn { white-space: nowrap; }
.actions-col { text-align: right; white-space: nowrap; }
.card:not(.flush) th:first-child, .card:not(.flush) td:first-child { padding-left: 0; }
.card:not(.flush) th:last-child, .card:not(.flush) td:last-child { padding-right: 0; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.s1 { background: var(--green-10); color: var(--green-80); }
.badge.s2 { background: var(--yellow-10); color: var(--yellow-text); }
.badge.s3 { background: var(--orange-10); color: var(--orange-text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); font: 400 15px/1.3 Ubuntu, system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink-75); }
.btn .icon { color: var(--ink-75); }
.btn-sm { padding: 5px 12px; font-size: 14px; }
.btn-primary, .btn-danger-solid { color: var(--white); border-color: transparent; }
.btn-primary { background: var(--green-70); } .btn-primary:hover { background: var(--green-80); border-color: transparent; }
.btn-danger-solid { background: var(--orange-text); } .btn-danger-solid:hover { background: var(--orange-deep); border-color: transparent; }
.btn-primary .icon, .btn-danger-solid .icon { color: var(--white); }
.btn-danger { color: var(--orange-text); border-color: var(--orange-text); } .btn-danger:hover { background: var(--orange-10); border-color: var(--orange-deep); }
.btn-danger .icon { color: currentColor; }
.danger-zone { border-color: #E9A67D; }
.cutover-banner { background: var(--yellow-10); color: var(--yellow-text); border-bottom: 1px solid #E8CF8C; padding: 6px 32px; font-size: 13px; }
.cutover-banner-lg { border: 1px solid #E8CF8C; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; font-size: 15px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); border-color: transparent; }
.btn-block { width: 100%; }

/* Forms */
.form { max-width: 760px; }
.field { margin-bottom: 16px; flex: 1 1 200px; min-width: 0; }
.field.narrow { flex: 0 1 140px; }
.field label, .field .label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 14px; }
.field.check label { font-weight: 400; display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.field.check input { margin-top: 4px; }
fieldset.choice { border: 0; padding: 0; margin: 0 0 16px; }
.field label.radio { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 6px; font-weight: 400; cursor: pointer; }
.field label.radio input { margin-top: 4px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; max-width: none; }
.inline-form .field { flex: 0 1 200px; margin-bottom: 0; }
.inline-form .field.check { flex: 1 1 240px; align-self: flex-end; padding-bottom: 10px; }
.inline-form .field.check label { margin: 0; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], input[type=search], select {
    width: 100%; padding: 9px 12px; border: 1px solid #9C9A98; border-radius: 6px; background: var(--white); color: var(--ink); font: inherit; }
input:focus, select:focus { border-color: var(--purple); }
input[type=radio], input[type=checkbox] { accent-color: #007D4D; }
.hint { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.form-actions { display: flex; gap: 8px; margin-bottom: 24px; }
.form .card:last-of-type { margin-bottom: 20px; }

/* Alerts, key box, pills */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 20px; }
.alert .icon { color: currentColor; margin-top: 2px; }
.alert-body { min-width: 0; flex: 1; }
.alert-success { background: var(--green-10); border-color: #7FD9B5; color: var(--green-80); }
.alert-error { background: var(--orange-10); border-color: #E9A67D; color: var(--orange-deep); }
.alert-warning { background: var(--yellow-10); border-color: #E8CF8C; color: var(--yellow-text); }
.alert-info { background: var(--blue-10); border-color: #B9B0F5; color: var(--blue-text); }
.alert a { color: inherit; font-weight: 500; }
.card .alert { margin-bottom: 16px; }
.keybox { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--green-10); border: 1px solid #7FD9B5; border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; }
.keybox-value { font: 400 22px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; color: var(--ink); word-break: break-all; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 20px; font-weight: 500; font-size: 14px; margin-bottom: 16px; }
.pill .icon { color: currentColor; }
.pill-ok { background: var(--green-10); color: var(--green-80); } .pill-warn { background: var(--yellow-10); color: var(--yellow-text); }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0; }
.facts + .field.check { margin-top: 20px; }
.period { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: flex-end; }
.period label { flex: 1 0 100%; margin-bottom: 0 !important; }
.period select { flex: 1 1 130px; }
.period input { flex: 1 1 90px; min-width: 90px; }
html:not(.js) .period-select { display: none; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; overflow-wrap: anywhere; }
/* Three narrow cards: label above value, so emails and URLs get the full card width. */
.grid-3 .facts { grid-template-columns: 1fr; gap: 0; }
.grid-3 .facts dd + dt { margin-top: 10px; }
.help summary { cursor: pointer; font-weight: 500; }
.help { margin-top: 0; max-width: 760px; }
.help p { margin: 12px 0 0; color: var(--muted); }

/* Tabs and list toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.toolbar .tabs { margin-bottom: 0; border-bottom: 0; }
.tab { padding: 8px 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; }
.tab:hover { background: var(--white); }
.tab.active, .tab[aria-selected=true] { border-bottom-color: var(--green); font-weight: 500; }
.toolbar .tab { border: 1px solid var(--line); border-radius: 20px; background: var(--white); padding: 5px 14px; }
.toolbar .tab.active { border-color: var(--green-70); background: var(--green-10); color: var(--green-80); }
html:not(.js) button.tab { display: none; }
html:not(.js) .tabs[role=tablist] { display: none; }
.js [data-panel][data-inactive] { display: none; }
.search-box { position: relative; flex: 0 1 320px; width: 100%; }
.search-box .icon { position: absolute; left: 12px; top: 11px; }
.search-box input { padding-left: 38px; }

/* Login */
.login-page { background: var(--bg); }
.login { max-width: 400px; margin: 0 auto; padding: 12vh 16px 32px; }
.login-card { padding: 32px; }
.login-logo { display: block; margin: 0 auto 20px; width: 160px; height: auto; }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 24px; }

@media (max-width: 899px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; padding: 12px 16px; }
    .sidebar-inner { position: static; }
    .sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0; padding: 0; }
    .menu-btn { display: inline-flex; background: none; border: 1px solid rgba(255, 255, 255, .4); border-radius: 6px; padding: 6px; cursor: pointer; }
    .nav { display: none; padding-top: 12px; }
    .sidebar.open .nav { display: flex; }
    html:not(.js) .nav { display: flex; padding-top: 12px; flex-direction: row; flex-wrap: wrap; }
    .topbar { padding: 10px 16px; }
    main { padding: 20px 16px 40px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1099px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 699px) {
    .grid-3 { grid-template-columns: 1fr; }
    .table-wrap { overflow-x: visible; }
    table.stack, .stack tbody, .stack tr, .stack td { display: block; }
    .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
    .stack tbody tr:last-child { border-bottom: 0; }
    .stack td, .card:not(.flush) .stack td:first-child, .card:not(.flush) .stack td:last-child { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border: 0; padding: 4px 0; text-align: right; }
    .stack td[data-label]::before { font-family: Ubuntu, system-ui, sans-serif; content: attr(data-label); flex: none; color: var(--muted); font-size: 13px; text-align: left; }
    .stack td.lead { display: block; text-align: left; padding-bottom: 6px; }
    .stack td.actions-col { display: flex; justify-content: flex-start; gap: 8px; padding-top: 8px; }
    .stack td.actions-col .btn { flex: 1; }
    .stack td.valid > div { text-align: right; }
    .user-name, .logout-label { display: none; }
    .facts { grid-template-columns: 100px 1fr; }
    .keybox-value { font-size: 18px; }
    .card { padding: 16px; }
}
