:root {
    --app-primary: #bf1e2e;
    --app-secondary: #231f20;
    --app-sidebar: #171415;
    --app-header: #ffffff;
    --app-button: #bf1e2e;
    --app-card: #ffffff;
    --app-text: #231f20;
    --soft-bg: #f6f7fb;
    --line: #eadfe2;
    --muted: #70676a;
    --success: #13784d;
    --danger: #b4232e;
    --warning: #b76b00;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow: 0 22px 55px rgba(35, 31, 32, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--app-text);
    background:
        radial-gradient(circle at 10% 10%, rgba(191, 30, 46, 0.12), transparent 34%),
        linear-gradient(135deg, #ffffff 0%, #f7f8fb 52%, #eef1f6 100%);
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d9d4d6;
    border-radius: 12px;
    background: #fff;
    color: var(--app-text);
    padding: 0.72rem 0.85rem;
    outline: none;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 4px rgba(191, 30, 46, 0.12);
}

label {
    display: grid;
    gap: 0.42rem;
    color: #40383b;
    font-weight: 800;
}

button,
.primary-button,
.secondary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    padding: 0.72rem 1.1rem;
    font-weight: 900;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.primary-button {
    background: linear-gradient(135deg, var(--app-button), #8f1724);
    color: #fff;
    box-shadow: 0 15px 30px rgba(191, 30, 46, 0.23);
}

.secondary-button {
    margin-top: 0.8rem;
    background: #231f20;
    color: #fff;
}

.ghost-button {
    background: #fff;
    color: var(--app-primary);
    border: 1px solid rgba(191, 30, 46, 0.22);
}

.eyebrow {
    display: inline-flex;
    color: var(--app-primary);
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.flash {
    width: min(100%, 1120px);
    margin: 0 auto 1rem;
    border-radius: 16px;
    padding: 0.9rem 1rem;
    border: 1px solid #e8d7db;
    background: #fff;
    color: var(--app-text);
    box-shadow: 0 12px 28px rgba(35, 31, 32, 0.06);
}

.flash-success {
    border-color: #b8e6cf;
    background: #effaf5;
    color: #11623f;
}

.flash-danger {
    border-color: #ffc9d0;
    background: #fff1f2;
    color: #9f1725;
}

.flash-warning {
    border-color: #ffe2aa;
    background: #fff8e9;
    color: #865300;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 288px minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background:
        radial-gradient(circle at 15% 10%, rgba(191, 30, 46, 0.28), transparent 32%),
        linear-gradient(165deg, var(--app-sidebar), #231f20 55%, #322b2d);
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-card {
    display: grid;
    gap: 0.55rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.95rem;
    text-decoration: none;
}

.brand-card img {
    width: 100%;
    max-height: 58px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    padding: 0.45rem;
}

.brand-card span {
    font-size: 0.82rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.9);
}

.side-nav {
    display: grid;
    gap: 0.38rem;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    min-height: 44px;
    border-radius: 13px;
    color: rgba(255, 255, 255, 0.84);
    text-decoration: none;
    padding: 0.68rem 0.75rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.side-link b {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.side-link:hover,
.side-link.active {
    background: rgba(191, 30, 46, 0.24);
    color: #fff;
}

.sidebar-note {
    margin-top: auto;
    display: grid;
    gap: 0.25rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.85rem;
}

.sidebar-note strong {
    color: #fff;
}

.sidebar-note span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.82rem;
    line-height: 1.45;
}

.app-main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 86px;
    padding: 1rem 1.35rem;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(234, 223, 226, 0.9);
    backdrop-filter: blur(10px);
}

.app-topbar h1 {
    margin: 0.1rem 0 0;
    font-size: clamp(1.35rem, 2.1vw, 2rem);
    letter-spacing: -0.03em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0 0.9rem;
    font-weight: 900;
}

.mobile-menu-button {
    display: none;
}

.content-wrap {
    width: min(100%, 1220px);
    margin: 0 auto;
    padding: 1.4rem;
}

.page-hero,
.page-line,
.panel-card,
.table-card,
.module-card,
.metric-card,
.auth-card,
.install-card {
    border: 1px solid rgba(226, 218, 221, 0.92);
    background: var(--app-card);
    box-shadow: 0 18px 42px rgba(35, 31, 32, 0.07);
}

.page-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    margin-bottom: 1rem;
    background:
        radial-gradient(circle at 92% 12%, rgba(191, 30, 46, 0.12), transparent 28%),
        #fff;
}

.page-hero h2,
.page-line h2 {
    margin: 0.15rem 0 0.35rem;
    font-size: clamp(1.55rem, 3vw, 2.5rem);
    letter-spacing: -0.04em;
}

.page-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.page-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-radius: 22px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.metric-card {
    display: grid;
    gap: 0.35rem;
    border-radius: 20px;
    padding: 1rem;
}

.metric-card span,
.metric-card small {
    color: var(--muted);
}

.metric-card strong {
    color: var(--app-primary);
    font-size: 1.8rem;
    letter-spacing: -0.04em;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.mt-soft {
    margin-top: 1rem;
}

.system-hero {
    background:
        radial-gradient(circle at 90% 10%, rgba(191, 30, 46, 0.18), transparent 30%),
        linear-gradient(135deg, #fff 0%, #fff7f8 52%, #f8fafc 100%);
}

.module-card {
    display: grid;
    gap: 0.5rem;
    border-radius: 22px;
    padding: 1rem;
}

.module-card.active {
    border-color: rgba(191, 30, 46, 0.32);
    background: linear-gradient(145deg, #fff, #fff6f7);
}

.module-card h3 {
    margin: 0;
}

.module-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.module-card a {
    color: var(--app-primary);
    font-weight: 900;
    text-decoration: none;
}

.module-card code {
    color: var(--app-primary);
    background: #fff1f2;
    border-radius: 10px;
    padding: 0.35rem 0.45rem;
}

.kiosk-shell {
    display: grid;
    gap: 1rem;
}

.kiosk-hero {
    border: 1px solid rgba(191, 30, 46, 0.22);
    border-radius: 28px;
    padding: 1.25rem;
    color: #fff;
    background:
        radial-gradient(circle at 90% 15%, rgba(255, 255, 255, 0.16), transparent 26%),
        linear-gradient(135deg, var(--app-primary), #231f20);
    box-shadow: 0 22px 48px rgba(35, 31, 32, 0.12);
}

.kiosk-hero .eyebrow {
    color: #ffdce2;
}

.kiosk-hero h2 {
    margin: 0.15rem 0 0.45rem;
    font-size: clamp(2rem, 4.2vw, 4.4rem);
    line-height: 0.94;
    letter-spacing: -0.07em;
}

.kiosk-hero p {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.55;
}

.kiosk-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 1rem;
}

.kiosk-form input,
.kiosk-form select {
    min-height: 56px;
    font-size: 1.08rem;
}

.giant-action {
    min-height: 62px;
    font-size: 1.08rem;
}

.clean-list {
    display: grid;
    gap: 0.55rem;
    margin: 1rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted);
    line-height: 1.45;
}

.table-headline {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.8rem;
}

.table-headline h3 {
    margin: 0;
}

.table-headline span,
label small,
td small {
    color: var(--muted);
}

.mini-pill {
    display: inline-flex;
    border-radius: 999px;
    background: #fff1f2;
    color: var(--app-primary);
    padding: 0.2rem 0.5rem;
    margin: 0.1rem;
    font-size: 0.76rem;
    font-weight: 900;
}

.inline-reply-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 0.4rem;
    min-width: 320px;
}

.inline-reply-form input {
    min-height: 38px;
    padding: 0.5rem 0.7rem;
}

.panel-card,
.table-card {
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.form-stack {
    display: grid;
    gap: 1.1rem;
}

.form-section {
    display: grid;
    gap: 0.85rem;
}

.form-section h2,
.form-section h3 {
    margin: 0;
    letter-spacing: -0.02em;
}

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

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

.choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.choice-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 0.9rem;
    cursor: pointer;
}

.choice-card input {
    width: auto;
    margin-top: 0.16rem;
    accent-color: var(--app-primary);
}

.choice-card strong,
.choice-card span {
    display: block;
}

.choice-card span {
    color: var(--muted);
    font-weight: 600;
    line-height: 1.4;
}

.form-actions,
.install-actions {
    display: flex;
    justify-content: flex-end;
}

.table-card {
    overflow-x: auto;
}

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

th,
td {
    border-bottom: 1px solid #eee7ea;
    padding: 0.78rem 0.7rem;
    text-align: left;
    vertical-align: top;
}

th {
    color: #4d4447;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

td {
    color: #3c3538;
}

.status-pill {
    display: inline-flex;
    border-radius: 999px;
    background: #eefaf4;
    color: var(--success);
    padding: 0.26rem 0.55rem;
    font-weight: 900;
    font-size: 0.78rem;
}

.empty-cell {
    color: var(--muted);
    text-align: center;
    padding: 2rem;
}

.app-footer {
    padding: 0.55rem 1rem;
    color: rgba(35, 31, 32, 0.62);
    border-top: 1px solid rgba(234, 223, 226, 0.76);
    font-size: 0.76rem;
    text-align: left;
}

.auth-body,
.install-body {
    display: grid;
    place-items: center;
    padding: 1.2rem;
    background-image:
        linear-gradient(135deg, rgba(35, 31, 32, 0.72), rgba(191, 30, 46, 0.48)),
        var(--login-bg-image, none);
    background-size: cover;
    background-position: center;
}

.auth-stage,
.install-stage {
    width: min(100%, 1180px);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 1rem;
    align-items: stretch;
}

.login-hero,
.auth-card {
    border-radius: 28px;
    padding: clamp(1.2rem, 3vw, 2rem);
}

.login-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 560px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(191, 30, 46, 0.55), transparent 28%),
        linear-gradient(145deg, #151213, #231f20 52%, #46131b);
    box-shadow: var(--shadow);
}

.login-hero::after {
    content: "";
    position: absolute;
    inset: auto -18% -30% 26%;
    height: 290px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 68%);
}

.login-hero img {
    position: absolute;
    top: 1.4rem;
    left: 1.4rem;
    max-width: 260px;
    max-height: 78px;
    object-fit: contain;
    border-radius: 16px;
    background: #fff;
    padding: 0.45rem;
}

.login-hero .eyebrow {
    color: #ffccd3;
}

.login-hero h1 {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0.25rem 0 0.6rem;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.login-hero p {
    position: relative;
    z-index: 1;
    max-width: 620px;
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.08rem;
    line-height: 1.55;
}

.auth-card {
    display: grid;
    align-content: center;
    gap: 1rem;
    background: #fff;
}

.auth-card.compact {
    width: min(100%, 520px);
}

.auth-card h1,
.auth-card h2 {
    margin: 0;
    letter-spacing: -0.04em;
}

.install-card {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    min-height: calc(100vh - 2.4rem);
    overflow: hidden;
    border-radius: 30px;
}

.install-aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.3rem;
    color: #fff;
    background:
        radial-gradient(circle at 30% 10%, rgba(191, 30, 46, 0.42), transparent 35%),
        linear-gradient(160deg, #151213, #231f20);
}

.install-aside img {
    width: 100%;
    max-height: 78px;
    object-fit: contain;
    border-radius: 18px;
    background: #fff;
    padding: 0.55rem;
}

.install-aside h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.05em;
}

.install-aside p {
    margin: 0;
    color: rgba(255, 255, 255, 0.74);
    line-height: 1.55;
}

.install-score {
    margin-top: auto;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    padding: 1rem;
}

.install-score strong {
    display: block;
    font-size: 2rem;
}

.install-form {
    display: grid;
    gap: 1.15rem;
    max-height: calc(100vh - 2.4rem);
    overflow: auto;
    padding: 1.35rem;
    background: #fff;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.check-row {
    display: grid;
    gap: 0.16rem;
    border: 1px solid #eee7ea;
    border-radius: 16px;
    padding: 0.75rem;
    background: #fafafa;
}

.check-row span {
    font-weight: 900;
}

.check-row small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.check-row .ok {
    color: var(--success);
}

.check-row .fail {
    color: var(--danger);
}

.inline-status {
    margin-top: 0.7rem;
    color: var(--muted);
    font-weight: 800;
}

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

.qr-token-box {
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px dashed #e4d4d9;
    border-radius: 16px;
    background: #fff7f9;
}

.qr-token-box small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.qr-token-box code {
    display: block;
    overflow-wrap: anywhere;
    color: var(--app-primary);
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    margin-right: 0.35rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    vertical-align: -2px;
}

@media (max-width: 1100px) {
    .metric-grid,
    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .login-shell,
    .install-card {
        grid-template-columns: 1fr;
    }

    .login-hero,
    .install-card {
        min-height: auto;
    }

    .install-form {
        max-height: none;
    }
}

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

    .app-sidebar {
        position: fixed;
        z-index: 30;
        inset: 0 auto 0 0;
        width: min(310px, calc(100vw - 56px));
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .mobile-menu-button {
        display: inline-flex;
        width: 42px;
        min-height: 42px;
        padding: 0;
        background: var(--app-primary);
        color: #fff;
    }

    .topbar-actions {
        gap: 0.35rem;
    }

    .user-chip {
        display: none;
    }

    .content-wrap {
        padding: 0.95rem;
    }

    .page-hero,
    .page-line {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid,
    .module-grid,
    .form-grid,
    .choice-grid,
    .check-grid {
        grid-template-columns: 1fr;
    }
}
