/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn .icon { width: 15px; height: 15px; flex-shrink: 0; }

/* Primary */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-white);
  color: var(--text-dark);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: #B3BAC5;
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-medium);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-dark);
}

/* Icon-only button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-medium);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-dark);
}
.btn-icon .icon { width: 17px; height: 17px; }

/* Submit – stands out with large, green, pulsing CTA */
.btn-submit {
  background: #0052CC;
  color: #fff;
  border-color: #0052CC;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0,82,204,.35);
}
.btn-submit:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(0,82,204,.45);
}

/* Small */
.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

/* ─── "Not saved yet" indicator ─────────────────────────────────────────── */
.unsaved-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--danger-light);
  border: 1px solid #FFBDAD;
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  margin-bottom: 16px;
  animation: pulse-border 1.8s ease-in-out infinite;
}
.unsaved-indicator .icon { width: 15px; height: 15px; flex-shrink: 0; }
.unsaved-indicator.hidden { display: none; }

@keyframes pulse-border {
  0%, 100% { border-color: #FFBDAD; }
  50%       { border-color: var(--danger); }
}

/* ─── Form controls ──────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group:last-child { margin-bottom: 0; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  background: var(--bg-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(76,154,255,.2);
}

input::placeholder,
textarea::placeholder { color: var(--text-placeholder); }

textarea { resize: vertical; min-height: 80px; }

.input-with-icon {
  position: relative;
}
.input-with-icon input { padding-left: 36px; }
.input-with-icon .icon-prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.input-with-action {
  position: relative;
}
.input-with-action input { padding-right: 40px; }
.input-with-action .btn-input-action {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 2px;
  border-radius: var(--radius-sm);
}
.input-with-action .btn-input-action:hover { color: var(--text-dark); }
.input-with-action .btn-input-action .icon { width: 16px; height: 16px; }

/* ─── Duration Picker ────────────────────────────────────────────────────── */
.duration-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.duration-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.duration-preset-btn {
  padding: 5px 12px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: var(--bg-white);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-medium);
  cursor: pointer;
  transition: all var(--transition);
}
.duration-preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.duration-preset-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.duration-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
}

.duration-stepper-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--bg-hover);
  cursor: pointer;
  font-size: 20px;
  font-weight: 300;
  color: var(--text-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.duration-stepper-btn:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary);
}
.duration-stepper-btn:disabled { opacity: .4; cursor: not-allowed; }

.duration-display {
  min-width: 80px;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  padding: 0 12px;
  background: var(--bg-white);
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 2px solid var(--border);
  border-right: 2px solid var(--border);
}

/* ─── Issue Selector Dropdown ────────────────────────────────────────────── */
.issue-selector-wrapper {
  position: relative;
}

.issue-selector-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-white);
  transition: border-color var(--transition);
  min-height: 42px;
}
.issue-selector-display:hover { border-color: var(--border-focus); }
.issue-selector-display.open  { border-color: var(--border-focus); }

.issue-selector-placeholder { color: var(--text-placeholder); font-size: 14px; }

.issue-selector-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 2px solid var(--border-focus);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 200;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.issue-selector-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.issue-selector-search input {
  width: 100%;
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 13px;
}

.issue-selector-list {
  overflow-y: auto;
  flex: 1;
}

.issue-selector-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 13px;
}
.issue-selector-item:hover { background: var(--bg-hover); }
.issue-selector-item.selected { background: var(--primary-light); }

/* ─── Issue Badge / Chip ─────────────────────────────────────────────────── */
.issue-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.issue-key {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  font-family: monospace;
}

.issue-summary {
  font-size: 13px;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Status Badge ───────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.status-badge.todo        { background: #DFE1E6; color: #42526E; }
.status-badge.in-progress { background: #DEEBFF; color: #0052CC; }
.status-badge.done        { background: #E3FCEF; color: #006644; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

/* ─── Progress bar ───────────────────────────────────────────────────────── */
.progress-bar-track {
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width .4s ease;
}
.progress-bar-fill.over  { background: var(--warning); }
.progress-bar-fill.exact { background: var(--success); }

/* ─── Toggle switch (filter mine/all) ───────────────────────────────────── */
.toggle-group {
  display: flex;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-white);
}

.toggle-btn {
  flex: 1;
  padding: 6px 14px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-medium);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.toggle-btn.active {
  background: var(--primary);
  color: #fff;
}
.toggle-btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-dark);
}

/* ─── Tooltip ────────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-dark);
  color: #fff;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 10000;
}
[data-tooltip]:hover::after { opacity: 1; }

/* Tooltip below – used for items near the top of the viewport (header buttons) */
#app-header [data-tooltip]::after {
  bottom: auto;
  top: calc(100% + 6px);
}

/* ─── Scrollbar style ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #B3BAC5; }
