:root {
    --green-950: #0d3025;
    --green-900: #123c2f;
    --green-800: #1a4b3a;
    --green-700: #286649;
    --green-600: #3c8057;
    --green-500: #6ca54f;
    --green-300: #bad3a4;
    --green-100: #edf4e8;
    --cream: #f7f5ed;
    --cream-dark: #ece9dd;
    --white: #ffffff;
    --ink: #163029;
    --muted: #718079;
    --danger: #b84a43;
    --warning: #b7791f;
    --shadow: 0 18px 50px rgba(25, 57, 44, .12);
    --shadow-soft: 0 10px 28px rgba(25, 57, 44, .08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, #fff 0, #f6f4ec 45%, #efede5 100%);
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

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

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1220px;
    margin: 0 auto;
    padding: 18px 28px;
    background: rgba(247, 245, 237, .88);
    backdrop-filter: blur(18px);
}

.brand,
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-symbol,
.login-brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--white);
    background: var(--green-700);
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
}

.brand-symbol svg,
.login-brand-mark svg {
    width: 24px;
    fill: currentColor;
}

.brand-copy,
.topbar-user-copy {
    display: grid;
}

.brand-copy strong,
.topbar-user-copy strong {
    font-size: 14px;
}

.brand-copy small,
.topbar-user-copy small {
    color: var(--muted);
    font-size: 12px;
}

.user-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--white);
    font-weight: 800;
    background: var(--green-900);
    border-radius: 50%;
}

.main-content {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 20px 0 125px;
}

.auth-content {
    min-height: 100vh;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.alert-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.alert-success {
    color: #245238;
    background: #eef8ed;
    border-color: #cfe6ca;
}

.alert-success .alert-dot {
    background: #5e9f56;
}

.alert-error {
    color: #793e39;
    background: #fff0ee;
    border-color: #efcbc7;
}

.alert-error .alert-dot {
    background: var(--danger);
}

.alert-warning {
    color: #76521d;
    background: #fff7e7;
    border-color: #eedcad;
}

.alert-warning .alert-dot {
    background: var(--warning);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--green-600);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .14em;
}

.muted {
    color: var(--muted);
}

.mobile-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    align-items: center;
    min-height: 330px;
    padding: 45px;
    overflow: hidden;
    color: var(--green-950);
    background:
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(239,244,232,.94));
    border: 1px solid rgba(33, 76, 58, .08);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.mobile-hero::after {
    position: absolute;
    inset: auto -10% -40% 25%;
    height: 85%;
    content: "";
    background: rgba(184, 211, 163, .26);
    border-radius: 50% 50% 0 0;
    transform: rotate(-5deg);
}

.hero-copy {
    position: relative;
    z-index: 2;
    max-width: 640px;
}

.hero-copy h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 6vw, 76px);
    line-height: .98;
    letter-spacing: -.045em;
}

.hero-copy > p:last-child {
    max-width: 520px;
    margin: 22px 0 0;
    color: #52655d;
    font-size: 17px;
    line-height: 1.65;
}

.hero-illustration {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    min-height: 230px;
}

.globe {
    display: grid;
    place-items: center;
    width: 145px;
    height: 145px;
    color: var(--green-600);
    font-size: 94px;
    background:
        radial-gradient(circle at 35% 30%, #f6f9f1 0, #d9e6ca 75%);
    border: 8px solid rgba(255,255,255,.76);
    border-radius: 50%;
    box-shadow: 0 25px 45px rgba(45, 92, 59, .22);
}

.hand {
    position: absolute;
    bottom: 7px;
    width: 90px;
    height: 145px;
    background: #d7b28c;
    border-radius: 60% 60% 28px 28px;
}

.hand-left {
    left: 20%;
    transform: rotate(-35deg);
}

.hand-right {
    right: 20%;
    transform: rotate(35deg);
}

.floating-leaf {
    position: absolute;
    color: var(--green-500);
    font-size: 28px;
}

.leaf-a {
    top: 15%;
    left: 15%;
    transform: rotate(20deg);
}

.leaf-b {
    top: 4%;
    right: 18%;
    transform: rotate(-25deg);
}

.leaf-c {
    bottom: 16%;
    right: 7%;
    transform: rotate(45deg);
}

.action-stack {
    display: grid;
    gap: 16px;
    width: min(760px, 100%);
    margin: -42px auto 30px;
    position: relative;
    z-index: 5;
}

.main-action-card,
.secondary-action-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    width: 100%;
    padding: 20px;
    text-align: left;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(33,76,58,.08);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.secondary-action-card {
    box-shadow: var(--shadow-soft);
}

.action-icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    color: var(--green-700);
    background: var(--green-100);
    border-radius: 18px;
}

.action-icon svg {
    width: 30px;
    fill: currentColor;
}

.action-copy {
    display: grid;
    gap: 4px;
}

.action-copy strong,
.secondary-action-card strong {
    font-size: 17px;
}

.action-copy small,
.secondary-action-card small {
    color: var(--muted);
}

.round-arrow {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    color: var(--white);
    background: var(--green-700);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.link-arrow {
    color: var(--green-700);
    font-size: 28px;
}

.device-picker {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
}

.device-picker span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.device-picker select {
    min-width: 150px;
    padding: 7px 30px 7px 10px;
    color: var(--ink);
    background: #f4f5ef;
    border: 1px solid #dde3d8;
    border-radius: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 30px 0;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 22px;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(33,76,58,.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.stat-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 48px;
    height: 48px;
    color: var(--green-700);
    font-weight: 900;
    background: var(--green-100);
    border-radius: 15px;
}

.stat-card div {
    display: grid;
    gap: 5px;
}

.stat-card small {
    color: var(--muted);
}

.stat-card strong {
    font-size: 23px;
}

.section-card {
    padding: 26px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(33,76,58,.08);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 31px;
}

.activity-list,
.card-list {
    display: grid;
    gap: 12px;
}

.activity-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 15px;
    padding: 15px 2px;
    border-bottom: 1px solid #e9ece4;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-status {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    font-weight: 900;
    border-radius: 50%;
}

.activity-status.status-completed {
    color: #2e7546;
    background: #e6f3e6;
}

.activity-status.status-processing,
.activity-status.status-pending {
    color: #8a6928;
    background: #fff4d8;
}

.activity-status.status-failed {
    color: #a1443e;
    background: #fde9e7;
}

.activity-main {
    min-width: 0;
}

.activity-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-bottom: 5px;
}

.activity-main small {
    color: var(--muted);
}

.activity-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    text-align: right;
}

.activity-value strong {
    font-size: 21px;
}

.activity-value small {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
}

.badge-completed {
    color: #2f7146;
    background: #e8f5e9;
}

.badge-processing,
.badge-pending {
    color: #86651e;
    background: #fff4d7;
}

.badge-failed {
    color: #9f4540;
    background: #fde9e7;
}

.error-text {
    margin: 7px 0 0;
    color: var(--danger);
    font-size: 13px;
}

.empty-state,
.error-page {
    display: grid;
    justify-items: center;
    padding: 50px 20px;
    color: var(--muted);
    text-align: center;
}

.empty-state h3,
.error-page h1 {
    margin-bottom: 5px;
    color: var(--ink);
}

.empty-icon,
.error-page > span {
    color: var(--green-600);
    font-size: 48px;
    font-weight: 900;
}

.bottom-nav {
    position: fixed;
    z-index: 30;
    right: 50%;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    width: min(650px, 100%);
    padding: 10px 12px calc(10px + var(--safe-bottom));
    background: var(--green-950);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -12px 35px rgba(8,37,28,.22);
    transform: translateX(50%);
}

.bottom-nav a,
.bottom-nav form button {
    display: grid;
    justify-items: center;
    gap: 4px;
    width: 100%;
    padding: 5px;
    color: rgba(255,255,255,.72);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.bottom-nav svg {
    width: 23px;
    height: 23px;
    fill: currentColor;
}

.bottom-nav span {
    font-size: 11px;
}

.bottom-nav .active {
    color: #b7d98b;
}

.nav-main-action {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: -30px auto 0;
    color: var(--white);
    background: var(--green-500);
    border: 5px solid var(--green-950);
    border-radius: 50%;
    box-shadow: 0 10px 24px rgba(98, 151, 76, .4);
    cursor: pointer;
}

.nav-main-action span {
    font-size: 33px;
    line-height: 1;
}

.login-wrap {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    min-height: 100vh;
}

.login-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(32px, 6vw, 90px);
    overflow: hidden;
    color: var(--green-950);
    background:
        linear-gradient(145deg, #f8f6ee 0, #eef4e6 100%);
}

.login-visual::after {
    position: absolute;
    right: -8%;
    bottom: -30%;
    width: 70%;
    aspect-ratio: 1;
    content: "";
    background: rgba(112, 164, 78, .16);
    border-radius: 50%;
}

.login-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 13px;
}

.login-brand span:last-child {
    display: grid;
}

.login-brand strong {
    font-size: 20px;
}

.login-brand small {
    color: var(--muted);
}

.login-message {
    position: relative;
    z-index: 2;
    max-width: 680px;
}

.login-message h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(48px, 7vw, 90px);
    line-height: .97;
    letter-spacing: -.055em;
}

.login-message > p:last-child {
    max-width: 580px;
    color: #586b62;
    font-size: 18px;
    line-height: 1.65;
}

.login-leaf {
    position: absolute;
    width: 170px;
    height: 90px;
    background: rgba(105, 157, 72, .18);
    border-radius: 100% 0 100% 0;
}

.leaf-one {
    top: 18%;
    right: 10%;
    transform: rotate(-20deg);
}

.leaf-two {
    right: 30%;
    bottom: 12%;
    transform: rotate(30deg) scale(.7);
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 40px;
    background: var(--white);
}

.login-panel-inner {
    width: min(420px, 100%);
}

.login-panel h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 45px;
}

.form-stack,
.form-grid {
    display: grid;
    gap: 16px;
    margin-top: 28px;
}

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

.form-grid .btn {
    align-self: end;
}

label {
    display: grid;
    gap: 7px;
}

label > span {
    font-size: 13px;
    font-weight: 800;
}

input,
select {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    color: var(--ink);
    background: #f8f8f4;
    border: 1px solid #dce2d8;
    border-radius: 12px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

input:focus,
select:focus {
    border-color: var(--green-600);
    box-shadow: 0 0 0 4px rgba(85, 139, 89, .12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 18px;
    font-weight: 800;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
}

.btn-large {
    min-height: 55px;
    font-size: 16px;
}

.btn-small {
    min-height: 38px;
    padding: 0 12px;
    font-size: 12px;
}

.btn-primary {
    color: var(--white);
    background: var(--green-700);
}

.btn-primary:hover {
    background: var(--green-800);
}

.btn-secondary {
    color: var(--green-800);
    background: var(--green-100);
    border-color: #d6e5ce;
}

.admin-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.admin-heading h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(38px, 6vw, 64px);
}

.admin-actions {
    display: flex;
    gap: 10px;
}

.admin-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-section-header {
    align-items: center;
}

.filter-row {
    display: flex;
    gap: 10px;
    width: min(560px, 100%);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #e8ebe4;
}

th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

td small {
    color: var(--muted);
}

.admin-grid {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 22px;
}

.manage-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px;
    background: #fafaf7;
    border: 1px solid #e5e9e1;
    border-radius: 16px;
}

.manage-card-main {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 3px;
}

.manage-card-main small {
    color: var(--muted);
}

.manage-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.device-status-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
}

.device-status-dot.online {
    background: #68a956;
    box-shadow: 0 0 0 5px rgba(104,169,86,.14);
}

.device-status-dot.offline {
    background: #aeb6b0;
}

details {
    margin-top: 8px;
}

details summary {
    color: var(--green-700);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

details code {
    display: block;
    max-width: 100%;
    margin-top: 7px;
    padding: 8px;
    overflow-wrap: anywhere;
    background: #f1f3ed;
    border-radius: 8px;
}

.error-page {
    min-height: 60vh;
    align-content: center;
}

@media (max-width: 900px) {
    .mobile-hero {
        grid-template-columns: 1fr;
    }

    .hero-illustration {
        display: none;
    }

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

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .login-wrap {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 370px;
    }

    .login-panel {
        padding: 35px 22px 70px;
    }
}

@media (max-width: 650px) {
    body {
        background: var(--cream);
    }

    .topbar {
        padding: 14px 18px;
    }

    .topbar-user-copy {
        display: none;
    }

    .main-content {
        width: min(100% - 24px, 1180px);
        padding-top: 8px;
    }

    .mobile-hero {
        min-height: 290px;
        padding: 34px 24px 85px;
        border-radius: 24px;
    }

    .hero-copy h1 {
        font-size: 48px;
    }

    .hero-copy > p:last-child {
        font-size: 15px;
    }

    .action-stack {
        margin-top: -62px;
    }

    .main-action-card,
    .secondary-action-card {
        gap: 13px;
        padding: 16px;
    }

    .action-icon {
        width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .action-copy strong,
    .secondary-action-card strong {
        font-size: 15px;
    }

    .action-copy small,
    .secondary-action-card small {
        font-size: 12px;
    }

    .device-picker {
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
    }

    .device-picker select {
        min-height: 38px;
    }

    .stats-grid,
    .admin-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .section-card {
        padding: 20px 16px;
        border-radius: 22px;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-header h2 {
        font-size: 28px;
    }

    .activity-item {
        grid-template-columns: auto 1fr;
    }

    .activity-value {
        grid-column: 2;
        justify-self: start;
    }

    .admin-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-actions,
    .filter-row {
        flex-direction: column;
        width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .manage-card {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .manage-card form {
        width: 100%;
    }

    .manage-card form .btn {
        width: 100%;
    }

    .login-visual {
        min-height: 330px;
        padding: 32px 24px;
    }

    .login-message h1 {
        font-size: 50px;
    }

    .login-message > p:last-child {
        font-size: 15px;
    }

    .login-panel h2 {
        font-size: 38px;
    }
}


.qr-instruction-card {
    cursor: default;
}

.qr-corner-icon {
    color: var(--green-700);
    font-size: 34px;
    font-weight: 900;
}

.scan-screen {
    display: grid;
    justify-items: center;
    width: min(580px, 100%);
    margin: 50px auto;
    padding: 44px 28px;
    text-align: center;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(33,76,58,.08);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.scan-screen h1 {
    margin: 4px 0 12px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(38px, 7vw, 58px);
}

.scan-device-icon {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin-bottom: 22px;
    color: var(--green-700);
    background: var(--green-100);
    border-radius: 26px;
}

.scan-device-icon svg {
    width: 48px;
    fill: currentColor;
}

.scan-progress {
    display: flex;
    gap: 8px;
    margin: 24px 0;
}

.scan-progress span {
    width: 10px;
    height: 10px;
    background: var(--green-500);
    border-radius: 50%;
    animation: scanPulse 1.15s infinite ease-in-out;
}

.scan-progress span:nth-child(2) {
    animation-delay: .18s;
}

.scan-progress span:nth-child(3) {
    animation-delay: .36s;
}

@keyframes scanPulse {
    0%, 80%, 100% {
        opacity: .3;
        transform: scale(.75);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.scan-cancel {
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.device-card-list {
    display: grid;
    gap: 18px;
}

.device-qr-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 22px;
    padding: 18px;
    background: #fafaf7;
    border: 1px solid #e4e9df;
    border-radius: 20px;
}

.device-qr-info {
    min-width: 0;
}

.device-title-row {
    display: flex;
    align-items: center;
    gap: 13px;
}

.device-title-row > div {
    display: grid;
    gap: 4px;
}

.device-title-row small {
    color: var(--muted);
}

.device-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}

.btn-danger {
    color: #99433d;
    background: #fdeceb;
    border-color: #efceca;
}

.device-qr-panel {
    display: grid;
    align-content: start;
    justify-items: center;
    gap: 10px;
    padding: 15px;
    background: var(--white);
    border: 1px solid #e4e9df;
    border-radius: 16px;
}

.qr-code {
    display: grid;
    place-items: center;
    width: 226px;
    min-height: 226px;
    padding: 8px;
    background: var(--white);
    border-radius: 12px;
}

.qr-code img,
.qr-code canvas {
    max-width: 100%;
    height: auto !important;
}

.device-qr-panel > small {
    color: var(--muted);
}

.device-qr-panel input {
    min-height: 38px;
    font-size: 11px;
}

.copy-link {
    padding: 5px;
    color: var(--green-700);
    background: transparent;
    border: 0;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.qr-missing {
    padding: 25px 5px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 780px) {
    .device-qr-card {
        grid-template-columns: 1fr;
    }

    .device-qr-panel {
        width: 100%;
    }
}


.scanner-page {
    width: min(620px, 100%);
    margin: 25px auto;
}

.scanner-heading {
    margin-bottom: 20px;
    text-align: center;
}

.scanner-heading h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(38px, 8vw, 58px);
}

.scanner-heading > p:last-child {
    color: var(--muted);
    line-height: 1.6;
}

.scanner-shell {
    position: relative;
    overflow: hidden;
    min-height: 360px;
    background: #081b15;
    border: 8px solid var(--white);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

#qr-reader {
    width: 100%;
    min-height: 360px;
    border: 0 !important;
    background: #081b15;
}

#qr-reader video {
    display: block;
    width: 100% !important;
    min-height: 360px;
    object-fit: cover;
}

#qr-reader__scan_region {
    min-height: 360px;
    background: transparent !important;
}

#qr-reader__dashboard {
    display: none !important;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(
            rgba(4, 22, 16, .46),
            rgba(4, 22, 16, .46)
        );
    mask:
        linear-gradient(#000 0 0),
        linear-gradient(#000 0 0);
    mask-composite: exclude;
}

.scan-corner {
    position: absolute;
    width: 58px;
    height: 58px;
    border-color: #b5dc79;
    border-style: solid;
}

.corner-tl {
    top: 18%;
    left: 13%;
    border-width: 5px 0 0 5px;
    border-radius: 14px 0 0;
}

.corner-tr {
    top: 18%;
    right: 13%;
    border-width: 5px 5px 0 0;
    border-radius: 0 14px 0 0;
}

.corner-bl {
    bottom: 18%;
    left: 13%;
    border-width: 0 0 5px 5px;
    border-radius: 0 0 0 14px;
}

.corner-br {
    right: 13%;
    bottom: 18%;
    border-width: 0 5px 5px 0;
    border-radius: 0 0 14px;
}

.scan-line {
    position: absolute;
    top: 23%;
    right: 14%;
    left: 14%;
    height: 3px;
    background: #b5dc79;
    border-radius: 99px;
    box-shadow: 0 0 14px rgba(181, 220, 121, .9);
    animation: scannerLine 2.2s infinite ease-in-out;
}

@keyframes scannerLine {
    0%,
    100% {
        top: 23%;
    }

    50% {
        top: 75%;
    }
}

.scanner-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 18px 0;
    padding: 13px 16px;
    color: var(--muted);
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.scanner-status-dot {
    width: 10px;
    height: 10px;
    background: #aab3ad;
    border-radius: 50%;
}

.scanner-status.active .scanner-status-dot {
    background: #6aa657;
    box-shadow: 0 0 0 5px rgba(106, 166, 87, .14);
}

.scanner-status.success {
    color: #2f7146;
}

.scanner-status.success .scanner-status-dot {
    background: #6aa657;
}

.scanner-status.error {
    color: var(--danger);
}

.scanner-status.error .scanner-status-dot {
    background: var(--danger);
}

.scanner-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.scanner-help {
    margin-top: 22px;
    padding: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, .72);
    border-radius: 16px;
}

.scanner-help strong {
    color: var(--ink);
}

.scanner-help p {
    margin: 7px 0 0;
    line-height: 1.55;
}

@media (max-width: 650px) {
    .scanner-page {
        margin-top: 10px;
    }

    .scanner-shell,
    #qr-reader,
    #qr-reader video,
    #qr-reader__scan_region {
        min-height: 430px;
    }

    .scanner-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .scanner-actions .btn {
        width: 100%;
    }
}


.scanner-diagnostics {
    margin: -5px 0 18px;
    padding: 13px 15px;
    color: #8f403a;
    background: #fff0ee;
    border: 1px solid #efcbc7;
    border-radius: 13px;
    font-size: 13px;
    line-height: 1.5;
}

.scanner-diagnostics[hidden] {
    display: none;
}


.main-action-card.qr-instruction-card {
    width: 100%;
    border: 0;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

body.modal-open {
    overflow: hidden;
}

.qr-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 18px;
}

.qr-modal.is-open {
    display: flex;
}

.qr-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 24, 18, .72);
    backdrop-filter: blur(5px);
}

.qr-modal-panel {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: 22px;
    background: #f7f4ec;
    border-radius: 28px 28px 18px 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .32);
    animation: qrModalIn .22s ease-out;
}

@keyframes qrModalIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qr-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.qr-modal-header h2 {
    margin: 2px 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(30px, 7vw, 44px);
}

.qr-modal-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--green-700);
    background: var(--white);
    border: 1px solid rgba(28, 74, 55, .1);
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.qr-modal-description {
    margin: 12px 0 18px;
    color: var(--muted);
    line-height: 1.55;
}

.scanner-shell-modal {
    min-height: 390px;
}

.scanner-shell-modal #qr-reader,
.scanner-shell-modal #qr-reader video,
.scanner-shell-modal #qr-reader__scan_region {
    min-height: 390px;
}

@media (min-width: 720px) {
    .qr-modal {
        align-items: center;
    }

    .qr-modal-panel {
        border-radius: 28px;
    }
}

@media (max-width: 650px) {
    .qr-modal {
        padding: 0;
    }

    .qr-modal-panel {
        width: 100%;
        max-height: 100vh;
        min-height: 100vh;
        padding: 18px;
        border-radius: 0;
    }

    .scanner-shell-modal,
    .scanner-shell-modal #qr-reader,
    .scanner-shell-modal #qr-reader video,
    .scanner-shell-modal #qr-reader__scan_region {
        min-height: 430px;
    }
}
