/* =====================================================================
   ODSLocal – Contributor Hub  (login + dashboard)
   ===================================================================== */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
    --odshub-primary:     #1d4ed8;
    --odshub-primary-dk:  #1e3a8a;
    --odshub-primary-lt:  #eff6ff;
    --odshub-green:       #16a34a;
    --odshub-amber:       #d97706;
    --odshub-danger:      #dc2626;
    --odshub-text:        #1e293b;
    --odshub-muted:       #64748b;
    --odshub-border:      #e2e8f0;
    --odshub-surface:     #ffffff;
    --odshub-bg:          #f8fafc;
    --odshub-radius:      12px;
    --odshub-radius-lg:   20px;
    --odshub-shadow:      0 4px 24px rgba(30,58,138,.10);
    --odshub-shadow-lg:   0 20px 60px rgba(0,0,0,.22);
    --odshub-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */

.odshub-login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 55%, #1d4ed8 100%);
    padding: 24px 16px;
    font-family: var(--odshub-font);
}

.odshub-login-card {
    background: var(--odshub-surface);
    border-radius: var(--odshub-radius-lg);
    padding: 48px 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--odshub-shadow-lg);
}

/* Brand block */
.odshub-login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.odshub-login-logo {
    max-height: 72px;
    max-width: 180px;
    object-fit: contain;
    margin-bottom: 16px;
}

.odshub-login-logo-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--odshub-primary-lt);
    color: var(--odshub-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.odshub-login-logo-placeholder svg {
    width: 36px;
    height: 36px;
}

.odshub-login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--odshub-text);
    margin: 0 0 6px;
}

.odshub-login-desc {
    font-size: .875rem;
    color: var(--odshub-muted);
    margin: 0;
    line-height: 1.5;
}

/* Error alert */
.odshub-login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--odshub-danger);
    font-size: .875rem;
    padding: 10px 14px;
    margin-bottom: 20px;
}

.odshub-login-error svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Form fields */
.odshub-login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.odshub-field label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--odshub-text);
    margin-bottom: 6px;
    letter-spacing: .02em;
}

.odshub-field input[type="text"],
.odshub-field input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid var(--odshub-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .9375rem;
    color: var(--odshub-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.odshub-field input:focus {
    border-color: var(--odshub-primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}

/* Password toggle */
.odshub-field-wrap {
    position: relative;
}

.odshub-field-wrap input {
    padding-right: 42px !important;
}

.odshub-toggle-pwd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--odshub-muted);
    padding: 4px;
    line-height: 0;
}

.odshub-toggle-pwd:hover { color: var(--odshub-primary); }
.odshub-toggle-pwd svg { width: 18px; height: 18px; }

/* Remember */
.odshub-remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
    color: var(--odshub-muted);
    cursor: pointer;
    margin-top: -4px;
}

/* Submit */
.odshub-login-submit {
    width: 100%;
    padding: 13px;
    background: var(--odshub-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
    margin-top: 4px;
}

.odshub-login-submit:hover  { background: var(--odshub-primary-dk); }
.odshub-login-submit:active { transform: scale(.98); }

/* Footer links */
.odshub-login-footer {
    text-align: center;
    margin-top: 20px;
}

.odshub-login-footer a {
    font-size: .875rem;
    color: var(--odshub-muted);
    text-decoration: none;
}

.odshub-login-footer a:hover { color: var(--odshub-primary); text-decoration: underline; }

/* Powered-by */
.odshub-login-powered {
    color: rgba(255,255,255,.45);
    font-size: .8125rem;
    font-family: var(--odshub-font);
    margin-top: 20px;
    text-align: center;
}

/* =====================================================================
   DASHBOARD HUB
   ===================================================================== */

.odshub {
    font-family: var(--odshub-font);
    width: 90%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 0 60px;
    color: var(--odshub-text);
}

/* ── Header ─────────────────────────────────────────────────────────── */
.odshub-header {
    background: linear-gradient(135deg, var(--odshub-primary-dk) 0%, var(--odshub-primary) 100%);
    border-radius: var(--odshub-radius-lg) var(--odshub-radius-lg) 0 0;
    padding: 28px 32px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.odshub-header-user {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 200px;
}

.odshub-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,.5);
    object-fit: cover;
    flex-shrink: 0;
}

.odshub-greeting {
    font-size: 1.1rem;
    margin: 0 0 2px;
    line-height: 1.3;
}

.odshub-greeting strong { font-weight: 700; }

.odshub-role {
    font-size: .8125rem;
    opacity: .75;
    margin: 0;
}

/* Stats row */
.odshub-header-stats {
    display: flex;
    gap: 24px;
    flex-shrink: 0;
}

.odshub-stat {
    text-align: center;
}

.odshub-stat-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.odshub-stat-value--green { color: #86efac; }
.odshub-stat-value--amber { color: #fcd34d; }

.odshub-stat-label {
    font-size: .75rem;
    opacity: .75;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Action buttons */
.odshub-header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

.odshub-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: .8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.odshub-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.odshub-btn--outline {
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,.35);
}

.odshub-btn--outline:hover {
    background: rgba(255,255,255,.22);
    color: #fff;
    text-decoration: none;
}

.odshub-btn--danger {
    background: rgba(220,38,38,.25);
    color: #fff;
    border: 1.5px solid rgba(220,38,38,.5);
}

.odshub-btn--danger:hover {
    background: rgba(220,38,38,.4);
    color: #fff;
    text-decoration: none;
}

/* ── Scope / attribution bar ────────────────────────────────────────── */
.odshub-scope-bar {
    background: #f1f5f9;
    border-bottom: 1px solid var(--odshub-border);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: .8125rem;
}

.odshub-scope-bar--full {
    color: var(--odshub-muted);
    gap: 8px;
}

.odshub-scope-bar--full svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--odshub-green);
}

.odshub-scope-bar--empty {
    color: #92400e;
    background: #fffbeb;
}

.odshub-scope-bar--empty svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--odshub-amber);
}

.odshub-scope-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.odshub-scope-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--odshub-muted);
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.odshub-scope-label svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.odshub-scope-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .775rem;
    font-weight: 500;
    white-space: nowrap;
}

.odshub-scope-pill--territory {
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.odshub-scope-pill-type {
    font-size: .68rem;
    font-weight: 400;
    opacity: .65;
    letter-spacing: .01em;
}

.odshub-scope-pill--ods {
    background: #dcfce7;
    color: #15803d;
}

.odshub-scope-sep {
    width: 1px;
    height: 20px;
    background: var(--odshub-border);
    flex-shrink: 0;
}

/* ── Tab navigation ─────────────────────────────────────────────────── */
.odshub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--odshub-surface);
    border-bottom: 2px solid var(--odshub-border);
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.odshub-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px 14px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    color: var(--odshub-muted);
    white-space: nowrap;
    transition: color .15s, border-color .15s;
    font-family: var(--odshub-font);
}

.odshub-tab:hover { color: var(--odshub-primary); }

.odshub-tab.is-active {
    color: var(--odshub-primary);
    border-bottom-color: var(--odshub-primary);
    font-weight: 600;
}

.odshub-tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.odshub-tab-icon svg {
    width: 18px;
    height: 18px;
}

/* ── Tab panels ─────────────────────────────────────────────────────── */
.odshub-panels {
    background: var(--odshub-bg);
    border-radius: 0 0 var(--odshub-radius-lg) var(--odshub-radius-lg);
    min-height: 400px;
}

.odshub-panel {
    display: none;
    padding: 32px;
    animation: odshub-fadein .18s ease;
}

.odshub-panel.is-active { display: block; }

.odshub-empty {
    margin: 0;
    color: var(--odshub-muted);
}

.odshub-management {
    display: grid;
    gap: 22px;
}

.odshub-management-head h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
    color: var(--odshub-text);
}

.odshub-management-head p {
    margin: 0;
    color: var(--odshub-muted);
}

.odshub-management-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.odshub-management-card {
    display: grid;
    gap: 8px;
    min-height: 116px;
    padding: 18px;
    border: 1px solid var(--odshub-border);
    border-radius: 10px;
    background: #fff;
    color: var(--odshub-text);
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.odshub-management-card:hover,
.odshub-management-card:focus-visible {
    color: var(--odshub-text);
    border-color: #bfdbfe;
    box-shadow: 0 12px 24px rgba(29, 78, 216, .10);
    transform: translateY(-1px);
    text-decoration: none;
}

.odshub-management-card strong {
    font-size: .98rem;
}

.odshub-management-card span {
    color: var(--odshub-muted);
    font-size: .86rem;
    line-height: 1.45;
}

.odshub-entry-v2 {
    display: grid;
    gap: 18px;
}

.odshub-entry-v2-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px;
    border: 1px solid var(--odshub-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.odshub-entry-v2-toolbar label {
    display: grid;
    gap: 5px;
    color: var(--odshub-muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.odshub-entry-v2-toolbar select {
    min-width: 130px;
    min-height: 40px;
    border: 1px solid var(--odshub-border);
    border-radius: 8px;
    padding: 7px 34px 7px 10px;
    background: #fff;
    color: var(--odshub-text);
    font: inherit;
}

.odshub-entry-v2-submit {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    padding: 8px 16px;
    background: var(--odshub-primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.odshub-entry-v2-submit:hover,
.odshub-entry-v2-submit:focus-visible {
    background: var(--odshub-primary-dk);
}

.odshub-entry-v2-portal .bdw-display-wrapper {
    margin-top: 0;
}

@keyframes odshub-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 680px) {
    .odshub-header {
        padding: 20px 16px;
        gap: 16px;
    }

    .odshub-header-stats {
        gap: 16px;
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }

    .odshub-header-actions {
        margin-left: 0;
        order: 2;
    }

    .odshub-panel {
        padding: 20px 16px;
    }

    .odshub-login-card {
        padding: 36px 24px 28px;
    }

    .odshub-management-grid {
        grid-template-columns: 1fr;
    }

    .odshub-entry-v2-toolbar {
        align-items: stretch;
    }

    .odshub-entry-v2-toolbar label,
    .odshub-entry-v2-toolbar select,
    .odshub-entry-v2-submit {
        width: 100%;
    }

    .odshub-btn span { display: none; }
    .odshub-btn svg { width: 18px; height: 18px; }
    .odshub-btn     { padding: 8px 10px; }
}

/* UX hardening: consistent focus and resilient dashboard layout */
.odshub *,
.odshub-login-wrap * {
    box-sizing: border-box;
}

.odshub a:focus-visible,
.odshub button:focus-visible,
.odshub-tab:focus-visible,
.odshub-btn:focus-visible,
.odshub-login-submit:focus-visible,
.odshub-toggle-pwd:focus-visible,
.odshub-entry-v2-toolbar select:focus-visible {
    outline: 3px solid #facc15;
    outline-offset: 3px;
    text-decoration: none;
}

.odshub-field input[type="text"],
.odshub-field input[type="password"],
.odshub-entry-v2-toolbar select,
.odshub-entry-v2-submit {
    min-height: 44px;
}

.odshub-header,
.odshub-management-card,
.odshub-entry-v2-toolbar,
.odshub-login-error {
    overflow-wrap: anywhere;
}

.odshub-table-wrap {
    max-width: 100%;
}

@media (max-width: 680px) {
    .odshub-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .odshub-tabs {
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .odshub-tab {
        flex: 0 0 auto;
        min-height: 44px;
    }

    .odshub-btn {
        min-height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .odshub-panel,
    .odshub-management-card,
    .odshub-login-submit,
    .odshub-field input[type="text"],
    .odshub-field input[type="password"] {
        animation: none;
        transition: none;
    }

    .odshub-management-card:hover,
    .odshub-management-card:focus-visible,
    .odshub-login-submit:active {
        transform: none;
    }
}
