body {
  background: linear-gradient(to bottom right, #f8fafc, #e0e7ff);
  min-height: 100vh;
}

body.dashboard-bg {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.16), transparent 25%),
    radial-gradient(circle at 80% 0%, rgba(255,255,255,0.10), transparent 20%),
    linear-gradient(135deg, #5a62d6, #836bd3 45%, #6d7edb);
}

body.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #172554 0%, #334155 45%, #0f766e 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.26);
  padding: 30px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand i {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #0f766e);
  font-size: 1.5rem;
}

.login-brand h1 {
  font-size: 1.45rem;
  margin: 0 0 4px;
  font-weight: 800;
}

.login-brand p {
  margin: 0;
  color: #64748b;
}

.user-chip {
  font-size: 0.85rem;
  color: #475569;
}

.navbar {
  background-color: #f8fafc !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
  color: #1e293b !important;
  font-weight: 600;
}

main.container {
  max-width: 1600px;
  padding-top: 82px;
}

.metric-card {
  background: linear-gradient(145deg, #f6f7fc, #eef2ff);
  border: none;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 30px rgba(41, 53, 108, 0.14);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #2c3350;
  height: 100%;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

.icon-blue { background: linear-gradient(135deg, #4da5ff, #3c68ff); }
.icon-green { background: linear-gradient(135deg, #32d296, #0fa968); }
.icon-orange { background: linear-gradient(135deg, #ffb347, #ff784b); }
.icon-purple { background: linear-gradient(135deg, #9d7bff, #7451ff); }

.metric-value {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.metric-label {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: #6c7693;
  margin-bottom: 4px;
}

.metric-sub {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1b9b6e;
}

.card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.06);
}

.chart-card {
  min-height: 300px;
}

.chart-card canvas {
  width: 100%;
  height: 280px;
}

.ticket-card {
  min-height: 100%;
}

.subtask-list {
  border-left: 3px solid #dbeafe;
  padding-left: 0.75rem;
}

.subtask-row {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.2rem 0;
}

.subtask-row span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-title {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.table-card {
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.06);
  border: none;
}

.filters-card {
  background: #fff;
  border: none;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

.filters-card h5 {
  font-weight: 700;
  color: #1f2937;
}

.header-section,
.filters-section {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  box-shadow: 0 10px 38px rgba(0,0,0,0.09);
  margin-bottom: 28px;
  border: 1px solid rgba(255,255,255,0.3);
}

.header-section {
  padding: 20px 24px;
}

.header-section h1 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 2rem;
  margin-bottom: 8px;
}

.header-section small {
  color: #8b93aa;
  font-size: 0.95rem;
}

.filters-section {
  padding: 12px;
}

.form-control,
.form-select {
  border: 1px solid rgba(109,93,252,0.18);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.95rem;
  background-color: rgba(255,255,255,0.75);
}

.form-control:focus,
.form-select:focus {
  border-color: #6d5dfc;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.14);
}

.board-col {
  min-height: 70vh;
  border-radius: 16px;
  padding: 20px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  border: 2px solid rgba(102,126,234,0.1);
  position: relative;
  overflow-y: auto;
}

.board-col::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 16px 16px 0 0;
}

.col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e9ecf5;
}

.col-header .fw-semibold {
  font-size: 1.1rem;
  color: #2d3748;
}

.work-card {
  border: 2px solid #e9ecf5;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  background: #fff;
  cursor: move;
  position: relative;
  overflow: hidden;
}

.work-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #667eea, #764ba2);
  opacity: 0;
}

.work-card:hover {
  box-shadow: 0 12px 24px rgba(102,126,234,0.15);
  border-color: #667eea;
  transform: translateY(-4px);
}

.work-card:hover::before {
  opacity: 1;
}

.work-card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.work-card .card-body {
  padding: 16px;
}

.tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  margin: 0.5rem 0;
}

.progress-bar {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 999px;
}

.drop-hover {
  background: rgba(102,126,234,0.05);
  border: 2px dashed #667eea;
  border-radius: 16px;
}

.empty-placeholder {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  padding: 40px 20px;
  font-size: 0.95rem;
}

.btn-primary {
  background-color: #4f46e5;
  border-color: #4f46e5;
}

.btn-primary:hover {
  background-color: #4338ca;
  border-color: #4338ca;
}

.btn-outline-primary {
  color: #4f46e5;
  border-color: #4f46e5;
}

.btn-outline-primary:hover {
  background-color: #4f46e5;
  color: #fff;
}

.avatar-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex: 0 0 auto;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1080;
}

body.detail-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f4f7fb 0%, #eef2ff 100%);
}

.detail-shell {
  padding: 0;
}

.detail-card {
  min-height: 80vh;
  background: #fff;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.detail-header h1 {
  margin: 4px 0 8px;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0;
}

.detail-header p {
  margin: 0;
  color: rgba(255,255,255,0.82);
}

.detail-kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.72);
}

.detail-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-body {
  padding: 28px 32px 34px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.detail-info-box {
  border: 1px solid #e7eaf5;
  border-radius: 12px;
  padding: 18px;
  background: #f8fafc;
}

.detail-info-box i {
  color: #667eea;
  font-size: 1.4rem;
  margin-bottom: 10px;
  display: inline-block;
}

.detail-info-box span {
  display: block;
  color: #6b7280;
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
}

.detail-info-box strong {
  display: block;
  color: #1f2937;
  font-size: 1rem;
  margin-top: 4px;
}

.detail-section {
  border: 1px solid #e7eaf5;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  background: #fff;
}

.detail-section h2 {
  font-size: 1rem;
  margin: 0 0 10px;
  font-weight: 800;
  color: #1f2937;
}

.detail-section p {
  margin: 0;
  color: #4b5563;
  line-height: 1.6;
}

.detail-progress {
  height: 12px;
}

.detail-comment {
  border: 1px solid #e7eaf5;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #f8fafc;
}

.comment-form {
  border: 1px solid #e7eaf5;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  background: #f8fafc;
}

.backup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.backup-row,
.backup-upload {
  border: 1px solid #e7eaf5;
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px;
}

.backup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.fishbone-wrap {
  overflow-x: auto;
  padding: 12px 4px 4px;
}

.fishbone {
  position: relative;
  min-width: 920px;
  min-height: 430px;
  padding: 24px 24px 34px;
}

.fishbone-spine {
  position: absolute;
  left: 70px;
  right: 150px;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background: #334155;
}

.fishbone-head {
  position: absolute;
  right: 24px;
  top: calc(50% - 34px);
  min-width: 138px;
  height: 68px;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
}

.fishbone-branches {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 34px 44px;
  z-index: 1;
}

.fishbone-branch {
  position: relative;
  min-height: 168px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.fishbone-branch::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 3px;
  height: 52px;
  background: #334155;
  transform-origin: bottom;
  z-index: -1;
}

.fishbone-branch.top {
  align-self: start;
}

.fishbone-branch.top::after {
  bottom: -52px;
  transform: rotate(34deg);
}

.fishbone-branch.bottom {
  margin-top: 210px;
}

.fishbone-branch.bottom::after {
  top: -52px;
  transform: rotate(-34deg);
}

.fishbone-person {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.fishbone-person strong,
.fishbone-person small {
  display: block;
}

.fishbone-person small {
  color: #64748b;
}

.fishbone-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.fishbone-branch ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

.fishbone-branch li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: #334155;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #667eea, #764ba2);
  border-radius: 10px;
}

@media (max-width: 992px) {
  .board-col {
    min-height: 50vh;
    margin-bottom: 1.5rem;
  }

  .detail-header {
    flex-direction: column;
    padding: 22px;
  }

  .detail-body {
    padding: 22px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .fishbone {
    min-width: 760px;
  }
}
