/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
input, select, textarea, button {
  font-family: inherit;
  font-size: 1rem;
}

/* === Login === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.login-container {
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.login-logo {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #C5A572;
  margin-bottom: 0.25rem;
}
.login-subtitle {
  font-size: 0.875rem;
  color: #888;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}
.login-form input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  outline: none;
}
.login-form input:focus {
  border-color: #C5A572;
}
.login-form button {
  display: block;
  width: 100%;
  padding: 14px;
  background: #C5A572;
  color: #0a0a0a;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.login-form button:active { opacity: 0.8; }
.login-error {
  margin-top: 12px;
  color: #ef4444;
  font-size: 0.875rem;
}

/* === Header === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #111;
  border-bottom: 1px solid #222;
  padding: 12px 16px 8px;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.header-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #C5A572;
}
.header-countdown {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}
.header-countdown .days {
  font-size: 1.5rem;
  font-weight: 700;
  color: #C5A572;
  display: block;
  line-height: 1;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #888;
}
.btn-icon {
  background: none;
  border: none;
  color: #666;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
}
.btn-icon:active { color: #ef4444; }
.header-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-bar {
  flex: 1;
  height: 4px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #C5A572;
  border-radius: 2px;
  transition: width 0.3s;
}
.progress-text {
  font-size: 0.75rem;
  color: #888;
  white-space: nowrap;
}

/* === Filters === */
.filters {
  position: sticky;
  top: 72px;
  z-index: 99;
  background: #0a0a0a;
  padding: 8px 16px;
  border-bottom: 1px solid #1a1a1a;
}
.filter-blocks {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.filter-blocks::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #999;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.filter-btn.active {
  background: #C5A572;
  color: #0a0a0a;
  border-color: #C5A572;
  font-weight: 600;
}
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.filter-statuses {
  display: flex;
  gap: 4px;
}
.filter-pill {
  padding: 4px 10px;
  background: none;
  border: 1px solid #333;
  border-radius: 12px;
  color: #888;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}
.filter-pill.active {
  border-color: #C5A572;
  color: #C5A572;
}
.filter-mine {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #888;
  cursor: pointer;
  white-space: nowrap;
}
.filter-mine input {
  accent-color: #C5A572;
}

/* === Task List === */
.task-list {
  padding: 0 16px 100px;
}
.block-section {
  margin-top: 16px;
}
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  cursor: pointer;
  user-select: none;
}
.block-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #C5A572;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.block-count {
  font-size: 0.75rem;
  color: #666;
}
.block-progress {
  width: 60px;
  height: 3px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
  margin-left: 8px;
}
.block-progress-fill {
  height: 100%;
  background: #C5A572;
  border-radius: 2px;
}

/* === Task Card === */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: #1a1a1a;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.task-card:active { background: #222; }
.task-card.priority-P0 { border-left-color: #ef4444; }
.task-card.priority-P1 { border-left-color: #f59e0b; }
.task-card.priority-P2 { border-left-color: #3b82f6; }
.task-card.priority-P3 { border-left-color: #6b7280; }
.task-card.status-done {
  opacity: 0.5;
  border-left-color: #22c55e;
}
.task-card.status-blocked {
  opacity: 0.6;
}
.task-card.is-blocked {
  opacity: 0.5;
  border-left-style: dashed;
}

.task-checkbox {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #444;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  padding: 0;
}
.task-checkbox.checked {
  background: #22c55e;
  border-color: #22c55e;
}
.task-checkbox.checked::after {
  content: '\2713';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.task-checkbox.blocked {
  border-color: #555;
  border-style: dashed;
  cursor: not-allowed;
}

.task-body {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-size: 0.9rem;
  line-height: 1.3;
  word-break: break-word;
}
.task-card.status-done .task-title {
  text-decoration: line-through;
  color: #666;
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.7rem;
}
.task-priority {
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.65rem;
}
.task-priority.P0 { background: #ef444433; color: #ef4444; }
.task-priority.P1 { background: #f59e0b33; color: #f59e0b; }
.task-priority.P2 { background: #3b82f633; color: #3b82f6; }
.task-priority.P3 { background: #6b728033; color: #6b7280; }
.task-deadline {
  color: #888;
}
.task-deadline.overdue {
  color: #ef4444;
  font-weight: 600;
}
.task-assignee {
  color: #C5A572;
}
.task-dep {
  color: #666;
  font-style: italic;
}
.task-urgency {
  padding: 1px 6px;
  border-radius: 3px;
  background: #ef444422;
  color: #ef4444;
  font-weight: 500;
}

/* === FAB === */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #C5A572;
  color: #0a0a0a;
  border: none;
  font-size: 2rem;
  font-weight: 300;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(197, 165, 114, 0.3);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.fab:active { transform: scale(0.9); }

/* === Overlay & Panel === */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
}
.overlay.active { display: block; }
.panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  background: #151515;
  border-radius: 16px 16px 0 0;
  z-index: 300;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.panel.open {
  transform: translateY(0);
}
.panel-handle {
  width: 40px;
  height: 4px;
  background: #444;
  border-radius: 2px;
  margin: 10px auto;
}
.panel-content {
  padding: 0 20px 32px;
}
.panel-content h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: #e0e0e0;
}

/* === Detail Panel === */
.detail-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}
.detail-desc {
  font-size: 0.875rem;
  color: #999;
  margin-bottom: 16px;
  line-height: 1.5;
}
.detail-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-field label {
  display: block;
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.detail-field select,
.detail-field input {
  width: 100%;
  padding: 8px 10px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.85rem;
}
.detail-field select:focus,
.detail-field input:focus {
  border-color: #C5A572;
  outline: none;
}
.detail-dep {
  padding: 8px 12px;
  background: #1a1a1a;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 16px;
}
.detail-dep.blocked {
  border: 1px dashed #ef4444;
  color: #ef4444;
}
.detail-dep.done {
  border: 1px solid #22c55e33;
  color: #22c55e;
}
.detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* === Comments === */
.comments-section {
  border-top: 1px solid #222;
  padding-top: 16px;
}
.comments-title {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.comment {
  padding: 8px 0;
  border-bottom: 1px solid #1a1a1a;
}
.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 4px;
}
.comment-author { color: #C5A572; font-weight: 500; }
.comment-date { color: #555; }
.comment-text {
  font-size: 0.85rem;
  color: #ccc;
  line-height: 1.4;
  white-space: pre-wrap;
}
.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.comment-form input {
  flex: 1;
  padding: 10px 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.85rem;
  outline: none;
}
.comment-form input:focus { border-color: #C5A572; }
.comment-form button {
  padding: 10px 16px;
  background: #C5A572;
  color: #0a0a0a;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

/* === Buttons === */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: #C5A572;
  color: #0a0a0a;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 8px;
}
.btn-primary:active { opacity: 0.8; }
.btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  background: #1a1a1a;
  color: #888;
  border: 1px solid #333;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}
.btn-done {
  flex: 1;
  padding: 10px;
  background: #22c55e22;
  color: #22c55e;
  border: 1px solid #22c55e44;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
}
.btn-done.is-done {
  background: #22c55e;
  color: #fff;
}
.btn-delete {
  padding: 10px 16px;
  background: #ef444422;
  color: #ef4444;
  border: 1px solid #ef444444;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-status {
  flex: 1;
  padding: 10px;
  background: #3b82f622;
  color: #3b82f6;
  border: 1px solid #3b82f644;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
}

/* === Forms === */
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #C5A572;
}
.form-group textarea {
  resize: vertical;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #555;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: #333;
  color: #e0e0e0;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background: #ef4444; color: #fff; }

/* === Responsive === */
@media (min-width: 768px) {
  .task-list { max-width: 720px; margin: 0 auto; }
  .filters { max-width: 720px; margin: 0 auto; padding-left: 0; padding-right: 0; }
  .panel { max-width: 480px; left: 50%; transform: translate(-50%, 100%); }
  .panel.open { transform: translate(-50%, 0); }
}
