/* Signal Dashboard Users – Ivory & Ink Styles */

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

:root {
  /* Typography */
  --font-body: "Atkinson Hyperlegible", "Segoe UI", Arial, sans-serif;
  --font-ui: "Lexend", "Segoe UI", Arial, sans-serif;

  /* Light theme colors — Ivory & Ink */
  --page: #FAF8F2;
  --page-accent: #F0ECE2;
  --surface: #FFFEFA;
  --surface-alt: #F6F2E9;
  --surface-strong: #E8E1D4;
  --border: #D8D1C5;
  --text: #242321;
  --muted: #6E6A63;
  --focus: #2D2B28;
  --primary: #2D2B28;
  --primary-hover: #171614;
  --on-primary: #FAF7EF;
  --on-secondary: #242321;
  --secondary: #E8E2D8;
  --secondary-hover: #DAD2C5;
  --accent-1: #817A70;
  --accent-2: #8C9795;
  --accent-3: #B49B73;
  --success: #6F806F;
  --danger: #8A5D54;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  --page: #020202;
  --page-accent: #090806;
  --surface: #151411;
  --surface-alt: #201E1A;
  --surface-strong: #322F28;
  --border: #4D4941;
  --text: #FAF7EF;
  --muted: #C7C1B5;
  --focus: #E8E1D4;
  --primary: #E8E1D4;
  --primary-hover: #FFF9ED;
  --on-primary: #151411;
  --on-secondary: #FAF7EF;
  --secondary: #4C4840;
  --secondary-hover: #625D53;
  --accent-1: #B6ADA0;
  --accent-2: #8EA09C;
  --accent-3: #C8AD7C;
  --success: #9BAE99;
  --danger: #C89084;
  --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);
  font-size: 18px;
  line-height: 1.6;
  background: 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: var(--surface-alt);
  color: var(--text);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

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

.sidebar-sigil {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-sigil span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--on-primary);
}

.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: var(--muted);
}

.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: var(--muted);
  background: transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.nav-item--active {
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 500;
}

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

.main-area {
  padding: 24px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== 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;
  font-family: var(--font-ui);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

.theme-button:hover:not([data-active="true"]) {
  background: var(--surface-strong);
}

.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: 8px 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(--primary);
}

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

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

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

.primary-btn {
  border: none;
  padding: 8px 16px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: 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 var(--on-primary);
  background: transparent;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.primary-btn--small {
  padding: 6px 12px;
  font-size: 13px;
}

.secondary-btn {
  border: 1px solid var(--border);
  padding: 8px 14px;
  background: var(--secondary);
  color: var(--on-secondary);
  font-family: var(--font-ui);
  font-size: 14px;
}

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

.danger-btn {
  border: 1px solid var(--danger);
  padding: 8px 14px;
  background: var(--danger);
  color: var(--on-primary);
  font-family: var(--font-ui);
  font-size: 14px;
}

.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: 24px;
}

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

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

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

.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: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-family: var(--font-body);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  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: var(--surface-strong);
}

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

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

.status--ok {
  background: rgba(111, 128, 111, 0.15);
  color: var(--success);
}

.status--warn {
  background: rgba(180, 155, 115, 0.15);
  color: var(--accent-3);
}

.status--error {
  background: rgba(138, 93, 84, 0.15);
  color: var(--danger);
}

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

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

.detail-empty {
  display: block;
  font-size: 14px;
  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: 12px;
  margin: 12px 0 16px;
  font-size: 14px;
}

.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 6px;
  font-size: 13px;
  font-family: var(--font-ui);
}

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

.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: 12px;
}

/* ===== 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;
  }
}