/* ═══════════════ BUTTONS ═══════════════ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.15s,
    opacity 0.15s;
}
.btn-primary:hover {
  background: var(--accent2);
}
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s;
}
.btn-secondary:hover {
  border-color: var(--accent);
}
.btn-ghost {
  background: none;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border2);
  background: var(--surface2);
}
.btn-danger {
  background: rgba(255, 80, 80, 0.1);
  color: var(--red);
  border: 1px solid rgba(255, 80, 80, 0.3);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
}
.btn-danger:hover {
  background: rgba(255, 80, 80, 0.2);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ═══════════════ MODALS ═══════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay[hidden] {
  display: none;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-wide {
  max-width: 1000px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover {
  color: var(--text);
}
.modal-body {
  padding: 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ═══════════════ FORM FIELDS ═══════════════ */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin-bottom: 6px;
}
.field-label.mt {
  margin-top: 16px;
}
.field-input,
.field-textarea,
.field-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus {
  border-color: var(--accent);
}
.field-textarea {
  resize: vertical;
}
.field-select {
  cursor: pointer;
}
.field-color {
  width: 60px;
  height: 36px;
  padding: 2px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
}
.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

/* ═══════════════ TASK DETAIL ═══════════════ */
.task-detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}
.task-detail-sidebar {
  border-left: 1px solid var(--border);
  padding-left: 20px;
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text3);
  margin-bottom: 12px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}
.history-entry {
  font-size: 12px;
  border-left: 2px solid var(--border2);
  padding-left: 10px;
}
.history-entry .he-action {
  color: var(--text);
  font-weight: 500;
}
.history-entry .he-actor {
  color: var(--accent2);
}
.history-entry .he-time {
  color: var(--text3);
  font-size: 11px;
}
.history-entry .he-detail {
  color: var(--text2);
  font-size: 11px;
  margin-top: 2px;
}

.comments-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.comment-item {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.comment-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.comment-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent2);
}
.comment-time {
  font-size: 11px;
  color: var(--text3);
}
.comment-body {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ═══════════════ COLUMNS MANAGE ═══════════════ */
.columns-manage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.col-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.col-manage-item .drag-handle {
  color: var(--text3);
  cursor: grab;
  font-size: 14px;
}
.col-manage-item .col-name-edit {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
}
.col-manage-item .col-name-edit:focus {
  color: var(--accent2);
}
.col-manage-item .btn-del-col {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 14px;
  transition: color 0.15s;
}
.col-manage-item .btn-del-col:hover {
  color: var(--red);
}
.column-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.hint {
  font-size: 11px;
  color: var(--text3);
}

/* ═══════════════ TOAST ═══════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 200;
  animation: toast-in 0.2s ease;
}
.toast[hidden] {
  display: none;
}
.toast.success {
  border-color: var(--green);
  color: var(--green);
}
.toast.error {
  border-color: var(--red);
  color: var(--red);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════ PROFILE MENU ═══════════════ */
.profile-menu { position: relative; }
.profile-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.profile-avatar:hover { background: var(--accent2); }
.profile-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: 220px; background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  overflow: hidden;
}
.profile-dropdown-header { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.profile-name { font-size: 13px; font-weight: 600; color: var(--text); }
.profile-email { font-size: 12px; color: var(--text3); margin-top: 1px; }
.profile-role {
  display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; color: var(--accent2);
  background: rgba(124,107,255,0.12); padding: 1px 7px; border-radius: 20px;
}
.profile-dropdown-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text2); font-size: 13px; padding: 10px 14px; transition: background 0.15s, color 0.15s;
}
.profile-dropdown-item:hover { background: var(--surface2); color: var(--text); }
.profile-logout { color: var(--red); border-top: 1px solid var(--border); }
.profile-logout:hover { background: rgba(255,80,80,0.1); color: var(--red); }

/* ═══════════════ SETTINGS PAGE ═══════════════ */
.settings-main { padding: 24px 28px; max-width: 760px; margin: 0 auto; overflow-y: auto; }
.settings-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.settings-tab {
  padding: 10px 4px; margin-right: 20px; font-size: 13px; font-weight: 500; color: var(--text3);
  border-bottom: 2px solid transparent; background: none; border-left: none; border-right: none; border-top: none;
}
.settings-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.settings-section { margin-bottom: 36px; }
.settings-section h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.settings-section .settings-sub { font-size: 12px; color: var(--text3); margin-bottom: 16px; }

.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px;
}
.list-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row-title { font-size: 13px; font-weight: 600; color: var(--text); }
.list-row-sub { font-size: 11px; color: var(--text3); font-family: 'JetBrains Mono', monospace; }
.list-row-badge {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text3); background: var(--surface); padding: 2px 8px; border-radius: 20px; flex-shrink: 0;
}
.list-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 4px; }
.inline-form .field-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }

.token-reveal {
  background: var(--surface2); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px; font-size: 12px;
}
.token-reveal .token-value {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent2);
  word-break: break-all; margin: 6px 0; display: block;
}

@media (max-width: 768px) {
  .settings-main { padding: 16px; }
  .list-row { flex-direction: column; align-items: flex-start; }
  .list-row-actions { width: 100%; justify-content: flex-end; }
}
