:root {
  --ink: #172033;
  --muted: #687085;
  --line: #e6e8ee;
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --navy: #17223b;
  --accent: #11a889;
  --accent-soft: #e8f8f4;
  --critical: #d44747;
  --critical-soft: #fff0ee;
  --warning: #d7892d;
  --warning-soft: #fff6e8;
  --info: #4b6fbf;
  --info-soft: #eef3ff;
  --shadow: 0 8px 30px rgba(23, 32, 51, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.55;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  padding: 24px 18px;
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; color: #0c4439; font-weight: 900;
  background: linear-gradient(135deg, #a9f4df, #4ad3b1);
}
.brand strong { display: block; font-size: 14px; letter-spacing: .08em; }
.brand span { display: block; color: #9da8bf; font-size: 11px; margin-top: 1px; }

.nav { display: grid; gap: 5px; }
.nav-item {
  appearance: none; border: 0; color: #aeb7c9; background: transparent;
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 11px 12px; border-radius: 10px; font-size: 14px; font-weight: 650;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: rgba(79, 220, 184, .15); }
.nav-icon { width: 21px; color: #6ee6c7; font-size: 17px; text-align: center; }

.sidebar-note {
  margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04); border-radius: 12px;
}
.sidebar-note p { margin: 8px 0 0; color: #abb5c8; font-size: 11px; line-height: 1.65; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .14em; color: #61dfbd; }

.main { grid-column: 2; min-width: 0; }
.topbar {
  height: 74px; padding: 0 32px; background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px);
}
.workspace-picker { display: flex; align-items: center; gap: 10px; }
.workspace-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #edf1f8; font-weight: 800; color: #526078; }
.workspace-picker small { display: block; color: #9299a8; font-size: 9px; letter-spacing: .12em; }
.workspace-picker strong { display: block; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync-status { color: var(--muted); font-size: 12px; margin-right: 6px; }
.sync-status i { width: 7px; height: 7px; display: inline-block; background: var(--accent); border-radius: 50%; margin-right: 7px; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 22px; }

.button { border: 0; border-radius: 9px; padding: 9px 14px; font-size: 12px; font-weight: 750; }
.button.primary { color: white; background: var(--accent); box-shadow: 0 4px 14px rgba(17,168,137,.18); }
.button.primary:hover { background: #0d9479; }
.button.secondary { color: #4d566a; background: #f0f2f6; }
.button.secondary:hover { background: #e5e8ee; }

.page { width: min(1240px, calc(100% - 64px)); margin: 0 auto; padding: 34px 0 64px; }
.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 24px; }
.page-header h1 { margin: 4px 0 5px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.045em; }
.page-header p { margin: 0; color: var(--muted); font-size: 13px; }
.date-chip { background: white; border: 1px solid var(--line); padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 17px 18px; box-shadow: var(--shadow); }
.metric-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-icon { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: #f2f4f7; color: #667085; }
.metric-value { display: block; margin-top: 9px; font-size: 25px; line-height: 1; letter-spacing: -.04em; }
.metric-foot { display: block; margin-top: 7px; color: #9198a6; font-size: 10px; }
.metric-card.danger .metric-icon { background: var(--critical-soft); color: var(--critical); }
.metric-card.warning .metric-icon { background: var(--warning-soft); color: var(--warning); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 18px 20px 14px; border-bottom: 1px solid #eff0f3; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.panel-count { color: var(--muted); background: #f1f3f6; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; }

.signal-list { padding: 8px 10px 11px; }
.signal-card { display: grid; grid-template-columns: 35px 1fr auto; gap: 11px; padding: 13px 10px; border-bottom: 1px solid #f0f1f4; align-items: start; }
.signal-card:last-child { border-bottom: 0; }
.severity-dot { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.severity-critical { color: var(--critical); background: var(--critical-soft); }
.severity-high { color: var(--warning); background: var(--warning-soft); }
.severity-medium { color: var(--info); background: var(--info-soft); }
.signal-title { margin: 0; font-size: 13px; font-weight: 800; }
.signal-summary { margin: 2px 0 0; color: var(--ink); font-size: 12px; }
.signal-reason { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.signal-action { color: var(--accent); font-size: 10px; font-weight: 750; white-space: nowrap; margin-top: 3px; }

.workload-list { padding: 15px 18px 20px; }
.workload-row { margin-bottom: 17px; }
.workload-row:last-child { margin-bottom: 0; }
.workload-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; margin-bottom: 6px; }
.member-name { font-weight: 800; }
.manager-tag { margin-left: 5px; color: #805f00; background: #fff4c9; border-radius: 4px; padding: 2px 4px; font-size: 8px; }
.risk-number { color: var(--muted); }
.bar { height: 7px; border-radius: 999px; background: #edf0f3; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #39c9a5, #11a889); }
.bar > i.hot { background: linear-gradient(90deg, #f0ad4e, #dc7148); }
.workload-detail { display: flex; gap: 9px; margin-top: 5px; color: #9299a7; font-size: 9px; }

.full-panel { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: #89909f; font-size: 10px; text-align: left; letter-spacing: .03em; background: #fafbfc; }
th, td { padding: 12px 16px; border-bottom: 1px solid #eef0f3; }
td { font-size: 11px; }
tr:last-child td { border-bottom: 0; }
.task-title { font-weight: 700; min-width: 220px; }
.status-pill, .priority-pill { display: inline-block; padding: 3px 7px; border-radius: 999px; background: #f0f2f5; color: #60697b; font-size: 9px; font-weight: 750; }
.priority-high, .priority-urgent { color: #b3443f; background: #fff0ee; }
.risk-score { font-weight: 850; }
.risk-high { color: var(--critical); }

.import-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.dropzone { margin: 20px; min-height: 260px; border: 1.5px dashed #bcc4d1; border-radius: 14px; display: grid; place-items: center; text-align: center; padding: 30px; background: #fafbfc; transition: .2s; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 23px; }
.dropzone h3 { margin: 0; font-size: 15px; }
.dropzone p { color: var(--muted); font-size: 11px; margin: 7px 0 15px; }
.dropzone input { display: none; }
.help-list { padding: 17px 20px; margin: 0; list-style: none; }
.help-list li { padding: 11px 0; border-bottom: 1px solid #eff0f2; font-size: 11px; color: var(--muted); }
.help-list li:last-child { border: 0; }
.help-list strong { color: var(--ink); display: block; margin-bottom: 2px; }
.text-link { color: var(--accent); font-weight: 750; text-decoration: none; }

.empty { padding: 45px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.loading { min-height: calc(100vh - 74px); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; color: white; background: #172033; border-radius: 10px; padding: 11px 15px; font-size: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a63d3d; }

@media (max-width: 980px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .import-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { width: 100%; }
  .mobile-menu { display: block; }
  .workspace-picker { display: none; }
  .topbar { padding: 0 16px; }
  .sync-status, #reset-button { display: none; }
  .page { width: min(100% - 30px, 1240px); padding-top: 24px; }
  .page-header { align-items: flex-start; }
  .date-chip { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .signal-card { grid-template-columns: 34px 1fr; }
  .signal-action { grid-column: 2; }
}
