:root {
  --sidebar-bg: #1a2332;
  --sidebar-border: #243044;
  --header-bg: #222d3d;
  --header-text: #e8edf4;
  --content-bg: #f4f6f9;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-muted: #64748b;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --available: #059669;
  --waiting: #d97706;
  --success: #2563eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
  color: var(--text-primary);
  line-height: 1.5;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--header-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(13, 148, 136, 0.2);
  color: #5eead4;
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  color: #94a3b8;
  font-size: 0.75rem;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(13, 148, 136, 0.25);
  color: #99f6e4;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.8rem;
  color: #94a3b8;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

/* Main */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--sidebar-border);
}

.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.content {
  flex: 1;
  padding: 28px;
  overflow: auto;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #e2e8f0;
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 26px;
  height: 26px;
}

.stat-available .stat-icon {
  background: #d1fae5;
  color: var(--available);
}

.stat-waiting .stat-icon {
  background: #fef3c7;
  color: var(--waiting);
}

.stat-success .stat-icon {
  background: #dbeafe;
  color: var(--success);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

/* Panel */
.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.panel-header h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.panel-header p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
}

.platform-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.platform-table th,
.platform-table td {
  padding: 14px 24px;
  text-align: left;
  vertical-align: middle;
}

.platform-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: #f8fafc;
  font-weight: 600;
}

.platform-table tbody tr:hover {
  background: #f8fafc;
}

.col-action {
  width: 160px;
  text-align: right;
}

.platform-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.platform-name code {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-online {
  background: #d1fae5;
  color: #047857;
}

.badge-idle {
  background: #fef3c7;
  color: #b45309;
}

.badge-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-login {
  background: var(--accent);
  color: #fff;
}

.btn-login:hover {
  background: var(--accent-hover);
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
}

.meta-line {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 16px;
  }

  .content {
    padding: 16px;
  }
}
