:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --soft: #eef0ff;
  --ink: #182033;
  --muted: #667085;
  --line: #e4e7ec;
  --canvas: #f6f7fb;
  --card: #fff;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font:
    15px/1.55 "Noto Sans JP",
    "Hiragino Kaku Gothic ProN",
    system-ui,
    sans-serif;
}
button, input, select, textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 15%, #dfe2ff, transparent 32%),
    var(--canvas);
}
.login-card {
  width: min(100%, 430px);
  padding: 42px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #635bff, var(--primary-dark));
  color: #fff;
  font-weight: 900;
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.muted {
  color: var(--muted);
}
.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}
textarea {
  min-height: 90px;
  resize: vertical;
}
.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}
.app-shell {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 240px;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 7px 32px;
}
.brand strong, .brand small {
  display: block;
}
.brand small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
}
.main-nav {
  display: grid;
  gap: 3px;
}
.nav-item, .quiet-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-item:hover, .nav-item.active, .quiet-button:hover {
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 800;
}
.sidebar-bottom {
  display: grid;
  gap: 3px;
  margin-top: auto;
}
.main-content {
  margin-left: 240px;
  padding: 34px clamp(20px, 5vw, 76px) 70px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}
.topbar h1 {
  margin: 0;
  font-size: 28px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
}
.button.primary {
  background: var(--primary);
  color: #fff;
}
.button.primary:hover {
  background: var(--primary-dark);
}
.button.secondary {
  border-color: var(--line);
  background: #fff;
}
.filters {
  display: grid;
  grid-template-columns:
    minmax(200px, 1fr) repeat(3, minmax(130px, max-content));
  gap: 10px;
  margin-bottom: 20px;
}
.search {
  position: relative;
  display: block;
}
.search svg {
  position: absolute;
  top: 11px;
  left: 11px;
  color: var(--muted);
}
.search input {
  padding-left: 38px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.kpi, .panel, .node, .flow-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.kpi {
  padding: 14px;
}
.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.kpi strong {
  font-size: 24px;
}
.area-chips, .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.area-chips {
  margin-bottom: 17px;
}
.chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
}
.chip.done {
  background: #dcfce7;
  color: var(--success);
}
.chip.blocked {
  background: #fef3c7;
  color: var(--warning);
}
.chip.high {
  background: #fee2e2;
  color: var(--danger);
}
.board-tree {
  display: grid;
  gap: 12px;
}
.node {
  padding: 14px;
}
.node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.node-title {
  font-weight: 800;
}
.node-header > span {
  white-space: nowrap;
}
.node-children {
  display: grid;
  gap: 9px;
  margin: 12px 0 0 17px;
  padding-left: 14px;
  border-left: 2px solid var(--soft);
}
.empty {
  padding: 55px 22px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
}
.table {
  overflow: auto;
}
.table-row {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 0.7fr 0.8fr 0.8fr;
  gap: 10px;
  align-items: center;
  min-width: 720px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}
.table-row:last-child {
  border-bottom: 0;
}
.table-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.flow-wrap, .timeline-wrap {
  overflow: auto;
}
.flow {
  display: flex;
  align-items: stretch;
  gap: 14px;
  min-width: 720px;
}
.flow-column {
  display: grid;
  align-content: start;
  gap: 11px;
  min-width: 180px;
  flex: 1;
}
.flow-arrow {
  align-self: center;
  color: var(--primary);
  font-weight: 800;
}
.flow-card {
  padding: 14px;
  border-left: 4px solid var(--primary);
}
.flow-card small {
  color: var(--muted);
}
.timeline {
  min-width: 720px;
}
.timeline-axis {
  display: grid;
  grid-template-columns: 220px 1fr;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.timeline-axis div:last-child {
  display: flex;
  justify-content: space-between;
}
.timeline-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}
.timeline-label {
  padding-left: 12px;
  font-weight: 700;
}
.timeline-track {
  position: relative;
  height: 24px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(25% - 1px),
    #edf0f5 calc(25% - 1px),
    #edf0f5 25%
  );
}
.timeline-bar {
  position: absolute;
  top: 4px;
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, #818cf8, var(--primary));
}
dialog {
  width: min(100% - 28px, 560px);
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.26);
}
dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}
dialog form {
  padding: 22px;
}
.dialog-header, .dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dialog-header {
  margin-bottom: 19px;
}
.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}
.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.wide {
  grid-column: 1/-1;
}
.dialog-footer {
  margin-top: 22px;
}
.dialog-footer span {
  flex: 1;
}
#toast {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 5;
  max-width: 340px;
  padding: 12px 15px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: none;
}
.mobile-nav {
  display: none;
}
.mobile-account-actions {
  display: none;
}
@media (min-width: 1200px) {
  .main-content {
    max-width: 1600px;
  }
}
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin: 0;
    padding: 22px 16px 86px;
  }
  .topbar h1 {
    font-size: 24px;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .mobile-account-actions {
    display: flex;
    gap: 8px;
    margin: -10px 0 18px;
  }
  .mobile-account-actions .button {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
  }
  .search {
    grid-column: 1/-1;
  }
  .mobile-nav {
    position: fixed;
    z-index: 3;
    inset: auto 0 0;
    display: flex;
    justify-content: space-around;
    padding: 7px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
  }
  .mobile-nav button {
    display: grid;
    place-items: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
  }
  .kpis {
    grid-template-columns: 1fr 1fr;
  }
  .dialog-grid {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: auto;
  }
}
@media (max-width: 390px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .topbar .button {
    width: 100%;
  }
  .login-card {
    padding: 30px 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
