/* DataFlux Brutalist Editorial Theme
   Ivory #FAF8F5 / Charcoal #1A1A1A
   No rounded corners. No glass. No gradients. No glow.
   4px offset shadows. Sharp borders. Space Grotesk + JetBrains Mono. */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg:        #FAF8F5;
  --bg-alt:    #F0EDE8;
  --bg-dark:   #1A1A1A;
  --fg:        #1A1A1A;
  --fg-inv:    #FAF8F5;
  --muted:     #6B6B6B;
  --border:    #1A1A1A;
  --accent:    #1A1A1A;
  --red:       #C0392B;
  --red-bg:    #FDF0EE;
  --green:     #1A7F4E;
  --green-bg:  #E8F5EE;
  --amber:     #B7791F;
  --amber-bg:  #FAF3E0;
  --blue:      #2C5282;
  --blue-bg:   #EBF0F7;
  --purple:    #553C9A;
  --purple-bg: #F0EDF8;
  --shadow:    4px 4px 0px #1A1A1A;
  --shadow-sm: 2px 2px 0px #1A1A1A;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Grid overlay - subtle */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(26,26,26,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,26,26,0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--fg); text-decoration: none; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: 240px; height: 100vh;
  background: var(--bg-dark);
  color: var(--fg-inv);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid #333;
}

.sidebar-brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-brand-sub {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  border-left: 3px solid transparent;
  transition: none;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--fg-inv);
  background: #2a2a2a;
  border-left-color: #555;
}

.nav-item.active {
  color: var(--bg-dark);
  background: var(--fg-inv);
  border-left-color: var(--fg-inv);
}

.nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #333;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: #666;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-footer button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #888;
  font: inherit;
  cursor: pointer;
  padding: 8px 0;
}

.sidebar-footer button:hover { color: var(--red); }

/* ── Main Layout ───────────────────────────────────────────────── */
.main {
  margin-left: 240px;
  min-height: 100vh;
  padding: 28px 32px;
  position: relative;
  z-index: 1;
}

/* ── Header ────────────────────────────────────────────────────── */
.page-breadcrumb {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-breadcrumb a:hover { text-decoration: underline; }

.page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

/* ── Status Tags ───────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border: 2px solid var(--border);
}

.tag-active { background: var(--green); color: var(--fg-inv); border-color: var(--green); }
.tag-dead   { background: #6B6B6B; color: var(--fg-inv); border-color: #6B6B6B; }
.tag-failed { background: var(--red); color: var(--fg-inv); border-color: var(--red); }
.tag-pro    { background: var(--bg-dark); color: var(--fg-inv); }
.tag-free   { background: var(--bg-alt); color: var(--muted); }
.tag-2fa    { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }

.tag-dot {
  width: 6px; height: 6px;
  display: inline-block;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  padding: 9px 16px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: none;
}

.btn:hover {
  background: var(--bg-dark);
  color: var(--fg-inv);
}

.btn-primary { background: var(--bg-dark); color: var(--fg-inv); }
.btn-primary:hover { background: var(--fg); color: var(--bg-dark); }

.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--fg-inv); }

.btn-success { color: var(--green); border-color: var(--green); }
.btn-success:hover { background: var(--green); color: var(--fg-inv); }

.btn-sm { font-size: 11px; padding: 6px 12px; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Cards / Sections ──────────────────────────────────────────── */
.section {
  background: #fff;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-alt);
}

.section-icon {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-icon svg { width: 14px; height: 14px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Data Tiles ────────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  gap: 12px;
}

.tile-grid-2 { grid-template-columns: repeat(2, 1fr); }
.tile-grid-3 { grid-template-columns: repeat(3, 1fr); }
.tile-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .tile-grid-2, .tile-grid-3, .tile-grid-4 { grid-template-columns: 1fr; }
}

.tile {
  background: var(--bg-alt);
  border: 1px solid #D5D0C8;
  padding: 12px 14px;
  position: relative;
}

.tile-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--muted, #888);
  cursor: pointer;
  padding: 3px;
  opacity: 0;
  transition: opacity 0.15s ease;
  line-height: 0;
}
.tile:hover .tile-copy-btn { opacity: 0.75; }
.tile-copy-btn:hover { opacity: 1 !important; color: var(--fg, #000); }

.tile:hover { border-color: var(--border); }

.tile-label {
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.tile-value {
  font-size: 13px;
  color: var(--fg);
  word-break: break-all;
}

.tile-value-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.tile-copy {
  cursor: pointer;
  color: var(--muted);
  opacity: 0.4;
  transition: none;
}

.tile-copy:hover { opacity: 1; color: var(--fg); }

/* ── Code Panels ───────────────────────────────────────────────── */
.code-panel {
  background: var(--bg-alt);
  border: 1px solid #D5D0C8;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.code-panel::-webkit-scrollbar { width: 6px; }
.code-panel::-webkit-scrollbar-track { background: var(--bg-alt); }
.code-panel::-webkit-scrollbar-thumb { background: #C5C0B8; }

/* ── Brand Pills ───────────────────────────────────────────────── */
.brand-pill {
  display: inline-block;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  padding: 3px 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}

/* ── Tables ────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--border);
}

.data-table th {
  background: var(--bg-dark);
  color: var(--fg-inv);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 14px;
  text-align: left;
  border-right: 1px solid #333;
}

.data-table th:last-child { border-right: none; }

.data-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-top: 1px solid #D5D0C8;
  border-right: 1px solid #E5E0D8;
}

.data-table td:last-child { border-right: none; }

.data-table tbody tr:nth-child(even) { background: var(--bg-alt); }
.data-table tbody tr:hover { background: #E8E4DC; }

/* ── Stats Grid ────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: #fff;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.stat-label {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-top: 8px;
}

.stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Chart (minimal SVG) ───────────────────────────────────────── */
.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding: 10px 0;
  border-bottom: 2px solid var(--border);
}

.chart-bar {
  flex: 1;
  background: var(--bg-dark);
  min-height: 2px;
  position: relative;
  transition: none;
}

.chart-bar:hover { background: var(--fg); }

.chart-bar-label {
  position: absolute;
  bottom: -22px;
  left: 0; right: 0;
  text-align: center;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
}

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 70px; right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlide 0.2s ease-out;
}

.toast-error { border-color: var(--red); color: var(--red); }
.toast-success { border-color: var(--green); color: var(--green); }

@keyframes toastSlide {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Loading ───────────────────────────────────────────────────── */
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--bg-alt);
  border-top-color: var(--fg);
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Notification Center ────────────────────────────────────────── */
.noti-wrap { position: relative; }

.noti-btn {
  position: relative;
  width: 40px; height: 40px;
  border: 2px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.noti-btn:hover { background: var(--bg-alt); }
.noti-btn svg { width: 18px; height: 18px; stroke: var(--fg); }

.noti-badge {
  position: absolute; top: -9px; right: -9px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--red); color: #fff;
  border: 2px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700; line-height: 14px;
  display: flex; align-items: center; justify-content: center;
}
.noti-badge.hidden { display: none; }

.noti-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 360px; max-height: 480px; overflow-y: auto;
  background: var(--bg);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 300;
  display: none;
}
.noti-panel.open { display: block; }

.noti-panel-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}
.noti-panel-title { font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.noti-panel-actions { display: flex; gap: 10px; }
.noti-link-btn {
  background: none; border: none; padding: 0;
  font: inherit; font-size: 11px;
  color: var(--blue); cursor: pointer; text-decoration: underline;
}
.noti-link-btn:hover { color: var(--fg); }

.noti-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.noti-item:hover { background: var(--bg-alt); }
.noti-item.unread { background: var(--green-bg); }
.noti-item.unread:hover { background: #DDF0E5; }

.noti-ico {
  flex: none; width: 28px; height: 28px;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.noti-ico svg { width: 14px; height: 14px; stroke: var(--green); }

.noti-body { flex: 1; min-width: 0; }
.noti-title { font-size: 12.5px; font-weight: 600; }
.noti-text { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.noti-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--muted); margin-top: 4px;
  text-transform: uppercase; letter-spacing: .04em;
}
.noti-empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 12px; }

/* New-capture toast: slides in right-to-left, brutalist card */
.noti-toast-wrap {
  position: fixed; top: 16px; right: 16px;
  z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
  width: 340px;
}
.noti-toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  cursor: pointer;
  animation: notiSlideIn .38s cubic-bezier(.21, 1, .5, 1);
}
.noti-toast.leaving { animation: notiSlideOut .25s ease-in forwards; }
.noti-toast .noti-ico { width: 30px; height: 30px; }
.noti-toast .noti-ico svg { width: 16px; height: 16px; }
.noti-toast-title { font-size: 12.5px; font-weight: 700; }
.noti-toast-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; margin-top: 2px; word-break: break-all;
}
.noti-toast-time { font-size: 10px; color: var(--muted); margin-top: 4px; }
.noti-toast-close {
  flex: none;
  background: none; border: none; padding: 0 2px;
  color: var(--muted); font-size: 16px; line-height: 1;
  cursor: pointer;
}
.noti-toast-close:hover { color: var(--red); }

@keyframes notiSlideIn {
  from { transform: translateX(calc(100% + 24px)); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes notiSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(calc(100% + 24px)); opacity: 0; }
}

/* ── Confirm Modal ─────────────────────────────────────────────── */
#confirmModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}
#confirmModal > div:first-child {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
#confirmModal .modal-box {
  background: var(--bg);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 420px;
  width: 90%;
}
#confirmModal h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
}
#confirmModal p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
}
#confirmModal .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Utility ────────────────────────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.copy-btn { cursor: pointer; color: var(--muted); opacity: 0.4; }
.copy-btn:hover { opacity: 1; color: var(--fg); }

/* ── Mobile ────────────────────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--bg-dark);
  color: var(--fg-inv);
  padding: 12px 16px;
  z-index: 50;
  align-items: center;
  justify-content: space-between;
}

.mobile-header-brand { font-weight: 700; font-size: 14px; }

@media (max-width: 1024px) {
  .sidebar { display: none; }
  .mobile-header { display: flex; }
  .main { margin-left: 0; padding-top: 60px; }
}