:root {
    --bg: #f3f4f8;
    --surface: #fff;
    --text: #1f2130;
    --muted: #686d7d;
    --border: #dcdfea;
    --primary: #5d35b1;
    --dark: #45258c;
    --success: #157347;
    --warning: #9a6700;
    --error: #b42318;
}

/* =========================
   General
========================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* =========================
   Top bar
========================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    justify-content: space-between;
    align-items: center;

    min-height: 68px;
    padding: 12px 18px;

    border-bottom: 1px solid var(--border);
    background: #fffffff5;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.topbar strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
}

.logout-link,
.text-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

/* =========================
   Main layout
========================= */

.app-shell {
    width: min(100%, 720px);
    margin: auto;
    padding: 22px 16px 48px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(29px, 8vw, 42px);
}

.hero p,
.muted,
.field-help {
    color: var(--muted);
    line-height: 1.55;
}

/* =========================
   Tabs
========================= */

.action-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 8px;
    border-radius: 18px;
    background: #e9e9f0;
}

.action-tabs .tab-button {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 16px 10px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #626272;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.action-tabs .tab-button.active {
    background: #ffffff;
    color: #6234bd;
    box-shadow: 0 5px 15px rgba(45, 30, 80, 0.12);
}
/* =========================
   Panels and cards
========================= */

.panel,
.auth-card {
    margin-bottom: 16px;
    padding: 20px;

    border: 1px solid var(--border);
    border-radius: 18px;

    background: var(--surface);
    box-shadow: 0 10px 32px #1f213012;
}

/* =========================
   QR scanner
========================= */

.scanner-actions {
    display: flex;
    gap: 10px;
}

.scanner {
    width: 100%;
    margin-top: 16px;

    overflow: hidden;

    border-radius: 14px;
    background: #111;
}

/* =========================
   Separator
========================= */

.separator {
    display: flex;
    align-items: center;
    gap: 12px;

    margin: 20px 0;

    color: var(--muted);
    font-size: 13px;
}

.separator::before,
.separator::after {
    height: 1px;
    flex: 1;

    background: var(--border);
    content: "";
}

/* =========================
   Form fields
========================= */

label {
    display: block;
    margin: 15px 0 7px;

    font-size: 14px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid #5d35b11f;
}

textarea {
    resize: vertical;
}

.inline-control {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

/* =========================
   Buttons
========================= */

button {
    min-height: 48px;
    padding: 11px 17px;

    border: 0;
    border-radius: 11px;

    cursor: pointer;
    font-weight: 800;
}

.inline-control button,
.primary-button,
.auth-card button {
    background: var(--primary);
    color: #fff;
}

.primary-button:hover,
.inline-control button:hover,
.auth-card button:hover {
    background: var(--dark);
}

.secondary-button {
    background: #252836;
    color: #fff;
}

.save-button {
    width: 100%;
    margin-top: 22px;
}

/* =========================
   Selected QR record
========================= */

.record-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.record-heading h2 {
    margin: 8px 0 0;
    font-size: 25px;
}

.status-pill {
    display: inline-block;
    padding: 6px 9px;

    border-radius: 999px;

    background: #eee9fb;
    color: var(--primary);

    font-size: 12px;
    font-weight: 800;
}

/* =========================
   Help and messages
========================= */

.field-help {
    min-height: 21px;
    margin: 7px 0 0;
    font-size: 13px;
}

.message {
    min-height: 22px;
    margin-top: 12px;
    font-size: 14px;
}

.message.success {
    color: var(--success);
}

.message.warning {
    color: var(--warning);
}

.message.error,
.alert.error {
    color: var(--error);
}

.alert {
    margin: 15px 0;
    padding: 12px;

    border-radius: 10px;
    background: #fff0ef;
}

/* =========================
   Login page
========================= */

.auth-page {
    display: grid;
    min-height: 100vh;
    padding: 20px;
    place-items: center;
}

.auth-card {
    width: min(100%, 430px);
    margin: 0;
    padding: 28px;
}

.auth-card button {
    width: 100%;
    margin-top: 20px;
}

/* =========================
   Utilities
========================= */

.hidden {
    display: none !important;
}

code {
    overflow-wrap: anywhere;
}

/* =========================
   Responsive
========================= */

@media (max-width: 520px) {
    .action-tabs {
        gap: 5px;
        padding: 6px;
    }

    .action-tabs .tab-button {
        padding: 13px 4px;
        font-size: 13px;
    }
}

/* =========================
   Generated sign result
========================= */

.generated-sign-result {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* =========================
   Generated value and copy button
========================= */

.generated-value-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.generated-value-row button {
    background: var(--secondary);
    color: #ffffff;
}

/* =========================
   QR preview area
========================= */

.qr-result-area {
    display: grid;
    place-items: center;

    margin-top: 22px;
    padding: 18px;

    border-radius: 14px;
    background: #f5f5f8;
}

/* =========================
   Generated QR image
========================= */

#generated-qr-preview {
    padding: 12px;

    border-radius: 12px;
    background: #ffffff;
}

/* =========================
   Download buttons grid
========================= */

.download-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    margin-top: 18px;
}

/* =========================
   Link styled as a button
========================= */

.link-button {
    display: block;

    margin-top: 12px;
    padding: 14px 18px;

    border-radius: 11px;

    text-align: center;
    text-decoration: none;
}

/*
|--------------------------------------------------------------------------
| Permanent QR Link Field
|--------------------------------------------------------------------------
|
| Styles the permanent QR URL field shown in the Activate QR
| and Edit QR panels.
|
*/

.qr-link-field {
    margin-bottom: 22px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f7f5fc;
}

.qr-link-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

#qr-permanent-link {
    min-width: 0;
    background: #ffffff;
}

#copy-qr-permanent-link {
    white-space: nowrap;
}


/*
|--------------------------------------------------------------------------
| Mobile Layout
|--------------------------------------------------------------------------
|
| Adjusts the action tabs and download buttons for smaller screens.
|
*/

@media (max-width: 520px) {
    .action-tabs {
        grid-template-columns: 1fr;
    }

    .download-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   Mobile responsive styles
========================= */

@media (max-width: 520px) {
    .action-tabs {
        grid-template-columns: 1fr;
    }

    .download-grid {
        grid-template-columns: 1fr;
    }
}
