/* Manifest — team task inbox
   Visual world: a split-flap departure board. Warm charcoal cabinet,
   amber signal, mechanical flap tiles for status, monospace for data. */

:root {
  --bg: #15130f;
  --panel: #1c1914;
  --row: #201c16;
  --row-hover: #262019;
  --row-active: #2c241a;
  --border: #362f22;
  --border-strong: #4a4030;
  --text: #f4efe3;
  --text-secondary: #b7ac97;
  --text-muted: #9c9179;
  --accent: #f0a93a;
  --accent-ink: #241704;

  --status-todo-bg: #454b57;
  --status-todo-text: #eef1f5;
  --status-progress-bg: #f0a93a;
  --status-progress-text: #241704;
  --status-blocked-bg: #b8452e;
  --status-blocked-text: #fff3ec;
  --status-done-bg: #2f6b3a;
  --status-done-text: #eafbea;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Roboto Mono", monospace;

  --row-grid: 100px minmax(180px, 1fr) 110px 130px 84px 90px 60px;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* Browser surfaces themed to the world */
::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

* {
  scrollbar-color: var(--border-strong) var(--panel);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--panel);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 2px solid var(--panel);
}

input,
select,
textarea {
  caret-color: var(--accent);
}

a {
  color: var(--accent);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  z-index: 100;
  transition: top 0.15s ease;
}

.skip-link:focus-visible {
  top: 12px;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* -------------------------------------------------- App shell -------------------------------------------------- */

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 32px 64px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* -------------------------------------------------- Header -------------------------------------------------- */

.app-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 22px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-name {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-tag {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.board-summary {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.header-row--controls {
  gap: 14px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field--search {
  flex: 1 1 320px;
  min-width: 200px;
}

.field--filter {
  flex: 0 0 200px;
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14.5px;
  padding: 10px 14px 10px 36px;
  border-radius: 8px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-input:hover {
  border-color: var(--border-strong);
}

#search-input:focus-visible {
  border-color: var(--accent);
}

/* Clear the native search cancel button so our styling stays consistent */
#search-input::-webkit-search-cancel-button {
  filter: invert(0.7);
  cursor: pointer;
}

#filter-select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14.5px;
  padding: 10px 14px;
  border-radius: 8px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1L6 6L11 1' stroke='%23b7ac97' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
  transition: border-color 0.15s ease;
}

#filter-select:hover {
  border-color: var(--border-strong);
}

#filter-select:focus-visible {
  border-color: var(--accent);
}

/* -------------------------------------------------- Board -------------------------------------------------- */

.board {
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 10px;
  margin-top: 24px;
  overflow: hidden;
  flex: 1;
}

.board-columns {
  display: grid;
  grid-template-columns: var(--row-grid);
  column-gap: 14px;
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item + .item {
  border-top: 1px solid var(--border);
}

.row-open {
  display: grid;
  grid-template-columns: var(--row-grid);
  column-gap: 14px;
  align-items: center;
  width: 100%;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  padding: 16px 20px;
  transition: background-color 0.15s ease;
}

.row-open:hover {
  background: var(--row-hover);
}

.row-open:active {
  background: var(--row-active);
}

.row-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--row-hover);
}

.cell {
  min-width: 0;
}

.cell-title {
  font-weight: 600;
  font-size: 14.5px;
  overflow-wrap: break-word;
}

.cell-project,
.cell-assignee {
  color: var(--text-secondary);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-due {
  color: var(--text-secondary);
  font-size: 13px;
}

.cell-comments {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.cell-comments svg {
  flex: none;
}

/* Priority pill */
.priority {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  white-space: nowrap;
}

.priority-high {
  border-color: var(--status-blocked-bg);
  color: #e79a85;
}

.priority-medium {
  border-color: var(--accent);
  color: var(--accent);
}

.priority-low {
  border-color: var(--border-strong);
  color: var(--text-muted);
}

/* -------------------------------------------------- Split-flap status -------------------------------------------------- */

.flap {
  --flap-h: 15px;
  display: inline-flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.25);
}

.flap-halves {
  display: flex;
  flex-direction: column;
}

.flap-top,
.flap-bottom {
  height: var(--flap-h);
  overflow: hidden;
  display: block;
}

.flap-top {
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}

.flap-text {
  display: block;
  height: calc(var(--flap-h) * 2);
  line-height: calc(var(--flap-h) * 2);
  padding: 0 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.flap-bottom .flap-text {
  margin-top: calc(var(--flap-h) * -2);
}

.flap[data-status="todo"] { background: var(--status-todo-bg); }
.flap[data-status="todo"] .flap-text { color: var(--status-todo-text); }

.flap[data-status="in-progress"] { background: var(--status-progress-bg); }
.flap[data-status="in-progress"] .flap-text { color: var(--status-progress-text); }

.flap[data-status="blocked"] { background: var(--status-blocked-bg); }
.flap[data-status="blocked"] .flap-text { color: var(--status-blocked-text); }

.flap[data-status="done"] { background: var(--status-done-bg); }
.flap[data-status="done"] .flap-text { color: var(--status-done-text); }

.flap.flap-turn {
  animation: flap-turn 0.42s ease-in-out;
}

@keyframes flap-turn {
  0% { transform: rotateX(0deg); }
  45% { transform: rotateX(-90deg); }
  55% { transform: rotateX(-90deg); }
  100% { transform: rotateX(0deg); }
}

/* -------------------------------------------------- Empty state -------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 72px 24px;
  color: var(--text-secondary);
}

.empty-state svg {
  color: var(--border-strong);
  margin-bottom: 6px;
}

.empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.empty-detail {
  margin: 0 0 8px;
  font-size: 14px;
  max-width: 46ch;
}

/* -------------------------------------------------- Buttons -------------------------------------------------- */

.btn {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: #f5b657;
}

.btn-primary:active {
  transform: translateY(1px);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--row-hover);
  color: var(--text);
}

/* -------------------------------------------------- Footer -------------------------------------------------- */

.app-footer {
  margin-top: 28px;
  text-align: center;
}

.app-footer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* -------------------------------------------------- Detail dialog -------------------------------------------------- */

.detail {
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  padding: 0;
  width: min(560px, 92vw);
  max-height: min(88vh, 780px);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.detail::backdrop {
  background: rgba(8, 7, 5, 0.72);
}

.detail-frame {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 780px);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.detail-id {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.detail-body-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 28px;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.detail-title {
  margin: 2px 0 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin: 0 0 18px;
  padding: 16px 18px;
  background: var(--row);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.meta-item dt {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.meta-item dd {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 10px;
}

.field--status {
  padding: 16px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  margin-bottom: 22px;
}

.field--status label {
  margin-bottom: 8px;
}

#status-control {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 7px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1L6 6L11 1' stroke='%23f0a93a' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
  transition: border-color 0.15s ease;
}

#status-control:hover {
  border-color: var(--accent);
}

#status-control:focus-visible {
  border-color: var(--accent);
}

.status-feedback {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-height: 16px;
}

.detail-notes h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.detail-notes p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-line;
  max-width: 68ch;
}

/* -------------------------------------------------- Reduced motion -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------- Responsive -------------------------------------------------- */

@media (max-width: 960px) {
  .app {
    padding: 22px 20px 48px;
  }

  .board-columns {
    display: none;
  }

  .row-open {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 8px;
    column-gap: 12px;
    padding: 14px 16px;
  }

  .cell-status {
    order: 1;
    flex: 0 0 auto;
  }

  .cell-title {
    order: 2;
    flex: 1 1 160px;
    min-width: 140px;
  }

  .cell-comments {
    order: 3;
    margin-left: auto;
  }

  .cell-project::before {
    content: "Project: ";
    color: var(--text-muted);
    font-weight: 600;
  }

  .cell-assignee::before {
    content: "Assignee: ";
    color: var(--text-muted);
    font-weight: 600;
  }

  .cell-due::before {
    content: "Due: ";
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-sans);
  }

  .cell-priority::before {
    content: "Priority: ";
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12.5px;
  }

  .cell-project,
  .cell-assignee,
  .cell-due,
  .cell-priority {
    order: 4;
    flex: 0 0 auto;
    font-size: 12.5px;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 18px 14px 40px;
  }

  .header-row--brand {
    align-items: flex-start;
  }

  .board-summary {
    font-size: 12px;
  }

  .header-row--controls {
    flex-direction: column;
    align-items: stretch;
  }

  .field--filter {
    flex: none;
  }

  .detail {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    inset: 0;
  }

  .detail-frame {
    max-height: 100vh;
    height: 100%;
  }
}
