@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: linear-gradient(160deg, #eef0f3 0%, #d9dce1 100%);
    color: #222;
    min-height: 100vh;
}

/* ---------- Auth pages (login / register / restore) ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.id-card {
    position: relative;
    width: 100%;
    max-width: 820px;
    min-height: 430px;
    background: #fbfbfa;
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.id-card-guilloche {
    position: absolute;
    left: -70px;
    top: 50%;
    transform: translateY(-50%);
    width: 240px;
    height: 460px;
    background: url('/static/img/sm-star.png') center / contain no-repeat;
    opacity: 0.85;
    pointer-events: none;
    z-index: 1;
}

.id-card-body {
    position: relative;
    z-index: 3;
    width: 100%;
    padding: 2.6rem 2.2rem 2rem 3rem;
    display: flex;
    flex-direction: column;
    min-height: 430px;
}

.tagline {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #2b2f36;
    text-transform: uppercase;
    line-height: 1.35;
    max-width: 300px;
    margin-bottom: 2.2rem;
}

.auth-form {
    max-width: 340px;
    width: 100%;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #c81e2c;
    margin-bottom: 0.3rem;
}

.form-subtitle {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 1.4rem;
    font-weight: 300;
}

.input-icon-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-icon-group svg {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #8a8f98;
}

.input-icon-group input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.6rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #d7d9dd;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-icon-group input:focus {
    outline: none;
    border-color: #c81e2c;
    box-shadow: 0 0 0 3px rgba(200, 30, 44, 0.12);
}

.btn {
    display: inline-block;
    text-align: center;
    padding: 0.75rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    background: #e4e6e9;
    color: #a3a7ad;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}

.btn:disabled:active {
    transform: none;
}

.btn-green {
    width: 100%;
    text-transform: uppercase;
    background: linear-gradient(135deg, #34c979 0%, #1fa85e 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(31, 168, 94, 0.35);
}

.btn-green:hover {
    opacity: 0.92;
}

.btn-secondary {
    background: #eee;
    color: #444;
}

.btn-secondary:hover {
    background: #e2e2e2;
}

.btn-outline {
    background: transparent;
    border: 1px solid #c81e2c;
    color: #c81e2c;
}

.btn-outline:hover {
    background: rgba(200, 30, 44, 0.08);
}

.form-actions {
    display: flex;
    gap: 0.8rem;
}

.form-actions .btn {
    flex: 1;
}

.form-link {
    display: inline-block;
    margin-top: 0.9rem;
    font-size: 0.82rem;
    color: #444;
    text-decoration: underline;
}

.form-link:hover {
    color: #c81e2c;
}

.alert {
    padding: 0.7rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fdecea;
    color: #b0121e;
    border: 1px solid #f5c2c7;
}

.alert-success {
    background: #eaf7ed;
    color: #1e7b34;
    border: 1px solid #c3e6cb;
}

.id-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding-top: 1.4rem;
}

.id-card-footer img {
    height: 30px;
}

.id-card-footer .form-link {
    margin-top: 0;
}

/* ---------- Extra registration-wizard elements ---------- */

.form-subtitle-lg {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
    margin-bottom: 1.1rem;
    max-width: 320px;
}

.input-icon-group.no-icon input {
    padding-left: 1rem;
}

.form-link-inline {
    margin-top: 0;
    align-self: center;
    white-space: nowrap;
}

.btn-blue {
    background: linear-gradient(135deg, #4a90e2 0%, #2f6fc9 100%);
    color: #fff;
}

.btn-blue:hover {
    opacity: 0.92;
}

.form-hint {
    font-size: 0.78rem;
    color: #888;
    line-height: 1.4;
    margin: 0.4rem 0 1rem;
    max-width: 320px;
}

.captcha-box {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid #d7d9dd;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
    max-width: 300px;
}

.captcha-box input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #1fa85e;
}

.captcha-text {
    font-size: 0.85rem;
    color: #333;
}

.captcha-brand {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #4a90e2;
}

.captcha-brand-text {
    font-size: 0.55rem;
    color: #888;
}

.captcha-disclaimer {
    font-size: 0.68rem;
    color: #999;
    max-width: 300px;
    margin-bottom: 1.1rem;
}

.captcha-disclaimer a {
    color: #4a90e2;
}

.code-inputs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.code-inputs input {
    width: 42px;
    height: 46px;
    text-align: center;
    font-size: 1.2rem;
    border: 1px solid #d7d9dd;
    border-radius: 6px;
    background: #fff;
}

.code-inputs input:focus {
    outline: none;
    border-color: #c81e2c;
    box-shadow: 0 0 0 3px rgba(200, 30, 44, 0.12);
}

.password-toggle-group {
    position: relative;
}

.password-toggle-group input {
    padding-right: 2.6rem;
}

.toggle-visibility {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #8a8f98;
    padding: 0.2rem;
}

.toggle-visibility svg {
    width: 18px;
    height: 18px;
}

.terms-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #444;
    margin-bottom: 1.1rem;
    cursor: pointer;
}

.terms-check input {
    margin-top: 0.2rem;
}

.terms-check a {
    color: #c81e2c;
}

/* ---------- Terms page ---------- */

.terms-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.terms-card {
    max-width: 760px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 2.5rem 3rem 3rem;
}

.terms-logo {
    height: 34px;
    margin-bottom: 1.5rem;
}

.terms-card h1 {
    font-size: 1.4rem;
    color: #c81e2c;
    margin-bottom: 1.2rem;
}

.terms-card h2 {
    font-size: 1.05rem;
    color: #222;
    margin: 1.6rem 0 0.6rem;
}

.terms-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
    margin-bottom: 0.6rem;
}

/* ---------- Red diagonal panel with logo + photo ---------- */

.id-card-panel {
    position: absolute;
    inset: 0;
    z-index: 2;
    background-color: #0e7a34;
    background-image: url('/static/img/sm-bg-green.png');
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 1600px auto;
    clip-path: polygon(55% 0, 100% 0, 100% 100%, 77% 100%);
    pointer-events: none;
}

.panel-logo {
    position: absolute;
    z-index: 4;
    top: 1.8rem;
    right: 1.8rem;
}

.panel-logo img {
    height: 26px;
}

.panel-photo {
    position: absolute;
    z-index: 4;
    top: 6.6rem;
    right: 3.6rem;
    width: 100px;
    height: 125px;
    border-radius: 6px;
    border: 4px solid #fbfbfa;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.panel-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- Profile / dashboard ---------- */

.profile-page {
    min-height: 100vh;
    display: flex;
}

.profile-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06);
}

.sidebar-hero {
    background: linear-gradient(160deg, #1fa34f 0%, #0e7a34 55%, #06481f 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.2rem 1.5rem 1.8rem;
}

.profile-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: 3px solid #fff;
    object-fit: cover;
    margin-bottom: 0.9rem;
}

.profile-name {
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.6rem;
}

.status-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
}

.status-verified {
    background: rgba(255, 255, 255, 0.92);
    color: #1a7a3e;
}

.status-unverified {
    background: #6e0f19;
    color: #fff;
}

.profile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: 100%;
    background: #fff;
    padding: 1.4rem 1.2rem;
}

.profile-nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #1a8fa8;
    text-decoration: none;
    padding: 0.7rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.3;
}

.profile-nav a svg {
    color: #444;
}

.profile-nav a.active,
.profile-nav a:hover {
    background: #f1f6f7;
    color: #106e83;
}

.profile-nav-logout {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-align: left;
    background: none;
    border: none;
    color: #1a8fa8;
    font-size: 0.85rem;
    padding: 0.7rem 0.5rem;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.profile-nav-logout:hover {
    background: #f1f6f7;
    color: #106e83;
    border-radius: 6px;
}

.profile-nav-logout svg {
    color: #444;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.profile-content {
    flex: 1;
    background: #eef0f3;
    min-height: 100vh;
}

.profile-topbar {
    background: #2b2f36;
    color: #fff;
    padding: 1rem 2rem;
    font-size: 0.95rem;
}

.profile-main {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

.profile-card {
    position: relative;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    padding: 1.8rem 2rem;
    overflow: hidden;
    width: 100%;
}

.profile-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: -40px;
    width: 200px;
    height: 200px;
    background: url('/static/img/sm-star.png') center / contain no-repeat;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.profile-card > * {
    position: relative;
    z-index: 1;
}

.profile-card h1 {
    font-size: 1.2rem;
    color: #222;
    margin-bottom: 1.2rem;
}

.form-group-simple {
    margin-bottom: 1rem;
}

.form-group-simple label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.3rem;
}

.form-group-simple input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid #d7d9dd;
    border-radius: 6px;
    background: #fff;
}

.form-group-simple input:read-only {
    background: #f3f4f6;
    color: #777;
}

.input-with-toggle {
    position: relative;
}

.input-with-toggle input {
    padding-right: 2.6rem;
}

.input-with-toggle .toggle-visibility {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
}

.form-group-simple input:focus {
    outline: none;
    border-color: #c81e2c;
    box-shadow: 0 0 0 3px rgba(200, 30, 44, 0.12);
}

.profile-card .form-actions {
    margin-top: 1.2rem;
}

.profile-card .form-actions .btn {
    flex: none;
    width: auto;
    padding: 0.7rem 1.6rem;
}

.profile-card h1 + h1 {
    margin-top: 0.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group-simple {
    flex: 1;
}

.form-group-simple select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid #d7d9dd;
    border-radius: 6px;
    background: #fff;
}

.ms-dropdown {
    position: relative;
}

.ms-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    border: 1px solid #d7d9dd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
}

.ms-trigger svg {
    flex-shrink: 0;
    color: #888;
}

.ms-trigger-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #888;
}

.ms-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d7d9dd;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    max-height: 220px;
    overflow-y: auto;
    padding: 0.4rem;
    z-index: 20;
}

.ms-dropdown.open .ms-panel {
    display: block;
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.88rem;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
}

.ms-option:hover {
    background: #f3f4f6;
}

/* ---------- Auth settings ---------- */

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0;
    cursor: pointer;
    border-bottom: 1px solid #f0f1f3;
}

.radio-option:last-of-type {
    border-bottom: none;
}

.radio-option input {
    margin-top: 0.3rem;
    accent-color: #4a6cf7;
}

.radio-option strong {
    display: block;
    font-size: 0.9rem;
    color: #222;
    font-weight: 500;
}

.radio-option small {
    display: block;
    font-size: 0.78rem;
    color: #888;
    margin-top: 0.15rem;
}

.recommended {
    color: #1fa85e;
    font-size: 0.75rem;
}

.warning-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fff8e6;
    border: 1px solid #f5dfa0;
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.2rem;
    font-size: 0.85rem;
    color: #7a5c00;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    flex: none;
    white-space: nowrap;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    color: #333;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 999px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #4a6cf7;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.device-code-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.device-code {
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    background: #f3f4f6;
    padding: 0.6rem 1rem;
    border-radius: 6px;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 0.3rem;
}

.copy-btn svg {
    width: 18px;
    height: 18px;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
    .profile-page {
        flex-direction: column;
    }

    .profile-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .profile-nav {
        display: none;
    }

    .id-card {
        min-height: 0;
    }

    .id-card-body {
        width: 100%;
        padding: 1.4rem 1.4rem 1.6rem;
        padding-top: 6.5rem;
        min-height: 0;
    }

    .id-card-panel {
        clip-path: polygon(0 0, 100% 0, 100% 90px, 0 90px);
    }

    .panel-logo {
        top: 33px;
        left: 1.2rem;
        right: auto;
    }

    .panel-logo img {
        height: 20px;
    }

    .panel-photo {
        top: 13px;
        right: 1.2rem;
        width: 44px;
        height: 56px;
        border-width: 2px;
    }

    .id-card-guilloche {
        display: none;
    }

    .tagline {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .form-actions {
        flex-direction: column;
    }

    .id-card-footer {
        flex-wrap: wrap;
    }

    .dashboard-card {
        padding: 2rem;
        margin: 1rem;
    }
}
