:root {
  color-scheme: light;
  font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
  font-synthesis: none;
  --ink: #17232d;
  --muted: #65737d;
  --muted-2: #87939b;
  --line: #dce3e7;
  --line-soft: #e9eef1;
  --surface: #ffffff;
  --surface-subtle: #f7f9fa;
  --canvas: #eef2f4;
  --blue: #326a8f;
  --blue-dark: #255571;
  --blue-soft: #e9f2f7;
  --green: #2e7650;
  --green-soft: #eaf5ef;
  --amber: #a76512;
  --amber-soft: #fff3dd;
  --red: #b13d3a;
  --red-soft: #fcebea;
  --purple: #6653a6;
  --purple-soft: #f0edfb;
  --shadow: 0 10px 28px rgba(25, 45, 57, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 960px; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 95% 0%, rgba(50, 106, 143, 0.09), transparent 26rem),
    var(--canvas);
  color: var(--ink);
}

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

button { color: inherit; }

button,
select { cursor: pointer; }

input,
select,
textarea {
  min-width: 0;
  border: 1px solid #cfd8dd;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #76a6c4;
  box-shadow: 0 0 0 3px rgba(50, 106, 143, 0.12);
}

input::placeholder,
textarea::placeholder { color: #9aa5ac; }

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand-block,
.title-row,
.header-meta {
  display: flex;
  align-items: center;
}

.brand-block { gap: 12px; }

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 11px;
  background: var(--blue);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(50, 106, 143, 0.24);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.title-row { gap: 9px; }

h1 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.environment-badge {
  padding: 3px 7px;
  border: 1px solid #96b6c9;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.header-meta { gap: 14px; }

.demo-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #dde9ef;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

main { padding: 18px 20px 24px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  max-width: 1040px;
  margin-bottom: 14px;
}

.metric-card {
  position: relative;
  display: flex;
  align-items: baseline;
  min-height: 73px;
  padding: 14px 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(25, 45, 57, 0.04);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #a9bbc5;
}

.metric-card p {
  align-self: flex-start;
  min-width: 94px;
  margin: 2px 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric-card strong {
  color: #30414c;
  font-size: 1.65rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-card > span {
  margin-left: 4px;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.metric-primary::before { background: var(--blue); }
.metric-primary strong { color: var(--blue-dark); }
.metric-warning::before { background: #dc911f; }
.metric-warning strong { color: var(--amber); }
.metric-danger::before { background: #d35551; }
.metric-danger strong { color: var(--red); }

.workspace {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px 18px 11px;
}

.view-header h2 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.view-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.73rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.button-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 10px rgba(50, 106, 143, 0.17);
}

.button-primary:hover { background: var(--blue-dark); }

.button-quiet {
  border-color: #cfd8dd;
  background: #fff;
  color: #53636d;
}

.button-quiet:hover { background: #f4f7f8; }

.tabs {
  display: flex;
  gap: 3px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  min-height: 39px;
  padding: 8px 14px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.tab::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  background: transparent;
}

.tab span {
  display: inline-grid;
  min-width: 22px;
  height: 19px;
  margin-left: 5px;
  place-items: center;
  border-radius: 10px;
  background: #edf1f3;
  color: #67757e;
  font-size: 0.65rem;
}

.tab.is-active { color: var(--blue-dark); }
.tab.is-active::after { background: var(--blue); }
.tab.is-active span { background: var(--blue-soft); color: var(--blue-dark); }

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(128px, 0.8fr)) repeat(5, minmax(126px, 0.72fr)) auto;
  gap: 9px;
  padding: 12px 18px 13px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
}

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

.field > span:first-child {
  color: #5e6d76;
  font-size: 0.66rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  height: 32px;
  padding: 5px 8px;
  font-size: 0.74rem;
}

.input-with-icon { position: relative; }
.input-with-icon input { padding-left: 29px; }

.search-icon {
  position: absolute;
  top: 9px;
  left: 10px;
  width: 10px;
  height: 10px;
  border: 1.5px solid #7d8b93;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 7px;
  width: 5px;
  height: 1.5px;
  transform: rotate(45deg);
  border-radius: 1px;
  background: #7d8b93;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
}

.filter-actions .button { height: 32px; }

.table-toolbar {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.preset-group,
.table-meta,
.progress-legend {
  display: flex;
  align-items: center;
}

.preset-group {
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: #edf1f3;
}

.preset-label {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
}

.preset {
  min-height: 28px;
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #596871;
  font-size: 0.72rem;
  font-weight: 700;
}

.preset:hover { color: var(--ink); }

.preset.is-active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 1px 4px rgba(28, 49, 61, 0.14);
}

.table-meta {
  gap: 9px;
  color: var(--muted);
  font-size: 0.69rem;
  white-space: nowrap;
}

.divider {
  width: 1px;
  height: 13px;
  background: var(--line);
}

.progress-legend {
  gap: 18px;
  min-height: 31px;
  padding: 5px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #f8fafb;
  color: var(--muted);
  font-size: 0.67rem;
}

.progress-legend strong { color: var(--blue-dark); }

.table-frame {
  max-width: 100%;
  height: clamp(380px, calc(100vh - 387px), 650px);
  overflow: auto;
  outline: none;
  scrollbar-color: #aebcc4 #edf1f3;
  scrollbar-width: thin;
}

.table-frame:focus-visible { box-shadow: inset 0 0 0 2px #79a8c4; }

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.72rem;
}

.data-table th,
.data-table td {
  height: 42px;
  padding: 5px 8px;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  z-index: 4;
  top: 0;
  height: 37px;
  padding-top: 4px;
  padding-bottom: 4px;
  background: #edf2f5;
  color: #4d5d67;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.header-sort {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: inherit;
  text-align: left;
  white-space: nowrap;
}

.sort-indicator { color: #9ba7ae; font-size: 0.55rem; }
.header-sort.is-sorted .sort-indicator { color: var(--blue); }

.data-table tbody tr {
  --row-bg: #fff;
  background: var(--row-bg);
  transition: background-color 90ms ease;
}

.data-table tbody tr:nth-child(even) { --row-bg: #fbfcfd; }
.data-table tbody tr:hover { --row-bg: #eef5f8; }
.data-table tbody tr.row-overdue { --row-bg: #fffaf2; }
.data-table tbody tr.row-error { box-shadow: inset 3px 0 0 #d85b56; }
.data-table tbody tr:focus-visible { outline: 2px solid #6b9ab7; outline-offset: -2px; }

.data-table td { background: var(--row-bg); color: #34434d; }

.data-table .sticky-col {
  position: sticky;
  z-index: 2;
  background: var(--row-bg);
}

.data-table th.sticky-col {
  z-index: 6;
  background: #e8eef2;
}

.data-table .sticky-last { box-shadow: 5px 0 8px -7px rgba(24, 44, 56, 0.9); }

.sticky-0 { left: 0; }
.sticky-1 { left: 92px; }
.sticky-2 { left: 204px; }
.sticky-3 { left: 272px; }
.sticky-4 { left: 398px; }
.sticky-5 { left: 524px; }
.sticky-6 { left: 656px; }

.col-progress { width: 92px; min-width: 92px; max-width: 92px; }
.col-id { width: 112px; min-width: 112px; max-width: 112px; }
.col-error { width: 68px; min-width: 68px; max-width: 68px; text-align: center !important; }
.col-first-due,
.col-final-due { width: 126px; min-width: 126px; max-width: 126px; }
.col-owner,
.col-designer { width: 132px; min-width: 132px; max-width: 132px; }
.col-store { width: 190px; min-width: 190px; max-width: 190px; }
.col-name { width: 260px; min-width: 260px; max-width: 260px; }
.col-team { width: 92px; min-width: 92px; max-width: 92px; }
.col-requester { width: 120px; min-width: 120px; max-width: 120px; }
.col-order-date { width: 108px; min-width: 108px; max-width: 108px; }
.col-new-count,
.col-rollout-count { width: 66px; min-width: 66px; max-width: 66px; text-align: right !important; }
.col-slack { width: 92px; min-width: 92px; max-width: 92px; text-align: center !important; }
.col-checkpoint { width: 112px; min-width: 112px; max-width: 112px; text-align: center !important; }
.col-changed-date,
.col-invoice-date { width: 112px; min-width: 112px; max-width: 112px; }
.col-change-memo,
.col-cancel-memo { width: 230px; min-width: 230px; max-width: 230px; }
.col-cancel-type,
.col-billing-type { width: 128px; min-width: 128px; max-width: 128px; }
.col-delivery-type { width: 138px; min-width: 138px; max-width: 138px; }

.case-id {
  color: var(--blue-dark);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cell-select {
  width: 100%;
  height: 29px;
  border-color: transparent;
  border-radius: 5px;
  background-color: transparent;
  color: #33434d;
  font-size: 0.69rem;
}

.cell-select { padding: 3px 18px 3px 5px; }
.cell-select:hover { border-color: #bdcbd2; background-color: #fff; }
.cell-select:focus { border-color: #76a6c4; background-color: #fff; }

.delivery-select {
  border-color: #d2dce1;
  background: #f7f9fa;
  color: #42545f;
  font-weight: 700;
}

.date-cell {
  position: relative;
  width: 100%;
  height: 29px;
}

.date-view,
.date-editor {
  width: 100%;
  height: 29px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #33434d;
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
}

.date-view {
  padding: 3px 6px;
  text-align: left;
}

.date-view:hover {
  border-color: #bdcbd2;
  background: #fff;
}

.date-view:focus-visible {
  border-color: #76a6c4;
  box-shadow: 0 0 0 3px rgba(50, 106, 143, 0.12);
  outline: none;
}

.date-editor {
  padding: 3px 2px 3px 5px;
  border-color: #76a6c4;
  background: #fff;
}

.date-value,
.empty-date {
  display: inline-block;
  min-width: 1px;
  min-height: 18px;
  font-variant-numeric: tabular-nums;
}

.progress-select {
  border-color: #c9dbe5;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 700;
}

.progress-select.status-not-started { border-color: #d5dde1; background: #f0f3f5; color: #596871; }
.progress-select.status-working { border-color: #b9d3e2; background: #e7f2f8; color: #256285; }
.progress-select.status-review { border-color: #d4c9eb; background: var(--purple-soft); color: var(--purple); }
.progress-select.status-rollout { border-color: #b9ddca; background: var(--green-soft); color: var(--green); }
.progress-select.status-delivery { border-color: #b6d8d8; background: #e7f5f4; color: #25706e; }
.progress-select.status-hold { border-color: #ecd29f; background: var(--amber-soft); color: var(--amber); }
.progress-select.status-complete { border-color: #cbd7ce; background: #edf4ef; color: #3d6e4f; }
.progress-select.status-cancelled { border-color: #e7c2c0; background: var(--red-soft); color: var(--red); }

.date-view.overdue-input {
  border-color: #edc2bf;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 800;
}

.status-label,
.error-label,
.checkpoint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 750;
}

.error-label {
  background: var(--red-soft);
  color: var(--red);
}

.error-label::before { content: "!"; font-weight: 900; }

.no-error {
  color: #a2adb3;
  font-size: 0.68rem;
}

.overdue-date { color: var(--red); font-weight: 800; }

.overdue-date::before {
  content: "!";
  display: inline-grid;
  width: 15px;
  height: 15px;
  margin-right: 4px;
  place-items: center;
  border-radius: 50%;
  background: var(--red-soft);
  font-size: 0.6rem;
}

.checkpoint.is-done { background: var(--green-soft); color: var(--green); font-variant-numeric: tabular-nums; }

.slack-button {
  padding: 4px 7px;
  border: 1px solid #d4cceb;
  border-radius: 5px;
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 0.65rem;
  font-weight: 750;
}

.slack-button:hover { border-color: #ad9ed8; }

.empty-state td {
  height: 150px;
  text-align: center !important;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: #41515b;
  font-size: 0.82rem;
}

.table-footer {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 18px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
  color: var(--muted);
  font-size: 0.65rem;
}

.lock-icon { margin-right: 4px; color: var(--blue); }

.drawer-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(21, 34, 42, 0.28);
  opacity: 0;
  transition: opacity 180ms ease;
}

.drawer-backdrop.is-visible { opacity: 1; }

.detail-drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  display: flex;
  width: min(570px, 100vw);
  height: 100vh;
  flex-direction: column;
  transform: translateX(102%);
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -16px 0 45px rgba(21, 36, 45, 0.2);
  transition: transform 200ms ease;
}

.detail-drawer.is-open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-kicker {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.drawer-header h2 { margin: 0 0 4px; font-size: 1.13rem; }

.drawer-header p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #66747d;
  font-size: 1.15rem;
}

.icon-button:hover { background: #f1f4f5; }

.detail-form {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.detail-sections {
  flex: 1;
  overflow-y: auto;
  padding: 6px 22px 22px;
}

.detail-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}

.detail-section:last-child { border-bottom: 0; }

.detail-section h3 {
  margin: 0 0 11px;
  color: #30424d;
  font-size: 0.79rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

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

.form-field.is-wide { grid-column: 1 / -1; }

.form-field span {
  color: #5d6c75;
  font-size: 0.67rem;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 0.75rem;
}

.form-field textarea {
  min-height: 68px;
  resize: vertical;
  line-height: 1.5;
}

.form-field input[readonly] {
  background: #f3f6f7;
  color: #66747c;
}

.dummy-callout {
  margin: 14px 0 0;
  padding: 9px 11px;
  border: 1px solid #d7e4eb;
  border-radius: 7px;
  background: #f2f7fa;
  color: #536a78;
  font-size: 0.68rem;
  line-height: 1.5;
}

.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

.toast {
  position: fixed;
  z-index: 60;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 11px 15px;
  transform: translateY(16px);
  border-radius: 8px;
  background: #263a46;
  color: #fff;
  box-shadow: 0 10px 28px rgba(16, 29, 36, 0.24);
  font-size: 0.74rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible { transform: translateY(0); opacity: 1; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

@media (max-width: 1480px) {
  .filters { grid-template-columns: minmax(230px, 1.4fr) repeat(4, minmax(130px, 0.75fr)); }
  .field-keyword { grid-column: span 2; }
  .filter-actions { justify-content: flex-end; }
  .table-frame { height: clamp(360px, calc(100vh - 430px), 620px); }
}

@media (max-width: 1100px) {
  main { padding-right: 14px; padding-left: 14px; }
  .filters { grid-template-columns: repeat(4, minmax(145px, 1fr)); }
  .field-keyword { grid-column: span 2; }
  .table-frame { height: 480px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
