* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: #333; }

/* Login */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); width: 360px; text-align: center; }
.login-box h1 { font-size: 24px; margin-bottom: 8px; color: #0071dc; }
.login-box p { font-size: 13px; color: #888; margin-bottom: 24px; }
.login-box input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.login-box button { width: 100%; padding: 12px; background: #0071dc; color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: #005bb5; }
.login-error { color: #e63946; font-size: 13px; margin-bottom: 12px; display: none; }

/* Dashboard */
.dashboard { display: none; max-width: 1100px; margin: 0 auto; padding: 24px; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.header h1 { font-size: 22px; color: #0071dc; }
.header button { padding: 8px 16px; background: #f0f0f0; border: 1px solid #ddd; border-radius: 6px; cursor: pointer; font-size: 13px; }
.header button:hover { background: #e0e0e0; }

/* Stats bar */
.stats-bar { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card { flex: 1; background: #fff; padding: 16px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); text-align: center; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #0071dc; }
.stat-card .label { font-size: 12px; color: #888; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Create form */
.create-form { background: #fff; padding: 16px 20px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-bottom: 24px; display: flex; gap: 12px; align-items: center; }
.create-form input { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.create-form button { padding: 10px 20px; background: #0071dc; color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.create-form button:hover { background: #005bb5; }
.new-key-result { background: #d4edda; border: 1px solid #c3e6cb; padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; display: none; align-items: center; gap: 12px; }
.new-key-result code { font-size: 15px; font-weight: 600; color: #155724; flex: 1; word-break: break-all; }
.new-key-result button { padding: 6px 14px; background: #28a745; color: #fff; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; }

/* Table */
.table-wrapper { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: #f8f9fa; padding: 12px; text-align: left; font-weight: 600; color: #555; border-bottom: 2px solid #eee; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
tbody td { padding: 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: #f8f9fa; }

.key-cell { font-family: monospace; font-size: 12px; color: #666; }
.key-full { display: none; }
.key-truncated { cursor: pointer; }
.key-truncated:hover { color: #0071dc; }

.status-active { color: #28a745; font-weight: 600; }
.status-revoked { color: #e63946; font-weight: 600; }

.devices-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.devices-ok { background: #d4edda; color: #155724; }
.devices-full { background: #fff3cd; color: #856404; }

.action-btn { padding: 4px 12px; border: none; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
.action-btn.revoke { background: #fee2e2; color: #e63946; }
.action-btn.revoke:hover { background: #fecaca; }
.action-btn.activate { background: #d4edda; color: #28a745; }
.action-btn.activate:hover { background: #c3e6cb; }

/* Expanded row */
.expanded-row { display: none; }
.expanded-row td { padding: 0; }
.expanded-content { padding: 16px 20px; background: #fafafa; border-bottom: 2px solid #eee; }
.expanded-content h4 { font-size: 13px; margin-bottom: 8px; color: #555; }
.full-key-display { font-family: monospace; font-size: 14px; background: #f0f0f0; padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.full-key-display code { flex: 1; word-break: break-all; }
.full-key-display button { padding: 4px 10px; font-size: 11px; background: #0071dc; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

.devices-list { margin-bottom: 12px; }
.device-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 12px; border-bottom: 1px solid #eee; }
.device-item:last-child { border-bottom: none; }
.device-item .device-id { font-family: monospace; color: #666; flex: 1; }
.device-item .device-meta { color: #999; }
.device-item button { padding: 2px 8px; font-size: 11px; background: #fee2e2; color: #e63946; border: none; border-radius: 3px; cursor: pointer; }
.reset-devices-btn { padding: 4px 12px; font-size: 11px; background: #ff9800; color: #fff; border: none; border-radius: 4px; cursor: pointer; margin-bottom: 12px; }

.usage-list { max-height: 200px; overflow-y: auto; font-size: 12px; }
.usage-item { padding: 4px 0; border-bottom: 1px solid #f0f0f0; color: #666; display: flex; gap: 16px; }
.usage-item:last-child { border-bottom: none; }

.time-ago { color: #999; font-size: 12px; }
