:root {
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #1A2233;
  --text-soft: #6B7280;
  --navy: #1A2A4A;
  --blue: #4A6FB5;
  --status-draft: #9CA3AF;
  --status-applied: #6B7280;
  --status-replied: #E0A82E;
  --status-negotiating: #F59E0B;
  --status-accepted: #10B981;
  --status-declined: #EF4444;
  --status-rejected: #DC2626;
  --status-closed: #94A3B8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 32px 16px;
}

.wrap { max-width: 1080px; margin: 0 auto; }

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}
header h1 {
  font-size: 28px;
  color: var(--navy);
  letter-spacing: 0.02em;
  font-weight: 700;
}
.meta { font-size: 13px; color: var(--text-soft); display: flex; align-items: center; gap: 12px; }

.reset-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-soft);
  cursor: pointer;
  font-family: inherit;
}
.reset-btn:hover { background: var(--bg); color: var(--status-rejected); border-color: var(--status-rejected); }

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.stat {
  background: var(--card);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  text-align: center;
}
.stat__num {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}
.stat__label {
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-btn {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: all 0.2s;
}
.filter-btn:hover { background: var(--bg); }
.filter-btn.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.cards { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.card {
  background: var(--card);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 20px;
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 16px;
  align-items: start;
}

.status-bar {
  width: 4px;
  height: 100%;
  border-radius: 3px;
  min-height: 60px;
}
.s-draft        { background: var(--status-draft); }
.s-applied      { background: var(--status-applied); }
.s-replied      { background: var(--status-replied); }
.s-negotiating  { background: var(--status-negotiating); }
.s-accepted     { background: var(--status-accepted); }
.s-declined     { background: var(--status-declined); }
.s-rejected     { background: var(--status-rejected); }
.s-closed       { background: var(--status-closed); }

.card__main { min-width: 0; }
.card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-soft);
}
.pill--lancers { background: #FFE9D0; color: #B85100; }
.pill--crowdworks { background: #D9EBFC; color: #1659A6; }
.pill--status { color: #fff; }
.pill--status.s-draft        { background: var(--status-draft); }
.pill--status.s-applied      { background: var(--status-applied); }
.pill--status.s-replied      { background: var(--status-replied); }
.pill--status.s-negotiating  { background: var(--status-negotiating); }
.pill--status.s-accepted     { background: var(--status-accepted); }
.pill--status.s-declined     { background: var(--status-declined); }
.pill--status.s-rejected     { background: var(--status-rejected); }
.pill--status.s-closed       { background: var(--status-closed); }

.card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  line-height: 1.4;
}
.card__sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.card__sub b { color: var(--text); font-weight: 600; }

.card__notes {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--blue);
  margin-top: 10px;
}

.card__history {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 10px;
}
.card__history h4 {
  font-size: 11px;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  font-weight: 700;
}
.card__history ul { list-style: none; }
.card__history li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  padding: 3px 0;
}
.card__history li time { color: var(--blue); font-variant-numeric: tabular-nums; }

.card__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
  align-items: flex-end;
}
.card__amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.card__date {
  font-size: 11px;
  color: var(--text-soft);
}
.card__link {
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
  margin-top: 4px;
}
.card__link:hover { text-decoration: underline; }

/* Action buttons */
.actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.actions__label {
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.action-btn__icon { font-size: 13px; }
.action-btn--applied:hover     { background: #F3F4F6; border-color: var(--status-applied); }
.action-btn--replied:hover     { background: #FEF6E0; border-color: var(--status-replied); }
.action-btn--negotiating:hover { background: #FEF2D5; border-color: var(--status-negotiating); }
.action-btn--accepted:hover    { background: #D1FAE5; border-color: var(--status-accepted); color: var(--status-accepted); }
.action-btn--rejected:hover    { background: #FEE2E2; border-color: var(--status-rejected); color: var(--status-rejected); }
.action-btn--declined:hover    { background: #FEE2E2; border-color: var(--status-declined); color: var(--status-declined); }
.action-btn--closed:hover      { background: #F1F5F9; border-color: var(--status-closed); }

.empty {
  text-align: center;
  padding: 80px 0;
  color: var(--text-soft);
  font-size: 14px;
}

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .card {
    grid-template-columns: 12px 1fr;
    gap: 12px;
  }
  .card__actions {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
  }
  .card__history li { grid-template-columns: 110px 1fr; }
  .action-btn__label { display: none; }
  .action-btn { padding: 6px 8px; }
}
