* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 1.5rem;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
}

.form-group input, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

button, .btn {
    padding: 0.75rem 1.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
}

button:hover, .btn:hover {
    background: #0056b3;
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 2rem 1rem;
}

.sidebar h2 {
    margin-bottom: 1rem;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin: 0.5rem 0;
}

.sidebar a {
    color: white;
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border-radius: 4px;
}

.sidebar a:hover, .sidebar a.active {
    background: #34495e;
}

.content {
    flex: 1;
    padding: 2rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #007bff;
}

.users-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
}

.users-table th, .users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.users-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #000;
}

.error {
    color: #dc3545;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.empty-state {
    text-align: center;
    color: #666;
    padding: 2rem;
}

.info-text {
    background: #e3f2fd;
    padding: 0.75rem;
    border-radius: 4px;
    color: #1976d2;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Token Claim Styles */
.claim-device-section {
    padding: 1rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-label {
    font-weight: 600;
    color: #333;
}

/* Public pages */
.public-header {
    background: #2c3e50;
    color: white;
    padding: 1.5rem 0;
}

.public-header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.public-brand h1 {
    margin-bottom: 0.25rem;
}

.public-brand p {
    color: #ecf0f1;
}

.public-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    gap: 1rem;
}

.public-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.code-block {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-top: 0.75rem;
}

.public-list {
    margin-left: 1.25rem;
    margin-top: 0.5rem;
}

.public-image {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ddd;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: #007bff;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.token-card {
    background: white;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.token-card h3 {
    color: #28a745;
    margin-bottom: 1rem;
}

.token-info {
    color: #666;
    margin-bottom: 1rem;
}

.token-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    border: 1px solid #dee2e6;
}

.token-code {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #212529;
    flex: 1;
    word-break: break-all;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.token-expiry {
    font-size: 0.9rem;
    color: #dc3545;
    font-weight: 500;
}

.token-instructions {
    background: #e8f5e9;
    padding: 1rem;
    border-left: 4px solid #28a745;
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #1b5e20;
}

.instruction-code {
    display: block;
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-family: 'Courier New', monospace;
    border: 1px solid #81c784;
    word-break: break-all;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}