:root {
  --canvas: #f7f7f7;
  --surface: #ffffff;
  --surface-subtle: #f2f2f2;
  --ink: #1a1a1a;
  --ink-2: #333333;
  --muted: #666666;
  --line: #cccccc;
  --line-strong: #949494;
  --key: #0017c1;
  --key-hover: #00118f;
  --key-soft: #e8f1fe;
  --positive: #197a4b;
  --positive-soft: #e7f4ec;
  --warning: #8a5a00;
  --warning-soft: #fff4cc;
  --accent: #006f83;
  --danger: #b40000;
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-2);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
a { color: var(--key-hover); }
:focus-visible { outline: 3px solid #ffd43d; outline-offset: 2px; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line-strong);
  padding: 20px 12px;
}
.brand {
  display: block;
  margin: 0 8px 20px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.3;
}
.brand small { display: block; color: var(--muted); font-size: .86rem; font-weight: 400; margin-top: 3px; }
.nav-heading { margin: 18px 12px 4px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 400;
}
.nav-list a:hover { background: var(--surface-subtle); text-decoration: underline; text-underline-offset: 3px; }
.nav-list a[aria-current="page"] { background: var(--key-soft); color: var(--key-hover); font-weight: 700; }
.sidebar-foot { margin: 24px 12px 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

.content { min-width: 0; }
.topbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.crumb { color: var(--muted); font-size: .9rem; }
.client { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; }
.client::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--positive); }
.main { width: min(1180px, 100%); margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .86rem; font-weight: 700; }
h1 { margin: 0; color: var(--ink); font-size: 1.8rem; line-height: 1.35; }
.lead { margin: 6px 0 0; color: var(--muted); max-width: 72ch; }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-subtle);
  color: var(--ink-2);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
.status.live { border-color: var(--positive); background: var(--positive-soft); color: var(--positive); }
.status.draft { border-color: #9c7600; background: var(--warning-soft); color: var(--warning); }
.status.contract { border-color: var(--line-strong); background: #e8e8e8; color: #555555; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 28px; }
.summary-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-item { background: var(--surface); padding: 14px 16px; }
.summary-label { display: block; color: var(--muted); font-size: .82rem; font-weight: 700; }
.summary-value { display: block; margin-top: 2px; color: var(--ink); font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-value.role-value { font-size: 1.05rem; line-height: 2.25rem; }
.summary-note { color: var(--muted); font-size: .8rem; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
.section-head h2 { margin: 0; color: var(--ink); font-size: 1.15rem; }
.section-head p { margin: 0; color: var(--muted); font-size: .86rem; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tool-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 16px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  text-decoration: none;
}
.tool-card:hover { border-color: var(--key); background: #fbfcff; }
.tool-card h2 { margin: 0; color: var(--ink); font-size: 1.08rem; }
.tool-card p { grid-column: 1 / -1; margin: 4px 0 0; color: var(--muted); }
.tool-card .path { align-self: end; color: var(--key-hover); font-family: "Noto Sans Mono", ui-monospace, monospace; font-size: .8rem; }
.tool-card .arrow { align-self: end; color: var(--key); font-size: 1.25rem; }
.tool-card.disabled {
  border-color: var(--line);
  background: #eeeeee;
  color: #777777;
  cursor: not-allowed;
  filter: grayscale(1);
}
.tool-card.disabled:hover { border-color: var(--line); background: #eeeeee; }
.tool-card.disabled h2, .tool-card.disabled p { color: #666666; }
.tool-card.disabled .path { color: #666666; font-family: "Noto Sans JP", sans-serif; }
.tool-card .lock { align-self: end; color: #666666; font-size: 1rem; }

.split { display: grid; grid-template-columns: minmax(0, .85fr) minmax(420px, 1.15fr); gap: 32px; align-items: start; }
.panel { min-width: 0; padding-top: 16px; border-top: 2px solid var(--ink); }
.panel h2 { margin: 0 0 14px; color: var(--ink); font-size: 1.1rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 4px; color: var(--ink); font-size: .9rem; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #666666;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.field textarea { min-height: 112px; resize: vertical; }
.field .hint { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--key);
  border-radius: 6px;
  background: var(--key);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}
.button:hover { background: var(--key-hover); }
.button.secondary { background: var(--surface); color: var(--key-hover); }
.button.danger { border-color: var(--danger); background: var(--surface); color: var(--danger); }
.save-state { color: var(--muted); font-size: .82rem; }
.editor {
  width: 100%;
  min-height: 480px;
  padding: 16px;
  border: 1px solid #666666;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-family: "Noto Sans JP", sans-serif;
  line-height: 1.8;
  resize: vertical;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { background: var(--surface-subtle); color: var(--ink); font-size: .82rem; }
.data-table td { color: var(--ink-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { margin: 0; padding: 32px 16px; color: var(--muted); text-align: center; }
.row-button { border: 0; background: transparent; color: var(--danger); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.brief-list { display: grid; gap: 10px; }
.brief-item { padding: 16px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.brief-item header { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.brief-item h2 { margin: 0; color: var(--ink); font-size: 1rem; }
.brief-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 0; color: var(--muted); font-size: .82rem; }
.brief-item p { margin: 10px 0 0; white-space: pre-wrap; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .workspace { display: block; }
  .sidebar { position: sticky; z-index: 10; height: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .brand { margin: 0 8px 8px; font-size: 1rem; }
  .brand small, .nav-heading, .sidebar-foot { display: none; }
  .nav-list { display: flex; gap: 4px; overflow-x: auto; }
  .nav-list + .nav-heading, .nav-heading + .nav-list { margin-top: 0; }
  .nav-list a { white-space: nowrap; min-height: 36px; padding: 7px 10px; }
  .topbar { padding: 8px 16px; }
  .main { padding: 22px 16px 48px; }
  .page-head { align-items: start; flex-direction: column; gap: 10px; }
  h1 { font-size: 1.5rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
}
@media (max-width: 440px) {
  .summary-grid { grid-template-columns: 1fr; }
  .crumb { display: none; }
}
