/* ============================================================================
   Wove Loader — control panel
   Responsive (mobile → desktop), themable, accessible.
   ========================================================================== */

:root {
    /* palette ------------------------------------------------------------ */
    --bg: #0d0f17;
    --bg-2: #08090f;
    --panel: #141828;
    --panel-2: #1a1f33;
    --panel-3: #232a42;
    --line: #2c3352;
    --line-soft: #222840;
    --text: #e9ebf5;
    --text-dim: #c6cbe0;
    --muted: #8e95b5;
    --faint: #666d8c;

    --accent: #a48bfa;
    --accent-d: #7c5cf0;
    --accent-soft: rgba(148, 118, 250, .16);
    --weave: #3ec6b5;
    --amber: #f0b64e;
    --amber-soft: rgba(240, 182, 78, .16);
    --green: #55c98a;
    --green-soft: rgba(85, 201, 138, .16);
    --red: #ee7285;
    --red-soft: rgba(238, 114, 133, .16);
    --blue: #62a8ee;
    --blue-soft: rgba(98, 168, 238, .16);

    /* geometry ----------------------------------------------------------- */
    --r-sm: 7px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-2: 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-3: 0 18px 48px rgba(0, 0, 0, .5);

    --header-h: 60px;
    --maxw: 1180px;

    /* font --------------------------------------------------------------- */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

    --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background:
        radial-gradient(1100px 600px at 80% -10%, rgba(140, 110, 250, .10), transparent 60%),
        radial-gradient(900px 520px at -12% 112%, rgba(62, 198, 181, .06), transparent 60%),
        var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; }
code {
    background: var(--panel-2); padding: 1.5px 6px; border-radius: 5px;
    font-family: var(--mono); font-size: .9em; border: 1px solid var(--line-soft);
}
a { color: var(--accent); }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 16px; }

.brand {
    display: inline-flex; align-items: center; gap: 9px;
    font-weight: 700; font-size: 17px; white-space: nowrap; letter-spacing: -.01em;
}
.brand .logo {
    display: block; flex: 0 0 auto;
    width: 30px; height: 30px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}
.brand span { color: var(--accent); font-weight: 600; }

/* ============================================================ login ====== */

.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; }
.login-card {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--r-xl);
    padding: 30px 28px; width: 340px; max-width: 100%;
    display: flex; flex-direction: column; gap: 13px;
    box-shadow: var(--shadow-3);
}
.login-card .brand { justify-content: center; font-size: 19px; margin-bottom: 6px; }
.login-card .brand .logo { width: 38px; height: 38px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: -6px 0 8px; }

/* ============================================================ header ===== */

header {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 18px;
    height: var(--header-h); padding: 0 18px;
    background: rgba(13, 15, 23, .85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
header .brand { font-size: 16px; }

header nav { display: flex; gap: 3px; flex: 1; min-width: 0; }
header nav button {
    background: none; border: none; color: var(--muted);
    padding: 8px 14px; border-radius: var(--r-md); cursor: pointer;
    font-size: 14px; font-weight: 500; white-space: nowrap;
    transition: color .15s var(--ease), background .15s var(--ease);
}
header nav button:hover { color: var(--text); background: var(--panel-2); }
header nav button.active {
    color: #131022; background: linear-gradient(180deg, var(--accent), var(--accent-d));
    font-weight: 600; box-shadow: var(--shadow-1);
}

.who { display: flex; align-items: center; gap: 12px; color: var(--muted); white-space: nowrap; }
.who-mobile { display: none; }
#whoami { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
#whoami::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 0 3px var(--green-soft);
}

/* hamburger (mobile only) */
.hamburger {
    display: none; width: 42px; height: 42px; padding: 0;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md);
    cursor: pointer; position: relative; flex: 0 0 auto;
}
.hamburger span, .hamburger span::before, .hamburger span::after {
    content: ""; position: absolute; left: 11px; width: 20px; height: 2px;
    background: var(--text); border-radius: 2px; transition: transform .22s var(--ease), opacity .18s var(--ease);
}
.hamburger span { top: 20px; }
.hamburger span::before { top: -6px; }
.hamburger span::after { top: 6px; }
body.nav-open .hamburger span { background: transparent; }
body.nav-open .hamburger span::before { top: 0; transform: rotate(45deg); }
body.nav-open .hamburger span::after { top: 0; transform: rotate(-45deg); }

.nav-backdrop {
    position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5);
    opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

/* ============================================================ layout ==== */

main { padding: 22px; max-width: var(--maxw); margin: 0 auto; }
.tab { display: none; animation: fade .25s var(--ease); }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.section-head h3 { font-size: 18px; }
.section-head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================ cards ===== */

.cards {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px;
}
.card {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 18px 16px;
    box-shadow: var(--shadow-1);
    transition: transform .15s var(--ease), border-color .15s var(--ease);
}
.card:hover { transform: translateY(-2px); border-color: var(--accent-d); }
.card::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--weave), transparent);
    opacity: .55;
}
.card .num { font-size: 32px; font-weight: 800; color: var(--accent); line-height: 1.1; letter-spacing: -.02em; }
.card .lbl { color: var(--muted); margin-top: 5px; font-size: 13px; }

/* ============================================================ panels ==== */

.panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.panel + .panel { margin-top: 16px; }

/* ============================================================ tables ==== */

.table-wrap {
    border: 1px solid var(--line); border-radius: var(--r-lg);
    overflow: hidden; background: var(--panel); box-shadow: var(--shadow-1);
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
thead th {
    position: sticky; top: 0; z-index: 1;
    color: var(--muted); font-weight: 600; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .05em;
    background: var(--panel-2);
}
td .mono, td.mono { font-family: var(--mono); font-size: 12px; }
td .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
td .sub.tamper-flag { color: var(--red); font-weight: 600; cursor: help; }
/* Per-product group header rows inside a grouped license table. */
tbody tr.group-row td { background: var(--panel-2); padding: 8px 14px; border-bottom: 1px solid var(--line); }
tbody tr.group-row:hover td { background: var(--panel-2); }
tbody tr.group-row .group-count { color: var(--muted); font-size: 12px; margin-left: 8px; }
.empty { color: var(--muted); text-align: center; padding: 28px 14px !important; }

/* ============================================================ controls == */

input, select, textarea, button {
    font: inherit; color: var(--text); background: var(--panel-2);
    border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 9px 11px; min-height: 40px;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { cursor: pointer; }

button {
    background: linear-gradient(180deg, var(--accent), var(--accent-d));
    color: #131022; font-weight: 600; cursor: pointer; border: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: filter .15s var(--ease), transform .08s var(--ease), background .15s var(--ease);
}
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; filter: none; transform: none; }
button.ghost {
    background: var(--panel-2); color: var(--text); border: 1px solid var(--line); font-weight: 500;
}
button.ghost:hover { background: var(--panel-3); filter: none; }
button.danger { background: linear-gradient(180deg, #ee7285, #d95570); color: #fff; }
button.subtle { background: transparent; border: 1px solid var(--line); color: var(--text-dim); font-weight: 500; }

/* keyboard focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus-visible, a:focus-visible { outline-offset: 3px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.err { color: var(--red); font-size: 13px; min-height: 16px; }

.search {
    position: relative; display: inline-flex; align-items: center; min-width: 0;
}
.search input { padding-left: 32px; }
.search::before {
    content: "⌕"; position: absolute; left: 11px; color: var(--muted); font-size: 16px; pointer-events: none;
}

/* badges */
.badge {
    display: inline-block; padding: 2.5px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
    border: 1px solid transparent; white-space: nowrap;
}
.badge.neutral { background: var(--panel-3); color: var(--muted); border-color: var(--line); }
.badge.active, .badge.deployed { background: var(--green-soft); color: var(--green); border-color: rgba(85, 201, 138, .3); }
.badge.suspended { background: var(--amber-soft); color: var(--amber); border-color: rgba(240, 182, 78, .3); }
.badge.revoked, .badge.expired { background: var(--red-soft); color: var(--red); border-color: rgba(238, 114, 133, .3); }
.badge.banana { background: var(--amber-soft); color: var(--amber); border-color: rgba(240, 182, 78, .3); text-transform: capitalize; }
.badge.polar { background: var(--blue-soft); color: var(--blue); border-color: rgba(98, 168, 238, .3); text-transform: capitalize; }
.badge .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: middle; }

/* action button clusters in tables */
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.actions button, .actions select { padding: 6px 10px; min-height: 34px; font-size: 12.5px; }
.actions select { padding-right: 8px; }

/* ============================================================ upload boxes */

.upload {
    display: flex; gap: 11px; align-items: center; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px;
    box-shadow: var(--shadow-1);
}
.upload .desc { flex: 1 1 100%; color: var(--muted); margin-bottom: 4px; }
.upload .desc b { color: var(--text-dim); }
input[type=file] {
    padding: 7px 10px; cursor: pointer;
}
input[type=file]::file-selector-button {
    font: inherit; margin-right: 10px; padding: 6px 12px; cursor: pointer;
    background: var(--panel-3); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm);
}

textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.5; }

.keyfield { display: flex; gap: 10px; align-items: stretch; }
.keyfield textarea { min-height: 64px; }

/* ============================================================ modals ==== */

.modal {
    position: fixed; inset: 0; z-index: 60; padding: 18px;
    background: rgba(5, 6, 12, .66); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: grid; place-items: center;
    animation: fade .18s var(--ease);
}
.modal-card {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--r-xl);
    padding: 24px; width: 480px; max-width: 100%; max-height: 90vh; overflow: auto;
    box-shadow: var(--shadow-3);
    animation: pop .2s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-card h3 { margin-bottom: 12px; }
.modal-card .form-grid { display: flex; flex-direction: column; gap: 12px; }
.modal-card .form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-card .form-row .field { flex: 1; min-width: 130px; }

.keybox {
    background: var(--bg-2); border: 1px dashed var(--accent); border-radius: var(--r-md);
    padding: 14px; font-family: var(--mono); font-size: 15px; word-break: break-all; margin: 14px 0;
    color: var(--accent);
}

/* dialog (confirm/prompt) */
.dialog-msg { font-size: 14.5px; line-height: 1.55; margin-bottom: 6px; }
.dialog-msg.warn::before { content: "⚠ "; color: var(--amber); }

/* ============================================================ toasts ==== */

.toasts {
    position: fixed; z-index: 80; right: 16px; bottom: 16px;
    display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px));
}
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--panel-2); border: 1px solid var(--line); border-left-width: 3px;
    border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--shadow-2);
    font-size: 13.5px; animation: toastin .25s var(--ease);
}
.toast.out { animation: toastout .2s var(--ease) forwards; }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
.toast .ti { font-weight: 700; }
.toast.ok .ti { color: var(--green); }
.toast.err .ti { color: var(--red); }
.toast.info .ti { color: var(--blue); }
.toast .tx { color: var(--text-dim); word-break: break-word; }
@keyframes toastin { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateX(20px); } }

/* ============================================================ console === */

.console-panel, .files-panel { display: flex; flex-direction: column; gap: 12px; }

.subview-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow-1);
}
.subview-head .left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.subview-head .right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.console-title { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); word-break: break-word; }

.status-dot { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.online { color: var(--green); }
.status-dot.online::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 1.8s infinite; }
.status-dot.offline { color: var(--red); }
.status-dot.offline::before { background: var(--red); }
.status-dot.reconnecting { color: var(--blue); }
.status-dot.reconnecting::before { background: var(--blue); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); } 50% { box-shadow: 0 0 0 6px transparent; } }

.console-output {
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 12px 14px; height: min(60vh, 560px); min-height: 280px; overflow-y: auto;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
    white-space: pre-wrap; word-break: break-word;
}
.console-output:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cline { white-space: pre-wrap; }
.cout { color: var(--text); }
.cerr { color: var(--red); }
.cmeta { color: var(--accent); opacity: .85; }

.console-input {
    display: flex; align-items: center; gap: 9px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 6px 8px 6px 14px;
}
.console-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.console-prompt { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.console-input input {
    flex: 1; min-width: 0; border: none; background: none; padding: 6px 0; min-height: 32px;
    font-family: var(--mono); font-size: 13px;
}
.console-input input:focus { outline: none; box-shadow: none; }
.console-input button { flex: 0 0 auto; }

/* ============================================================ files ===== */

.files-toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow-1);
}
.files-toolbar .left { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.files-toolbar .right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.iconbtn {
    width: 38px; height: 38px; min-height: 0; padding: 0; font-size: 15px;
    background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
}
.iconbtn:hover:not(:disabled) { background: var(--panel-3); filter: none; }
.iconbtn:disabled { opacity: .35; }

/* breadcrumb bar — the "back buttons in file trees" */
.crumbs {
    display: flex; align-items: center; gap: 2px; flex-wrap: nowrap;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 6px 10px; font-family: var(--mono); font-size: 12.5px; scrollbar-width: thin;
}
.crumbs::-webkit-scrollbar { height: 5px; }
.crumbs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.crumb {
    background: none; border: none; color: var(--muted); cursor: pointer;
    padding: 4px 8px; border-radius: var(--r-sm); min-height: 0; font-family: var(--mono); font-size: 12.5px;
    white-space: nowrap; transition: color .12s var(--ease), background .12s var(--ease);
}
.crumb:hover { color: var(--text); background: var(--panel-2); filter: none; }
.crumb.current { color: var(--accent); font-weight: 600; cursor: default; }
.crumb.current:hover { background: none; }
.crumb-sep { color: var(--faint); padding: 0 1px; user-select: none; }

.files-busy { min-height: 18px; color: var(--muted); font-size: 12.5px; }
.files-busy.loading::before {
    content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 7px;
    border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
    vertical-align: -2px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.files-table .fname {
    color: var(--text); text-decoration: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; word-break: break-all;
}
.files-table .fname .fi { flex: 0 0 auto; opacity: .9; }
.files-table .fname:hover { color: var(--accent); }
.files-table .ro {
    margin-left: 7px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

.upbtn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
    border-radius: var(--r-md); padding: 0 12px; height: 38px; font-weight: 500; cursor: pointer; font-size: 13.5px;
}
.upbtn:hover { background: var(--panel-3); }
.upbtn input { display: none; }

/* file editor */
.editor-card { width: 860px; max-width: 100%; }
.editor-card h3 { margin: 0; word-break: break-all; }
#editorText {
    width: 100%; height: min(60vh, 520px); min-height: 280px; margin: 12px 0; resize: vertical;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
    color: var(--text); white-space: pre; tab-size: 4;
}

/* ============================================================ responsive  */

/* tablet */
@media (max-width: 980px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
}

/* phone */
@media (max-width: 720px) {
    :root { --header-h: 56px; }
    main { padding: 16px 14px 90px; }

    /* collapse nav into a drawer */
    .hamburger { display: block; }
    header { gap: 12px; }
    header .who { display: none; }
    header nav {
        position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 36;
        flex-direction: column; gap: 4px; flex: none;
        background: var(--panel); border-bottom: 1px solid var(--line);
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
        transform: translateY(-130%); transition: transform .26s var(--ease);
        box-shadow: var(--shadow-2);
        max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    }
    body.nav-open header nav { transform: translateY(0); }
    header nav button { width: 100%; text-align: left; padding: 13px 14px; font-size: 15px; }
    header nav .who-mobile {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line);
        color: var(--muted);
    }

    .cards { grid-template-columns: repeat(2, 1fr); gap: 11px; }
    .card { padding: 15px; }
    .card .num { font-size: 27px; }

    .section-head h3 { font-size: 17px; }
    .section-head .tools { width: 100%; }
    .section-head .tools .search, .section-head .tools .grow { flex: 1; }

    /* table → card list */
    .table-wrap { border: none; background: none; box-shadow: none; overflow: visible; }
    .table-scroll { overflow: visible; }
    table.responsive thead { display: none; }
    table.responsive, table.responsive tbody { display: block; }
    table.responsive tr {
        display: block; background: var(--panel); border: 1px solid var(--line);
        border-radius: var(--r-lg); padding: 6px 14px; margin-bottom: 12px; box-shadow: var(--shadow-1);
    }
    table.responsive tr:hover { background: var(--panel); }
    table.responsive td {
        display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
        padding: 9px 0; border-bottom: 1px solid var(--line-soft); text-align: right;
    }
    table.responsive tr td:last-child { border-bottom: none; }
    table.responsive td::before {
        content: attr(data-label); color: var(--muted); font-size: 11.5px; font-weight: 600;
        text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: 0 0 auto; padding-top: 2px;
    }
    table.responsive td:empty { display: none; }
    table.responsive td.actions { justify-content: flex-start; flex-wrap: wrap; text-align: left; }
    table.responsive td.actions::before { width: 100%; }
    table.responsive td.full { flex-direction: column; align-items: flex-start; text-align: left; }
    table.responsive td.full::before { margin-bottom: 4px; }
    table.responsive td.full .badge { align-self: flex-start; }
    table.responsive .files-table td.full .ro { margin: 4px 0 0; }
    table.responsive .empty { display: block; text-align: center; }
    table.responsive .empty::before { content: none; }

    .files-toolbar .right { width: 100%; margin-left: 0; }
    .files-toolbar .left { width: 100%; }
    .console-output { height: 52vh; }

    .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
    .modal { padding: 0; place-items: end stretch; }
    .modal-card {
        width: 100%; max-width: 100%; max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0;
        padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
        animation: sheet .26s var(--ease);
    }
    @keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }
    .editor-card { border-radius: var(--r-xl) var(--r-xl) 0 0; }
}

@media (max-width: 380px) {
    .cards { grid-template-columns: 1fr; }
}

/* honour reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* scrollbars (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--panel-3); background-clip: content-box; }

/* ============================================================================
   Plugins tab — upload hero + plugin cards
   ========================================================================== */

.upload-hero {
    display: grid; grid-template-columns: 1.1fr 1.4fr; gap: 26px; align-items: stretch;
    background:
        radial-gradient(900px 280px at 88% -40%, var(--accent-soft), transparent 70%),
        linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--r-xl);
    padding: 22px 24px; margin-bottom: 26px; box-shadow: var(--shadow-2);
}
.upload-hero .uh-text h3 { margin: 0 0 8px; font-size: 19px; }
.upload-hero .uh-text p { margin: 0; max-width: 42ch; line-height: 1.5; }
.uh-form { display: flex; flex-direction: column; gap: 14px; }
.uh-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.uh-fields .hint { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.uh-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.uh-actions #plgStatus { font-size: 13px; }

.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    text-align: center; cursor: pointer; min-height: 132px; padding: 18px;
    border: 1.5px dashed var(--line); border-radius: var(--r-lg);
    background: var(--bg-2); color: var(--text-dim);
    transition: border-color .15s var(--ease), background .15s var(--ease), transform .08s var(--ease);
}
.dropzone:hover { border-color: var(--accent-d); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.dropzone.has-file { border-style: solid; border-color: rgba(85, 201, 138, .5); background: var(--green-soft); }
.dropzone .dz-icon { font-size: 26px; color: var(--accent); line-height: 1; }
.dropzone.has-file .dz-icon { color: var(--green); }
.dropzone .dz-main { font-size: 14px; }
.dropzone .dz-main b { color: var(--text); }
.dropzone .dz-sub { font-size: 12px; color: var(--muted); font-family: var(--mono); word-break: break-all; }

.plugin-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px;
}
.plugin-card {
    display: flex; flex-direction: column; gap: 14px;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px;
    box-shadow: var(--shadow-1); transition: transform .15s var(--ease), border-color .15s var(--ease);
}
.plugin-card:hover { transform: translateY(-2px); border-color: var(--accent-d); }
.pc-head { display: flex; flex-direction: column; gap: 5px; }
.pc-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pc-id { color: var(--muted); font-size: 12px; }
.pc-stats { display: flex; gap: 8px; }
.pc-stats > div {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 9px 4px;
}
.pc-num { font-size: 20px; font-weight: 700; color: var(--accent); }
.pc-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pc-active { font-size: 13px; min-height: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.pc-actions button { font-size: 13px; padding: 7px 12px; }

.empty-card {
    grid-column: 1 / -1; text-align: center; color: var(--muted);
    padding: 40px; border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--panel);
}

@media (max-width: 760px) {
    .upload-hero { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
    .uh-fields { grid-template-columns: 1fr; }
    .plugin-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   API tab — documentation + code blocks
   ========================================================================== */

.api-docs { max-width: 860px; }
.api-docs .api-h { margin: 22px 0 6px; font-size: 15px; }
.api-docs p { line-height: 1.55; }

.code-card {
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md);
    overflow: hidden; margin: 10px 0 4px;
}
.code-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 7px 10px 7px 14px; border-bottom: 1px solid var(--line-soft);
    background: var(--panel); font-size: 12px; color: var(--muted); font-weight: 600;
}
.code-head .copybtn { padding: 4px 11px; font-size: 12px; }
.code-card pre {
    margin: 0; padding: 14px; overflow-x: auto;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--text-dim);
}
.code-card code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }

/* ============================================================================
   Traffic tab — request-rate chart + event markers
   ========================================================================== */

.traffic-chart {
    background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-md);
    padding: 10px 12px; margin: 12px 0 10px;
}
.tchart { width: 100%; height: auto; display: block; }
.tc-axis { stroke: var(--line); stroke-width: 1; }
.tc-ylab, .tc-xlab { fill: var(--faint); font-size: 9px; font-family: var(--mono); }
.tc-guide { stroke: rgba(238, 114, 133, .22); stroke-width: 1; }
.tc-more { fill: var(--muted); font-size: 8px; font-family: var(--mono); }
.tc-selbg { fill: var(--accent-soft); }
.tc-hit { fill: transparent; cursor: pointer; }
.tc-hit:hover { fill: rgba(233, 235, 245, .06); }

.traffic-legend {
    display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
    font-size: 12px; color: var(--text-dim); margin-bottom: 18px;
}
.tl-item { display: inline-flex; align-items: center; gap: 5px; }
.tl-sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tl-sep { color: var(--faint); margin-left: 8px; }
.ev-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.traffic-auto { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }

/* Hosted databases: per-license storage usage bar */
.usage-bar {
    width: 100%; max-width: 220px; height: 8px; border-radius: 5px;
    background: var(--panel-3); overflow: hidden; margin-bottom: 4px;
}
.usage-bar > span { display: block; height: 100%; border-radius: 5px; background: var(--green); transition: width .3s ease; }
.usage-bar > span.warn { background: var(--amber); }
.usage-bar > span.over { background: var(--red); }

/* Hosted databases: data browser + console sub-view */
.db-browser { margin-top: 4px; }
.db-cols { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.db-side {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 70vh;
}
.db-side-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.db-side input { width: 100%; }
.db-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.db-list li {
    padding: 5px 7px; border-radius: var(--r-sm); cursor: pointer; font-family: var(--mono);
    font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-list li:hover { background: var(--panel-2); }
.db-list li.sel { background: var(--accent-soft); color: var(--text); }
.db-list li.muted, .db-list li.err { cursor: default; font-family: inherit; }
.db-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.db-view {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 12px; max-height: 48vh; overflow: auto; min-height: 120px;
}
.db-kv-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.db-sub { color: var(--muted); font-size: 12px; margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.db-pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; color: var(--text); }
.db-doc { padding: 8px; background: var(--panel-2); border-radius: var(--r-sm); margin-bottom: 8px; }
.db-pairs { width: 100%; border-collapse: collapse; }
.db-pairs td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.db-field { color: var(--accent); white-space: nowrap; }
.db-listval { margin: 0; padding-left: 20px; }
.db-stream-entry { border-left: 2px solid var(--line); padding: 4px 0 4px 10px; margin: 8px 0; }
.db-stream-id { color: var(--blue); margin-bottom: 4px; }
.db-console-out {
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 10px; max-height: 26vh; overflow: auto; font-size: 12px;
}
.db-line { padding: 2px 0; }
.db-line.cmd .db-pre { color: var(--accent); }
.db-line.err .db-pre { color: var(--red); }
@media (max-width: 720px) { .db-cols { grid-template-columns: 1fr; } }

/* Multi-product license bundling */
.prod-x { cursor: pointer; color: var(--red); font-weight: 700; padding: 0 2px; opacity: .75; }
.prod-x:hover { opacity: 1; }
.prod-add { padding: 1px 7px; font-size: 12px; line-height: 1.4; }
select.loaderProd { max-width: 120px; }

/* Bundle-products checkbox grid (create-license dialog) */
.prod-check-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 4px; }
.prod-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; color: var(--text); }
.prod-check input { width: auto; margin: 0; }
