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

:root {
  --bg: #f4f5f7;
  --column-bg: #ebecf0;
  --column-hover: #dde0e8;
  --card-bg: #ffffff;
  --text: #172b4d;
  --text-muted: #6b778c;
  --border: #dfe1e6;
  --primary: #0052cc;
  --primary-hover: #0065ff;
  --danger: #de350b;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.25);
  --radius: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

#add-ticket-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

#add-ticket-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Board ── */

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  align-items: start;
}

/* ── Column ── */

.column {
  background: var(--column-bg);
  border-radius: var(--radius);
  padding: 12px;
  transition: background 0.15s;
}

.column.drag-over {
  background: var(--column-hover);
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.column-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.count {
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  padding: 2px 7px;
  border-radius: 20px;
  text-align: center;
}

/* ── Ticket list drop zone ── */

.ticket-list {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Ticket card ── */

.ticket {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px 32px 12px 12px;
  box-shadow: var(--shadow-card);
  cursor: grab;
  position: relative;
  transition: box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}

.ticket:hover {
  box-shadow: var(--shadow-card-hover);
}

.ticket:hover .delete-btn {
  opacity: 1;
}

.ticket.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.ticket-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.ticket-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.45;
  word-break: break-word;
}

.delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: color 0.15s, opacity 0.15s, background 0.15s;
}

.delete-btn:hover {
  color: var(--danger);
  background: #ffecea;
}

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 30, 66, 0.54);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  z-index: 100;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-modal);
  transform: translateY(-12px) scale(0.98);
  transition: transform 0.18s;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 22px;
  color: var(--text);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  margin-bottom: 18px;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
  background: #fff;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--primary);
}

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

.modal-actions button {
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
}

#cancel-btn {
  background: none;
  color: var(--text-muted);
}

#cancel-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-actions button[type="submit"] {
  background: var(--primary);
  color: #fff;
}

.modal-actions button[type="submit"]:hover {
  background: var(--primary-hover);
}

/* ── Responsive ── */

@media (max-width: 700px) {
  .board {
    grid-template-columns: 1fr;
    padding: 16px;
  }
}
