:root {
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --gradient-sidebar: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  --bg: #f0f2f8;
  --surface: #ffffff;
  --surface-hover: #f7f8fc;
  --border: #e2e5f1;
  --text: #1e1e2f;
  --text-secondary: #6b7085;
  --text-muted: #9ca3b8;
  --primary: #6C63FF;
  --primary-light: #8B85FF;
  --primary-bg: rgba(108, 99, 255, 0.08);
  --danger: #f5576c;
  --danger-bg: rgba(245, 87, 108, 0.08);
  --success: #43e97b;
  --success-bg: rgba(67, 233, 123, 0.1);
  --warning: #fee140;
  --shadow-sm: 0 1px 3px rgba(30, 30, 47, 0.06);
  --shadow: 0 4px 16px rgba(30, 30, 47, 0.08);
  --shadow-lg: 0 8px 32px rgba(30, 30, 47, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-1);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-icon {
  width: 80px; height: 80px;
  background: var(--gradient-1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.35);
}

.login-title {
  font-size: 24px; font-weight: 700; margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary); margin-bottom: 32px; font-size: 14px;
}

.input-group {
  position: relative; margin-bottom: 16px;
}

.input-group input {
  width: 100%; padding: 14px 48px 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.toggle-pass {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px; display: flex;
}

.error-msg {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.45);
  transform: translateY(-1px);
}

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

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

.btn-bugfix {
  background: linear-gradient(135deg, #ff6b6b 0%, #ffa36b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}
.btn-bugfix:hover {
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.45);
  transform: translateY(-1px);
}

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

.app {
  display: flex; height: 100vh;
}

.sidebar {
  width: 280px; min-width: 280px;
  background: var(--gradient-sidebar);
  color: white;
  display: flex; flex-direction: column;
  box-shadow: 4px 0 24px rgba(102, 126, 234, 0.2);
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-logo {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}

.sidebar-header .btn-icon {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.12);
}
.sidebar-header .btn-icon:hover {
  background: rgba(255,255,255,0.25);
  color: white;
}

.projects-list {
  flex: 1; overflow-y: auto; padding: 12px;
}

.project-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  margin-bottom: 4px; position: relative;
}

.project-item:hover { background: rgba(255,255,255,0.12); }
.project-item.active { background: rgba(255,255,255,0.22); }

.project-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.project-item-name {
  flex: 1; font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.project-item-badge {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.sidebar-footer .btn-ghost {
  color: rgba(255,255,255,0.7);
}
.sidebar-footer .btn-ghost:hover {
  background: rgba(255,255,255,0.12);
  color: white;
}

.main-content {
  flex: 1; overflow-y: auto; padding: 32px;
}

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; text-align: center; color: var(--text-muted);
}
.empty-icon {
  margin-bottom: 16px; opacity: 0.4;
}
.empty-state h2 { font-size: 20px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

.empty-state-sm {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted); font-size: 14px;
}

.project-view { max-width: 1100px; }

.project-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}

.project-header-left {
  display: flex; align-items: center; gap: 12px;
}

.project-color-dot {
  width: 16px; height: 16px; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.project-header h1 {
  font-size: 26px; font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.25);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.project-header-right {
  display: flex; align-items: center; gap: 12px;
}

.stats {
  display: flex; gap: 16px;
}

.stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 16px; background: var(--primary-bg);
  border-radius: var(--radius-sm);
}
.stat-value { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.tabs {
  display: flex; gap: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition);
}
.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab.active {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.tab-content { animation: fadeIn 0.3s ease; }

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

#calendarTab {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

.calendar-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0;
}

.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-nav h3 {
  font-size: 16px; font-weight: 700;
}

.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; margin-bottom: 8px;
}
.calendar-weekdays span {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  padding: 4px 0;
}

.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
  position: relative;
}
.cal-day:hover { background: var(--primary-bg); }
.cal-day.today {
  background: var(--primary-bg);
  font-weight: 700; color: var(--primary);
}
.cal-day.selected {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.35);
}
.cal-day.other-month { color: var(--text-muted); opacity: 0.4; }
.cal-day.has-tasks::after {
  content: '';
  position: absolute; bottom: 3px;
  width: 5px; height: 5px;
  background: var(--primary);
  border-radius: 50%;
}
.cal-day.selected.has-tasks::after { background: white; }

.tasks-section {
  min-height: 300px;
}

.tasks-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}

.tasks-header-btns {
  display: flex; align-items: center; gap: 8px;
}

.tasks-toggle {
  display: flex; background: var(--bg); border-radius: var(--radius-sm);
  overflow: hidden; border: 1px solid var(--border);
}

.toggle-opt {
  padding: 6px 14px; border: none; background: transparent;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.toggle-opt:hover { color: var(--text-secondary); }
.toggle-opt.active { background: var(--primary); color: white; }
.toggle-opt.active.bug-active { background: linear-gradient(135deg, #ff6b6b 0%, #ffa36b 100%); }

.tasks-header h3 {
  font-size: 18px; font-weight: 700;
}

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

.task-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border-left: 4px solid var(--primary);
}
.task-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.task-card.completed {
  border-left-color: var(--success);
  opacity: 0.7;
}
.task-card.bug-card {
  border-left-color: #ff6b6b;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}
.task-card.bug-card.completed {
  border-left-color: #ff6b6b;
  opacity: 0.7;
}
.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-card-header {
  display: flex; align-items: center; gap: 12px;
}

.task-checkbox {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  background: var(--surface);
}
.task-checkbox:hover { border-color: var(--primary); }
.task-checkbox.checked {
  background: var(--gradient-4);
  border-color: #43e97b;
}
.task-checkbox.checked svg { display: block; }
.task-checkbox svg { display: none; }

.task-title {
  flex: 1; font-size: 15px; font-weight: 600;
}

.task-actions {
  display: flex; gap: 4px;
}

.task-desc {
  margin-top: 8px; padding-left: 34px;
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.5;
}

.desc-heading {
  font-size: 14px; font-weight: 700;
  color: var(--primary);
  margin-top: 10px;
  margin-bottom: 2px;
  line-height: 1.4;
}

.desc-heading-lg {
  font-size: 15px; font-weight: 800;
  color: var(--text);
  margin-top: 12px;
  margin-bottom: 4px;
  line-height: 1.4;
}

.desc-line {
  margin-top: 2px;
  line-height: 1.6;
}

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

.creds-header h3 { font-size: 18px; font-weight: 700; }

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

.cred-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.cred-card:hover { box-shadow: var(--shadow); }

.cred-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.cred-service {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}

.cred-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

.cred-field {
  background: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  position: relative;
}

.cred-field-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.cred-field-value {
  font-size: 14px; font-weight: 500;
  word-break: break-all;
  display: flex; align-items: center; justify-content: space-between;
}

.cred-copy {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px;
  transition: var(--transition);
}
.cred-copy:hover { color: var(--primary); }

.cred-notes {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-secondary);
}

.fab {
  position: fixed;
  bottom: 32px; right: 32px;
  width: 56px; height: 56px;
  background: var(--gradient-2);
  border: none; border-radius: 50%;
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(245, 87, 108, 0.4);
  transition: var(--transition);
  z-index: 50;
}
.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(245, 87, 108, 0.5);
}

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 30, 47, 0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%; max-width: 500px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}

.modal h2 {
  font-size: 20px; font-weight: 700; margin-bottom: 24px;
}

.modal-field {
  margin-bottom: 16px;
}

.modal-field label {
  display: block;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-field input,
.modal-field textarea,
.modal-field select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px;
  transition: var(--transition);
  outline: none;
  background: var(--surface);
}

.modal-field input:focus,
.modal-field textarea:focus,
.modal-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.modal-field textarea {
  resize: vertical; min-height: 80px;
}

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px;
}

.modal-colors {
  display: flex; gap: 8px; flex-wrap: wrap;
}

.color-option {
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; border: 3px solid transparent;
  transition: var(--transition);
}
.color-option:hover { transform: scale(1.15); }
.color-option.selected { border-color: var(--text); }

.project-edit-input {
  font-size: 26px; font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border: none; border-bottom: 2px solid var(--primary);
  outline: none; padding: 0 0 4px;
  font-family: inherit;
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text);
  color: white; padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 30, 47, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 150;
}

.confirm-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
}

.confirm-box h3 { margin-bottom: 12px; font-size: 18px; }
.confirm-box p { color: var(--text-secondary); margin-bottom: 24px; font-size: 14px; }
.confirm-box .confirm-actions { display: flex; gap: 10px; justify-content: center; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; min-width: 100%;
    max-height: 200px;
  }
  #calendarTab {
    grid-template-columns: 1fr;
  }
  .calendar-section { position: static; }
  .main-content { padding: 16px; }
  .project-header { flex-direction: column; align-items: flex-start; }
  .cred-fields { grid-template-columns: 1fr; }
}
