/* Royal State Scripts license panel. Created by: ThaRinDu_G */
:root {
    color-scheme: dark;
    --bg: #090a0c;
    --surface: #111318;
    --surface-2: #171a20;
    --line: #292d35;
    --muted: #9298a3;
    --text: #f7f8fa;
    --red: #e52445;
    --red-dark: #a70f2b;
    --green: #27c678;
    --amber: #e9a83a;
    --blue: #4089ff;
    --radius: 8px;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }

.topbar {
    position: sticky; top: 0; z-index: 20; min-height: 68px; padding: 12px clamp(18px, 4vw, 64px);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    border-bottom: 1px solid var(--line); background: rgba(9, 10, 12, .94); backdrop-filter: blur(14px);
}
.brand, .top-actions, .panel-heading, .panel-heading > div { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; background: var(--red); font-weight: 800; }
.brand strong, .panel-heading strong { display: block; font-size: 14px; }
.brand small, .panel-heading small, td small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.admin-name { color: var(--muted); font-size: 12px; }
.top-actions form { margin: 0; }

.workspace { width: min(1500px, calc(100% - 36px)); margin: 0 auto; padding: 38px 0 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.eyebrow { color: var(--red); font-size: 10px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 8px 0 7px; font-size: clamp(28px, 4vw, 42px); line-height: 1.05; }
.page-heading p, .login-brand p { margin: 0; color: var(--muted); line-height: 1.6; }

.button { min-height: 38px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 6px; color: #fff; cursor: pointer; font-weight: 700; font-size: 12px; }
.button.primary { background: var(--red); }
.button.primary:hover { background: #f03251; }
.button.ghost { border-color: var(--line); background: #15181d; }
.button.ghost:hover { border-color: #454b57; }
.button.danger { border-color: #6f1728; background: #2a1117; color: #ff8297; }
.button.full { width: 100%; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats-grid article { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stats-grid small { display: block; color: var(--muted); }
.stats-grid strong { display: block; margin-top: 10px; font-size: 27px; }
.green { color: var(--green); } .amber { color: var(--amber); } .red { color: #ff5873; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, .75fr); gap: 16px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 16px 38px rgba(0, 0, 0, .22); }
.panel-heading { min-height: 64px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-heading.spread { justify-content: space-between; flex-wrap: wrap; }
.status-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px rgba(229, 36, 69, .12); }

.search { display: flex; gap: 8px; }
.search input { width: min(270px, 48vw); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th { padding: 12px 14px; color: var(--muted); font-size: 10px; text-align: left; text-transform: uppercase; background: #0e1014; }
td { padding: 14px; border-top: 1px solid #20232a; vertical-align: middle; }
tbody tr:hover { background: #15181e; }
td code { font-family: "Cascadia Mono", Consolas, monospace; color: #dfe3ea; font-size: 12px; }
.row-actions { text-align: right; }
.icon-link { color: #ff6c84; font-size: 12px; font-weight: 700; }
.empty { padding: 30px; color: var(--muted); text-align: center; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 5px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.badge.active { color: #62e9a4; background: rgba(39, 198, 120, .12); }
.badge.suspended { color: #f6c261; background: rgba(233, 168, 58, .13); }
.badge.revoked, .badge.expired { color: #ff758c; background: rgba(229, 36, 69, .14); }

.editor { position: sticky; top: 84px; }
.editor form, .editor > label { display: block; padding: 16px; }
.editor > form + form { padding-top: 0; }
.editor label, .login-panel label { display: block; color: #c3c7cf; font-size: 11px; font-weight: 700; }
.form-grid { display: grid; gap: 10px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.binding { grid-template-columns: minmax(0, 1fr) 110px; }
input, select, textarea { width: 100%; margin-top: 7px; border: 1px solid #30343d; border-radius: 5px; outline: 0; color: var(--text); background: #0c0e12; }
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229, 36, 69, .11); }
.form-grid + .form-grid, .form-grid + label, label + .form-grid, form > label + .button { margin-top: 12px; }
.license-key { margin: 7px 16px 0; width: calc(100% - 32px); color: #ff8ca0; font-family: "Cascadia Mono", Consolas, monospace; }
.danger-zone { border-top: 1px solid var(--line); }

.log-panel { margin-top: 16px; }
.activity-list article { display: grid; grid-template-columns: 10px minmax(180px, 1fr) auto 110px; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid #20232a; }
.activity-list article:first-child { border-top: 0; }
.activity-list strong { font-size: 12px; }
.activity-list small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.activity-list time { color: var(--muted); font-size: 10px; text-align: right; }
.activity-icon { width: 8px; height: 8px; border-radius: 50%; }
.activity-icon.ok { background: var(--green); } .activity-icon.bad { background: var(--red); }

.alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid; border-radius: 6px; }
.alert.success { color: #75eeb1; border-color: #1c7049; background: #10281d; }
.alert.error { color: #ff8ca0; border-color: #722039; background: #2b1119; }

.login-page { display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 18% 20%, #251018 0, #090a0c 34%); }
.login-shell { width: min(920px, 100%); display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(28px, 8vw, 90px); align-items: center; }
.login-brand h1 { margin: 12px 0 18px; font-size: clamp(38px, 7vw, 68px); }
.login-panel { padding-bottom: 4px; }
.login-panel form { padding: 18px; }
.login-panel label + label, .login-panel label + .button { margin-top: 14px; }
.login-panel .alert { margin: 14px 18px 0; }

@media (max-width: 980px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .editor { position: static; grid-row: 1; }
}

@media (max-width: 680px) {
    .workspace { width: min(100% - 24px, 1500px); padding-top: 24px; }
    .topbar { padding: 10px 12px; }
    .admin-name { display: none; }
    .page-heading { align-items: start; flex-direction: column; }
    .page-heading .button { width: 100%; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid article { padding: 14px; }
    .stats-grid strong { font-size: 22px; }
    .form-grid.two, .form-grid.binding { grid-template-columns: 1fr; }
    .activity-list article { grid-template-columns: 10px 1fr auto; }
    .activity-list time { display: none; }
    .login-page { padding: 18px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand h1 { font-size: 38px; }
}
