/* Signal Dashboard Users – Styles */

/* ===== Custom Properties ===== */

:root {
  /* Typography */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;

  /* Light theme colors */
  --page: #F4F7F8;
  --page-accent: #E0F7FA;
  --surface: #FFFFFF;
  --surface-alt: #F9FAFB;
  --surface-strong: #F0F4F5;
  --border: #DCE3E8;
  --text: #1A2327;
  --muted: #6B7C83;
  --focus: #0FB5B9;
  --primary: #0FB5B9;
  --accent-1: #0B858C;
  --on-primary: #FFFFFF;
  --on-secondary: #FFFFFF;
  --secondary: #0B858C;
  --success: #2F9B5C;
  --warn: #D18E2E;
  --danger: #E51A2A;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --page: #0D1117;
  --page-accent: #0B171B;
  --surface: #161B22;
  --surface-alt: #1C2333;
  --surface-strong: #1A2035;
  --border: #2A3441;
  --text: #E6EDF3;
  --muted: #7B8A90;
  --focus: #0FB5B9;
  --primary: #0FB5B9;
  --accent-1: #12C4C8;
  --on-primary: #FFFFFF;
  --on-secondary: #FFFFFF;
  --secondary: #0B858C;
  --success: #3CC776;
  --warn: #E5A845;
  --danger: #F04F5C;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== Base ===== */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: radial-gradient(circle at top left, var(--page-accent), var(--page));
  color: var(--text);
}

button, input, select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ===== Layout Shell ===== */

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

/* ===== Sidebar ===== */

.sidebar {
  background: #0B171B;
  color: #F4F7F8;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.sidebar-sigil {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 20% 0%, var(--primary), var(--accent-1));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3), 0 12px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-sigil span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.8);
}

.sidebar-title {
  display: flex;
  flex-direction: column;
}

.sidebar-name {
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-sub {
  font-size: 11px;
  color: #B0BEC5;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 13px;
  color: #CFD8DC;
  background: transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(16, 179, 187, 0.1);
  color: #E0F7FA;
}

.nav-item--active {
  background: rgba(16, 179, 187, 0.18);
  color: #E0F7FA;
}

/* ===== Main Area ===== */

.main-area {
  padding: 20px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== Top Bar ===== */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.page-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 22px;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  border-radius: 9999px;
  padding: 4px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: inline-flex;
  gap: 4px;
}

.theme-button {
  border: none;
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-button[data-active="true"] {
  background: var(--secondary);
  color: var(--on-secondary);
}

.profile-chip {
  border-radius: 9999px;
  border: 1px solid var(--border);
  padding: 4px 10px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.profile-initials {
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-name {
  font-size: 13px;
}

/* ===== Toolbar ===== */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  font-family: var(--font-ui);
  color: var(--muted);
}

.field-inline input,
.field-inline select {
  min-width: 180px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

.field-inline input:focus,
.field-inline select:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--focus);
}

.toolbar-right {
  display: flex;
  gap: 8px;
}

/* ===== Buttons ===== */

.btn {
  border-radius: 9999px;
  font-size: 13px;
  cursor: pointer;
}

.primary-btn {
  border: none;
  padding: 7px 14px;
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: radial-gradient(circle at 0% 0%, #E8FBFC, var(--primary));
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.primary-btn span:first-child {
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.85);
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.7));
}

.primary-btn:hover {
  box-shadow: 0 0 0 1px var(--focus);
}

.primary-btn--small {
  padding: 5px 10px;
  font-size: 12px;
}

.secondary-btn {
  border: 1px solid var(--border);
  padding: 7px 12px;
  background: var(--surface-alt);
  color: var(--text);
}

.secondary-btn:hover {
  border-color: var(--focus);
  background: var(--surface);
}

.danger-btn {
  border: 1px solid var(--danger);
  padding: 7px 12px;
  background: var(--danger);
  color: #FDF2F3;
}

.danger-btn:hover {
  box-shadow: 0 0 0 1px var(--danger);
}

/* ===== Main Layout Grid ===== */

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  gap: 16px;
}

/* ===== Panels ===== */

.panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 14px 14px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  margin-bottom: 10px;
}

.panel-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
}

.panel-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ===== Table ===== */

.table-shell {
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 7px 10px;
  text-align: left;
}

.data-table thead {
  background: var(--surface-strong);
}

.data-table tbody tr:nth-child(even) {
  background: var(--surface);
}

.data-table tbody tr:hover {
  background: var(--surface-alt);
}

.data-table tbody tr[aria-selected="true"] {
  background: rgba(16, 179, 187, 0.08);
}

.data-table tbody tr {
  cursor: pointer;
}

.status {
  display: inline-flex;
  border-radius: 9999px;
  padding: 2px 8px;
  font-size: 11px;
}

.status--ok {
  background: rgba(47, 155, 92, 0.12);
  color: var(--success);
}

.status--warn {
  background: rgba(209, 138, 46, 0.12);
  color: var(--warn);
}

.status--error {
  background: rgba(229, 26, 34, 0.12);
  color: var(--danger);
}

.table-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}

/* ===== Detail Panel ===== */

.detail-empty {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.detail-empty[data-state="empty"] {
  display: block;
}

.detail-empty[data-state="active"] {
  display: none;
}

.detail-body {
  display: block;
}

.detail-body[data-state="inactive"] {
  display: none;
}

.detail-body[data-state="active"] {
  display: block;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 12px;
}

.detail-list dt {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
}

.detail-list dd {
  margin: 2px 0 0;
}

.detail-preferences h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-family: var(--font-ui);
}

.detail-flags {
  list-style: none;
  padding: 0;
  margin: 6px 0 10px;
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.flag-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  margin-right: 6px;
}

.flag-dot--enabled {
  background: var(--primary);
}

.flag-dot--disabled {
  background: var(--border);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ===== Accessibility ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 12px;
  }

  .layout-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left {
    flex-direction: column;
  }

  .field-inline input,
  .field-inline select {
    min-width: unset;
    width: 100%;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }
}