:root{
  /* GitHub Dark-like palette */
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --bg-start: #0d1117;
  --bg-end:   #0d1117;
  --surface: #0d1117;   /* canvas default */
  --surface-2: #161b22; /* elevated */
  --border: #30363d;
  /* default primary; can be overridden per-user by --accent */
  --accent: #2f81f7; /* user-chosen accent (hex) */
  --primary-400: var(--accent);
  --primary-500: #2d7bf2;
  --primary-600: #2466c2;
  --success: #3fb950;
  --danger: #f85149;
  --attention: #d29922;
}

*{ box-sizing: border-box; }

/* Normalize native controls so buttons look like links styled with .btn */
button, input, select, textarea{ font: inherit; color: inherit; }
/* Make native form controls (checkbox, radio, range) use the accent color */
input[type="checkbox"], input[type="radio"], input[type="range"]{ accent-color: var(--primary-400); }
/* Keep the Private profile checkbox using the default system color */
input.checkbox-private{ accent-color: auto; }

/* Ensure all UI uses a single font */
body, input, button, select, textarea { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; }

html, body{
  height: 100vh;
}

body{
  margin: 0;
  padding: 0;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
}

h1,h2,h3,h4,h5,h6,p{ margin: 0; padding: 0; }

.muted{ color: var(--text-muted); }
.code{ font: inherit; }

.container{ max-width: 960px; margin: 24px auto 80px; padding: 0 16px; }

/* Prevent fixed footer from overlapping the Save button on the profile edit form */
.profile-edit{ padding-bottom: 120px; }

/* Larger bio box for profile editing */
#bio-input{ min-height: 220px; }

a{ color: var(--primary-400); text-decoration: none; }
a:hover{ text-decoration: underline; }

/* --- Buttons (site-wide) --- */
.btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .22s ease, border-color .22s ease, color .22s ease, box-shadow .22s ease;
  box-shadow: inset 0px 0px 5px black;
}
.btn:hover{ background: #111a2b; text-decoration: none; }
.btn:focus-visible{ outline: 2px solid var(--primary-400); outline-offset: 2px; }
.btn:active{ transform: translateY(0); }
.btn[disabled], .btn:disabled{ opacity: .6; cursor: not-allowed; pointer-events: none; }

/* Variants */
.btn-outline{ color: var(--text); border-color: var(--border); background: transparent; }
.btn-outline:hover{ background: #111a2b; border-color: var(--primary-400); }

.btn-solid{ color: #fff; background: var(--primary-400); border-color: transparent; }
.btn-solid:hover{ background: var(--primary-500); }
.btn-solid:active{ background: var(--primary-600); }

.btn-ghost{ color: var(--text); background: transparent; border-color: transparent; }
.btn-ghost:hover{ background: #111a2b; }

/* Icon button (used in nav and overlays) */
.btn-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: inset 0px 0px 5px black;
}
.btn-icon:hover{ background: #111a2b; border-color: var(--primary-400); }

/* Elements inside buttons */
.btn .avatar{ background: transparent; border-color: transparent; }
.btn svg{ vertical-align: middle; }

/* --- Simple user search styles --- */
.search-form{ display:flex; gap:8px; align-items:center; margin-top: 8px; }
.search-form input[type="text"]{ flex:1; padding:8px 10px; border:1px solid var(--border); border-radius:8px; background: var(--surface); color: var(--text); }
.user-list{ list-style:none; margin:10px 0 0; padding:0; display:grid; gap:8px; }
.user-item .user-card{ display:flex; align-items:center; gap:10px; padding:10px; border:1px solid var(--border); border-radius:8px; background: var(--surface); }
.user-item .avatar{ width:28px; height:28px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background: var(--surface-2); border:1px solid var(--border); font-size:13px; }
.user-item .uname{ font-weight:600; }
.user-item .joined{ margin-left:auto; color: var(--text-muted); font-size: 12px; }

/* --- Home page --- */
.home .hero{ display:flex; gap:16px; align-items:center; border:1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 16px; }
.hero-icon{ width:64px; height:64px; border-radius: 12px; border:1px solid var(--border); background: var(--surface); }
.hero-title{ font-size: 28px; font-weight: 800; }
.hero-subtitle{ margin-top: 4px; }
.hero-actions{ margin-top: 10px; display:flex; gap:8px; flex-wrap: wrap; }

.home-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.home-card{ border:1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow: hidden; display: flex; flex-direction: column; }
.home-card-title{ padding: 10px 12px; border-bottom:1px solid var(--border); color: var(--text-muted); font-weight: 600; }
.home-card-body{ padding: 12px; }
.home-actions{ display:flex; gap:8px; flex-wrap: wrap; }

/* Home posts: ensure letter avatars match image size (32x32) */
.home .user-card .avatar{
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
}

.status-dot{ width: 10px; height:10px; border-radius:50%; display:inline-block; margin-right:8px; border:1px solid var(--border); background: var(--border); }
.status-dot.online{ background: var(--success); }
.status-dot.offline{ background: var(--danger); }
.mc-inline{ display:flex; align-items:center; gap:8px; }
.mc-addr-row{ display:flex; gap:8px; align-items:center; margin-top:10px; }

/* --- Tables --- */
.table-responsive{
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px; /* allow horizontal scroll on small screens */
}

.table thead th{
  position: sticky;
  top: 0;
  background: var(--surface);
  color: var(--text-muted);
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.2px;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}

.table th:first-child{ border-top-left-radius: 10px; }
.table th:last-child{ border-top-right-radius: 10px; }

.table tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.table tbody tr:last-child td{ border-bottom: 0; }

.table tbody tr:nth-child(odd){ background: #111723; }
.table tbody tr:nth-child(even){ background: var(--surface-2); }
.table tbody tr:hover{ background: #0b1220; }

.table a{ color: var(--primary-400); text-decoration: none; }
.table a:hover{ text-decoration: underline; }

@media (max-width: 720px){
  .table thead th, .table tbody td{ padding: 8px 10px; }
}

/* --- Accent palette (profile edit) --- */
.accent-palette{ display:flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.accent-swatch{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 5px black;
  cursor: pointer;
}
.accent-swatch input[type="radio"]{
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.accent-swatch .check{ display: none; }
.accent-swatch input[type="radio"]:checked + .check{ display: block; }
.accent-swatch::before{
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  box-shadow: 0 0 0 0px rgba(255,255,255,0);
  transition: box-shadow .2s ease;
}
.accent-swatch:hover::before{ box-shadow: 0 0 0 2px rgba(255,255,255,0.08) inset; }

/* Set background from data-color attr */
.accent-swatch[data-color] { background: var(--surface-2); }
.accent-swatch[data-color="#2563eb"]{ background: #2563eb; }
.accent-swatch[data-color="#0284c7"]{ background: #0284c7; }
.accent-swatch[data-color="#16a34a"]{ background: #16a34a; }
.accent-swatch[data-color="#059669"]{ background: #059669; }
.accent-swatch[data-color="#7c3aed"]{ background: #7c3aed; }
.accent-swatch[data-color="#db2777"]{ background: #db2777; }
.accent-swatch[data-color="#ea580c"]{ background: #ea580c; }
.accent-swatch[data-color="#d97706"]{ background: #d97706; }
.accent-swatch[data-color="#e11d48"]{ background: #e11d48; }
.accent-swatch[data-color="#0891b2"]{ background: #0891b2; }
