* { box-sizing: border-box; }
html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f6f8;
    color: #1c2430;
}
body { margin: 0; min-height: 100vh; }
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}
.login-shell { width: 100%; max-width: 430px; }
.login-card {
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    padding: 36px;
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.brand { font-weight: 700; letter-spacing: .01em; }
h1 { margin: 24px 0 8px; font-size: 30px; }
h2 { margin-top: 0; }
.intro, .welcome p, .tool-card p, .account-panel p {
    color: #5a6573;
    line-height: 1.5;
}
label { display: block; margin: 20px 0 7px; font-weight: 600; }
input, select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #b9c1ca;
    border-radius: 7px;
    background: #fff;
    font: inherit;
}
input:focus, select:focus { outline: 2px solid currentColor; outline-offset: 2px; }
button {
    width: 100%;
    min-height: 46px;
    margin-top: 24px;
    padding: 10px 18px;
    border: 0;
    border-radius: 7px;
    background: #202a36;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.alert {
    margin-top: 22px;
    padding: 12px 14px;
    border: 1px solid #b7bcc3;
    border-radius: 7px;
    background: #f2f3f5;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 28px;
    background: #fff;
    border-bottom: 1px solid #dfe3e8;
}
.topbar-subtitle { margin-top: 2px; color: #66717f; font-size: 14px; }
.topbar form { margin: 0; }
.secondary-button {
    width: auto;
    min-height: 40px;
    margin: 0;
    background: #eef0f3;
    color: #202a36;
}
.dashboard { max-width: 1100px; margin: 0 auto; padding: 42px 24px; }
.welcome h1 { margin-top: 0; }
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
    margin-top: 32px;
}
.tool-card, .account-panel, .user-card {
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 24px;
}
.tool-label {
    margin-bottom: 12px;
    color: #66717f;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}
.account-panel { margin-top: 30px; }
.primary-link, .secondary-link {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 7px;
    font-weight: 600;
    text-decoration: none;
}
.primary-link { background: #202a36; color: #fff; }
.secondary-link { background: #eef0f3; color: #202a36; }
.users-section { margin-top: 32px; }
.user-card { margin-top: 18px; }
.user-card h3 { margin: 0 0 6px; }
.user-summary p { margin: 5px 0; }
.user-meta { color: #66717f; font-size: 14px; }
.compact-form { margin-top: 18px; }
.password-reset-form {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #e2e5e9;
}
.password-reset-form label { margin-top: 14px; }
.password-reset-form .secondary-button, .compact-form .secondary-button { width: auto; }
@media (max-width: 600px) {
    .login-card { padding: 26px 22px; }
    .topbar { padding: 16px 20px; }
    .dashboard { padding: 30px 20px; }
    .secondary-link { padding: 8px 12px; font-size: 14px; }
    .password-reset-form .secondary-button, .compact-form .secondary-button { width: 100%; }
}

/* TARGET OPTIMISER PORTAL THEME V2 */

html[data-theme="dark"],
html[data-theme="dark"] body {
    background: #090e14 !important;
    color: #f2f4f8 !important;
}

html[data-theme="dark"] .topbar {
    background: #101620 !important;
    border-color: #293241 !important;
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .tool-card,
html[data-theme="dark"] .account-panel,
html[data-theme="dark"] .user-card {
    background: #151b25 !important;
    border-color: #2b3442 !important;
    color: #f2f4f8 !important;
}

html[data-theme="dark"] .login-card {
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .intro,
html[data-theme="dark"] .welcome p,
html[data-theme="dark"] .tool-card p,
html[data-theme="dark"] .account-panel p,
html[data-theme="dark"] .topbar-subtitle,
html[data-theme="dark"] .tool-status,
html[data-theme="dark"] .user-meta {
    color: #9ea9b8 !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select {
    background: #0f1620 !important;
    color: #f2f4f8 !important;
    border-color: #3a4555 !important;
}

html[data-theme="dark"] input::placeholder {
    color: #788596 !important;
}

html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .secondary-link,
html[data-theme="dark"] .theme-toggle {
    background: #202936 !important;
    color: #f2f4f8 !important;
    border: 1px solid #344052 !important;
}

html[data-theme="dark"] .secondary-button:hover,
html[data-theme="dark"] .secondary-link:hover,
html[data-theme="dark"] .theme-toggle:hover {
    background: #2a3544 !important;
}

html[data-theme="dark"] .alert {
    background: #1a222e !important;
    color: #f2f4f8 !important;
    border-color: #344052 !important;
}

html[data-theme="dark"] .password-reset-form {
    border-color: #2b3442 !important;
}

html[data-theme="light"],
html[data-theme="light"] body {
    background: #f5f6f8 !important;
    color: #1c2430 !important;
}

.topbar-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
}

.topbar-actions form {
    width: auto !important;
    margin: 0 !important;
}

.topbar-actions .secondary-button,
.theme-toggle {
    width: auto !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 9px 14px !important;
}

.theme-toggle {
    border-radius: 7px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 600px) {
    .topbar-actions {
        gap: 7px !important;
    }

    .theme-toggle {
        padding: 8px 10px !important;
        font-size: 14px;
    }
}
