:root {
  --bg: #f5f5f5;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #d6d6d6;
  --line-strong: #bdbdbd;
  --surface: #ffffff;
  --header: #ececec;
  --hover: #f0f0f0;
  --focus: #333333;
  --toast: #222222;
  --status-making: #8a4b12;
  --status-making-bg: #f3e2cf;
  --status-review: #5c3d7a;
  --status-review-bg: #ebe3f2;
  --status-published: #245c2e;
  --status-published-bg: #dceadb;
  --font: ui-sans-serif, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --page-pad: 1.5rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

body.is-resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing * {
  cursor: col-resize !important;
}

.page {
  padding: var(--page-pad);
  padding-bottom: 3rem;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.brand {
  margin: 0 0 0.15rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

select,
input,
textarea,
button {
  font: inherit;
}

.filters select {
  min-width: 9rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.4rem 0.55rem;
  background: var(--surface);
  color: var(--ink);
}

button.ghost {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

button.ghost:hover {
  background: var(--hover);
}

.toast {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: 4px;
  background: var(--toast);
  color: #fff;
  font-size: 0.85rem;
}

.toast.is-error {
  background: #444;
}

.board {
  margin: 0;
}

.table-frame {
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: visible;
}

.db {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.db th,
.db td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  background: var(--surface);
  overflow: hidden;
}

.db th:last-child,
.db td:last-child {
  border-right: 0;
}

.db tbody tr:last-child td {
  border-bottom: 0;
}

.db thead th {
  position: relative;
  background: var(--header);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  padding: 0.55rem 0.65rem;
  white-space: nowrap;
}

.db tbody tr:hover td {
  background: var(--hover);
}

.db tbody tr.is-saving td {
  background: #eaeaea;
}

.col-date,
.db tbody td.date-cell {
  box-shadow: 1px 0 0 var(--line);
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
}

.db thead th:hover .col-resizer::after,
.col-resizer.is-active::after {
  background: var(--focus);
}

.cell {
  display: block;
  width: 100%;
  min-height: 2.4rem;
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell:focus {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--focus);
}

select.cell.status-制作中:focus {
  background-color: var(--status-making-bg);
}

select.cell.status-確認待ち:focus {
  background-color: var(--status-review-bg);
}

select.cell.status-公開:focus {
  background-color: var(--status-published-bg);
}

.cell-date {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

select.cell {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.5rem;
  cursor: pointer;
}

select.cell.status-制作中,
select.cell.status-確認待ち,
select.cell.status-公開 {
  font-weight: 600;
  border-radius: 4px;
  margin: 0.35rem 0.4rem;
  width: calc(100% - 0.8rem);
  min-height: 1.7rem;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

select.cell.status-制作中 {
  color: var(--status-making);
  background-color: var(--status-making-bg);
}

select.cell.status-確認待ち {
  color: var(--status-review);
  background-color: var(--status-review-bg);
}

select.cell.status-公開 {
  color: var(--status-published);
  background-color: var(--status-published-bg);
}

.cell-title {
  font-weight: 600;
}

.cell-id {
  display: block;
  margin-top: 0.15rem;
  padding: 0 0.65rem 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  word-break: break-all;
}

.empty {
  margin: 1.5rem 0;
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.pager-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.pager-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.pager button {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0.35rem 0.7rem;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.pager button:hover:not(:disabled) {
  background: var(--hover);
}

.pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.pager button.is-current {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

@media (max-width: 720px) {
  :root {
    --page-pad: 1rem;
  }

  .top {
    flex-direction: column;
    align-items: start;
  }

  .filters label {
    flex: 1 1 140px;
  }

  .filters select {
    width: 100%;
    min-width: 0;
  }
}
