
/* Mechart brand overrides (refactored) */
@media (max-width: 760px) {
    .topbar {
        grid-template-columns: minmax(112px, max-content) minmax(0, 1fr) auto auto !important;
    }

    .topbar .brand {
        display: inline-flex !important;
        grid-column: 1 !important;
        align-items: center !important;
        gap: 8px !important;
        width: auto !important;
        min-width: 112px !important;
        max-width: none !important;
        overflow: visible !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .topbar .brand > span:last-child {
        display: block !important;
        width: auto !important;
        min-width: 54px !important;
        max-width: none !important;
        overflow: visible !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .topbar .brand strong {
        display: block !important;
        width: auto !important;
        min-width: 54px !important;
        max-width: none !important;
        overflow: visible !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: var(--text, #e2e8f0) !important;
        font-size: 14px !important;
        line-height: 1.15 !important;
        text-overflow: clip !important;
        white-space: nowrap !important;
    }

    .topbar .brand small {
        display: none !important;
    }
}

@media (max-width: 560px) {
    .topbar {
        grid-template-columns: minmax(104px, max-content) minmax(0, 1fr) auto auto !important;
        column-gap: 6px !important;
    }

    .topbar .brand {
        min-width: 104px !important;
        gap: 7px !important;
    }

    .topbar .brand-mark {
        width: 34px !important;
        height: 34px !important;
        flex: 0 0 34px !important;
    }

    .topbar .brand strong {
        font-size: 13px !important;
    }

    .topbar .control-select {
        max-width: 112px !important;
    }
}

@media (max-width: 390px) {
    .topbar {
        grid-template-columns: minmax(96px, max-content) minmax(0, 1fr) auto auto !important;
    }

    .topbar .brand {
        min-width: 96px !important;
    }

    .topbar .brand strong {
        font-size: 12px !important;
    }

    .topbar .control-select {
        max-width: 96px !important;
    }
}


/* =========================================================
   Final Mechart brand lock
   ========================================================= */
.topbar .brand strong{
    font-size:14px !important;
    white-space:nowrap !important;
}

@media (max-width:960px),
       (max-width:640px),
       (max-width:520px),
       (max-width:420px){
    .topbar .brand strong{
        font-size:14px !important;
    }
}

@media (max-width:520px){
    .topbar .brand{
        min-width:104px !important;
        max-width:none !important;
    }
}


/* =========================================================
   MECHART AUTH MODAL
   ========================================================= */
.guest-profile {
    appearance: none;
    font: inherit;
}

.auth-modal[hidden] {
    display: none !important;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity .18s ease;
}

.auth-modal.active {
    opacity: 1;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 15%, rgba(59,130,246,.16), transparent 34%),
        rgba(2, 6, 23, .78);
    backdrop-filter: blur(12px);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 28px;
    border: 1px solid rgba(148,163,184,.16);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(18,27,48,.98), rgba(9,16,29,.99));
    box-shadow:
        0 30px 90px rgba(0,0,0,.55),
        0 0 0 1px rgba(255,255,255,.025) inset;
    transform: translateY(12px) scale(.985);
    transition: transform .18s ease;
}

.auth-modal.active .auth-card {
    transform: translateY(0) scale(1);
}

.auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 11px;
    background: rgba(255,255,255,.045);
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, transform .16s ease;
}

.auth-close:hover {
    color: #fff;
    background: rgba(255,255,255,.09);
    transform: rotate(3deg);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-right: 44px;
    margin-bottom: 24px;
}

.auth-brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    box-shadow: 0 10px 28px rgba(59,130,246,.28);
}

.auth-brand strong,
.auth-brand small {
    display: block;
}

.auth-brand strong {
    color: #f8fafc;
    font-size: 15px;
}

.auth-brand small {
    margin-top: 3px;
    color: #64748b;
    font-size: 9px;
    letter-spacing: .12em;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 24px;
    padding: 4px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
}

.auth-tab {
    min-height: 38px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.auth-tab.active {
    color: #dbeafe;
    background: rgba(59,130,246,.14);
    box-shadow: 0 0 0 1px rgba(96,165,250,.14) inset;
}

.auth-panel {
    display: none;
}

.auth-panel.active {
    display: block;
}

.auth-heading {
    margin-bottom: 20px;
}

.auth-heading h2 {
    margin: 0 0 7px;
    color: #f8fafc;
    font-size: 24px;
    letter-spacing: -.035em;
}

.auth-heading p {
    margin: 0;
    color: #7f8da3;
    font-size: 12px;
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-field {
    display: grid;
    gap: 7px;
}

.auth-field > span {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
}

.auth-input-wrap {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(148,163,184,.16);
    border-radius: 12px;
    background: rgba(15,23,42,.72);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.auth-input-wrap:focus-within {
    border-color: rgba(96,165,250,.72);
    background: rgba(15,23,42,.96);
    box-shadow:
        0 0 0 3px rgba(59,130,246,.12),
        0 12px 30px rgba(2,6,23,.22);
}

.auth-input-icon {
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

.auth-input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #e8eef9;
    font: inherit;
    font-size: 13px;
}

.auth-input::placeholder {
    color: #536078;
}

.auth-primary {
    min-height: 48px;
    margin-top: 2px;
    border: 1px solid rgba(147,197,253,.28);
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(59,130,246,.23);
    transition: transform .16s ease, box-shadow .16s ease;
}

.auth-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(59,130,246,.3);
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #52617a;
    font-size: 10px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    background: rgba(255,255,255,.07);
}

.auth-google-form {
    width: 100%;
    margin: 0;
}

.auth-google {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    background: #fff;
    color: #172033;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease;
}

.auth-google:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(0,0,0,.2);
}

.auth-google-mark {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    font-weight: 900;
}

.auth-switch-copy {
    width: 100%;
    margin-top: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #7f8da3;
    font-size: 11px;
    cursor: pointer;
}

.auth-switch-copy strong {
    color: #93c5fd;
}

@media (max-width: 520px) {
    .auth-modal {
        align-items: end;
        padding: 8px;
    }

    .auth-card {
        width: 100%;
        max-height: calc(100dvh - 16px);
        padding: 24px 18px 20px;
        border-radius: 20px;
    }

    .auth-heading h2 {
        font-size: 21px;
    }
}


/* auth v3: top tabs removed */
.auth-tabs { display: none !important; }
