/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif&family=Geist:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  /* Colors */
  --bg: #f6f5f1;
  --surface: #fbfaf6;
  --surface-white: #fff;
  --border: #ece9e0;
  --border-warm: #d4cfc0;
  --text-primary: #0a0a0a;
  --text-secondary: #8a8478;
  --text-tertiary: #a8a294;
  --text-body: #6b6557;
  --text-dark: #3d3a33;
  --accent: #0a0a0a;
  --hover-surface: #f1ede2;
  /* Status */
  --status-todo: #9ca3af;
  --status-progress: #3b82f6;
  --status-review: #a855f7;
  --status-done: #16a34a;
  --status-closed: #6b7280;
  --priority-high: #ea580c;
  --priority-highest: #dc2626;
  --bug-red: #ef4444;
  /* Semantic */
  --success: #16a34a;
  --warning: #f97316;
  --error: #ef4444;
  --info: #3b82f6;
  /* Typography */
  --font-primary: 'Geist', 'Inter', -apple-system, sans-serif;
  --font-display: 'Instrument Serif', serif;
  --font-mono: 'Geist Mono', 'SF Mono', monospace;
  /* Spacing */
  --sp-1: 4px; --sp-2: 6px; --sp-3: 8px; --sp-4: 10px;
  --sp-5: 12px; --sp-6: 14px; --sp-7: 16px; --sp-8: 18px;
  --sp-9: 22px; --sp-10: 24px; --sp-11: 28px; --sp-12: 34px;
  /* Radii */
  --r-xs: 3.5px; --r-sm: 5px; --r-md: 6px; --r-lg: 7px;
  --r-xl: 8px; --r-2xl: 9px; --r-3xl: 10px; --r-4xl: 14px;
  --r-5xl: 16px; --r-full: 999px;
  /* Shadows */
  --shadow-subtle: 0 1px 0 rgba(0,0,0,.02);
  --shadow-card-hover: 0 6px 20px -8px rgba(0,0,0,.12);
  --shadow-elevated: 0 4px 16px -6px rgba(0,0,0,.08);
  --shadow-dropdown: 0 8px 24px -8px rgba(0,0,0,.15);
  /* Motion */
  --ease-out: cubic-bezier(0.16,1,0.3,1);
  --ease-in-out: cubic-bezier(0.65,0,0.35,1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-primary);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-warm); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ===== APP SHELL ===== */
.app {
  width: 1440px;
  margin: 0 auto;
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}
.app.login-mode .sidebar, .app.login-mode .topbar { display: none !important; }
.app.login-mode .main { width: 100%; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 228px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 18px 14px;
  overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-family: var(--font-display); font-size: 18px; font-style: italic; }
.logo-text { font-weight: 600; font-size: 15px; color: var(--text-primary); letter-spacing: -0.01em; }
.workspace-switch { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--border); cursor: pointer; margin-bottom: 18px; box-shadow: var(--shadow-subtle); transition: background var(--duration-fast) ease; }
.workspace-switch:hover { background: var(--hover-surface); }
.ws-ic { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg,#1f2937,#374151); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; flex-shrink: 0; }
.ws-meta { flex: 1; min-width: 0; }
.ws-meta b { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-meta span { font-size: 11px; color: var(--text-secondary); }
.nav-section { margin-bottom: 16px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-tertiary); padding: 4px 10px 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-dark); cursor: pointer; font-weight: 500; font-size: 13px; margin-bottom: 1px; transition: background var(--duration-fast) ease; }
.nav-item:hover { background: var(--hover-surface); }
.nav-item.active { background: var(--accent); color: var(--surface); }
.nav-item .ic { width: 15px; height: 15px; flex-shrink: 0; opacity: .85; display: flex; align-items: center; }
.nav-item.active .ic { opacity: 1; }
.nav-item.pinned-item { font-size: 12.5px; }
.bdg { margin-left: auto; font-size: 10.5px; color: var(--text-tertiary); font-weight: 500; }
.nav-item.active .bdg { color: var(--text-tertiary); }
.side-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; transition: background var(--duration-fast) ease; }
.user-card:hover { background: var(--hover-surface); }
.ua { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; flex-shrink: 0; }
.um { flex: 1; min-width: 0; }
.um b { display: block; font-size: 12.5px; color: var(--text-primary); font-weight: 600; }
.um span { font-size: 11px; color: var(--text-secondary); }

/* ===== MAIN AREA ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 64px; background: rgba(246,245,241,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 20; flex-shrink: 0; }
.main-content { flex: 1; overflow-y: auto; animation: fadeIn var(--duration-slow) var(--ease-out); }
.crumb { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.crumb b { color: var(--text-primary); font-weight: 600; }
.crumb a:hover { color: var(--text-primary); }
.crumb .sep { color: var(--border-warm); }
.search { margin-left: auto; width: 300px; position: relative; }
.search input { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px 0 36px; font-size: 13px; background: var(--surface); outline: none; color: var(--text-primary); transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease; }
.search input::placeholder { color: var(--text-tertiary); }
.search input:focus { border-color: var(--accent); background: #fff; }
.search svg { position: absolute; left: 12px; top: 11px; color: var(--text-tertiary); }
.kbd { position: absolute; right: 10px; top: 8px; font-size: 10.5px; background: #fff; border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; color: var(--text-secondary); font-family: var(--font-mono); font-weight: 500; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-dark); position: relative; transition: background var(--duration-fast) ease; }
.icon-btn:hover { background: var(--hover-surface); }
.dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; background: var(--warning); border-radius: 50%; border: 1.5px solid var(--surface); }
.btn-create { height: 36px; padding: 0 14px; border-radius: 10px; background: var(--accent); color: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; border: none; display: inline-flex; align-items: center; gap: 7px; font-family: inherit; box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 1px 2px rgba(0,0,0,.15); transition: background var(--duration-fast) ease, transform var(--duration-fast) ease; }
.btn-create:hover { background: #1f2937; }
.btn-create:active { transform: scale(0.98); }

/* ===== HERO ===== */
.hero { padding: 34px 28px 22px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg,var(--surface),transparent); }
.hero-top { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); padding: 4px 10px; border-radius: var(--r-full); font-size: 11.5px; color: var(--text-dark); font-weight: 500; }
.pill .pdot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.pill .pdot.active { background: var(--status-done); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.pill .pdot.completed { background: var(--status-todo); }
.pill .pdot.planning { background: var(--status-progress); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.hero h1 { font-size: 34px; font-weight: 500; color: var(--text-primary); letter-spacing: -0.025em; line-height: 1.1; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hero h1 em { font-family: var(--font-display); font-style: italic; font-weight: 400; color: var(--text-dark); }
.hero-sub { font-size: 14px; color: var(--text-body); margin-top: 8px; max-width: 640px; }

/* ===== STAT CARDS ===== */
.hero-grid { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr 1fr 1.4fr; gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; position: relative; overflow: hidden; }
.stat .l { font-size: 11.5px; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.stat .v { font-size: 28px; font-weight: 500; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1; }
.stat .v em { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 30px; }
.stat .s { font-size: 12px; color: var(--text-body); margin-top: 6px; }
.progress-track { height: 5px; background: var(--border); border-radius: 10px; margin-top: 12px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg,var(--accent),var(--text-dark)); border-radius: 10px; transition: width var(--duration-slow) var(--ease-out); }
.stat.chart { padding: 14px 18px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chart-head .l { margin-bottom: 0; }
.legend { display: flex; gap: 10px; font-size: 10.5px; color: var(--text-secondary); }
.leg-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* ===== SUBBAR ===== */
.subbar { padding: 14px 28px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg .t { padding: 6px 12px; border-radius: 7px; font-size: 12.5px; color: var(--text-body); cursor: pointer; font-weight: 500; transition: background var(--duration-fast) ease, color var(--duration-fast) ease; }
.seg .t:hover { background: var(--hover-surface); }
.seg .t.active { background: var(--accent); color: var(--surface); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; font-size: 12.5px; color: var(--text-dark); cursor: pointer; font-weight: 500; transition: background var(--duration-fast) ease; }
.chip:hover { background: var(--hover-surface); }
.chip.on { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.chip .x { opacity: .6; font-size: 11px; }
.avs { display: flex; align-items: center; margin-left: 6px; }
.avs .a { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--bg); margin-left: -8px; font-size: 10.5px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.right-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ===== BOARD ===== */
.board { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; padding: 8px 28px 28px; align-items: flex-start; }
.col { background: transparent; border-radius: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 560px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; margin-bottom: 2px; }
.col-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.005em; }
.col-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ct-todo { background: var(--status-todo); }
.ct-prog { background: var(--status-progress); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.ct-rev { background: var(--status-review); box-shadow: 0 0 0 3px rgba(168,85,247,.18); }
.ct-done { background: var(--status-done); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.col-count { background: var(--border); color: var(--text-body); font-size: 11px; padding: 1.5px 8px; border-radius: 10px; font-weight: 600; }
.col-tools { display: flex; gap: 4px; color: var(--text-tertiary); }
.col-tools span { cursor: pointer; width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.col-tools span:hover { background: var(--hover-surface); color: var(--text-dark); }

/* ===== CARDS ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out), border-color var(--duration-normal) ease; box-shadow: var(--shadow-subtle); }
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-card-hover); border-color: var(--border-warm); }
.card.featured { background: #fff; border-color: var(--border-warm); box-shadow: var(--shadow-elevated); }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.key { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); font-weight: 500; font-family: var(--font-mono); }
.tic { width: 13px; height: 13px; border-radius: 3.5px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.tic.story { background: var(--status-done); }
.tic.task { background: var(--status-progress); }
.tic.bug { background: var(--bug-red); }
.tic.epic { background: var(--status-review); }
.tic.subtask { background: var(--status-todo); }
.prio { font-size: 11px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 4px; }
.prio.high { color: var(--priority-high); }
.prio.highest { color: var(--priority-highest); }
.card-title { font-size: 14px; color: var(--text-primary); font-weight: 500; line-height: 1.4; letter-spacing: -0.005em; margin-bottom: 11px; }
.epic-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: #7e22ce; background: #f5edff; border: 1px solid #ecd9ff; padding: 2px 8px; border-radius: 6px; font-weight: 600; margin-bottom: 9px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 2px; }
.foot-left { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-secondary); }
.foot-left span { display: inline-flex; align-items: center; gap: 4px; }
.pts-pill { font-size: 11px; background: var(--accent); color: var(--surface); font-weight: 600; padding: 2.5px 8px; border-radius: 6px; font-family: var(--font-mono); }
.as { width: 22px; height: 22px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; border: 1.5px solid var(--surface); }
.add-card { border: 1.5px dashed var(--border-warm); background: transparent; border-radius: 14px; padding: 14px; text-align: center; font-size: 12.5px; color: var(--text-tertiary); cursor: pointer; font-weight: 500; transition: all var(--duration-fast) ease; }
.add-card:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }

/* ===== FOOTER ===== */
.app-footer { padding: 18px 28px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }

/* ===== TOAST ===== */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--accent); color: var(--surface); border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-dropdown); transform: translateX(120%); transition: transform var(--duration-slow) var(--ease-out), opacity var(--duration-normal) ease; }
.toast-show { transform: translateX(0); }
.toast-hide { opacity: 0; transform: translateX(40px); }
.toast-icon { font-size: 14px; }
.toast-success { background: var(--status-done); }
.toast-error { background: var(--error); }
.toast-warning { background: var(--warning); }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--duration-normal) ease; }
.modal-overlay.modal-open { opacity: 1; }
.modal-overlay.modal-closing { opacity: 0; }
.modal-container { background: var(--surface-white); border-radius: 16px; width: 520px; max-height: 85vh; overflow: auto; box-shadow: var(--shadow-dropdown); transform: translateY(10px) scale(.98); transition: transform var(--duration-slow) var(--ease-out); }
.modal-overlay.modal-open .modal-container { transform: translateY(0) scale(1); }
.modal-large { width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close-btn { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-secondary); cursor: pointer; transition: background var(--duration-fast) ease; }
.modal-close-btn:hover { background: var(--hover-surface); }
.modal-close-float { position: absolute; top: 16px; right: 16px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== DROPDOWN ===== */
.dropdown-wrapper { position: relative; display: inline-block; }
.dropdown-panel { display: none; position: absolute; top: calc(100% + 4px); left: 0; background: var(--surface-white); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-dropdown); z-index: 50; min-width: 180px; padding: 4px; transform-origin: top left; }
.dropdown-panel.open { display: block; animation: scaleIn var(--duration-normal) var(--ease-out); }
.dropdown-panel.right { left: auto; right: 0; transform-origin: top right; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; font-size: 13px; color: var(--text-primary); cursor: pointer; font-weight: 500; transition: background var(--duration-fast) ease; }
.dropdown-item:hover { background: var(--hover-surface); }
.dropdown-item.active { background: var(--accent); color: var(--surface); }
.dropdown-item.destructive { color: var(--error); }
.dropdown-item.destructive:hover { background: #fef2f2; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dark); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-input { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; font-size: 13.5px; background: #fff; outline: none; color: var(--text-primary); transition: border-color var(--duration-fast) ease; }
.form-input:focus { border-color: var(--accent); }
.form-textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; background: #fff; outline: none; color: var(--text-primary); resize: vertical; min-height: 80px; font-family: inherit; transition: border-color var(--duration-fast) ease; }
.form-textarea:focus { border-color: var(--accent); }
.form-select { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; font-size: 13.5px; background: #fff; outline: none; color: var(--text-primary); appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a8478' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.btn-primary { height: 40px; padding: 0 20px; border-radius: 10px; background: var(--accent); color: var(--surface); font-size: 13.5px; font-weight: 500; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background var(--duration-fast) ease, transform var(--duration-fast) ease; }
.btn-primary:hover { background: #1f2937; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { height: 40px; padding: 0 20px; border-radius: 10px; background: var(--surface); color: var(--text-primary); font-size: 13.5px; font-weight: 500; border: 1px solid var(--border); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background var(--duration-fast) ease; }
.btn-secondary:hover { background: var(--hover-surface); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-ghost { height: 36px; padding: 0 12px; border-radius: 8px; background: transparent; color: var(--text-dark); font-size: 13px; font-weight: 500; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background var(--duration-fast) ease; }
.btn-ghost:hover { background: var(--hover-surface); }

/* ===== STATUS PILLS ===== */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 600; }
.status-pill.open { background: #f3f4f6; color: #6b7280; }
.status-pill.in_progress { background: #eff6ff; color: #2563eb; }
.status-pill.in_review { background: #faf5ff; color: #9333ea; }
.status-pill.done { background: #f0fdf4; color: #16a34a; }
.status-pill.closed { background: #f3f4f6; color: #6b7280; }
.status-pill.active { background: #f0fdf4; color: #16a34a; }
.status-pill.completed { background: #f3f4f6; color: #6b7280; }
.status-pill.planning { background: #eff6ff; color: #2563eb; }
.status-pill.released { background: #f0fdf4; color: #16a34a; }
.status-pill.unreleased { background: #eff6ff; color: #2563eb; }
.status-pill.archived { background: #f3f4f6; color: #6b7280; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-primary); }
.data-table tr:hover td { background: var(--hover-surface); }
.data-table tr { cursor: pointer; transition: background var(--duration-fast) ease; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text-primary); }

/* ===== LOGIN ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-container { width: 480px; text-align: center; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 32px; }
.login-logo .logo-mark { width: 42px; height: 42px; font-size: 24px; border-radius: 12px; }
.login-logo .logo-text { font-size: 22px; }
.login-title { font-family: var(--font-display); font-size: 28px; font-style: italic; color: var(--text-dark); margin-bottom: 8px; }
.login-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }
.user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.user-select-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; display: flex; align-items: center; gap: 12px; text-align: left; transition: all var(--duration-fast) ease; }
.user-select-card:hover { border-color: var(--border-warm); box-shadow: var(--shadow-elevated); transform: translateY(-1px); }
.user-select-card.selected { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 2px var(--accent); }
.user-select-card .ua { width: 36px; height: 36px; font-size: 12px; }
.user-select-card .user-info b { display: block; font-size: 13px; color: var(--text-primary); font-weight: 600; }
.user-select-card .user-info span { font-size: 11.5px; color: var(--text-secondary); }
.login-form { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; text-align: left; }
.login-form .form-group { margin-bottom: 14px; }
.login-form .btn-primary { width: 100%; justify-content: center; margin-top: 8px; }
.user-select-card:nth-child(5) { grid-column: 1 / -1; max-width: 50%; justify-self: center; width: 100%; }

/* ===== SECTION TITLES ===== */
.section-title { font-size: 18px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.section-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.page-padding { padding: 28px; }

/* ===== CARD GRID ===== */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; cursor: pointer; transition: all var(--duration-normal) var(--ease-out); box-shadow: var(--shadow-subtle); }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: var(--border-warm); }
.project-card .project-key { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); font-weight: 600; margin-bottom: 8px; }
.project-card .project-name { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.project-card .project-desc { font-size: 12.5px; color: var(--text-body); line-height: 1.5; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card .project-meta { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--text-secondary); }

/* ===== BACKLOG ===== */
.backlog-layout { display: flex; gap: 0; }
.backlog-sidebar-panel { width: 220px; border-right: 1px solid var(--border); padding: 20px 16px; flex-shrink: 0; }
.backlog-main { flex: 1; min-width: 0; }
.sprint-section { border-bottom: 1px solid var(--border); }
.sprint-section-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; cursor: pointer; transition: background var(--duration-fast) ease; }
.sprint-section-header:hover { background: var(--hover-surface); }
.sprint-section-header .sprint-info { display: flex; align-items: center; gap: 10px; }
.sprint-section-header .sprint-name { font-weight: 600; font-size: 14px; }
.sprint-section-header .sprint-meta { font-size: 12px; color: var(--text-secondary); }
.backlog-row { display: flex; align-items: center; gap: 10px; padding: 8px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--duration-fast) ease; font-size: 13px; }
.backlog-row:hover { background: var(--hover-surface); }
.backlog-row .drag-handle { color: var(--text-tertiary); cursor: grab; opacity: 0; transition: opacity var(--duration-fast) ease; }
.backlog-row:hover .drag-handle { opacity: 1; }
.backlog-row .issue-key-link { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; }
.backlog-row .issue-title-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); font-weight: 500; }
.backlog-row .issue-meta-info { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.bulk-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--surface); padding: 12px 24px; border-radius: 12px; display: flex; align-items: center; gap: 16px; font-size: 13px; font-weight: 500; box-shadow: 0 8px 32px rgba(0,0,0,.2); z-index: 50; }
.bulk-bar button { color: var(--surface); background: rgba(255,255,255,.15); border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 500; transition: background var(--duration-fast) ease; }
.bulk-bar button:hover { background: rgba(255,255,255,.25); }

/* ===== ISSUE DETAIL ===== */
.issue-detail { display: flex; gap: 0; min-height: calc(100vh - 64px); }
.issue-main { flex: 1; padding: 28px; min-width: 0; overflow-y: auto; }
.issue-sidebar { width: 320px; border-left: 1px solid var(--border); padding: 28px 20px; background: var(--surface); flex-shrink: 0; overflow-y: auto; }
.issue-title-display { font-size: 24px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.3; margin-bottom: 16px; cursor: text; padding: 4px 0; border-bottom: 2px solid transparent; transition: border-color var(--duration-fast) ease; }
.issue-title-display:hover { border-bottom-color: var(--border); }
.issue-title-input { font-size: 24px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.3; width: 100%; border: none; border-bottom: 2px solid var(--accent); outline: none; background: transparent; padding: 4px 0; margin-bottom: 16px; }
.field-group { margin-bottom: 20px; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.field-value { font-size: 13px; color: var(--text-primary); cursor: pointer; padding: 6px 10px; border-radius: 6px; transition: background var(--duration-fast) ease; display: flex; align-items: center; gap: 8px; }
.field-value:hover { background: var(--hover-surface); }
.comment-box { display: flex; gap: 12px; margin-top: 20px; }
.comment-box .comment-avatar { flex-shrink: 0; }
.comment-box .comment-input { flex: 1; }
.comment-box textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; min-height: 60px; resize: none; outline: none; font-family: inherit; transition: border-color var(--duration-fast) ease; }
.comment-box textarea:focus { border-color: var(--accent); }
.comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-item .comment-body { flex: 1; min-width: 0; }
.comment-item .comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-item .comment-author { font-weight: 600; font-size: 13px; }
.comment-item .comment-time { font-size: 11.5px; color: var(--text-secondary); }
.comment-item .comment-text { font-size: 13px; color: var(--text-body); line-height: 1.6; }
.subtask-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.subtask-row input[type="checkbox"] { accent-color: var(--accent); }
.activity-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.activity-tab { padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease; }
.activity-tab:hover { color: var(--text-primary); }
.activity-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.audit-entry { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-body); }
.audit-entry strong { color: var(--text-primary); font-weight: 600; }

/* ===== SPRINTS ===== */
.sprints-layout { display: flex; min-height: calc(100vh - 64px); }
.sprint-list-panel { width: 280px; border-right: 1px solid var(--border); background: var(--surface); flex-shrink: 0; overflow-y: auto; }
.sprint-detail-panel { flex: 1; padding: 28px; overflow-y: auto; }
.sprint-list-item { padding: 14px 18px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--duration-fast) ease; }
.sprint-list-item:hover { background: var(--hover-surface); }
.sprint-list-item.active { background: var(--hover-surface); border-left: 3px solid var(--accent); }
.sprint-list-item .sprint-item-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.sprint-list-item .sprint-item-meta { font-size: 12px; color: var(--text-secondary); }

/* ===== RELEASES ===== */
.release-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 16px; }
.release-card .release-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.release-card .release-name { font-size: 18px; font-weight: 600; }
.release-card .release-desc { font-size: 13px; color: var(--text-body); margin-bottom: 16px; }
.release-card .release-stats { display: flex; gap: 24px; margin-bottom: 16px; font-size: 12.5px; color: var(--text-secondary); }
.release-card .release-stats strong { color: var(--text-primary); }

/* ===== REPORTS ===== */
.report-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); padding: 0 28px; background: var(--surface); }
.report-tab { padding: 14px 18px; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease; }
.report-tab:hover { color: var(--text-primary); }
.report-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.chart-container { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }

/* ===== NOTIFICATIONS ===== */
.notification-row { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--duration-fast) ease; }
.notification-row:hover { background: var(--hover-surface); }
.notification-row.unread { background: #fefef9; }
.notification-row .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status-progress); flex-shrink: 0; }
.notification-row .unread-dot.read { background: transparent; }
.notification-row .notif-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notification-row .notif-content { flex: 1; min-width: 0; }
.notification-row .notif-text { font-size: 13px; color: var(--text-primary); }
.notification-row .notif-time { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

/* ===== ADMIN ===== */
.admin-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.admin-tab { padding: 12px 18px; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; }
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.config-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.config-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.permission-grid { display: grid; grid-template-columns: 160px repeat(5, 1fr); gap: 0; font-size: 12px; }
.permission-grid .pg-header { font-weight: 600; padding: 8px 12px; background: var(--hover-surface); border-bottom: 1px solid var(--border); }
.permission-grid .pg-cell { padding: 8px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.permission-grid .pg-label { justify-content: flex-start; font-weight: 500; }

/* ===== WORKFLOW DESIGNER ===== */
.workflow-graph { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 40px; min-height: 400px; display: flex; align-items: center; justify-content: center; }
.wf-node { background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: 14px 20px; text-align: center; cursor: pointer; transition: all var(--duration-fast) ease; min-width: 120px; }
.wf-node:hover { border-color: var(--accent); box-shadow: var(--shadow-elevated); }
.wf-node .wf-label { font-weight: 600; font-size: 13px; margin-top: 6px; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

.fade-in { animation: fadeIn var(--duration-slow) var(--ease-out); }
.slide-up { animation: slideUp var(--duration-slow) var(--ease-out); }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 6px; }
.gap-3 { gap: 8px; }
.gap-4 { gap: 10px; }
.gap-6 { gap: 14px; }
.gap-8 { gap: 18px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.font-mono { font-family: var(--font-mono); }
.mt-4 { margin-top: 10px; }
.mt-6 { margin-top: 14px; }
.mb-4 { margin-top: 10px; }
.mb-6 { margin-bottom: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ===== EMPTY STATE ===== */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.empty-state .empty-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.empty-state .empty-desc { font-size: 13px; color: var(--text-secondary); max-width: 320px; }

/* ===== INLINE EDIT ===== */
.inline-create { display: flex; align-items: center; gap: 10px; padding: 8px 20px; border-bottom: 1px solid var(--border); }
.inline-create input { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; outline: none; }
.inline-create input:focus { border-color: var(--accent); }

/* ===== CHECKBOX ===== */
input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* ===== TIME TRACKER ===== */
.time-track-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.time-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.time-bar-fill { height: 100%; background: var(--status-progress); border-radius: 3px; }
