
:root {
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-soft: #f6f7f8;

    --color-text: #0b0c0e;
    --color-text-soft: #555b63;
    --color-text-muted: #92979e;

    --color-border: #e5e7ea;
    --color-border-strong: #d2d5d9;

    --color-accent: #26d4d1;
    --color-accent-dark: #13a9a7;

    --color-danger: #c43a3a;
    --color-danger-bg: #fff3f3;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    --content-width: 1120px;
    --reading-width: 680px;

    --shadow-menu:
        0 20px 60px rgba(0, 0, 0, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.05);

    --transition: 160ms ease;
}


/* ==========================================================================
   RESET
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html {
    background: var(--color-bg);
}

body {
    background: var(--color-bg);
    color: var(--color-text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    font-size: 16px;
    line-height: 1.55;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    display: block;
    max-width: 100%;
}

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

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

button {
    border: 0;
}

[hidden] {
    display: none !important;
}


/* ==========================================================================
   GLOBAL LAYOUT
   ========================================================================== */

.lab-app {
    min-height: 100vh;
    background: var(--color-bg);
}

.lab-main {
    width: 100%;
    min-height: 100vh;
}

.lab-page {
    width: 100%;
    padding:
        110px
        32px
        64px;
}

.lab-container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
}

.lab-container--small {
    max-width: var(--reading-width);
}


/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.lab-eyebrow {
    margin: 0 0 16px;

    color: var(--color-accent-dark);

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.13em;
}

.lab-title {
    margin: 0;

    color: var(--color-text);

    font-size: clamp(42px, 6vw, 76px);
    font-weight: 760;

    line-height: 0.98;
    letter-spacing: -0.05em;
}

.lab-title--medium {
    font-size: clamp(36px, 5vw, 56px);
}

.lab-title-dot {
    color: var(--color-accent);
}

.lab-description {
    max-width: 620px;

    margin: 24px 0 0;

    color: var(--color-text-soft);

    font-size: 17px;
    line-height: 1.7;
}


/* ==========================================================================
   HOME
   ========================================================================== */

.lab-home {
    min-height: calc(100vh - 170px);

    display: flex;
    align-items: center;
}

.lab-home__content {
    width: 100%;
}

.lab-home__intro {
    max-width: 720px;
}

.lab-tool {
    max-width: 760px;

    margin-top: 72px;
    padding-top: 34px;

    border-top: 1px solid var(--color-border);
}

.lab-tool__layout {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 48px;
}

.lab-tool__content {
    max-width: 470px;
}

.lab-tool__label {
    margin: 0 0 10px;

    color: var(--color-text-muted);

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.lab-tool__title {
    margin: 0;

    color: var(--color-text);

    font-size: 32px;
    font-weight: 720;

    line-height: 1.1;
    letter-spacing: -0.035em;
}

.lab-tool__description {
    margin: 14px 0 0;

    color: var(--color-text-soft);

    font-size: 15px;
    line-height: 1.65;
}

.lab-tool__note {
    margin: 22px 0 0;

    color: var(--color-text-muted);

    font-size: 12px;
}


/* ==========================================================================
   BUTTONS
   ========================================================================== */

.lab-button {
    min-height: 52px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 28px;

    padding: 0 22px;

    border-radius: var(--radius-md);

    cursor: pointer;

    font-size: 14px;
    font-weight: 650;

    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.lab-button:active {
    transform: translateY(1px);
}

.lab-button--primary {
    background: #0a0b0d;
    color: #ffffff;
}

.lab-button--primary:hover {
    background: #202225;
}

.lab-button--secondary {
    background: #ffffff;
    color: var(--color-text);

    border: 1px solid var(--color-border-strong);
}

.lab-button--secondary:hover {
    border-color: #0a0b0d;
}

.lab-button--block {
    width: 100%;
}

.lab-button__arrow {
    margin-left: auto;
    font-size: 18px;
}


/* ==========================================================================
   SECTIONS
   ========================================================================== */

.lab-section {
    margin-top: 48px;
    padding-top: 32px;

    border-top: 1px solid var(--color-border);
}

.lab-section__title {
    margin: 0;

    font-size: 22px;
    font-weight: 700;

    letter-spacing: -0.025em;
}

.lab-text {
    color: var(--color-text-soft);
    line-height: 1.7;
}

.lab-text + .lab-text {
    margin-top: 16px;
}


/* ==========================================================================
   ALERTS
   ========================================================================== */

.lab-alert {
    margin: 24px 0;

    padding: 14px 16px;

    border-radius: var(--radius-md);

    font-size: 14px;
}

.lab-alert--error {
    background: var(--color-danger-bg);
    color: var(--color-danger);

    border: 1px solid #efcccc;
}


/* ==========================================================================
   FORMS
   ========================================================================== */

.lab-checkbox {
    display: flex;
    align-items: flex-start;

    gap: 12px;

    cursor: pointer;
}

.lab-checkbox input {
    width: 18px;
    height: 18px;

    margin-top: 3px;

    accent-color: #0a0b0d;
}

.lab-checkbox__text {
    color: var(--color-text-soft);

    font-size: 14px;
    line-height: 1.65;
}


/* ==========================================================================
   FLOATING USER MENU
   ========================================================================== */

.lab-user-menu {
    position: fixed;

    top: 24px;
    right: 28px;

    z-index: 1000;
}


/* Trigger */

.lab-user-menu__trigger {
    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: 50%;

    cursor: pointer;

    overflow: hidden;

    box-shadow:
        0 3px 14px rgba(0, 0, 0, 0.07);

    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
}

.lab-user-menu__trigger:hover {
    border-color: var(--color-border-strong);

    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.1);
}

.lab-user-menu__trigger:active {
    transform: scale(0.97);
}


/* Avatar */

.lab-user-menu__avatar {
    width: 100%;
    height: 100%;

    object-fit: cover;

    border-radius: 50%;
}

.lab-user-menu__fallback {
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #0a0b0d;
    color: white;

    font-size: 13px;
    font-weight: 700;
}


/* Dropdown */

.lab-user-menu__dropdown {
    position: absolute;

    top: 58px;
    right: 0;

    width: 280px;

    padding: 9px;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: 16px;

    box-shadow: var(--shadow-menu);

    opacity: 0;

    transform:
        translateY(-5px)
        scale(0.985);

    transform-origin: top right;

    pointer-events: none;

    transition:
        opacity var(--transition),
        transform var(--transition);
}

.lab-user-menu__dropdown--open {
    opacity: 1;

    transform:
        translateY(0)
        scale(1);

    pointer-events: auto;
}


/* Profile */

.lab-user-menu__profile {
    padding: 13px 13px 12px;
}

.lab-user-menu__name {
    color: var(--color-text);

    font-size: 14px;
    font-weight: 700;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lab-user-menu__email {
    margin-top: 3px;

    color: var(--color-text-muted);

    font-size: 12px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lab-user-menu__role {
    margin-top: 10px;

    color: var(--color-text-soft);

    font-size: 10px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.1em;
}


/* Separator */

.lab-user-menu__separator {
    height: 1px;

    margin: 5px 8px;

    background: var(--color-border);
}


/* Debug */

.lab-user-menu__debug {
    min-height: 40px;

    display: flex;
    align-items: center;

    gap: 9px;

    padding: 8px 13px;

    color: var(--color-text-muted);

    font-size: 12px;
}

.lab-user-menu__status-dot {
    width: 6px;
    height: 6px;

    background: var(--color-accent);

    border-radius: 50%;
}


/* Menu items */

.lab-user-menu__item {
    min-height: 42px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 13px;

    border-radius: 10px;

    color: var(--color-text);

    font-size: 13px;
    font-weight: 550;

    transition:
        background var(--transition),
        color var(--transition);
}

.lab-user-menu__item:hover {
    background: var(--color-soft);
}

.lab-user-menu__item--logout {
    color: #72777e;
}

.lab-user-menu__arrow {
    color: #a3a7ad;

    font-size: 16px;

    transition: transform var(--transition);
}

.lab-user-menu__item:hover .lab-user-menu__arrow {
    transform: translateX(2px);
}


/* ==========================================================================
   SCANNER / CAMERA
   ========================================================================== */

.lab-scanner {
    width: 100%;
    max-width: 620px;

    margin: 0 auto;
}

.lab-camera-actions {
    display: grid;
    gap: 12px;

    margin-top: 40px;
}

.lab-camera-note {
    margin-top: 18px;

    color: var(--color-text-muted);

    font-size: 12px;
    line-height: 1.6;
}


/* ==========================================================================
   PROCESSING
   ========================================================================== */

.lab-processing {
    min-height: 65vh;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;
}

.lab-spinner {
    width: 34px;
    height: 34px;

    margin: 0 auto 24px;

    border: 2px solid #e2e4e7;
    border-top-color: #0a0b0d;
    border-radius: 50%;

    animation: lab-spin 0.7s linear infinite;
}

@keyframes lab-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ==========================================================================
   DEBUG
   ========================================================================== */

.lab-debug {
    margin-top: 36px;
    padding-top: 24px;

    border-top: 1px dashed var(--color-border-strong);
}

.lab-debug__title {
    margin-bottom: 16px;

    color: var(--color-text-muted);

    font-size: 10px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.13em;
}

.lab-debug__grid {
    display: grid;
    grid-template-columns: 130px 1fr;

    gap: 10px 20px;

    margin: 0;

    font-size: 13px;
}

.lab-debug__grid dt {
    color: var(--color-text-muted);
}

.lab-debug__grid dd {
    margin: 0;

    color: var(--color-text);
}


/* ==========================================================================
   MOBILE
   ========================================================================== */

@media (max-width: 767px) {

    .lab-page {
        padding:
            88px
            20px
            48px;
    }

    .lab-home {
        min-height: auto;
        align-items: flex-start;
    }

    .lab-title {
        font-size: 46px;
    }

    .lab-title--medium {
        font-size: 40px;
    }

    .lab-description {
        margin-top: 18px;

        font-size: 15px;
    }

    .lab-tool {
        margin-top: 52px;
        padding-top: 28px;
    }

    .lab-tool__layout {
        display: block;
    }

    .lab-tool__title {
        font-size: 28px;
    }

    .lab-tool__action {
        margin-top: 28px;
    }

    .lab-button {
        width: 100%;

        min-height: 54px;

        justify-content: space-between;
    }

    .lab-user-menu {
        top: 16px;
        right: 16px;
    }

    .lab-user-menu__trigger {
        width: 42px;
        height: 42px;
    }

    .lab-user-menu__dropdown {
        top: 52px;

        width: min(
            280px,
            calc(100vw - 32px)
        );
    }

    .lab-debug__grid {
        grid-template-columns: 1fr;

        gap: 3px;
    }

    .lab-debug__grid dd {
        margin-bottom: 10px;
    }
}


/* ==========================================================================
   DESKTOP ONLY / MOBILE ONLY
   ========================================================================== */

.lab-mobile-only {
    display: none;
}

@media (max-width: 767px) {

    .lab-mobile-only {
        display: block;
    }

    .lab-desktop-only {
        display: none;
    }
}


/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;
    }
}