:root {
    --brand-green: #15803d;
    --brand-green-dark: #14532d;
    --brand-green-light: #dcfce7;
    --brand-orange: #ea580c;
    --brand-orange-hover: #c2410c;
    --bg-page: #f1f5f9;
    --card-white: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-soft: #e2e8f0;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --shadow-card: 0 16px 45px -8px rgba(15, 23, 42, 0.12), 0 0 1px 1px rgba(15, 23, 42, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    min-width: 0;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-page);
    overflow: hidden;
}

body {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

button, input, select {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
}

.page-shell {
    width: 100%;
    max-width: 390px;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 14px;
    overflow: hidden;
    box-sizing: border-box;
}

.device-card {
    width: 100%;
    height: 100%;
    max-height: 100%;
    background: var(--card-white);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(226, 232, 240, 0.95);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.hero-header {
    width: 100%;
    height: clamp(210px, 37vh, 290px);
    background: linear-gradient(160deg, #16a34a 0%, #15803d 50%, #14532d 100%);
    position: relative;
    padding: clamp(14px, 2.5vh, 20px) 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    flex-shrink: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.dot-matrix-left {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 38px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.45) 1.5px, transparent 1.5px);
    background-size: 7px 7px;
    pointer-events: none;
    opacity: 0.85;
}

.hero-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.brand-badge-circle {
    width: clamp(42px, 6vh, 50px);
    height: clamp(42px, 6vh, 50px);
    border-radius: 50%;
    background: #ffffff;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    padding: 3px;
}

.brand-badge-circle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-badge-circle span {
    font-size: clamp(1.2rem, 3vh, 1.45rem);
    font-weight: 900;
    color: var(--brand-green);
    letter-spacing: -0.05em;
    line-height: 1;
}

.brand-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-app-title {
    color: #ffffff;
    font-size: clamp(0.94rem, 2.2vh, 1.05rem);
    font-weight: 850;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.hero-app-by {
    color: #bbf7d0;
    font-size: clamp(0.66rem, 1.5vh, 0.72rem);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.hero-art-container {
    width: 100%;
    max-width: 320px;
    height: clamp(120px, 21vh, 175px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 2;
    margin-top: auto;
}

.hero-illustration {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-body-panel {
    background: var(--card-white);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    margin-top: -18px;
    padding: clamp(14px, 2.2vh, 20px) clamp(16px, 4.5vw, 24px) max(10px, env(safe-area-inset-bottom));
    z-index: 3;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    box-sizing: border-box;
}

.panel-header-copy {
    text-align: center;
    margin-bottom: clamp(8px, 1.5vh, 14px);
    flex-shrink: 0;
}

.panel-title {
    font-size: clamp(1.02rem, 2.4vh, 1.16rem);
    font-weight: 850;
    color: var(--text-main);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.panel-desc {
    font-size: clamp(0.68rem, 1.4vh, 0.75rem);
    color: var(--text-muted);
    margin-top: 3px;
}

.login-form-modern {
    display: flex;
    flex-direction: column;
    gap: clamp(7px, 1.2vh, 10px);
    flex-shrink: 0;
}

.form-group-pill {
    width: 100%;
}

.pill-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.pill-input {
    width: 100%;
    height: clamp(40px, 5.2vh, 46px);
    padding: 0 42px 0 16px;
    border-radius: 11px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: clamp(0.8rem, 1.9vh, 0.86rem);
    font-weight: 600;
    outline: none;
    transition: all 0.15s ease;
}

.pill-input::placeholder {
    color: #94a3b8;
    font-size: clamp(0.76rem, 1.8vh, 0.82rem);
    font-weight: 500;
}

.pill-input:focus {
    background: #ffffff;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 2.5px rgba(22, 163, 74, 0.15);
}

.pill-icon {
    position: absolute;
    right: 14px;
    color: #94a3b8;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.password-toggle-btn {
    pointer-events: auto;
    background: none;
    cursor: pointer;
    padding: 3px;
}

.password-toggle-btn:hover {
    color: var(--brand-green);
}

.select-wrapper .pill-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--input-bg);
}

.select-caret {
    pointer-events: none;
}

.btn-primary-orange {
    width: 100%;
    height: clamp(40px, 5.2vh, 46px);
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand-orange) 0%, #f97316 100%);
    color: #ffffff;
    font-size: clamp(0.86rem, 2vh, 0.94rem);
    font-weight: 850;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 2px;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.btn-primary-orange:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.38);
}

.btn-primary-orange:active {
    transform: translateY(0);
}

.btn-primary-orange:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.quick-att-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 2px;
    flex-shrink: 0;
}

.btn-quick-att {
    height: clamp(36px, 4.4vh, 40px);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: clamp(0.74rem, 1.6vh, 0.8rem);
    font-weight: 800;
    transition: transform 0.15s ease, background 0.15s ease;
}

.btn-quick-att.in {
    background: var(--brand-green);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.2);
}

.btn-quick-att.in:hover {
    background: var(--brand-green-dark);
}

.btn-quick-att.out {
    background: #334155;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(51, 65, 85, 0.18);
}

.btn-quick-att.out:hover {
    background: #1e293b;
}

.footer-action-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px 0;
    flex-shrink: 0;
}

.sub-link {
    background: none;
    color: var(--text-muted);
    font-size: clamp(0.7rem, 1.5vh, 0.76rem);
    font-weight: 650;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.sub-link:hover {
    color: var(--brand-green);
}

.pwa-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #94a3b8;
    font-size: clamp(0.6rem, 1.3vh, 0.65rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    margin: clamp(8px, 1.4vh, 12px) 0 clamp(6px, 1.2vh, 8px);
    flex-shrink: 0;
}

.pwa-divider::before,
.pwa-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px dashed var(--border-soft);
}

.pwa-divider span {
    padding: 0 8px;
}

.pwa-action-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    flex-shrink: 0;
}

.btn-pwa-option {
    height: clamp(34px, 4.2vh, 38px);
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: clamp(0.7rem, 1.5vh, 0.75rem);
    font-weight: 750;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-pwa-option.ios {
    background: #0f172a;
    color: #ffffff;
}

.btn-pwa-option.ios:hover {
    background: #1e293b;
}

.btn-pwa-option.desktop {
    background: #f0fdf4;
    color: var(--brand-green);
    border: 1px solid #bbf7d0;
}

.btn-pwa-option.desktop:hover {
    background: #dcfce7;
}

.card-footer-direct {
    width: 100%;
    margin-top: auto;
    padding-top: clamp(8px, 1.5vh, 12px);
    text-align: center;
    flex-shrink: 0;
}

.footer-gradient-bar {
    width: 44%;
    height: 2px;
    margin: 0 auto 6px;
    background: linear-gradient(90deg, transparent, #22c55e, transparent);
    border-radius: 999px;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--text-muted);
    font-size: clamp(0.64rem, 1.3vh, 0.7rem);
    line-height: 1.3;
}

.footer-dev a {
    color: var(--brand-green);
    font-weight: 750;
    text-decoration: none;
}

.footer-dev a:hover {
    text-decoration: underline;
}

.message {
    display: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.72rem;
    line-height: 1.35;
    margin-bottom: 4px;
}

.message.is-visible {
    display: block;
}

.message.error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.message.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.button-spinner {
    width: 15px;
    height: 15px;
    display: none;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spinRotate 0.7s linear infinite;
}

.btn-primary-orange.is-loading .button-spinner {
    display: inline-block;
}

.btn-primary-orange.is-loading .btn-icon-svg,
.btn-primary-orange.is-loading .button-text {
    display: none;
}

@keyframes spinRotate {
    to { transform: rotate(360deg); }
}

.swal2-popup.swal2-toast.custom-compact-toast {
    padding: 10px 14px !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid var(--border-soft) !important;
    box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.15) !important;
}

.swal2-popup.swal2-toast.custom-compact-toast .swal2-title {
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    color: var(--text-main) !important;
}

@media (max-width: 480px) {
    body {
        padding: 0;
        background: var(--card-white);
    }
    .page-shell {
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        padding: 0;
        justify-content: flex-start;
    }
    .device-card {
        height: 100%;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
    .hero-header {
        padding-top: max(14px, env(safe-area-inset-top));
    }
    .card-body-panel {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

@media (max-height: 670px) {
    .hero-header {
        height: clamp(170px, 32vh, 210px);
        padding-top: max(8px, env(safe-area-inset-top));
    }
    .hero-art-container {
        height: clamp(80px, 16vh, 110px);
    }
    .pill-input {
        height: 36px;
    }
    .btn-primary-orange {
        height: 38px;
    }
    .btn-quick-att {
        height: 34px;
    }
    .pwa-divider {
        margin: 5px 0 4px;
    }
    .btn-pwa-option {
        height: 32px;
    }
}