/* ═══════════════════════════════════════════════════
   BUGVAULT — STYLE SYSTEM
   Architecture: CSS Custom Properties + BEM-ish naming
   Theme: Dark Industrial / Terminal Aesthetic
   ═══════════════════════════════════════════════════ */

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

:root {
  /* ── SURFACE SCALE ── */
  --s0: #080b0f;
  --s1: #0d1117;
  --s2: #111820;
  --s3: #16202c;
  --s4: #1c2a38;
  --s5: #243040;

  /* ── ACCENT ── */
  --accent: #00e5ff;
  --accent-dim: rgba(0,229,255,.15);
  --accent-hover: #33eaff;

  /* ── PRIORITY COLORS ── */
  --crit: #ff3c5a;
  --high: #ff8c00;
  --med:  #ffd600;
  --low:  #00e096;

  /* ── STATUS COLORS ── */
  --open:      #4fc3f7;
  --progress:  #ff8c00;
  --review:    #ce93d8;
  --closed:    #69f0ae;

  /* ── TYPOGRAPHY ── */
  --ff-mono: 'JetBrains Mono', monospace;
  --ff-display: 'Syne', sans-serif;

  /* ── SPACING ── */
  --radius: 6px;
  --radius-lg: 10px;

  /* ── TRANSITIONS ── */
  --tx: 180ms cubic-bezier(.4,0,.2,1);
}

html, body {
  height: 100%;
  background: var(--s0);
  color: #c9d8e8;
  font-family: var(--ff-mono);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ══ SCROLLBAR ══ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--s1); }
::-webkit-scrollbar-thumb { background: var(--s5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ══ LAYOUT ══ */
body {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}

/* ══ SIDEBAR ══ */
.sidebar {
  background: var(--s1);
  border-right: 1px solid var(--s4);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform var(--tx);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--s4);
}

.brand__icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.brand__name {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  letter-spacing: -.3px;
}

.brand__version {
  font-size: 9px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0,229,255,.3);
  padding: 1px 6px;
  border-radius: 20px;
  margin-left: auto;
}

.sidebar__nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: #6b7e94;
  font-family: var(--ff-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--tx);
  text-align: left;
  width: 100%;
}

.nav__item:hover {
  background: var(--s3);
  color: #a8c0d6;
}

.nav__item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0,229,255,.2);
}

.nav__icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.sidebar__footer {
  padding: 14px 18px;
  border-top: 1px solid var(--s4);
}

.sys__status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #4b6070;
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--low);
  box-shadow: 0 0 6px var(--low);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}

.session__token {
  margin-top: 6px;
  font-size: 9px;
  color: var(--s5);
  word-break: break-all;
  line-height: 1.4;
}

/* ══ MAIN ══ */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--s0);
  overflow: hidden;
}

/* ══ TOPBAR ══ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  border-bottom: 1px solid var(--s3);
  background: var(--s1);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.topbar__left, .topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: #6b7e94;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.breadcrumb {
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 600;
  color: #5a7284;
  letter-spacing: .3px;
}

.search__wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search__icon {
  position: absolute;
  left: 10px;
  color: #4b6070;
  font-size: 16px;
  pointer-events: none;
}

.search__input {
  background: var(--s2);
  border: 1px solid var(--s4);
  border-radius: var(--radius);
  color: #a8c0d6;
  font-family: var(--ff-mono);
  font-size: 12px;
  padding: 7px 12px 7px 32px;
  width: 220px;
  transition: all var(--tx);
  outline: none;
}

.search__input:focus {
  border-color: rgba(0,229,255,.4);
  background: var(--s3);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(0,229,255,.06);
}

.search__input::placeholder { color: #3d5060; }

.user__avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(0,229,255,.3);
  color: var(--accent);
  font-family: var(--ff-display);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  user-select: none;
}

/* ══ BUTTONS ══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tx);
  white-space: nowrap;
  outline: none;
}

.btn--primary {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,229,255,.25);
}

.btn--ghost {
  background: transparent;
  color: #6b7e94;
  border: 1px solid var(--s5);
}

.btn--ghost:hover { background: var(--s3); color: #a8c0d6; }

.btn--danger {
  background: var(--crit);
  color: #fff;
}

.btn--danger:hover { background: #ff6680; }

/* ══ VIEWS ══ */
.view {
  padding: 28px;
  flex: 1;
  animation: viewIn .22s ease;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

.view__heading { margin-bottom: 28px; }

.view__heading h1 {
  font-family: var(--ff-display);
  font-size: 26px;
  font-weight: 800;
  color: #e0eaf4;
  letter-spacing: -.5px;
}

.view__sub {
  margin-top: 4px;
  color: #4b6070;
  font-size: 11px;
}

/* ══ DASHBOARD ══ */
.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat__card {
  background: var(--s2);
  border: 1px solid var(--s4);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  transition: all var(--tx);
  cursor: default;
}

.stat__card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat--open::before   { background: var(--open); }
.stat--progress::before { background: var(--progress); }
.stat--review::before { background: var(--review); }
.stat--closed::before { background: var(--closed); }

.stat__card:hover {
  transform: translateY(-2px);
  border-color: var(--s5);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.stat__icon {
  font-size: 18px;
  margin-bottom: 10px;
  opacity: .5;
}

.stat--open .stat__icon   { color: var(--open); }
.stat--progress .stat__icon { color: var(--progress); }
.stat--review .stat__icon { color: var(--review); }
.stat--closed .stat__icon { color: var(--closed); }

.stat__value {
  font-family: var(--ff-display);
  font-size: 34px;
  font-weight: 800;
  color: #e0eaf4;
  line-height: 1;
  margin-bottom: 6px;
}

.stat__label {
  font-size: 10px;
  color: #4b6070;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.dashboard__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.dash__panel {
  background: var(--s2);
  border: 1px solid var(--s4);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.recent__panel {
  margin-bottom: 0;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-family: var(--ff-display);
  font-size: 12px;
  font-weight: 600;
  color: #7a92a8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.panel__badge {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.panel__link {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--ff-mono);
  font-size: 11px;
  cursor: pointer;
  transition: color var(--tx);
}

.panel__link:hover { color: var(--accent-hover); }

/* ── Priority Bars ── */
.priority__bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pbar__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pbar__label {
  font-size: 11px;
  color: #5a7284;
  width: 60px;
  text-transform: capitalize;
}

.pbar__track {
  flex: 1;
  height: 6px;
  background: var(--s4);
  border-radius: 3px;
  overflow: hidden;
}

.pbar__fill {
  height: 100%;
  border-radius: 3px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.pbar--critical .pbar__fill { background: var(--crit); }
.pbar--high     .pbar__fill { background: var(--high); }
.pbar--medium   .pbar__fill { background: var(--med); }
.pbar--low      .pbar__fill { background: var(--low); }

.pbar__count {
  font-size: 11px;
  color: #3d5060;
  width: 24px;
  text-align: right;
}

/* ── Activity Feed ── */
.activity__feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.activity__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 11px;
  color: #5a7284;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--s3);
}

.activity__item:last-child { border-bottom: none; padding-bottom: 0; }

.activity__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity__text { line-height: 1.5; }
.activity__text strong { color: #8aabc0; font-weight: 500; }
.activity__time { margin-left: auto; font-size: 10px; white-space: nowrap; color: #3d5060; }

/* ── Recent List ── */
.recent__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--s3);
  transition: background var(--tx);
  cursor: pointer;
}

.recent__row:hover { background: var(--s4); }

.recent__id {
  font-size: 10px;
  color: var(--accent);
  font-weight: 500;
  width: 56px;
  flex-shrink: 0;
}

.recent__title {
  flex: 1;
  font-size: 12px;
  color: #a8c0d6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ══ BUGS TABLE ══ */
.filter__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter__group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter__group label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #3d5060;
}

.filter__select {
  background: var(--s2);
  border: 1px solid var(--s4);
  border-radius: var(--radius);
  color: #7a92a8;
  font-family: var(--ff-mono);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--tx);
}

.filter__select:focus { border-color: rgba(0,229,255,.4); }

.filter__count {
  margin-left: auto;
  font-size: 11px;
  color: #3d5060;
}

.bugs__table {
  background: var(--s2);
  border: 1px solid var(--s4);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table__head {
  display: grid;
  grid-template-columns: 70px 1fr 90px 110px 120px 100px 90px;
  padding: 12px 18px;
  background: var(--s3);
  border-bottom: 1px solid var(--s4);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #3d5060;
  font-weight: 500;
}

.table__body {
  max-height: calc(100vh - 320px);
  overflow-y: auto;
}

.table__row {
  display: grid;
  grid-template-columns: 70px 1fr 90px 110px 120px 100px 90px;
  padding: 13px 18px;
  align-items: center;
  border-bottom: 1px solid var(--s3);
  transition: background var(--tx);
  cursor: pointer;
}

.table__row:hover { background: var(--s3); }
.table__row:last-child { border-bottom: none; }

.col--id {
  font-size: 10px;
  color: var(--accent);
  font-weight: 500;
}

.col--title {
  font-size: 12px;
  color: #a8c0d6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.badge--critical { background: rgba(255,60,90,.15);  color: var(--crit); border: 1px solid rgba(255,60,90,.3); }
.badge--high     { background: rgba(255,140,0,.12);  color: var(--high); border: 1px solid rgba(255,140,0,.25); }
.badge--medium   { background: rgba(255,214,0,.1);   color: var(--med);  border: 1px solid rgba(255,214,0,.2); }
.badge--low      { background: rgba(0,224,150,.1);   color: var(--low);  border: 1px solid rgba(0,224,150,.2); }

.badge--open     { background: rgba(79,195,247,.1);  color: var(--open);     border: 1px solid rgba(79,195,247,.2); }
.badge--progress { background: rgba(255,140,0,.1);   color: var(--progress); border: 1px solid rgba(255,140,0,.2); }
.badge--review   { background: rgba(206,147,216,.1); color: var(--review);   border: 1px solid rgba(206,147,216,.2); }
.badge--closed   { background: rgba(105,240,174,.1); color: var(--closed);   border: 1px solid rgba(105,240,174,.2); }

.col--assignee {
  font-size: 11px;
  color: #5a7284;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col--date {
  font-size: 10px;
  color: #3d5060;
}

.col--actions {
  display: flex;
  gap: 6px;
}

.action__btn {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid var(--s5);
  background: transparent;
  color: #4b6070;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tx);
}

.action__btn:hover { background: var(--s4); color: #a8c0d6; }
.action__btn--del:hover { background: rgba(255,60,90,.15); color: var(--crit); border-color: rgba(255,60,90,.3); }

.empty__state {
  padding: 60px 20px;
  text-align: center;
  color: #3d5060;
}

.empty__state .empty__icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty__state p { font-size: 13px; }

/* ══ MODAL ══ */
.modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--s2);
  border: 1px solid var(--s4);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  animation: slideUp .22s cubic-bezier(.4,0,.2,1);
}

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

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--s4);
}

.modal__title {
  font-family: var(--ff-display);
  font-size: 17px;
  font-weight: 700;
  color: #e0eaf4;
}

.modal__close {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 1px solid var(--s5);
  background: transparent;
  color: #5a7284;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tx);
}

.modal__close:hover { background: var(--s4); color: #a8c0d6; }

.modal__body { padding: 20px 22px; }
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--s4);
}

/* ── FORM ── */
.form__group { margin-bottom: 14px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form__label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #5a7284;
  margin-bottom: 6px;
}

.req { color: var(--crit); }

.form__input, .form__select, .form__textarea {
  width: 100%;
  background: var(--s3);
  border: 1px solid var(--s4);
  border-radius: var(--radius);
  color: #c9d8e8;
  font-family: var(--ff-mono);
  font-size: 12px;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--tx), box-shadow var(--tx);
  resize: none;
}

.form__input::placeholder, .form__textarea::placeholder { color: #3d5060; }

.form__input:focus, .form__select:focus, .form__textarea:focus {
  border-color: rgba(0,229,255,.45);
  box-shadow: 0 0 0 3px rgba(0,229,255,.07);
}

.form__input.input--error, .form__select.input--error, .form__textarea.input--error {
  border-color: rgba(255,60,90,.5);
}

.form__hint {
  font-size: 10px;
  color: var(--crit);
  margin-top: 4px;
  min-height: 14px;
}

.char__counter {
  font-size: 10px;
  color: #3d5060;
  text-align: right;
  margin-top: 4px;
}

.form__error {
  background: rgba(255,60,90,.1);
  border: 1px solid rgba(255,60,90,.3);
  border-radius: var(--radius);
  color: var(--crit);
  font-size: 11px;
  padding: 9px 12px;
  margin-top: 10px;
}

/* ══ TOAST ══ */
.toast__container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--s3);
  border: 1px solid var(--s5);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 12px;
  color: #a8c0d6;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: toastIn .22s cubic-bezier(.4,0,.2,1);
  min-width: 240px;
  max-width: 360px;
}

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

.toast--success { border-color: rgba(0,224,150,.3); }
.toast--success::before { content: '✓'; color: var(--low); font-size: 14px; }
.toast--error   { border-color: rgba(255,60,90,.3); }
.toast--error::before   { content: '!'; color: var(--crit); font-size: 14px; font-weight: 700; }
.toast--info    { border-color: rgba(0,229,255,.3); }
.toast--info::before    { content: 'ℹ'; color: var(--accent); font-size: 13px; }

/* ══ CONFIRM DIALOG ══ */
.confirm__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm__box {
  background: var(--s2);
  border: 1px solid var(--s4);
  border-radius: 12px;
  padding: 28px 32px;
  text-align: center;
  width: 320px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: slideUp .2s ease;
}

.confirm__icon {
  font-size: 30px;
  color: var(--high);
  margin-bottom: 12px;
}

.confirm__msg {
  font-size: 13px;
  color: #8aabc0;
  margin-bottom: 20px;
  line-height: 1.6;
}

.confirm__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ══ RESPONSIVE ══ */
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    width: 220px;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }

  .stats__grid { grid-template-columns: 1fr 1fr; }
  .dashboard__grid { grid-template-columns: 1fr; }

  .table__head, .table__row {
    grid-template-columns: 60px 1fr 80px 100px;
  }

  .col--assignee, .col--date, .col--actions { display: none; }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 14px; }
  .view { padding: 16px; }
  .stats__grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .search__input { width: 140px; }
  .search__input:focus { width: 180px; }
  .form__row { grid-template-columns: 1fr; }
}
