/* =====================================================================
   DachBoxIT QA Center — Professional theme matching DACHBOXIT Workforce Console
   Clean, structured, corporate design system
   ===================================================================== */

/* ===== Design Tokens ===== */
:root, :root[data-theme="light"] {
  /* Brand — DACHBOXIT Teal */
  --accent:        #27b5c5;
  --brand:         #27b5c5;
  --accent-ink:    #052d35;
  --brand-ink:     #052d35;
  --accent-strong: #1a8d9c;
  --brand-700:     #1a8d9c;
  --accent-soft:   #eaf8fa;
  --brand-tint:    #eaf8fa;
  --accent-mid:    #b6e8f0;
  --brand-tint-2:  #b6e8f0;

  /* Surfaces */
  --bg:     #f0f4f8;
  --bg2:    #ffffff;
  --bg3:    #f5f8fb;
  --border: #e4e8ee;

  /* Text */
  --text:   #111827;
  --ink:    #111827;
  --text2:  #6b7280;
  --ink-2:  #6b7280;

  /* Status */
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --danger-line: #fecaca;
  --ok:          #16a34a;
  --success:     #16a34a;
  --warn:        #d97706;

  /* Shadows */
  --shadow-1:   0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-2:   0 4px 16px rgba(0,0,0,.1);
  --shadow-pop: 0 16px 48px rgba(0,0,0,.14);

  /* Radii */
  --r-sm: 5px;
  --r:    8px;
  --r-lg: 12px;

  /* Aliases for templates that use older variable names */
  --surface:   #ffffff;
  --surface-2: #f5f8fb;
  --line:      #e4e8ee;
}


:root[data-theme="dark"] {
  --accent:        #27b5c5;
  --brand:         #27b5c5;
  --accent-ink:    #042028;
  --brand-ink:     #042028;
  --accent-strong: #5dd4e3;
  --brand-700:     #5dd4e3;
  --accent-soft:   rgba(39,181,197,.14);
  --brand-tint:    rgba(39,181,197,.14);
  --accent-mid:    rgba(39,181,197,.3);
  --brand-tint-2:  rgba(39,181,197,.3);
  --bg:     #0e1420;
  --bg2:    #151d28;
  --bg3:    #1c2533;
  --border: #28334a;
  --text:   #e6f0f5;
  --ink:    #e6f0f5;
  --text2:  #8fa0b4;
  --ink-2:  #8fa0b4;
  --danger:      #f87171;
  --danger-bg:   rgba(248,113,113,.12);
  --danger-line: rgba(248,113,113,.4);
  --ok:          #4ade80;
  --success:     #4ade80;
  --warn:        #fbbf24;
  --shadow-1:    0 1px 3px rgba(0,0,0,.3);
  --shadow-2:    0 4px 20px rgba(0,0,0,.45);
  --shadow-pop:  0 18px 52px rgba(0,0,0,.6);
  --surface:     #151d28;
  --surface-2:   #1c2533;
  --line:        #28334a;
}

:root {
  --display: 'Oswald', sans-serif;
  --ui: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--ui);
  font-size: 14px; line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: .01em; margin: 0 0 .4em; line-height: 1.2; }
::selection { background: var(--accent-mid); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--bg2); }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

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

/* =====================================================================
   SIDEBAR
   ===================================================================== */
.sidebar {
  width: 210px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
  overflow-y: auto; z-index: 100;
}

/* Sidebar logo area */
.sb-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  flex-shrink: 0;
}
.sb-logo { height: 50px; width: auto; display: block; }
/* Theme-aware logo: navy wordmark on light, white wordmark on dark */
.sb-logo.logo-dark { display: none; }
[data-theme="dark"] .sb-logo.logo-light { display: none; }
[data-theme="dark"] .sb-logo.logo-dark  { display: block; }

/* Nav container */
.sb-nav {
  flex: 1;
  padding: 8px 10px 12px;
  overflow-y: auto;
}

/* Section group labels */
.sb-group-label {
  display: block;
  font-size: 10px; font-weight: 700;
  color: var(--text2);
  letter-spacing: .1em; text-transform: uppercase;
  padding: 14px 10px 4px;
}
.sb-group-label:first-of-type { padding-top: 6px; }

/* Nav items */
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px;
  color: var(--text2); font-size: 13px; font-weight: 500;
  margin-bottom: 1px;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item .ico { font-size: 14px; flex-shrink: 0; width: 16px; text-align: center; }
.nav-item:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-count {
  margin-left: auto;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent);
  color: var(--c, var(--accent-strong));
  border-radius: 99px; padding: 1px 7px;
  font-size: 10px; font-weight: 700;
  min-width: 18px; text-align: center;
}

/* Sidebar footer — user info + logout */
.sb-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 0;
}
.sb-user-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.25; }
.sb-user-role { font-size: 11px; color: var(--text2); }
.sb-collapse {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text2);
  padding: 6px 8px; border-radius: 7px;
  cursor: pointer; transition: background .1s, color .1s;
}
.sb-collapse:hover { background: var(--bg3); color: var(--text); text-decoration: none; }

/* ===== Avatar circles ===== */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; text-transform: uppercase;
  font-size: 12px; user-select: none;
}

/* =====================================================================
   MAIN AREA
   ===================================================================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ===== Topbar ===== */
.topbar {
  height: 64px; padding: 0 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 50;
  flex-shrink: 0;
}
.font-display { font-family: var(--display); font-weight: 600; letter-spacing: .01em; }
.topbar h1 { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--text); margin: 0; letter-spacing: .01em; }
.spacer { flex: 1; }

/* User pill in topbar */
.topbar-user-pill {
  display: flex; align-items: center; gap: 7px;
  background: var(--brand-tint);
  border: 1px solid var(--brand-tint-2);
  border-radius: 99px; padding: 4px 12px 4px 6px;
}
.topbar-user-name { font-size: 12.5px; font-weight: 600; color: var(--brand-700); }

/* ===== Notification Bell ===== */
.pip {
  position: absolute; top: 2px; right: 2px;
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg2);
  pointer-events: none;
}
.lang-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 9px;
  color: var(--text2); cursor: pointer; font-size: 11px;
  font-family: var(--font-mono); font-weight: 700; letter-spacing: .05em;
  transition: background .15s, color .15s, border-color .15s;
}
.lang-toggle:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.bell-btn {
  position: relative;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 9px;
  color: var(--text2); cursor: pointer; font-size: 15px;
  transition: background .1s, color .1s;
}
.bell-btn:hover { background: var(--bg3); color: var(--text); }
.bell-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 320px; background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-pop);
  z-index: 200; overflow: hidden;
}
.bell-head {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.bell-body { max-height: 360px; overflow-y: auto; }
.bell-item-form { margin: 0; }
.bell-item {
  display: flex; gap: 10px; width: 100%; padding: 10px 14px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  cursor: pointer; text-align: left; color: var(--text);
  font-family: inherit; font-size: 13px;
  transition: background .1s;
}
.bell-item:hover { background: var(--bg3); }
.bell-item:last-child { border-bottom: none; }
.bell-item.unread { background: var(--accent-soft); }
.bell-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 4px; flex-shrink: 0; }
.bell-item-body { flex: 1; min-width: 0; }
.bell-text { font-size: 12.5px; }
.mono-meta { font-size: 10.5px; color: var(--text2); display: block; margin-top: 2px; }
.bell-empty { padding: 20px; font-size: 13px; color: var(--text2); text-align: center; margin: 0; }
.bell-wrap { position: relative; }

.linkish {
  background: none; border: none; color: var(--accent-strong);
  cursor: pointer; font-size: 12px; font-weight: 600; padding: 0;
  font-family: inherit;
}
.linkish:hover { text-decoration: underline; }
.btn-link {
  background: none; border: none; color: var(--accent-strong);
  cursor: pointer; font-size: 12.5px; font-weight: 600; padding: 0;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.t-ico { display: flex; align-items: center; flex-shrink: 0; }

/* ===== Content ===== */
.content { padding: 24px 24px 52px; max-width: 1160px; margin: 0 auto; flex: 1; width: 100%; }

/* ===== Toasts ===== */
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent; border-left-width: 3px;
}
.toast-ok    { background: color-mix(in srgb, var(--ok) 10%, var(--bg2)); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.toast-warn  { background: color-mix(in srgb, var(--warn) 10%, var(--bg2)); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.toast.error, .toast-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 7px;
  font-size: 13px; font-weight: 600; line-height: 1;
  border: 1px solid transparent; cursor: pointer;
  font-family: inherit; text-decoration: none;
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-secondary { background: var(--bg2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg3); border-color: var(--text2); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--danger) 16%, transparent); }
.btn-block { width: 100%; justify-content: center; padding: 11px 16px; font-size: 14px; }
.icon-btn {
  background: none; border: none; color: var(--text2); cursor: pointer;
  padding: 5px; font-size: 16px; border-radius: 6px;
  transition: color .1s, background .1s; line-height: 1;
}
.icon-btn:hover { color: var(--text); background: var(--bg3); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.inline-delete, form.inline { display: inline; margin: 0; }
.status-form { margin: 0; }

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px;
  box-shadow: var(--shadow-1);
}
.card-p { padding: 18px; }
.phase-card h3 {
  font-size: 11.5px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .07em;
  margin: 0 0 12px;
}
.muted { color: var(--text2); }
.small { font-size: 11.5px; }
.card h3 .bi { color: var(--accent-strong); }

/* =====================================================================
   FORMS
   ===================================================================== */
input[type=text], input[type=password], input[type=date], input[type=number],
input[type=url], input[type=email], textarea, select, .input {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 12px;
  color: var(--text); font-size: 13px;
  outline: none; width: 100%; font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 72px; }
select { cursor: pointer; }
input:focus, textarea:focus, select:focus, .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text2); }

/* Password eye toggle */
.pw-field { position: relative; display: flex; align-items: center; }
.pw-field input { flex: 1; padding-right: 36px; }
.pw-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 3px 4px;
  color: var(--text2); cursor: pointer; font-size: 14px; line-height: 1;
  transition: color .12s;
}
.pw-eye:hover { color: var(--text); }

/* =====================================================================
   LOGIN — Two-panel split
   ===================================================================== */
.login { min-height: 100vh; display: flex; }

/* Left dark panel */
.login-aside {
  width: 44%; flex-shrink: 0;
  background: #0b2233;
  display: flex; flex-direction: column;
  padding: 44px 48px;
  position: relative; overflow: hidden;
}
#loginCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.la-inner { position: relative; z-index: 1; flex: 1; }
.la-foot  { position: relative; z-index: 1; }

/* Right white panel */
.login-main {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px 36px; background: var(--bg2);
}
.login-card { width: 400px; max-width: 100%; }
.login-demo {
  margin-top: 18px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 14px;
  font-size: 12.5px; color: var(--text2); line-height: 1.6;
}
.login-demo code {
  background: var(--border); padding: 1px 5px; border-radius: 4px;
  font-family: 'Space Mono', monospace; font-size: 11.5px; color: var(--text);
}

/* =====================================================================
   MOBILE
   ===================================================================== */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 200;
    transform: translateX(-100%); transition: transform .22s;
    box-shadow: 10px 0 32px rgba(0,0,0,.18);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 16px 16px 44px; }
  .topbar { padding: 0 14px; }
  .login-aside { display: none; }
  .login-main { padding: 36px 20px; }
}

/* =====================================================================
   BUGS LIST
   ===================================================================== */
.bugs-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.bugs-filter  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 0; }
.search-wrap  { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text2); font-size: 13px; }
.search-wrap input { padding-left: 34px; }

.bug-list { display: flex; flex-direction: column; gap: 8px; }

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

.bug-row {
  background: var(--bg2); border: 1px solid var(--border);
  border-left: 3px solid var(--p-color, var(--accent));
  border-radius: 9px; padding: 12px 14px;
  display: flex; gap: 8px; align-items: center;
  box-shadow: var(--shadow-1);
  transition: background .1s;
  animation: pop .15s ease;
}
.bug-row:hover { background: var(--bg3); }
.bug-row-link  { flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.bug-row-link:hover { text-decoration: none; }
.bug-row-head  { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-bottom: 3px; }
.bug-title     { font-size: 13.5px; font-weight: 600; }
.bug-row-meta  { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--text2); }
.bug-row-meta i { font-size: 11px; }
.bug-row-actions { display: flex; gap: 5px; flex-shrink: 0; align-items: center; }

/* Badges */
.badge {
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, transparent);
  color: var(--c, var(--accent-strong));
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 26%, transparent);
  border-radius: 99px; padding: 2px 9px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap; line-height: 16px;
}

/* Status dropdown */
.status-select {
  background: var(--bg2);
  border: 1px solid color-mix(in srgb, var(--sc, var(--accent)) 28%, transparent);
  color: var(--sc, var(--text2));
  font-weight: 600; font-size: 11.5px;
  padding: 5px 8px; width: auto; border-radius: 7px;
}

.empty {
  text-align: center; padding: 56px 28px; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-1);
}
.empty .bi { color: var(--accent-strong); opacity: .55; }
.empty h2 { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--text); margin: 14px 0 6px; }
.empty p { margin: 10px auto 18px; max-width: 460px; }

/* =====================================================================
   BUG FORM
   ===================================================================== */
.bug-form { display: flex; flex-direction: column; gap: 18px; max-width: 800px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.form-error {
  background: var(--danger-bg); border: 1px solid var(--danger-line);
  color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: 13px;
}
.card-inner {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 9px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.card-inner h3 {
  font-size: 11px; font-weight: 700; color: var(--text2);
  margin: 0 0 4px; display: flex; align-items: center; gap: 6px;
  letter-spacing: .07em; text-transform: uppercase;
}
.accent-block .field input,
.accent-block .field textarea,
.accent-block .field select { background: var(--bg2); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 9px;
  padding: 24px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone i { font-size: 24px; color: var(--text2); }
.upload-zone p { font-size: 12.5px; color: var(--text2); margin: 6px 0 0; }
.thumb-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb {
  position: relative; width: 84px; height: 84px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--border); display: block;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Video thumbnails inside a .thumb wrapper (form previews + existing list) */
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
/* Standalone video player on the bug detail page */
video.thumb { width: 260px; height: 150px; object-fit: cover; background: #000; }
.thumb .thumb-x {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.68); color: #fff; border-radius: 5px;
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer;
}
.existing-thumb input[type=checkbox] { display: none; }
.existing-thumb input:checked + .thumb-x { background: var(--danger); }
.existing-thumb input:checked ~ img { opacity: .3; }

/* =====================================================================
   BUG DETAIL
   ===================================================================== */
.bug-detail { display: flex; flex-direction: column; gap: 16px; max-width: 920px; }
.bug-detail-header { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bug-detail-header .badges { display: flex; gap: 5px; flex-wrap: wrap; }
.bug-detail-header .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; font-size: 13px; }
.kv-grid > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kv-grid .k { color: var(--text2); font-weight: 600; flex-shrink: 0; }
.kv-grid .v { text-align: right; word-break: break-word; }

.section-block  { display: flex; flex-direction: column; gap: 6px; }
.section-label  { font-size: 11px; color: var(--text2); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.history-item   { display: flex; gap: 8px; font-size: 12px; color: var(--text2); padding: 3px 0; }
.history-item b { color: var(--text); }
.danger-zone    { display: flex; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
  display: block; box-shadow: var(--shadow-1);
  transition: transform .15s, box-shadow .15s; color: var(--text);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); text-decoration: none; }
.stat-label {
  font-size: 10.5px; color: var(--text2); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.stat-value {
  font-family: var(--display);
  font-size: 32px; font-weight: 600;
  color: var(--c, var(--accent-strong));
  margin-top: 6px; line-height: 1;
  font-variant-numeric: tabular-nums;
}

.activity-item {
  display: flex; gap: 9px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.activity-item:last-child { border-bottom: none; }
.activity-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--accent)); flex-shrink: 0; }
.activity-item .t   { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-item .muted { margin-left: auto; flex-shrink: 0; font-size: 10.5px; color: var(--text2); white-space: nowrap; }

/* Charts */
.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-bottom: 18px; }
.chart-card { padding: 18px; min-height: 220px; }
.chart-card h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text2); margin: 0 0 14px; }
.chart-card canvas { max-height: 200px !important; }
.deadlines-card canvas { display: none; }
.deadline-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.deadline-row:last-child { border-bottom: none; }
.team-chip { background: var(--bg3); border: 1px solid var(--border); border-radius: 7px; padding: 5px 11px; font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; }
.team-chip.owner { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent-strong); font-weight: 700; }
.stat-mini { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; }
.stat-mini span b { color: var(--accent-strong); margin-left: 4px; font-family: var(--display); }

/* =====================================================================
   COMMENTS & DEV REPORTS
   ===================================================================== */
.comment { background: var(--bg3); border-radius: 8px; padding: 12px; margin-bottom: 6px; border: 1px solid var(--border); }
.comment.dev-report { border-left: 3px solid var(--accent); }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 12px; font-weight: 700; color: var(--accent-strong); }
.comment-head .muted { margin-left: auto; }
.comment-head .inline { margin-left: 6px; }
.small-btn { padding: 2px 5px; font-size: 12px; }
.comment-form { display: flex; gap: 6px; margin-top: 8px; align-items: stretch; }
.comment-form input { flex: 1; }
.devreport-form { display: flex; flex-direction: column; gap: 10px; }
.devreport-form textarea { width: 100%; }

/* =====================================================================
   WORKFLOW INFO BANNERS
   ===================================================================== */
.info-banner {
  border-radius: 8px; padding: 11px 15px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 9px;
}
.info-banner.warn   { background: color-mix(in srgb, var(--warn) 10%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); color: var(--warn); }
.info-banner.ok     { background: color-mix(in srgb, var(--ok) 10%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent); color: var(--ok); }
.info-banner.accent { background: var(--accent-soft); border: 1px solid var(--accent-mid); color: var(--accent-strong); }
.solved-row .bug-row-link { opacity: .82; }
.struck { text-decoration: line-through; opacity: .65; }

/* =====================================================================
   MANAGE DEVS
   ===================================================================== */
.dev-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dev-row:last-child { border-bottom: none; }
.dev-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.dev-info { flex: 1; min-width: 120px; }
.dev-name { font-size: 13px; font-weight: 700; }
.dev-pw-form {
  display: flex; gap: 5px; align-items: center;
  background: var(--bg3); padding: 4px 10px;
  border-radius: 7px; border: 1px solid var(--border);
}
.dev-pw-form input { width: 140px; padding: 5px 8px; font-size: 12px; }
.dev-pw-form .btn  { padding: 4px 10px; font-size: 11.5px; }

/* =====================================================================
   PAGE REGISTRY
   ===================================================================== */
.page-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; }
.page-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 15px;
}
.page-info  { flex: 1; min-width: 0; }
.page-name  { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.page-url   { font-size: 11px; color: var(--accent-strong); word-break: break-all; font-family: 'Space Mono', monospace; }
.page-sections { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.section-chip { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; font-size: 10px; color: var(--text2); }
.page-actions { display: flex; gap: 4px; flex-shrink: 0; }
.page-actions .icon-btn {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.page-actions .icon-btn:hover { color: var(--accent-strong); background: var(--accent-soft); }
.page-actions .icon-btn.danger:hover { color: var(--danger); background: var(--danger-bg); }

/* =====================================================================
   TEAM CHAT
   ===================================================================== */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 120px); }
.chat-messages {
  flex: 1; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-1);
}
.chat-msg    { align-self: flex-start; max-width: 70%; position: relative; }
.chat-msg.me { align-self: flex-end; text-align: right; }
.chat-author { font-size: 10.5px; color: var(--accent-strong); font-weight: 700; margin-bottom: 2px; }
.chat-bubble {
  background: var(--bg3); padding: 9px 13px;
  border-radius: 12px; border-top-left-radius: 3px;
  text-align: left; font-size: 13px; box-shadow: var(--shadow-1);
}
.chat-msg.me .chat-bubble {
  background: var(--accent); color: var(--accent-ink);
  border-top-left-radius: 12px; border-top-right-radius: 3px; box-shadow: none;
}
.chat-bubble.clickable { cursor: pointer; }
.chat-bubble.clickable:hover { outline: 1px solid var(--accent-mid); }
.chat-bubble.deleted { font-style: italic; color: var(--text2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.chat-bugref {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 5px 9px; font-size: 11.5px;
  margin-bottom: 5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.chat-msg.me .chat-bugref { background: color-mix(in srgb, var(--accent-ink) 10%, var(--accent)); border-color: transparent; }
.chat-img   { max-width: 220px; max-height: 200px; border-radius: 8px; display: block; margin-bottom: 5px; }
.chat-time  { font-size: 10px; color: var(--text2); margin-top: 3px; font-family: 'Space Mono', monospace; }
.chat-composer { display: flex; gap: 6px; margin-top: 8px; align-items: stretch; }
.chat-composer input[type=text] { flex: 1; }
.chat-composer .bug-link-select { width: 160px; font-size: 11.5px; }
.chat-hint  { text-align: center; margin: 4px 0 0; font-size: 11.5px; color: var(--text2); }

/* =====================================================================
   HOURS TRACKER
   ===================================================================== */
.tab-row  { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-pill {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 14px;
  color: var(--text2); font-size: 12.5px; font-weight: 600;
  text-decoration: none; transition: .12s;
}
.tab-pill:hover { color: var(--text); background: var(--bg2); text-decoration: none; }
.tab-pill.active { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent-strong); font-weight: 700; }

.hours-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-cell   { text-align: center; }
.day-label  { font-size: 11px; color: var(--text2); font-weight: 700; margin-bottom: 5px; }
.day-input  { padding: 8px; text-align: center; font-weight: 600; font-size: 16px; font-family: var(--display); }
.day-input:disabled { opacity: 0.5; cursor: not-allowed; }
.hours-summary { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 13px; }
.hours-bar { height: 5px; background: var(--bg3); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.hours-bar-fill { height: 100%; transition: width .3s; }
.log-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 12.5px; align-items: center;
}
.log-row:last-child { border-bottom: none; }
.log-bug   { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-hours { color: var(--accent-strong); font-weight: 700; flex-shrink: 0; font-family: var(--display); }
.week-selector-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.week-select { flex: 1; min-width: 220px; max-width: 480px; }

/* =====================================================================
   DRAG-TO-REORDER
   ===================================================================== */
.drag-handle {
  display: flex; align-items: center; justify-content: center;
  width: 20px; flex-shrink: 0; color: var(--text2);
  cursor: grab; opacity: 0.35; font-size: 15px;
  transition: opacity .15s; user-select: none;
}
.bug-row:hover .drag-handle { opacity: 0.72; }
.drag-handle:active { cursor: grabbing; }
.drag-handle-disabled,
.bug-row:hover .drag-handle-disabled { opacity: 0; cursor: default; pointer-events: none; }
.bug-slot-num { font-size: 11px; font-weight: 600; color: var(--text2); min-width: 20px; flex-shrink: 0; }
.bug-row.dragging { opacity: 0.4; outline: 2px dashed var(--accent); }
.drop-indicator {
  display: none; height: 2px; background: var(--accent);
  border-radius: 1px; margin: 2px 0;
  box-shadow: 0 0 5px var(--accent); pointer-events: none;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 640px) {
  .form-grid-2, .kv-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hours-grid { grid-template-columns: repeat(4, 1fr); }
  .chat-composer .bug-link-select { width: 110px; }
  .chat-msg { max-width: 88%; }
  form[action$="/managedevs/add/"] { grid-template-columns: 1fr !important; }
  form[action$="/pages/save/"], form[action$="/save/"] { grid-template-columns: 1fr !important; }
}

/* =====================================================================
   DIRECT MESSAGES
   ===================================================================== */
.dm-layout {
  display: flex;
  height: calc(100vh - 120px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  background: var(--bg2);
}

/* Left panel — contact list */
.dm-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg2);
}

.dm-sidebar-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dm-contact-list { flex: 1; overflow-y: auto; }

.dm-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .12s;
}
.dm-contact:last-child { border-bottom: none; }
.dm-contact:hover { background: var(--bg3); text-decoration: none; }
.dm-contact.active { background: var(--accent-soft); }

.dm-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.dm-contact.active .dm-avatar {
  background: var(--accent);
  color: var(--accent-ink);
}

.dm-contact-info { flex: 1; min-width: 0; }
.dm-contact-name {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-contact-preview {
  font-size: 11.5px; color: var(--text2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dm-unread-badge {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 99px;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* Right panel — conversation */
.dm-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg3);
}

.dm-conv-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  flex-shrink: 0;
}
.dm-conv-name { font-family: var(--display); font-weight: 700; font-size: 15px; }

.dm-conv {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Message rows */
.dm-msg    { align-self: flex-start; max-width: 68%; }
.dm-msg.me { align-self: flex-end; text-align: right; }

.dm-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: var(--shadow-1);
}
.dm-msg.me .dm-bubble {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: none;
}

/* Composer */
.dm-composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  align-items: center;
  flex-shrink: 0;
}
.dm-composer input[type=text] { flex: 1; }

/* Empty state */
.dm-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 40px 20px;
}

@media (max-width: 760px) {
  .dm-layout { flex-direction: column; height: auto; min-height: calc(100vh - 120px); }
  .dm-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
  .dm-msg { max-width: 86%; }
}
