:root {
    --bg: #020711;
    --panel: rgba(6, 14, 28, 0.82);
    --panel-strong: rgba(8, 19, 38, 0.94);
    --ink: #f5f7fb;
    --muted: #aab7c8;
    --line: rgba(74, 139, 205, 0.28);
    --line-gold: rgba(220, 159, 70, 0.55);
    --primary: #d89a3d;
    --primary-dark: #b87922;
    --blue: #168dff;
    --blue-soft: rgba(22, 141, 255, 0.22);
    --danger: #ff776d;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

* {
    box-sizing: border-box;
}

body {
    background:
        radial-gradient(circle at 72% 10%, rgba(22, 141, 255, 0.24), transparent 30%),
        radial-gradient(circle at 18% 22%, rgba(216, 154, 61, 0.12), transparent 28%),
        linear-gradient(135deg, #01050d 0%, #071326 46%, #020711 100%);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    min-height: 100vh;
}

body::before {
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 64px 64px;
    content: "";
    inset: 0;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
    pointer-events: none;
    position: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.login-screen {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
}

.login-card,
.panel,
.stats-strip {
    backdrop-filter: blur(16px);
    background: linear-gradient(145deg, rgba(9, 20, 40, 0.92), rgba(2, 7, 17, 0.78));
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    position: relative;
}

.login-card::after,
.panel::after,
.stats-strip::after {
    border: 1px solid rgba(216, 154, 61, 0.12);
    border-radius: inherit;
    content: "";
    inset: 4px;
    pointer-events: none;
    position: absolute;
}

.login-card {
    max-width: 460px;
    padding: 34px;
    width: 100%;
}

.brand-lockup {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-shield {
    align-items: center;
    border: 2px solid var(--primary);
    clip-path: polygon(50% 0, 94% 16%, 86% 74%, 50% 100%, 14% 74%, 6% 16%);
    color: var(--primary);
    display: grid;
    font-weight: 900;
    height: 48px;
    justify-items: center;
    line-height: 1;
    place-items: center;
    text-shadow: 0 0 16px rgba(216, 154, 61, 0.5);
    width: 42px;
}

.brand-lockup strong {
    color: var(--primary);
    display: block;
    font-size: 30px;
    letter-spacing: 0;
    line-height: 0.95;
}

.brand-lockup span {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
    text-transform: uppercase;
}

.login-card h1,
.sidebar h1,
.dashboard-header h2,
.section-title h2 {
    margin: 0;
}

.login-card h1,
.dashboard-header h2 {
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1.02;
    max-width: 780px;
    text-transform: uppercase;
}

.eyebrow {
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 9px;
    text-transform: uppercase;
}

.muted,
.hint {
    color: var(--muted);
    line-height: 1.55;
}

.hint {
    font-size: 13px;
    margin-bottom: 0;
}

.alert {
    background: rgba(255, 119, 109, 0.12);
    border: 1px solid rgba(255, 119, 109, 0.42);
    border-radius: 6px;
    color: var(--danger);
    margin: 18px 0;
    padding: 12px;
}

.login-form,
.controls {
    display: grid;
    gap: 14px;
}

label {
    color: #d9e7fb;
    font-weight: 800;
}

input,
select,
textarea {
    background: rgba(2, 7, 17, 0.72);
    border: 1px solid rgba(120, 165, 210, 0.32);
    border-radius: 6px;
    color: var(--ink);
    min-height: 42px;
    outline: 0;
    padding: 9px 11px;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(22, 141, 255, 0.16);
}

textarea {
    resize: vertical;
}

input[type='color'] {
    padding: 3px;
}

input[type='range'] {
    accent-color: var(--primary);
    padding: 0;
}

input[type='file'] {
    padding-top: 8px;
}

input[type='checkbox'] {
    accent-color: var(--primary);
    min-height: auto;
    padding: 0;
    width: auto;
}

button {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 900;
    letter-spacing: 0;
    min-height: 42px;
    padding: 10px 15px;
    text-transform: uppercase;
}

button.primary,
.login-form button {
    background: linear-gradient(135deg, #f0b65b, #c78327);
    color: #10151f;
    box-shadow: 0 0 24px rgba(216, 154, 61, 0.24);
}

button.primary:hover,
.login-form button:hover {
    background: linear-gradient(135deg, #ffca75, #d99636);
}

button.secondary {
    background: rgba(4, 12, 26, 0.76);
    border: 1px solid var(--line-gold);
    color: #f7d19b;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    background: rgba(1, 5, 13, 0.72);
    border-right: 1px solid rgba(74, 139, 205, 0.22);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px;
}

.sidebar h1 {
    font-size: 24px;
    line-height: 1.08;
}

.sidebar .eyebrow {
    color: var(--blue);
}

.nav {
    display: grid;
    gap: 10px;
    margin-top: 34px;
}

.nav a {
    border: 1px solid transparent;
    border-radius: 6px;
    color: #dbe7f4;
    font-weight: 800;
    padding: 13px;
}

.nav a.active,
.nav a:hover {
    background: linear-gradient(90deg, rgba(22, 141, 255, 0.18), rgba(216, 154, 61, 0.08));
    border-color: rgba(22, 141, 255, 0.34);
    color: #ffffff;
}

.dashboard {
    display: grid;
    gap: 22px;
    padding: 28px;
}

.dashboard-header {
    align-items: center;
    border-bottom: 1px solid rgba(74, 139, 205, 0.2);
    display: flex;
    gap: 22px;
    justify-content: space-between;
    padding-bottom: 20px;
}

.dashboard-header h2::first-line {
    color: #ffffff;
}

.header-actions,
.section-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stats-strip {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    padding: 0;
}

.stats-strip div {
    border-right: 1px solid rgba(74, 139, 205, 0.18);
    padding: 18px 22px;
}

.stats-strip div:last-child {
    border-right: 0;
}

.stats-strip strong {
    color: var(--primary);
    display: block;
    font-size: 26px;
}

.stats-strip span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-top: 4px;
    text-transform: uppercase;
}

.workspace {
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(360px, 1fr) minmax(330px, 470px);
}

.panel {
    padding: 22px;
}

.controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 8px;
}

.checkbox-field {
    align-content: center;
}

.checkbox-field label {
    align-items: center;
    display: flex;
    gap: 10px;
    min-height: 42px;
}

.field.full {
    grid-column: 1 / -1;
}

.preview-panel {
    align-content: center;
    display: grid;
    gap: 16px;
    justify-items: center;
}

.preview-heading {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-self: stretch;
}

.preview-heading strong,
.preview-heading span {
    display: block;
}

.preview-heading span {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.mini-icon {
    border: 1px solid var(--blue);
    border-radius: 8px;
    color: var(--blue);
    display: grid;
    height: 42px;
    place-items: center;
    text-shadow: 0 0 18px rgba(22, 141, 255, 0.9);
    width: 42px;
}

.preview-frame {
    background:
        radial-gradient(circle at 50% 50%, rgba(22, 141, 255, 0.24), transparent 34%),
        linear-gradient(135deg, rgba(2, 7, 17, 0.96), rgba(9, 24, 48, 0.92));
    border: 1px solid rgba(22, 141, 255, 0.28);
    border-radius: 8px;
    display: grid;
    min-height: 390px;
    overflow: hidden;
    padding: 28px;
    place-items: center;
    position: relative;
    width: 100%;
}

.preview-frame::before {
    background:
        linear-gradient(rgba(22, 141, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 141, 255, 0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    content: "";
    inset: 0;
    opacity: 0.34;
    pointer-events: none;
    position: absolute;
}

#qr-preview {
    position: relative;
    z-index: 1;
}

#qr-preview svg,
#qr-preview canvas {
    border-radius: 8px;
    box-shadow:
        0 0 0 1px rgba(216, 154, 61, 0.28),
        0 20px 45px rgba(0, 0, 0, 0.42),
        0 0 50px rgba(22, 141, 255, 0.25);
    height: auto;
    max-width: 100%;
}

.center {
    text-align: center;
}

.history {
    display: grid;
    gap: 16px;
}

.section-title {
    justify-content: space-between;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-item {
    align-items: center;
    background: rgba(2, 7, 17, 0.45);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
}

.history-item strong {
    color: #ffffff;
    display: block;
}

.history-item span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-top: 4px;
    word-break: break-all;
}

@media (max-width: 1080px) {
    .app-shell,
    .workspace {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 22px;
    }

    .nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin-top: 0;
    }
}

@media (max-width: 760px) {
    .dashboard,
    .sidebar {
        padding: 18px;
    }

    .dashboard-header {
        align-items: flex-start;
        display: grid;
    }

    .controls,
    .nav,
    .stats-strip {
        grid-template-columns: 1fr;
    }

    .stats-strip div {
        border-bottom: 1px solid rgba(74, 139, 205, 0.18);
        border-right: 0;
    }

    .stats-strip div:last-child {
        border-bottom: 0;
    }
}
