/* ============================================================
   Bug Tracker SPA — dark, flat, refined (fără gradiente)
   ============================================================ */
:root {
  --bg: #0d0f14;
  --bg-alt: #08090d;
  --panel: #14171e;
  --panel-2: #1b1f28;
  --panel-3: #232936;
  --border: #2b313d;
  --border-muted: #1f242e;
  --text: #e9ecf1;
  --text-muted: #9aa3b2;
  --text-dim: #6b7383;

  --blue: #5d8eff;
  --blue-strong: #3f6ee0;
  --blue-hover: #78a1ff;
  --green: #41c463;
  --orange: #e0a63a;
  --red: #ef5b52;
  --brand: #e0392e;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 16px -8px rgba(0, 0, 0, .4);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 48px -16px rgba(0, 0, 0, .55);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --ring: 0 0 0 3px rgba(93, 142, 255, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

::selection { background: rgba(93, 142, 255, 0.32); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

code, pre { font-family: var(--mono); font-size: .85em; }
pre {
  background: var(--bg-alt); border: 1px solid var(--border-muted);
  border-radius: var(--radius); padding: .8rem .9rem;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

/* ---- Boot splash ---- */
.boot {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  gap: .7rem; color: var(--text-muted);
}
.boot-dot {
  width: 18px; height: 18px; border-radius: 6px; background: var(--brand);
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse { 50% { transform: scale(.8); opacity: .6; } }

/* ---- Layout shell ---- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--bg-alt);
  border-right: 1px solid var(--border-muted);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.2rem 1.3rem; font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.01em; border-bottom: 1px solid var(--border-muted);
  color: var(--text);
}
.brand-dot {
  width: 22px; height: 22px; border-radius: 7px; background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .92); font-size: .7rem;
  flex-shrink: 0;
}
.sidebar-nav { padding: .8rem; flex: 1; overflow-y: auto; }
.nav-section {
  text-transform: uppercase;
  font-size: .64rem;
  letter-spacing: .1em;
  font-weight: 600;
  color: var(--text-dim);
  padding: 1.1rem .7rem .4rem;
}
.nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .7rem; border-radius: var(--radius);
  color: var(--text-muted); font-weight: 500; margin-bottom: 2px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-link.active {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: inset 2.5px 0 0 var(--blue);
}
.nav-link .icon { width: 20px; text-align: center; opacity: .85; font-size: .9rem; }
.nav-link.active .icon { opacity: 1; color: var(--blue); }
.nav-badge {
  margin-left: auto; background: var(--blue); color: #fff;
  font-size: .68rem; font-weight: 600; border-radius: 9px;
  padding: .05rem .42rem; min-width: 18px; text-align: center;
}
.sidebar-footer {
  border-top: 1px solid var(--border-muted); padding: .8rem;
}
.user-chip { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.user-chip .who { min-width: 0; }
.user-chip .who .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; border-bottom: 1px solid var(--border-muted);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.75rem; gap: 1rem;
  background: rgba(13, 15, 20, .85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.topbar .search { flex: 1; max-width: 440px; }
.topbar .search input { background: var(--panel); border-color: transparent; }
.topbar .search input:hover { border-color: var(--border-muted); }
.topbar .search input:focus { background: var(--bg-alt); border-color: var(--blue); }
.content {
  padding: 2rem 2.25rem 3rem; max-width: 1280px; width: 100%; margin: 0 auto;
  animation: rise .3s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.subtitle { color: var(--text-muted); font-size: .85rem; }

/* ---- Avatars ---- */
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 600; color: var(--text); flex-shrink: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: .62rem; }

/* ---- Panels ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel-head { padding: .9rem 1.2rem; border-bottom: 1px solid var(--border-muted); display: flex; align-items: center; justify-content: space-between; }
.panel-head h3 {
  margin: 0; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .09em; font-weight: 600; color: var(--text-muted);
}
.panel-body { padding: 1.1rem 1.2rem; }
.panel + .panel { margin-top: 1.25rem; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-main { grid-template-columns: 2fr 1fr; }

/* ---- Stat cards ---- */
.stat {
  background: var(--panel);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.35rem;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color .15s ease;
}
.stat:hover { border-color: var(--border); }
.stat::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.stat.blue::before { background: var(--blue); }
.stat.orange::before { background: var(--orange); }
.stat.green::before { background: var(--green); }
.stat.red::before { background: var(--red); }
.stat .label { color: var(--text-muted); font-size: .74rem; font-weight: 500; text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; gap: .45rem; }
.stat .value { font-size: 2.3rem; font-weight: 700; letter-spacing: -0.03em; margin-top: .35rem; font-variant-numeric: tabular-nums; }
.stat.blue .value { color: var(--blue); }
.stat.orange .value { color: var(--orange); }
.stat.green .value { color: var(--green); }
.stat.red .value { color: var(--red); }

/* ---- Buttons (flat, fără gradiente) ---- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: .5rem .9rem; border-radius: var(--radius);
  font-size: .85rem; font-weight: 500; line-height: 1.4;
  font-family: var(--font);
  cursor: pointer; text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--panel-3); border-color: #3a414f; text-decoration: none; }
.btn:active { background: var(--panel-2); }
.btn-primary {
  background: var(--blue-strong);
  border-color: var(--blue-strong);
  color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--blue); border-color: var(--blue); }
.btn-danger { background: transparent; border-color: var(--border); color: #f0968f; }
.btn-danger:hover { background: rgba(239, 91, 82, .12); border-color: rgba(239, 91, 82, .55); color: #f6ada8; }
.btn-sm { padding: .28rem .6rem; font-size: .78rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--panel-2); border-color: transparent; color: var(--text); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: inline-flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.1rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 180px; }
label { display: block; font-size: .82rem; font-weight: 500; margin-bottom: .4rem; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .52rem .7rem;
  font-size: .85rem; font-family: var(--font); line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:hover, select:hover, textarea:hover { border-color: #343b48; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 90px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%239aa3b2'%3E%3Cpath d='M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .55rem center;
  padding-right: 1.9rem;
}
input[type="checkbox"] { accent-color: var(--blue); width: auto; }
input[type="color"] {
  width: 100%; height: 36px; padding: .2rem;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
}
.checkbox { display: inline-flex; align-items: center; gap: .5rem; font-weight: 400; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border-muted); }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600;
  padding: .18rem .62rem; border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.blue { color: #8db7ff; border-color: rgba(93, 142, 255, .38); background: rgba(93, 142, 255, .1); }
.badge.green { color: #6fdb87; border-color: rgba(65, 196, 99, .38); background: rgba(65, 196, 99, .1); }
.badge.orange { color: #eabc5f; border-color: rgba(224, 166, 58, .38); background: rgba(224, 166, 58, .1); }
.badge.red { color: #f4938c; border-color: rgba(239, 91, 82, .38); background: rgba(239, 91, 82, .1); }
.badge.gray { color: var(--text-muted); }
.badge.plain::before { display: none; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border-muted); vertical-align: middle; }
.table th { color: var(--text-dim); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover td { background: rgba(93, 142, 255, .04); }
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---- Permission grid (admin roles) ---- */
.perm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .35rem .9rem; margin: .6rem 0 1rem;
}
.color-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; vertical-align: -1px; }

/* ---- Bug rows ---- */
.bug-row {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border-muted);
  border-left: 2px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.bug-row:hover { background: rgba(93, 142, 255, .045); border-left-color: var(--blue); }
.bug-row:last-child { border-bottom: none; }
.bug-row .title { font-weight: 600; color: var(--text); }
.bug-row .title:hover { color: var(--blue); }
.bug-row .id { color: var(--text-dim); font-family: var(--mono); font-size: .78rem; }
.bug-row .info { flex: 1; min-width: 0; }
.bug-row .sub { color: var(--text-muted); font-size: .78rem; margin-top: .2rem; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

/* ---- Filters ---- */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.25rem; }
.filters .form-group { margin: 0; }
.filters select, .filters input { min-width: 130px; }

/* ---- Detail meta ---- */
.meta-grid { display: grid; grid-template-columns: 130px 1fr; gap: .55rem 1rem; }
.meta-grid dt { color: var(--text-muted); font-size: .82rem; }
.meta-grid dd { margin: 0; }

/* ---- Comments ---- */
.comment { display: flex; gap: .75rem; padding: 1rem 0; border-bottom: 1px solid var(--border-muted); }
.comment:last-child { border-bottom: none; }
.comment .body {
  background: var(--bg-alt); border: 1px solid var(--border-muted);
  border-radius: var(--radius); padding: .75rem .95rem; flex: 1; min-width: 0;
  transition: border-color .15s ease;
}
.comment:hover .body { border-color: var(--border); }
.comment .head { display: flex; justify-content: space-between; margin-bottom: .35rem; gap: .5rem; flex-wrap: wrap; }
.comment .author { font-weight: 600; }
.mention { color: var(--blue); font-weight: 600; background: rgba(93, 142, 255, .12); border-radius: 4px; padding: 0 .25rem; }

/* ---- Timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .7rem; padding: .55rem 0; font-size: .85rem; }
.timeline .tl-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--blue);
  margin-top: .45rem; flex-shrink: 0;
}
.timeline .tl-time { color: var(--text-dim); font-size: .75rem; margin-left: auto; white-space: nowrap; }

/* ---- Attachments ---- */
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.attach {
  border: 1px solid var(--border-muted); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-alt); display: block;
  transition: border-color .15s ease;
}
.attach:hover { border-color: var(--border); text-decoration: none; }
.attach img { width: 100%; height: 90px; object-fit: cover; display: block; }
.attach .file-ico { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--text-muted); }
.attach .cap { padding: .45rem .55rem; font-size: .72rem; color: var(--text-muted); }
.attach .cap .name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }

/* ---- Task board ---- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }
.board-col {
  background: var(--panel);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.board-col-head { padding: .8rem 1rem; border-bottom: 1px solid var(--border-muted); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.board-col-body { padding: .75rem; display: flex; flex-direction: column; gap: .6rem; min-height: 60px; }
.task-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius);
  padding: .75rem .85rem;
  transition: border-color .15s ease;
}
.task-card:hover { border-color: var(--border); }
.task-card.pinned { border-color: rgba(224, 166, 58, .5); }
.task-card .t-head { display: flex; justify-content: space-between; gap: .5rem; }
.task-card .t-title { font-weight: 600; }
.task-card .t-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; align-items: center; }
.task-card .t-actions { display: flex; gap: .3rem; margin-top: .6rem; flex-wrap: wrap; }
.label-chip { font-size: .68rem; background: var(--panel-2); border: 1px solid var(--border-muted); border-radius: 5px; padding: .08rem .45rem; color: var(--text-muted); }
.pin-star { color: var(--orange); }

/* ---- Notifications ---- */
.notif {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border-muted);
}
.notif:last-child { border-bottom: none; }
.notif.unread { background: rgba(93, 142, 255, .05); }
.notif .n-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .5rem; flex-shrink: 0; background: var(--border); }
.notif.unread .n-dot { background: var(--blue); }
.notif .n-body { flex: 1; min-width: 0; }
.notif .n-time { color: var(--text-dim); font-size: .75rem; }

/* ---- Toasts ---- */
.toast-stack {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200;
  display: flex; flex-direction: column; gap: .5rem; max-width: 360px;
}
.toast {
  padding: .7rem .95rem; border-radius: var(--radius);
  border: 1px solid var(--border); font-size: .85rem;
  background: var(--panel-2); color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: rise .25s ease both;
}
.toast.success { background: rgba(65, 196, 99, .12); border-color: rgba(65, 196, 99, .4); color: #7ee787; }
.toast.error { background: rgba(239, 91, 82, .12); border-color: rgba(239, 91, 82, .4); color: #f6ada8; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1.5rem; align-items: center; }

/* ---- Auth ---- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}
.auth-card { width: 100%; max-width: 388px; animation: rise .35s ease both; }
.auth-card .panel { box-shadow: var(--shadow-lg); }
.auth-card .brand {
  display: flex; align-items: center; justify-content: center; gap: .65rem;
  font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}
.auth-card .brand .brand-dot { width: 26px; height: 26px; border-radius: 8px; font-size: .8rem; }

/* ---- Utilities ---- */
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: .8rem; }
.mono { font-family: var(--mono); }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none; }
.empty { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; }
.empty .big { font-size: 1.8rem; margin-bottom: .6rem; opacity: .45; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }

.skeleton {
  border-radius: var(--radius);
  background: var(--panel);
  position: relative; overflow: hidden;
  min-height: 80px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .04), transparent);
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---- Responsive ---- */
.menu-toggle { display: none; }
@media (max-width: 960px) {
  .grid-main, .grid-4 { grid-template-columns: 1fr 1fr; }
  .board { grid-template-columns: 1fr; }
  .content { padding: 1.5rem; }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .grid-2, .grid-4, .grid-main { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
  .content { padding: 1.25rem 1rem 2rem; }
}
