:root {
    --bg: #131416;
    --main: #1c1d20;
    --text: #e0e0e4;
    --muted: rgba(224, 224, 228, 0.55);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.15);
    --primary: #0094ff;
    --primary-dark: #0052cc;
    --danger: #ef4444;
    --success: #4ade80;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
}

#root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

[hidden] {
    display: none !important;
}

#login-view {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    background: var(--main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-card {
    width: 100%;
    max-width: 360px;
}

.login-header {
    margin-bottom: 22px;
    text-align: center;
}

.login-header h1 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 700;
}

.login-header p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--muted);
}

.field input,
.input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.field input:focus,
.input:focus {
    border-color: var(--border-hover);
}

.btn-primary {
    width: 100%;
    border: none;
    background: var(--primary-dark);
    color: #fff;
    padding: 11px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    font-family: inherit;
    margin-top: 4px;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.92;
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: wait;
}

.btn-ghost {
    background: var(--main);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--border-hover);
}

.btn-ghost:disabled {
    opacity: 0.5;
    cursor: wait;
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 0.75rem;
    margin-bottom: 12px;
}

#dashboard-view {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    padding: 24px;
    gap: 16px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.brand h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.brand .subtitle {
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar .input {
    flex: 1;
}

.counter {
    font-size: 0.65rem;
    color: var(--muted);
}

.team-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--main);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s;
}

.team-row:hover {
    border-color: var(--border-hover);
}

.logo-cell {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.logo-cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-placeholder {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
}

.team-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.team-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-meta {
    font-size: 0.6rem;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.badge {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
    font-weight: 600;
    width: max-content;
}

.actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.upload-label {
    background: var(--primary-dark);
    color: #fff;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.upload-label:hover {
    opacity: 0.92;
}

.upload-label.busy {
    opacity: 0.6;
    cursor: wait;
}

.upload-label input {
    display: none;
}

.delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.delete-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
}

.delete-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.empty {
    text-align: center;
    padding: 30px;
    color: var(--muted);
    font-size: 0.8rem;
}

.footer-hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.65rem;
}

.settings-card {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-header h2 {
    margin: 0 0 2px;
    font-size: 0.95rem;
    font-weight: 700;
}

.settings-header p {
    margin: 0;
    font-size: 0.7rem;
    color: var(--muted);
}

.seg-control {
    display: inline-flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px;
    width: fit-content;
}

.seg-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.seg-btn:hover {
    color: var(--text);
}

.seg-btn.active {
    background: var(--main);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border-hover);
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-group .field {
    margin-bottom: 0;
}

.optional {
    font-style: normal;
    font-weight: 400;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
}

.success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--success);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 0.75rem;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
}

.settings-actions .btn-primary {
    width: auto;
    margin-top: 0;
    padding: 9px 18px;
}

.teams-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton {
    height: 60px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--main) 25%, rgba(255, 255, 255, 0.04) 50%, var(--main) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
