/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: #f4f6fa;
    color: #1f2937;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top bar (tool page) ---- */
.topbar {
    background: #1f2937;
    color: #fff;
    padding: 14px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.topbar-inner {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.topbar-title {
    font-weight: 600;
    font-size: 17px;
    letter-spacing: .2px;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}
.user-chip { opacity: .9; }
.logout-link {
    color: #fff;
    text-decoration: none;
    background: rgba(255,255,255,.12);
    padding: 6px 12px;
    border-radius: 6px;
    transition: background .15s ease;
}
.logout-link:hover { background: rgba(255,255,255,.22); }

/* ---- Layout ---- */
.container {
    flex: 1;
    width: 100%;
    max-width: 640px;
    margin: 28px auto;
    padding: 0 18px;
}
.login-body {
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 380px;
    margin: 48px auto;
    text-align: center;
}
.card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06),
                0 1px 2px rgba(15, 23, 42, 0.04);
}
.tool-card h1 {
    font-size: 22px;
    margin: 0 0 6px;
}
.brand {
    font-size: 22px;
    margin: 0 0 4px;
    line-height: 1.2;
}
.subtitle {
    color: #6b7280;
    margin: 0 0 22px;
    font-size: 14px;
}
.muted { color: #6b7280; font-size: 14px; margin-top: 0; }

/* ---- Form ---- */
label {
    display: block;
    margin: 14px 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-align: left;
}
input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 11px 13px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
input:disabled { background: #f3f4f6; cursor: not-allowed; }

/* ---- Buttons ---- */
.btn {
    margin-top: 18px;
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .05s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .65; }

.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* ---- Spinner ---- */
.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    display: none;
    animation: spin .7s linear infinite;
}
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Alerts / result area ---- */
.alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-align: left;
}
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.result-area:empty { display: none; }
.result-area { margin-top: 18px; }

/* ---- Footer ---- */
.footer {
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    padding: 18px 14px 24px;
}

/* ---- Mobile tweaks ---- */
@media (max-width: 480px) {
    .card { padding: 22px 18px; }
    .topbar-title { font-size: 15px; }
    .topbar-user { font-size: 13px; gap: 8px; }
}
