/* ============================================
   SMS Server QA Portal - Stylesheet
   Modern, Professional, Blue Accent Theme
   ============================================ */

/* CSS Variables */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --dark: #0f172a;
  --light: #f8fafc;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 260px;
  --header-height: 64px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --card-bg: #1e293b;
  --input-bg: #334155;
  --hover-bg: #334155;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --input-bg: #ffffff;
  --hover-bg: #f1f5f9;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Screen Management */
.screen { display: none; }
.screen.active { display: flex; }

/* ============================================
   LOGIN SCREEN
   ============================================ */
#login-screen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  padding: 40px;
  animation: slideUp 0.5s ease;
}

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

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header .logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--white);
  font-size: 28px;
  box-shadow: var(--shadow-md);
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.login-header p {
  color: var(--gray-500);
  font-size: 0.9rem;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

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

.input-wrapper > i:first-child {
  position: absolute;
  left: 14px;
  color: var(--gray-400);
  font-size: 0.9rem;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--white);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.toggle-password:hover { color: var(--gray-600); }

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

.login-footer p {
  font-size: 0.8rem;
  color: var(--gray-400);
}

.login-footer strong {
  color: var(--gray-600);
}

/* ============================================
   APP LAYOUT
   ============================================ */
#app-screen {
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-center {
  flex: 1;
  max-width: 500px;
  margin: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.brand i {
  color: var(--primary);
  font-size: 1.3rem;
}

.global-search {
  position: relative;
  width: 100%;
}

.global-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.9rem;
}

.global-search input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--bg-tertiary);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  transition: var(--transition);
}

.global-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.global-search input::placeholder {
  color: var(--text-muted);
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.user-btn:hover {
  background: var(--hover-bg);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 600;
  font-size: 0.85rem;
}

.user-btn span {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.user-btn i {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 200;
}

.dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

.dropdown a:hover {
  background: var(--hover-bg);
  color: var(--danger);
}

.dropdown a i {
  font-size: 0.9rem;
  width: 16px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 4px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  appearance: none;
}

.nav-item i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-item i.icon-resolved {
  color: #d97706;
}

.nav-item i.icon-testing {
  color: #2563eb;
}

.nav-item i.icon-verified {
  color: #059669;
}

.nav-item i.icon-removed {
  color: #dc2626;
}

.nav-item:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 8px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.version {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 28px;
  min-height: calc(100vh - var(--header-height));
  transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
  margin-left: 0;
}

/* Views */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h2 i {
  color: var(--primary);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--hover-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

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

.btn-block { width: 100%; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

.btn-icon:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.btn-icon.danger-hover:hover {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.1);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--white);
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.stat-icon.teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Dashboard Row */
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
}

.dashboard-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-card h3 i {
  color: var(--primary);
}

/* Progress Ring */
.progress-ring-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 1s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

/* Critical Card */
.critical-count {
  font-size: 3rem;
  font-weight: 700;
  color: var(--danger);
  text-align: center;
  margin: 16px 0;
}

.critical-label {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-filters-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.activity-filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 14px;
  align-items: end;
}

.activity-filter-actions {
  display: flex;
  justify-content: flex-end;
}

.activity-results-count {
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  transition: var(--transition);
}

.activity-item:hover {
  background: var(--hover-bg);
}

.activity-item--rich {
  padding: 14px 16px;
  border: 1px solid var(--border-color);
}

.activity-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-headline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.activity-headline strong {
  font-weight: 700;
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.activity-action-create {
  background: #dcfce7;
  color: #166534;
}

.activity-action-update {
  background: #dbeafe;
  color: #1d4ed8;
}

.activity-action-delete {
  background: #fee2e2;
  color: #b91c1c;
}

.activity-action-duplicate {
  background: #f3e8ff;
  color: #7e22ce;
}

.activity-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.activity-meta-line span {
  white-space: nowrap;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.activity-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 0.9rem;
}



/* ============================================
   ITEMS
   ============================================ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  min-width: 140px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.item-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.item-row:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
  border-color: var(--primary-light);
}

.item-type-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.item-type-icon.bug { background: #fef2f2; color: #ef4444; }
.item-type-icon.feature { background: #eff6ff; color: #3b82f6; }
.item-type-icon.improvement { background: #f0fdf4; color: #10b981; }
.item-type-icon.suggestion { background: #faf5ff; color: #a855f7; }
.item-type-icon.task { background: #fffbeb; color: #f59e0b; }

.item-info {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.item-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tooltip-trigger {
  position: relative;
  cursor: help;
}

.tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(2px);
  padding: 6px 10px;
  border-radius: 10px;
  background: #fde68a;
  color: #1f2937;
  border: 1px solid #f59e0b;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: pre;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 20;
}

.tooltip-trigger::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #f59e0b transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 20;
}

.tooltip-trigger:hover::after,
.tooltip-trigger:hover::before,
.tooltip-trigger:focus-visible::after,
.tooltip-trigger:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.item-title-wrap.tooltip-trigger,
.section-entry-description.tooltip-trigger {
  position: relative;
  cursor: help;
}

.item-title-wrap {
  width: 100%;
  max-width: 100%;
}

.item-title-wrap .item-title {
  display: block;
}

.item-title-wrap.tooltip-trigger::after,
.section-entry-description.tooltip-trigger::after {
  font-size: 0.88rem;
  padding: 7px 12px;
}

.item-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-status-new { background: #eff6ff; color: #2563eb; }
.badge-status-assigned { background: #eff6ff; color: #2563eb; }
.badge-status-in-progress { background: #fffbeb; color: #d97706; }
.badge-status-testing { background: #faf5ff; color: #7c3aed; }
.badge-status-fixed { background: #f0fdf4; color: #059669; }
.badge-status-completed { background: #f0fdf4; color: #059669; }
.badge-status-rejected { background: #fef2f2; color: #dc2626; }
.badge-status-reopened { background: #fef2f2; color: #dc2626; }
.badge-move-status { background: transparent; color: #94a3b8; border: 1px dashed #cbd5e1; font-weight: 500; font-size: 0.7rem; text-transform: none; padding: 2px 8px; }

.badge-priority-low { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.badge-priority-medium { background: #fffbeb; color: #d97706; }
.badge-priority-high { background: #fff7ed; color: #ea580c; }
.badge-priority-critical { background: #fef2f2; color: #dc2626; }

.badge-type-bug { background: #fef2f2; color: #dc2626; }
.badge-type-feature { background: #eff6ff; color: #2563eb; }
.badge-type-improvement { background: #f0fdf4; color: #059669; }
.badge-type-suggestion { background: #faf5ff; color: #7c3aed; }
.badge-type-task { background: #fffbeb; color: #d97706; }

/* ============================================
   MODALS
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show { display: flex; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  z-index: 1;
}

.modal-lg { max-width: 640px; }
.modal-xl { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header.detail-header {
  align-items: flex-start;
  gap: 16px;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-hint {
  margin: -4px 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-group-lg input {
  font-size: 1.1rem;
  padding: 12px 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.users-modal-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
}

.users-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
}

.users-panel-header {
  margin-bottom: 16px;
}

.users-panel-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.users-panel-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.users-form .modal-footer {
  padding-top: 16px;
}

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

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.user-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-row-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.user-row-info {
  min-width: 0;
}

.user-row-name {
  font-weight: 700;
  color: var(--text-primary);
}

.user-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-row-actions {
  flex-shrink: 0;
}

.activity-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.detail-meta-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-height: 36px;
  margin-left: auto;
}

.detail-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.detail-summary-card {
  background: linear-gradient(180deg, var(--bg-secondary), var(--card-bg));
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.detail-summary-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-summary-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

.detail-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.1px;
  line-height: 1.2;
  white-space: nowrap;
}

.detail-status-badge.resolved {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.detail-status-badge.testing {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #3b82f6;
}

.detail-status-badge.verified {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #22c55e;
}

.detail-status-badge.removed {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #ef4444;
}

.detail-created-by {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.detail-body {
  display: block;
  padding: 24px;
}

.detail-main {
  padding: 0;
}

.detail-section {
  margin-bottom: 0;
}

.detail-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-description {
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 1rem;
  white-space: pre-wrap;
  padding: 20px 22px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* Comments */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.comment-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.comment-form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.comment-form textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 60px;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Attachments */
.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.attachment-item:hover {
  background: var(--hover-bg);
}

.attachment-item i {
  color: var(--primary);
}

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

/* ============================================
   EXPORT PAGE
   ============================================ */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.export-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  transition: var(--transition);
}

.export-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.export-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--primary);
  font-size: 1.5rem;
}

.export-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.export-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  min-width: 280px;
  max-width: 400px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--primary); }

.toast i {
  font-size: 1.1rem;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.warning i { color: var(--warning); }
.toast.info i { color: var(--primary); }

.toast-message {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  transition: var(--transition);
}

.toast-close:hover { color: var(--text-primary); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ============================================
   SIDEBAR OVERLAY (MOBILE)
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 89;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
  display: block;
}

/* ============================================
   RESPONSIVE — 1024px (Tablet Landscape)
   ============================================ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 230px;
  }

  .dashboard-row {
    grid-template-columns: 1fr;
  }

  .users-modal-body {
    grid-template-columns: 1fr;
  }

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

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

  .main-content {
    padding: 20px;
  }
}

/* ============================================
   RESPONSIVE — 768px (Tablet Portrait / Mobile)
   ============================================ */
@media (max-width: 768px) {
  /* ---- Layout ---- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    width: 280px;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    /* Override any desktop collapsed state */
    margin: 0 !important;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  /* Ensure sidebar is never hidden via "collapsed" on mobile */
  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 0 !important;
    margin-top: var(--header-height);
    padding: 16px;
    width: 100%;
    min-height: calc(100vh - var(--header-height));
  }

  /* ---- Header ---- */
  .app-header {
    padding: 0 12px;
    gap: 8px;
  }

  .header-center {
    display: none;
  }

  .header-left {
    gap: 8px;
  }

  .header-right {
    gap: 8px;
  }

  .brand span {
    display: none;
  }

  .user-btn span,
  .user-btn .fa-chevron-down {
    display: none;
  }

  .user-btn {
    padding: 4px;
    border: none;
    background: transparent;
    gap: 0;
  }

  /* ---- Sidebar header inside mobile panel ---- */
  .sidebar-nav {
    padding-top: 72px; /* space below the header bar */
  }

  .nav-item {
    padding: 14px 18px;
    font-size: 1rem;
    min-height: 48px;
  }

  /* ---- Stats grid ---- */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px;
    gap: 12px;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  /* ---- Dashboard ---- */
  .dashboard-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dashboard-card {
    padding: 18px;
  }

  /* ---- Page header ---- */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .page-header h2 {
    font-size: 1.25rem;
  }

  .page-header .btn {
    width: 100%;
    justify-content: center;
  }

  /* ---- Filters bar ---- */
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select {
    width: 100%;
    min-width: unset;
    padding: 10px 12px;
    font-size: 1rem;
  }

  /* ---- Items list ---- */
  .item-row {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .item-type-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .item-info {
    flex: 1;
    min-width: 0;
  }

  .item-title {
    font-size: 0.9rem;
    white-space: normal;
    word-break: break-word;
  }

  .item-badges {
    width: 100%;
    flex-wrap: wrap;
    margin-top: 4px;
  }

  /* ---- Modals ---- */
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
    animation: slideUpMobile 0.3s ease;
  }

  .modal-lg,
  .modal-xl {
    max-width: 100%;
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-footer {
    padding-top: 14px;
    flex-direction: column;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* ---- Forms ---- */
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 1rem; /* prevents iOS zoom on focus */
    padding: 12px 14px;
  }

  /* ---- Users modal ---- */
  .users-modal-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .user-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .user-row-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .user-row-actions .btn {
    flex: 1;
    justify-content: center;
  }

  /* ---- Detail actions ---- */
  .detail-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .detail-actions .btn {
    flex: 1;
    min-width: 80px;
    justify-content: center;
    font-size: 0.8rem;
    padding: 8px 10px;
  }

  .detail-meta-wrap {
    align-items: flex-start;
    margin-left: 0;
  }

  /* ---- Detail summary grid ---- */
  .detail-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* ---- Activity ---- */
  .activity-filters-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .activity-filters-panel {
    padding: 14px;
  }

  .activity-item {
    padding: 10px;
    gap: 10px;
  }

  .activity-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }

  /* ---- Section entry cards ---- */
  .section-entry-card {
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .section-entry-watermark {
    width: 100%;
    text-align: right;
    margin-left: 0;
    margin-top: 6px;
  }

  /* ---- Export ---- */
  .export-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* ---- Toast ---- */
  #toast-container {
    top: auto;
    bottom: 16px;
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: unset;
    max-width: 100%;
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE — 480px (Mobile Portrait)
   ============================================ */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
    gap: 10px;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  .login-card {
    padding: 24px 20px;
  }

  .login-header h1 {
    font-size: 1.25rem;
  }

  .page-header h2 {
    font-size: 1.1rem;
  }

  .modal-content {
    max-height: 95vh;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.85rem;
    padding: 9px 16px;
  }

  .btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  /* Force badge text to wrap to prevent overflow */
  .badge {
    font-size: 0.68rem;
    padding: 3px 7px;
  }

  .item-meta {
    gap: 8px;
    font-size: 0.75rem;
  }

  .nav-item {
    font-size: 0.95rem;
    padding: 13px 16px;
  }
}

/* ============================================
   RESPONSIVE — 375px and smaller (Small phones)
   ============================================ */
@media (max-width: 375px) {
  :root {
    --header-height: 56px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .main-content {
    padding: 12px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-header {
    padding: 14px;
  }
}


/* ============================================
   UTILITIES
   ============================================ */
.admin-only { display: none; }
.show-admin .admin-only { display: inline-flex; }

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Selection */
::selection {
  background: var(--primary-light);
  color: var(--primary-dark);
}


/* ============================================
   TESTING PHASE CARD - LIST VIEW
   ============================================ */
.iteration-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  margin-bottom: 12px;
}

.iteration-card:hover {
  box-shadow: var(--shadow-md);
}

.iteration-card.has-items {
  border-left: 4px solid var(--primary);
}

.iteration-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.iteration-header:hover {
  background: var(--hover-bg);
}

.iteration-drag-handle {
  color: var(--gray-400);
  cursor: grab;
  padding: 4px;
}

.iteration-drag-handle:active { cursor: grabbing; }

.iteration-toggle {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  width: 20px;
  text-align: center;
}

.iteration-toggle.collapsed { transform: rotate(-90deg); }

.iteration-info {
  flex: 1;
  min-width: 0;
}

.iteration-info h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

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

.iteration-actions button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.iteration-actions button:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.iteration-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.iteration-body.collapsed {
  display: none;
}

/* ============================================
   PHASE DESCRIPTION - CLEAR TEXT LIST
   ============================================ */
.phase-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.phase-desc-list {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}

.phase-desc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
  border-bottom: 1px solid var(--border-color);
}

.phase-desc-item:last-child {
  border-bottom: none;
}

.phase-desc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}



.section-entry-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    var(--card-bg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 18px 16px 20px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.section-entry-card:hover {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0.01)),
    var(--hover-bg);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}



.section-entry-numbered-card {
  display: flex;
  align-items: flex-start;
}



.section-entry-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}



.section-entry-numbered-card .section-entry-description {
  flex: 1;
  min-width: 0;
}

.section-entry-watermark {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: center;
  color: #ff4d4f;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 2;
}

[data-theme="dark"] .section-entry-watermark {
  color: #ff6b6b;
}



.section-entry-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 45%);
  opacity: 0.35;
}

.section-entry-description {
  position: relative;
  z-index: 1;
  font-size: 0.98rem;
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  letter-spacing: 0.1px;
}

.section-entry-footer {
  flex: 0 0 100%;
  display: flex;
  justify-content: flex-start;
  margin-left: 42px;
  margin-top: 10px;
  position: relative;
  z-index: 2;
}



/* ============================================
   FORM MODE STYLES
   ============================================ */
.form-row-title[style*="none"],
.form-row-advanced[style*="none"] {
  display: none !important;
}

/* ============================================
   ISSUE TAG BADGES
   ============================================ */
.issue-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

/* Tag color presets — light mode */
.issue-tag-badge.tag-bug         { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.issue-tag-badge.tag-feature     { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.issue-tag-badge.tag-improvement { background: #eff6ff; color: #2563eb; border: 1px solid #93c5fd; }
.issue-tag-badge.tag-task        { background: #fff7ed; color: #ea580c; border: 1px solid #fdba74; }
.issue-tag-badge.tag-other       { background: #f8fafc; color: #64748b; border: 1px solid #cbd5e1; }

/* Dark mode overrides */
[data-theme="dark"] .issue-tag-badge.tag-bug         { background: rgba(220, 38, 38, 0.15);  color: #f87171; border-color: rgba(220, 38, 38, 0.3); }
[data-theme="dark"] .issue-tag-badge.tag-feature     { background: rgba(22, 163, 74, 0.15);  color: #4ade80; border-color: rgba(22, 163, 74, 0.3); }
[data-theme="dark"] .issue-tag-badge.tag-improvement { background: rgba(37, 99, 235, 0.15);  color: #60a5fa; border-color: rgba(37, 99, 235, 0.3); }
[data-theme="dark"] .issue-tag-badge.tag-task        { background: rgba(234, 88, 12, 0.15);  color: #fb923c; border-color: rgba(234, 88, 12, 0.3); }
[data-theme="dark"] .issue-tag-badge.tag-other       { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border-color: rgba(100, 116, 139, 0.3); }

