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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #263548;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.logo {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

.header-date { color: var(--text-muted); font-size: 13px; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.user-name { font-size: 13px; color: var(--text-muted); }

.btn-logout {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.btn-logout:hover { color: var(--text); border-color: var(--text-muted); }

/* Main */
.main { padding: 32px; max-width: 1400px; margin: 0 auto; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title { font-size: 22px; font-weight: 700; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

/* Widgets Grid */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Widget Card */
.widget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  transition: border-color 0.15s, transform 0.15s;
  cursor: default;
}
.widget-card:hover {
  border-color: var(--text-dim);
  transform: translateY(-1px);
}

.widget-accent {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  position: absolute;
  top: 24px;
  left: 0;
}

.widget-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 6px;
  padding-left: 12px;
}

.widget-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 12px;
}

.widget-value {
  font-size: 28px;
  font-weight: 700;
  padding-left: 12px;
  line-height: 1.2;
}

.widget-notes {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 12px;
  padding-left: 12px;
  font-style: italic;
}

.widget-updated {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 8px;
  padding-left: 12px;
}

.widget-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.widget-card:hover .widget-actions { opacity: 1; }

.widget-action-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}
.widget-action-btn:hover { color: var(--text); border-color: var(--text-muted); }
.widget-action-btn.delete:hover { color: var(--danger); border-color: var(--danger); }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty-state p { margin-top: 20px; font-size: 15px; line-height: 1.6; }
.empty-icon { opacity: 0.5; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 480px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-header h2 { font-size: 18px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.color-options { display: flex; gap: 8px; flex-wrap: wrap; }
.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}
.color-btn:hover { transform: scale(1.1); }
.color-btn.selected { border-color: #fff; transform: scale(1.1); }

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 640px) {
  .header { padding: 12px 16px; }
  .main { padding: 16px; }
  .user-name { display: none; }
  .widgets-grid { grid-template-columns: 1fr; }
  .modal { padding: 24px; }
}
