/* ===========
   Base
=========== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family:
    "Noto Sans JP",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic",
    Meiryo,
    sans-serif;

  font-size: 14px;
  line-height: 1.6;
  background: #f6f7fb;
  color: #111;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

/* ===========
   Header / Nav
=========== */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e6e6ee;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  color: #333;
  font-size: 13px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  display: block;
}

.nav a:hover {
  color: #000;
  background: rgba(0,0,0,0.05);
}

/* ===========
   Cards / Layout
=========== */
.card {
  background: #fff;
  border: 1px solid #e6e6ee;
  border-radius: 14px;
  padding: 18px;
  margin-top: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.04);
}

/* ===========
   Forms
=========== */
.form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #d6d6e3;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

button {
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

button:hover {
  opacity: 0.92;
}

.secondary-button {
  background: #fff;
  color: #111;
  border: 1px solid #d6d6e3;
}

.danger-button {
  background: #b42318;
  color: #fff;
}

/* ===========
   Small actions
=========== */
.mini-button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.action-stack {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===========
   Checkbox rows
=========== */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.check-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.check-row span {
  display: inline-block;
  line-height: 1.5;
}

/* ===========
   Tables
=========== */
table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
}

th {
  background: #f2f3f7;
  font-weight: 600;
}

th, td {
  border: 1px solid #e0e0ea;
  padding: 8px;
  font-size: 13px;
  vertical-align: top;
}

/* ===========
   Badges / Emphasis
=========== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

button.badge {
  cursor: pointer;
}

.badge-priority-urgent {
  background: #ffe3e3;
  color: #b42318;
  border-color: #f3b3b3;
}

.badge-priority-high {
  background: #fff0d9;
  color: #b54708;
  border-color: #f3cf95;
}

.badge-priority-normal {
  background: #eef2ff;
  color: #3741a0;
  border-color: #cfd8ff;
}

.badge-priority-low {
  background: #ecfdf3;
  color: #027a48;
  border-color: #b7ebc6;
}

.badge-status-not_started,
.badge-status-scheduled {
  background: #f4f4f5;
  color: #444;
  border-color: #dddddf;
}

.badge-status-in_progress {
  background: #e0f2fe;
  color: #075985;
  border-color: #b9def4;
}

.badge-status-paused {
  background: #fff7d6;
  color: #8a6116;
  border-color: #ecd894;
}

.badge-status-done {
  background: #dcfce7;
  color: #166534;
  border-color: #b7e7c5;
}

.badge-status-abandoned {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d8dbe0;
}

.due-overdue {
  color: #b42318;
  font-weight: 700;
}

.due-soon {
  color: #b54708;
  font-weight: 600;
}

/* ===========
   Status / Delete popover
=========== */
.status-popover-wrap {
  position: relative;
  display: inline-block;
}

.status-popover-trigger {
  appearance: none;
  -webkit-appearance: none;
  border-width: 1px;
}

.status-popover,
.delete-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 320px;
  max-width: min(320px, 90vw);
  background: #fff;
  border: 1px solid #d6d6e3;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  padding: 12px;
}

.status-popover[hidden],
.delete-popover[hidden] {
  display: none;
}

.status-popover-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.status-popover-target {
  font-size: 13px;
  color: #444;
  margin-bottom: 10px;
  word-break: break-word;
}

.status-popover-note {
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
}

.status-popover-form {
  display: grid;
  gap: 10px;
}

.status-popover-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

/* ===========
   Messages
=========== */
.error {
  background: #fff1f1;
  border: 1px solid #ffd0d0;
  padding: 12px;
  border-radius: 12px;
  margin-top: 12px;
}

.error ul {
  margin: 0;
  padding-left: 18px;
}

.success {
  background: #effff2;
  border: 1px solid #c8f2cf;
  padding: 12px;
  border-radius: 12px;
  margin-top: 12px;
}

/* ===========
   Footer
=========== */
.site-footer {
  margin-top: 24px;
  padding: 24px 0;
  color: #666;
  text-align: center;
}

/* ===========
   Responsive
=========== */
@media (max-width: 600px) {
  body { font-size: 13px; }
  .container { padding: 12px; }
  .nav { gap: 10px; }
  .nav a { font-size: 12px; padding: 6px 6px; }
  .card { padding: 14px; }

  .action-stack {
    flex-direction: column;
    align-items: stretch;
  }

  .status-popover-actions {
    flex-direction: column;
  }

  .status-popover,
  .delete-popover {
    width: min(280px, 88vw);
  }
}
