*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%; overflow-x: clip;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px; line-height: 1.5; background: #F3F3F6; color: #111113;
}
::selection { background: #111113; color: #FFFFFF; }
button, input, textarea, select { font-family: inherit; font-size: 16px; border: none; outline: none; background: transparent; color: inherit; }
a { color: inherit; text-decoration: none; }
button, .btn-link, select { cursor: pointer; transition: transform 120ms cubic-bezier(0.2, 0, 0, 1), background-color 150ms ease-out, opacity 150ms ease-out, color 150ms ease-out; }
button, .btn-link { white-space: nowrap; }
button:active, .btn-link:active { transform: scale(0.96); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.tabular { font-variant-numeric: tabular-nums; }

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

/* AUTH GATE */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: #FFFFFF; border-radius: 24px; padding: 36px 32px; display: flex; flex-direction: column; gap: 20px; }
.auth-title { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.12; }
.auth-sub { font-size: 16px; color: #52525B; text-wrap: pretty; }
.auth-error { font-size: 15px; color: #C2410C; }

/* WORKSPACE */
.canvas { max-width: 1400px; margin: 0 auto; padding: 40px 44px 96px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 36px; }
.title { font-size: clamp(32px, 4vw, 42px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.06; text-wrap: balance; }
.subtitle { margin-top: 8px; font-size: 16px; color: #52525B; }

.head-menu-wrap { position: relative; display: flex; align-items: center; }
.head-menu {
  position: absolute; top: 52px; right: 0; min-width: 220px; padding: 8px; border-radius: 16px;
  background: #FFFFFF; z-index: 40; display: flex; flex-direction: column; gap: 4px;
  animation: appearSoft 180ms cubic-bezier(0.2, 0, 0, 1) forwards;
}
.head-menu-meta { padding: 8px 12px; font-size: 14px; color: #52525B; overflow-wrap: anywhere; }
.head-menu-btn { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 15px; font-weight: 500; text-align: left; }
.head-menu-btn:hover { background: #F3F3F6; }

/* 4-COLUMN BOARD */
.matrix { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; align-items: start; }
.col-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; padding: 0 4px; }
.col-title { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.col-count { font-size: 16px; font-weight: 500; color: #52525B; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.empty-col { padding: 18px 4px; font-size: 15px; color: #52525B; }

.tile { position: relative; width: 100%; background: #FFFFFF; border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.tile-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.tile-info { min-width: 0; flex: 1; }
.tile-name { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; color: #111113; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { font-size: 14px; color: #52525B; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-reason { font-size: 14px; color: #111113; margin-top: 4px; overflow-wrap: break-word; }

.tile-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.bare-kebab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 12px; background: transparent; color: #52525B;
}
.bare-kebab:hover { background: #E4E4EA; color: #111113; }
@media (hover: hover) {
  .tile .bare-kebab { opacity: 0; }
  .tile:hover .bare-kebab, .tile:focus-within .bare-kebab, .tile.is-open .bare-kebab { opacity: 1; }
}

.btn-action {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 16px; border-radius: 12px; font-size: 15px; font-weight: 500;
  background: #111113; color: #FFFFFF;
}
.btn-action:hover { background: #27272A; }
.btn-action.is-setup { background: #E6E6EC; color: #111113; }
.btn-action.is-setup:hover { background: #DCDCE4; }
.btn-action.is-done { background: #E4E4EA; color: #111113; }

.tile-panel { padding-top: 6px; display: flex; flex-direction: column; gap: 10px; animation: appearSoft 180ms cubic-bezier(0.2, 0, 0, 1) forwards; }
.stage-select { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; background: #F3F3F6; font-size: 15px; font-weight: 500; color: #111113; }
.flat-field { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border-radius: 10px; background: #F3F3F6; font-size: 15px; color: #111113; }
.msg-box { width: 100%; min-height: 84px; resize: vertical; padding: 10px 12px; border-radius: 10px; background: #F3F3F6; font-size: 15px; line-height: 1.45; color: #111113; }
.soft-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; background: #E4E4EA; color: #111113; }
.soft-btn:hover { background: #D4D4DE; }
.more-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; padding: 10px 18px; border-radius: 14px; font-size: 15px; font-weight: 500; background: #E6E6EC; color: #111113; margin-top: 4px; }
.more-btn:hover { background: #DCDCE4; }

@media (max-width: 1120px) {
  .matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .canvas { padding: 24px 16px 80px; }
  .matrix { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
