:root {
    --nlync-border: #1a1a2e;
    --nlync-bg: #ffffff;
    --nlync-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --nlync-header-alt: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --nlync-open: #ffffff;
    --nlync-claimed: #e0f2fe;
    --nlync-mine: #d1fae5;
    --nlync-text: #1a1a2e;
    --nlync-muted: #64748b;
    --nlync-radius: 12px;
    --nlync-primary: #7c3aed;
    --nlync-primary-hover: #6d28d9;
    --nlync-accent: #ec4899;
    --nlync-success: #10b981;
    --nlync-gold: #fbbf24;
}

/* Main wrapper */
.nlync-sb-wrap {
    max-width: 980px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--nlync-text);
    padding: 20px 10px;
}

/* Toolbar */
.nlync-sb-toolbar {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 0 0 24px 0;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: var(--nlync-radius);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.nlync-sb-title {
    font-weight: 700;
    letter-spacing: 0.3px;
    font-size: 20px;
    margin: 0 0 6px 0;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nlync-sb-note {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.5;
}

.nlync-sb-toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.nlync-sb-user-info {
    font-size: 14px;
    color: #ffffff;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.nlync-sb-btn {
    display: inline-block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nlync-sb-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nlync-sb-btn-primary {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1a1a2e;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.nlync-sb-btn-primary:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(251, 191, 36, 0.5);
}

/* Board container */
.nlync-sb-board {
    width: 100%;
    margin-bottom: 16px;
}

/* Loading and error states */
.nlync-sb-loading,
.nlync-sb-error {
    padding: 40px 20px;
    border: 2px dashed var(--nlync-border);
    border-radius: var(--nlync-radius);
    text-align: center;
    color: var(--nlync-muted);
    font-size: 15px;
}

.nlync-sb-error {
    color: #d63638;
    border-color: #d63638;
}

.nlync-sb-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: var(--nlync-primary);
    border-radius: 50%;
    animation: nlync-sb-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes nlync-sb-spin {
    to { transform: rotate(360deg); }
}

/* Grid layout */
.nlync-sb-grid {
    display: grid;
    grid-template-columns: 54px repeat(10, 1fr);
    border: 3px solid var(--nlync-border);
    border-radius: var(--nlync-radius);
    overflow: hidden;
    background: var(--nlync-bg);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.2);
}

/* Header cells */
.nlync-sb-corner,
.nlync-sb-top,
.nlync-sb-left {
    background: var(--nlync-header);
    border-right: 2px solid rgba(255, 255, 255, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    user-select: none;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nlync-sb-corner {
    background: var(--nlync-header);
}

.nlync-sb-top {
    font-size: 16px;
    padding: 12px 4px;
    background: var(--nlync-header);
}

.nlync-sb-left {
    border-right: 3px solid var(--nlync-border);
    flex-direction: column;
    padding: 6px 4px;
    gap: 4px;
    background: var(--nlync-header-alt);
}

.nlync-sb-left-team {
    font-size: 10px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.nlync-sb-left-num {
    font-size: 16px;
    color: #ffffff;
}

/* Data cells */
.nlync-sb-cell {
    position: relative;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    background: var(--nlync-open);
    transition: all 0.3s ease;
    cursor: pointer;
}

.nlync-sb-cell.nlync-sb-claimed {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.nlync-sb-cell.nlync-sb-mine {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    box-shadow: inset 0 0 0 2px var(--nlync-success);
}

.nlync-sb-cell.nlync-sb-saving {
    opacity: 0.6;
    pointer-events: none;
}

.nlync-sb-cell:hover {
    box-shadow: inset 0 0 0 3px var(--nlync-primary);
    transform: scale(1.02);
    z-index: 10;
}

/* Make cells square */
.nlync-sb-cell::before {
    content: "";
    display: block;
    padding-top: 100%;
}

/* Cell content layer */
.nlync-sb-cell-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

/* Input field */
.nlync-sb-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--nlync-text);
    padding: 4px;
    line-height: 1.3;
}

.nlync-sb-input::placeholder {
    color: #999;
    font-weight: 400;
}

.nlync-sb-input[readonly] {
    cursor: not-allowed;
    opacity: 0.9;
}

.nlync-sb-input:focus {
    outline: 2px solid var(--nlync-primary);
    outline-offset: -2px;
    border-radius: 4px;
}

/* Lock icon */
.nlync-sb-lock {
    position: absolute;
    right: 4px;
    bottom: 4px;
    font-size: 10px;
    opacity: 0.5;
    pointer-events: none;
}

/* Remove right border on last column */
.nlync-sb-grid > :nth-child(11n) {
    border-right: none !important;
}

/* Top team label ABOVE numbers */
.nlync-sb-top-team-header {
    grid-column: 2 / -1;
    background: var(--nlync-header);
    padding: 16px 12px;
    text-align: center;
    font-weight: 800;
    font-size: 20px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
}

/* Footer legend */
.nlync-sb-footer {
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--nlync-radius);
}

.nlync-sb-legend {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: center;
    color: var(--nlync-text);
    font-size: 14px;
    flex-wrap: wrap;
    font-weight: 600;
}

.nlync-sb-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nlync-sb-dot {
    width: 20px;
    height: 20px;
    border: 2px solid var(--nlync-border);
    border-radius: 6px;
    display: inline-block;
}

.nlync-sb-dot-mine {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: var(--nlync-success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.nlync-sb-dot-taken {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #0ea5e9;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.nlync-sb-dot-open {
    background: var(--nlync-open);
    border-color: #cbd5e1;
}

/* ============================================
   AUTH FORMS - Beautiful Professional Design
   ============================================ */

.nlync-sb-auth-wrapper {
    max-width: 480px;
    margin: 40px auto;
    padding: 0 20px;
}

.nlync-sb-auth-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.nlync-sb-auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

/* Auth Header */
.nlync-sb-auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.nlync-sb-auth-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 36px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.nlync-sb-auth-icon-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.nlync-sb-auth-icon svg {
    width: 48px;
    height: 48px;
}

.nlync-sb-auth-card h2 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--nlync-text);
}

.nlync-sb-auth-card h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--nlync-text);
}

.nlync-sb-auth-subtitle {
    margin: 0;
    font-size: 15px;
    color: var(--nlync-muted);
    line-height: 1.5;
}

/* Form Styling */
.nlync-sb-form {
    margin: 0;
}

.nlync-sb-form-group {
    margin-bottom: 24px;
}

.nlync-sb-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--nlync-text);
}

.nlync-sb-form-group label svg {
    opacity: 0.6;
}

.nlync-sb-required {
    color: #ef4444;
    font-weight: 700;
}

.nlync-sb-form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.nlync-sb-form-group input:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}

.nlync-sb-form-group input:focus {
    outline: none;
    border-color: var(--nlync-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

.nlync-sb-form-group input::placeholder {
    color: #94a3b8;
}

/* Button Styling */
.nlync-sb-btn-large {
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
}

.nlync-sb-btn-full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nlync-sb-btn-secondary {
    background: #f1f5f9;
    color: var(--nlync-text);
    border: 2px solid #e2e8f0;
}

.nlync-sb-btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Auth Divider */
.nlync-sb-auth-divider {
    position: relative;
    text-align: center;
    margin: 28px 0;
}

.nlync-sb-auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.nlync-sb-auth-divider span {
    position: relative;
    background: #ffffff;
    padding: 0 16px;
    font-size: 13px;
    color: var(--nlync-muted);
    font-weight: 500;
}

/* Notice Enhancements for Auth */
.nlync-sb-notice {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
}

.nlync-sb-notice-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.nlync-sb-notice strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.nlync-sb-notice ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.nlync-sb-notice li {
    margin: 4px 0;
}

.nlync-sb-notice-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid var(--nlync-success);
    color: #065f46;
}

.nlync-sb-notice-success .nlync-sb-auth-icon {
    background: var(--nlync-success);
    font-size: 48px;
    font-weight: 700;
}

.nlync-sb-notice-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
    color: #991b1b;
}

.nlync-sb-notice-error svg {
    color: #ef4444;
}

.nlync-sb-notice-info {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 2px solid #0ea5e9;
    color: #075985;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nlync-sb-auth-wrapper {
        padding: 0 16px;
        margin: 24px auto;
    }

    .nlync-sb-auth-card {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .nlync-sb-auth-card h2 {
        font-size: 24px;
    }

    .nlync-sb-auth-icon {
        width: 64px;
        height: 64px;
    }

    .nlync-sb-auth-icon svg {
        width: 36px;
        height: 36px;
    }

    .nlync-sb-form-group {
        margin-bottom: 20px;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .nlync-sb-wrap {
        padding: 10px 5px;
    }

    .nlync-sb-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .nlync-sb-toolbar-right {
        width: 100%;
        justify-content: flex-start;
    }

    .nlync-sb-grid {
        grid-template-columns: 40px repeat(10, 1fr);
        border-radius: 8px;
    }

    .nlync-sb-top,
    .nlync-sb-left-num {
        font-size: 12px;
    }

    .nlync-sb-input {
        font-size: 11px;
    }

    .nlync-sb-title {
        font-size: 18px;
    }

    .nlync-sb-note {
        font-size: 12px;
    }

    .nlync-sb-auth-box {
        padding: 20px;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .nlync-sb-grid {
        grid-template-columns: 32px repeat(10, 1fr);
    }

    .nlync-sb-input {
        font-size: 10px;
    }

    .nlync-sb-left-team {
        font-size: 7px;
    }

    .nlync-sb-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
}
