/* anton x — shared design system */
:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --surface-hover: #1a1a1a;
  --border: #1f1f1f;
  --border-strong: #2a2a2a;
  --text: #f5f5f5;
  --text-muted: #8a8a8a;
  --text-dim: #5a5a5a;
  --accent: #FACC15;
  --accent-hover: #fbd84a;
  --accent-soft: rgba(250, 204, 21, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --info-soft: rgba(120, 120, 120, 0.14);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== Layout ===== */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 22px 24px 28px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.brand .x {
  color: var(--accent);
  margin-left: 4px;
}

.nav {
  /* display + list-style explicitly reset so Bootstrap's .nav (display: flex; flex-wrap: wrap; list-style: none) cannot turn the sidebar into a wrapping horizontal row. */
  display: block;
  list-style: none;
  padding: 4px 12px;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}
.nav::-webkit-scrollbar { width: 0; }

.nav-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 18px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.active::before {
  content: '';
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  margin-right: -3px;
  margin-left: -12px;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }

.user-card {
  margin: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-card .name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-card .role { font-size: 11px; color: var(--text-dim); }

/* ===== Main / topbar ===== */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  z-index: 10;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); transition: color 0.15s; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .current { color: var(--text); font-weight: 500; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  transition: all 0.15s ease; white-space: nowrap;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn svg { width: 14px; height: 14px; }
.btn-ghost { color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); color: #1a1400; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); color: #1a1400; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-danger { background: var(--danger-soft); color: #fca5a5; border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); color: #fca5a5; }
.btn-block { width: 100%; }
.btn-lg { padding: 11px 16px; font-size: 13.5px; }

/* Back button — added to every page per requirement */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all 0.15s ease;
  text-decoration: none;
}
.back-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); transform: translateX(-1px); }
.back-btn svg { width: 13px; height: 13px; }

/* ===== Pills ===== */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
}
.pill.priority { background: var(--danger-soft); color: #fca5a5; border-color: rgba(239,68,68,0.25); }
.pill.priority .dot { background: #ef4444; }
.pill.status { background: var(--accent-soft); color: var(--accent); border-color: rgba(250,204,21,0.25); }
.pill.status .dot { background: var(--accent); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ===== Inputs ===== */
.input, .select, textarea.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all 0.15s;
  font-family: inherit;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); background: var(--bg); }
.input::placeholder, textarea.input::placeholder { color: var(--text-dim); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.select option { background: #1a1a1a; color: var(--text); }
textarea.input { resize: vertical; min-height: 64px; }

/* ===== Card chrome ===== */
.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.rail-card-head {
  padding: 14px 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.rail-card-title {
  font-size: 11px; font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.rail-card-body { padding: 4px 16px 16px; }

.section-title {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  text-transform: uppercase; letter-spacing: 0.08em;
  display: flex; align-items: center; gap: 8px;
}
.section-title .count {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.section-action {
  font-size: 12px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px;
  transition: all 0.15s;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
}
.section-action:hover { color: var(--text); background: var(--surface-2); }
.section-action svg { width: 12px; height: 12px; }

.helper-text { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.4; }

/* ===== Save flash ===== */
.save-flash { transition: transform 0.1s; }
.save-flash:active { transform: scale(0.97); }

/* ===== Flash messages ===== */
.flash {
  margin: 16px 32px 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid;
  display: flex; align-items: center; gap: 10px;
}
.flash svg { width: 16px; height: 16px; flex-shrink: 0; }
.flash-success { background: var(--success-soft); color: #86efac; border-color: rgba(34,197,94,0.25); }
.flash-error { background: var(--danger-soft); color: #fca5a5; border-color: rgba(239,68,68,0.25); }

/* ===== Tables shared ===== */
table { font-family: inherit; }

/* ===== Form helpers ===== */
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label, .field-label {
  font-size: 11.5px; color: var(--text-muted);
  font-weight: 500;
}
.form-grid { display: grid; gap: 14px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 768px) { .form-grid.cols-2 { grid-template-columns: 1fr; } }
