/* ═══════════════════════════════════════════
   잇플(Itple) — Global Design System
   Benchmarked: Linear, Notion, Raycast
   Font: Plus Jakarta Sans + Pretendard + JetBrains Mono
═══════════════════════════════════════════ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ── TOKENS ── */
:root {
  /* Backgrounds */
  --bg-base:     #0B0F18;
  --bg-elevated: #131825;
  --bg-card:     #1A2035;
  --bg-hover:    #1E2740;
  --bg-active:   #243052;
  --bg-overlay:  rgba(0,0,0,0.65);

  /* Borders */
  --border-subtle:  rgba(255,255,255,0.05);
  --border-default: rgba(255,255,255,0.09);
  --border-strong:  rgba(255,255,255,0.16);

  /* Text */
  --text-primary:   #F1F5FB;
  --text-secondary: #8899B4;
  --text-tertiary:  #4E6080;
  --text-disabled:  #2D3A52;

  /* Accent — Green (성장, 긍정, 완료) */
  --green:        #10B981;
  --green-dim:    rgba(16,185,129,0.10);
  --green-border: rgba(16,185,129,0.25);
  --green-text:   #10B981;

  /* Accent — Blue (신뢰, 안정, 진행) */
  --blue:        #2563EB;
  --blue-dim:    rgba(37,99,235,0.10);
  --blue-border: rgba(37,99,235,0.25);

  /* Accent — Orange (주의, 리뷰) */
  --orange:        #F59E0B;
  --orange-dim:    rgba(245,158,11,0.10);
  --orange-border: rgba(245,158,11,0.25);

  /* Accent — Red (위험, 긴급) */
  --red:        #EF4444;
  --red-dim:    rgba(239,68,68,0.10);
  --red-border: rgba(239,68,68,0.25);

  /* Accent — Purple (AI, 창의, 분석) */
  --purple:        #7C3AED;
  --purple-dim:    rgba(124,58,237,0.10);
  --purple-border: rgba(124,58,237,0.25);

  /* Status */
  --status-todo:       #4E6080;
  --status-inprogress: #2563EB;
  --status-review:     #F59E0B;
  --status-done:       #10B981;
  --status-blocked:    #EF4444;

  /* Priority */
  --priority-urgent: #EF4444;
  --priority-high:   #F59E0B;
  --priority-medium: #2563EB;
  --priority-low:    #4E6080;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', 'Pretendard Variable', -apple-system, system-ui, sans-serif;
  --font-sans: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.2);

  /* Sidebar */
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;

  /* Z-index */
  --z-sidebar:  100;
  --z-header:   90;
  --z-modal:    200;
  --z-toast:    300;
  --z-tooltip:  400;
}

/* ── LIGHT MODE ── */
[data-theme="light"] {
  --bg-base:     #F7F8FA;
  --bg-elevated: #FFFFFF;
  --bg-card:     #FFFFFF;
  --bg-hover:    #F0F2F6;
  --bg-active:   #E6E9F0;
  --bg-overlay:  rgba(0,0,0,0.25);
  --border-subtle:  rgba(0,0,0,0.05);
  --border-default: rgba(0,0,0,0.09);
  --border-strong:  rgba(0,0,0,0.16);
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-tertiary:  #94A3B8;
  --text-disabled:  #CBD5E1;
  --green:        #059669;
  --green-dim:    rgba(5,150,105,0.08);
  --green-border: rgba(5,150,105,0.20);
  --green-text:   #059669;
  --blue:        #1D4ED8;
  --blue-dim:    rgba(29,78,216,0.08);
  --blue-border: rgba(29,78,216,0.20);
  --orange:        #D97706;
  --orange-dim:    rgba(217,119,6,0.08);
  --orange-border: rgba(217,119,6,0.20);
  --red:        #DC2626;
  --red-dim:    rgba(220,38,38,0.08);
  --red-border: rgba(220,38,38,0.20);
  --purple:        #6D28D9;
  --purple-dim:    rgba(109,40,217,0.08);
  --purple-border: rgba(109,40,217,0.20);
  --status-todo:       #94A3B8;
  --status-inprogress: #1D4ED8;
  --status-review:     #D97706;
  --status-done:       #059669;
  --status-blocked:    #DC2626;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.05);
}
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }
[data-theme="light"] .code-chip { background: #F0F2F5; border-color: rgba(0,0,0,0.1); color: #1A1D23; }
[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea { background: #FFFFFF; border-color: rgba(0,0,0,0.12); color: #1A1D23; }
[data-theme="light"] .form-input::placeholder,
[data-theme="light"] .form-textarea::placeholder { color: #B0B8C8; }
[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus { border-color: var(--green-border); box-shadow: 0 0 0 3px rgba(0,184,107,0.1); }
[data-theme="light"] .btn-primary { background: linear-gradient(135deg, var(--green), #059669); color: #FFFFFF; }
[data-theme="light"] .btn-secondary { background: #FFFFFF; border-color: rgba(0,0,0,0.12); color: #1A1D23; }
[data-theme="light"] .btn-ghost:hover { background: #F0F2F5; }
[data-theme="light"] .chat-message.self .chat-bubble { background: rgba(0,184,107,0.1); border-color: rgba(0,184,107,0.2); }
[data-theme="light"] .chat-message.other .chat-bubble { background: #F0F2F5; border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .chat-message.ai .chat-bubble { background: rgba(124,58,237,0.06); border-color: rgba(124,58,237,0.15); }
[data-theme="light"] .chat-input { background: #FFFFFF; border-color: rgba(0,0,0,0.12); color: #1A1D23; }
[data-theme="light"] .toast { background: #FFFFFF; border-color: rgba(0,0,0,0.1); box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
[data-theme="light"] .modal { background: #FFFFFF; border-color: rgba(0,0,0,0.1); box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
[data-theme="light"] [data-tooltip]::after { background: #FFFFFF; border-color: rgba(0,0,0,0.1); color: #1A1D23; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

::selection { background: rgba(16,185,129,0.2); color: var(--text-primary); }

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-sans); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-sans); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
code, kbd, pre { font-family: var(--font-mono); }

/* ── TYPOGRAPHY ── */
.t-display { font-family: var(--font-display); font-size: 2.5rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.t-h1      { font-family: var(--font-display); font-size: 1.875rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
.t-h2      { font-family: var(--font-display); font-size: 1.5rem;   font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.t-h3      { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.4; }
.t-h4      { font-family: var(--font-display); font-size: 0.9375rem; font-weight: 600; line-height: 1.5; }
.t-body    { font-size: 0.9375rem; font-weight: 400; line-height: 1.7; }
.t-small   { font-size: 0.8125rem; font-weight: 400; line-height: 1.6; }
.t-tiny    { font-size: 0.75rem;   font-weight: 400; line-height: 1.5; }
.t-label   { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.t-mono    { font-family: var(--font-mono); font-size: 0.875rem; }
.t-mono-sm { font-family: var(--font-mono); font-size: 0.75rem; }

.c-primary   { color: var(--text-primary); }
.c-secondary { color: var(--text-secondary); }
.c-tertiary  { color: var(--text-tertiary); }
.c-green     { color: var(--green); }
.c-blue      { color: var(--blue); }
.c-orange    { color: var(--orange); }
.c-red       { color: var(--red); }
.c-purple    { color: var(--purple); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 8px 18px; border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 0.875rem; font-weight: 500; line-height: 1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap; cursor: pointer;
  position: relative; overflow: hidden;
}
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn:active { transform: scale(0.97); }
.btn-sm  { padding: 5px 12px; font-size: 0.8125rem; }
.btn-lg  { padding: 11px 22px; font-size: 0.9375rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-md); }
.btn-icon.btn-sm { width: 26px; height: 26px; }

.btn-primary {
  background: linear-gradient(135deg, var(--green), #0EA572);
  color: white; font-weight: 600;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); opacity: 1; }

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

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

.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-border); }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-icon-only {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md); color: var(--text-tertiary);
}
.btn-icon-only:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── FORM ELEMENTS ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 9px 13px;
  color: var(--text-primary); font-size: 0.9375rem; font-family: var(--font-sans);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-tertiary); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12), 0 1px 2px rgba(0,0,0,0.05);
}
.form-select { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-helper { font-size: 0.75rem; color: var(--text-tertiary); }
.form-error  { font-size: 0.75rem; color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* ── CARDS ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: var(--space-5);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-sm { padding: var(--space-4); border-radius: var(--radius-md); }
.card:hover { border-color: var(--border-default); box-shadow: var(--shadow-sm); }
.card-clickable { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.card-clickable:hover { background: var(--bg-hover); border-color: var(--border-default); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
  font-family: var(--font-display);
}
.badge-green  { background: var(--green-dim);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue);   border: 1px solid var(--blue-border); }
.badge-orange { background: var(--orange-dim); color: var(--orange); border: 1px solid var(--orange-border); }
.badge-red    { background: var(--red-dim);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid var(--purple-border); }
.badge-gray   { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border-default); }

/* Status badges */
.badge-todo       { background: rgba(74,88,128,0.15); color: var(--status-todo);       border: 1px solid rgba(74,88,128,0.3); }
.badge-inprogress { background: var(--blue-dim);      color: var(--status-inprogress); border: 1px solid var(--blue-border); }
.badge-review     { background: var(--orange-dim);    color: var(--status-review);     border: 1px solid var(--orange-border); }
.badge-done       { background: var(--green-dim);     color: var(--status-done);       border: 1px solid var(--green-border); }
.badge-blocked    { background: var(--red-dim);       color: var(--status-blocked);    border: 1px solid var(--red-border); }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--border-subtle); margin: var(--space-4) 0; }
.divider-label {
  display: flex; align-items: center; gap: var(--space-3);
  color: var(--text-tertiary); font-size: 0.75rem;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border-subtle);
}

/* ── AVATAR ── */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-active); border: 1px solid var(--border-default);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--text-secondary);
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-lg { width: 40px; height: 40px; font-size: 0.875rem; }
.avatar-green  { background: var(--green-dim);  color: var(--green);  border-color: var(--green-border); }
.avatar-blue   { background: var(--blue-dim);   color: var(--blue);   border-color: var(--blue-border); }
.avatar-orange { background: var(--orange-dim); color: var(--orange); border-color: var(--orange-border); }
.avatar-purple { background: var(--purple-dim); color: var(--purple); border-color: var(--purple-border); }

/* ── CODE CHIP ── */
.code-chip {
  font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 700;
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  color: var(--text-primary); letter-spacing: 0.05em;
  display: inline-block;
}
.code-chip-green  { background: var(--green-dim);  color: var(--green);  border-color: var(--green-border); }
.code-chip-blue   { background: var(--blue-dim);   color: var(--blue);   border-color: var(--blue-border); }
.code-chip-orange { background: var(--orange-dim); color: var(--orange); border-color: var(--orange-border); }

/* ── PROGRESS BAR ── */
.progress-bar { height: 6px; background: var(--bg-active); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--green), #0EA572); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 0 8px rgba(16,185,129,0.3); }
.progress-fill.blue   { background: var(--blue); }
.progress-fill.orange { background: var(--orange); }

/* ── TOOLTIP ── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border-default);
  color: var(--text-primary); font-size: 0.75rem; padding: 4px 8px;
  border-radius: var(--radius-sm); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  z-index: var(--z-tooltip);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── ANIMATIONS ── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.animate-up { animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes slideIn  { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin     { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes shimmer  { from { transform: translateX(-100%); } to { transform: translateX(200%); } }

.animate-fade    { animation: fadeIn  0.2s ease; }
.animate-up      { animation: slideUp 0.25s ease; }
.animate-in      { animation: slideIn 0.2s ease; }
.animate-pulse   { animation: pulse 2s infinite; }
.animate-spin    { animation: spin 1s linear infinite; }

/* ── UTILITY ── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); } .gap-5 { gap: var(--space-5); } .gap-6 { gap: var(--space-6); }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-end   { justify-content: flex-end; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden  { display: none !important; }
.visible { visibility: visible; }
.mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); } .mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); } .mb-6 { margin-bottom: var(--space-6); }
.p-0 { padding: 0; }
.text-center { text-align: center; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.opacity-50 { opacity: 0.5; }
.rounded-full { border-radius: var(--radius-full); }
