* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0a0e27; --bg-alt: #131735; --card: #1a1f3a; --card-hover: #1f2547;
  --border: rgba(255,255,255,0.08); --border-strong: rgba(255,255,255,0.15);
  --text: #e0e0e0; --text-dim: #999; --text-muted: #666;
  --accent: #4CAF50; --accent-hover: #45a049; --accent-soft: rgba(76,175,80,0.15);
  --blue: #2196F3; --red: #f44336; --orange: #ff9800; --yellow: #ffc107;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4); --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}
[data-theme="light"] {
  --bg: #f0f2f5; --bg-alt: #ffffff; --card: #ffffff; --card-hover: #f8f9fa;
  --border: rgba(0,0,0,0.08); --border-strong: rgba(0,0,0,0.15);
  --text: #1a1a1a; --text-dim: #666; --text-muted: #999;
  --accent: #2e7d32; --accent-hover: #1b5e20; --accent-soft: rgba(46,125,50,0.1);
  --shadow: 0 4px 20px rgba(0,0,0,0.08); --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
}
html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; transition: background 0.2s, color 0.2s; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: var(--bg-alt); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; gap: 16px; flex-wrap: wrap; }
.header-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; }
.header-brand img { width: 32px; height: 32px; }
.header-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.header-nav a { padding: 8px 16px; border-radius: var(--radius-sm); color: var(--text-dim); font-weight: 500; transition: all 0.15s; }
.header-nav a:hover { background: var(--border); color: var(--text); text-decoration: none; }
.header-nav a.active { background: var(--accent-soft); color: var(--accent); }
.header-user { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.header-user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; text-transform: uppercase; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.15s; text-decoration: none; white-space: nowrap; user-select: none; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--border-strong); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover:not(:disabled) { background: #d32f2f; }
.btn-warning { background: var(--orange); color: white; }
.btn-warning:hover:not(:disabled) { background: #f57c00; }
.btn-info { background: var(--blue); color: white; }
.btn-info:hover:not(:disabled) { background: #1976D2; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 8px; min-width: 32px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-dim); font-size: 13px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); transition: border-color 0.15s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-helper { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: all 0.15s; }
.card-hover:hover { border-color: var(--border-strong); background: var(--card-hover); }
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: radial-gradient(circle at top left, rgba(76,175,80,0.1), transparent 50%), radial-gradient(circle at bottom right, rgba(33,150,243,0.1), transparent 50%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--card); padding: 40px; border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 32px; font-size: 24px; font-weight: 700; }
.login-logo img { width: 40px; height: 40px; }
.login-error { background: rgba(244,67,54,0.1); border: 1px solid var(--red); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; display: none; }
.login-error.show { display: block; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 24px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: pointer; transition: all 0.15s; min-height: 150px; text-align: center; user-select: none; position: relative; overflow: hidden; }
.tile:hover { border-color: var(--accent); background: var(--card-hover); transform: translateY(-3px); box-shadow: 0 8px 30px rgba(76,175,80,0.15); }
.tile-icon { font-size: 40px; line-height: 1; }
.tile-name { font-size: 15px; font-weight: 600; color: var(--text); word-break: break-word; overflow-wrap: anywhere; }
.tile-status { position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.tile-status.online { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 64px; margin-bottom: 20px; opacity: 0.5; }
.empty-state-title { font-size: 18px; color: var(--text-dim); margin-bottom: 8px; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--card); border-radius: var(--radius); padding: 28px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: modalIn 0.15s ease-out; }
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.context-menu { position: fixed; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; z-index: 2000; display: none; min-width: 160px; }
.context-menu.active { display: block; }
.context-menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); transition: background 0.1s; }
.context-menu-item:hover { background: var(--accent-soft); color: var(--accent); }
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 3000; pointer-events: none; }
.toast { background: var(--card); color: var(--text); padding: 12px 20px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); border-left: 4px solid var(--accent); font-size: 13px; animation: toastIn 0.2s ease-out; pointer-events: auto; min-width: 240px; max-width: 400px; }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--orange); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 12px 20px; border: none; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; transition: all 0.15s; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.list-item-info { flex: 1; min-width: 200px; }
.list-item-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.list-item-meta { color: var(--text-muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.list-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-success { background: rgba(76,175,80,0.15); color: var(--accent); }
.badge-danger { background: rgba(244,67,54,0.15); color: var(--red); }
.badge-warning { background: rgba(255,152,0,0.15); color: var(--orange); }
.badge-info { background: rgba(33,150,243,0.15); color: var(--blue); }
.badge-muted { background: var(--border); color: var(--text-dim); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.banner { padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 20px; display: flex; align-items: center; gap: 12px; font-size: 13px; border: 1px solid; }
.banner-warning { background: rgba(255,193,7,0.1); border-color: var(--yellow); color: var(--yellow); }
.banner-info { background: rgba(33,150,243,0.1); border-color: var(--blue); color: var(--blue); }
.banner-danger { background: rgba(244,67,54,0.1); border-color: var(--red); color: var(--red); }
.banner-content { flex: 1; }
.page-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.page-subtitle { color: var(--text-dim); margin-bottom: 24px; }
.loading { display: flex; justify-content: center; padding: 40px; color: var(--text-muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 768px) {
  .container { padding: 16px; }
  .header { padding: 12px 16px; }
  .header-brand { font-size: 17px; }
  .header-nav a { padding: 6px 12px; font-size: 13px; }
  .page-title { font-size: 22px; }
  .dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .tile { padding: 20px 14px; min-height: 120px; }
  .tile-icon { font-size: 32px; }
  .tile-name { font-size: 13px; }
  .form-row { grid-template-columns: 1fr; }
  .login-card { padding: 28px; }
  .modal { padding: 20px; }
  .list-item { padding: 14px 16px; }
  .list-item-actions { width: 100%; }
}
