/* 自動運転マップ。トークンは office-v2 / office-theme */
.oam.ov2-page {
  --shadow: var(--ov2-shadow);
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2px 28px;
  background: transparent;
}
.oam { --shadow: var(--ov2-shadow); max-width: 1180px; margin-bottom: 24px; }
.oam h1 { margin: 0 0 6px; font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.oam-lead { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 46rem; line-height: 1.6; }
.oam-hero {
  display: grid; grid-template-columns: 1.4fr auto; gap: 16px; align-items: center;
  padding: 18px 20px; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  animation: oam-rise .45s cubic-bezier(.2, .9, .2, 1) both;
}
.oam-hero-kpis { display: flex; gap: 10px; }
.oam-kpi {
  min-width: 88px; text-align: center; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2);
  transition: transform .18s ease, border-color .18s ease;
}
.oam-kpi .k { font-size: 10px; font-weight: 750; color: var(--muted); }
.oam-kpi .v { font-size: 22px; font-weight: 900; margin-top: 2px; }
.oam-kpi.is-ok .v { color: var(--st-done, #0e9f6e); }
.oam-kpi.is-bad .v { color: var(--st-alert, #dc2626); }

.oam-impact { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.oam-imp {
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  animation: oam-rise .5s cubic-bezier(.2, .9, .2, 1) both;
  transition: transform .18s ease, border-color .18s ease;
}
.oam-imp:nth-child(1) { animation-delay: .04s; }
.oam-imp:nth-child(2) { animation-delay: .08s; }
.oam-imp:nth-child(3) { animation-delay: .12s; }
.oam-imp:nth-child(4) { animation-delay: .16s; }
.oam-imp:hover { transform: translateY(-2px); border-color: var(--line-2, #cbd5e6); }
.oam-imp .k { font-size: 11px; font-weight: 750; color: var(--muted); }
.oam-imp .v { font-size: 26px; font-weight: 900; letter-spacing: -.03em; margin-top: 4px; line-height: 1.05; }
.oam-imp .v small { font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 3px; }
.oam-imp .s { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.oam-imp.is-ok .v { color: var(--st-done, #0e9f6e); }
.oam-imp.is-warn .v { color: #b45309; }
.oam-imp.is-bad .v { color: var(--st-alert, #dc2626); }

.oam-ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.oam-ops-line {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  animation: oam-rise .42s cubic-bezier(.2, .9, .2, 1) both;
  transition: border-color .15s, transform .15s, box-shadow .18s ease;
}
.oam-ops-line:nth-child(1) { animation-delay: .06s; }
.oam-ops-line:nth-child(2) { animation-delay: .1s; }
.oam-ops-line:nth-child(3) { animation-delay: .14s; }
.oam-ops-line:nth-child(4) { animation-delay: .18s; }
.oam-ops-line:hover { transform: translateY(-2px); border-color: var(--line-2, #cbd5e6); box-shadow: var(--shadow); }
.oam-ops-line.is-focus { border-color: var(--c, #2563eb); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, #2563eb) 22%, transparent); }
.oam-ops-line .bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); }
.oam-ops-line .nm { font-size: 12px; font-weight: 800; line-height: 1.25; }
.oam-ops-line .sl { font-size: 10.5px; font-weight: 750; margin-top: 2px; }
.oam-ops-line[data-state="ok"] .sl { color: var(--st-done, #0e9f6e); }
.oam-ops-line[data-state="delay"] .sl { color: var(--st-alert, #dc2626); }
.oam-ops-line[data-state="wait"] .sl { color: #b45309; }

.oam-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.oam-view[hidden] { display: none !important; }
.oam-view:not([hidden]) { animation: oam-fade .28s ease both; }
.oam-panel {
  padding: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  animation: oam-rise .48s cubic-bezier(.2, .9, .2, 1) .12s both;
}
.oam-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.oam-ph h2 { margin: 0; font-size: 14px; font-weight: 850; }
.oam-ph .note { font-size: 11.5px; color: var(--muted); }
.oam-pb { padding: 12px 14px 14px; }

.oam-metro-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
.oam-metro { padding: 6px 4px 10px; overflow-x: auto; }
.oam-metro svg { display: block; width: 100%; min-width: 760px; height: auto; }
.oam-metro .trk { stroke-width: 6; stroke-linecap: round; fill: none; }
.oam-metro .trk.is-future {
  stroke-dasharray: 2 9; opacity: .55;
  animation: oam-dash 1.8s linear infinite;
}
.oam-metro .trk.is-live { filter: drop-shadow(0 0 3px color-mix(in srgb, currentColor 35%, transparent)); }
.oam-metro .car { filter: drop-shadow(0 1px 2px rgba(11, 22, 48, .28)); }
.oam-metro .stn { cursor: pointer; }
.oam-metro .stn circle,
.oam-metro .stn rect {
  transition: transform .15s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.oam-metro .stn:hover circle,
.oam-metro .stn:hover rect,
.oam-metro .stn:focus-visible circle,
.oam-metro .stn:focus-visible rect { transform: scale(1.14); }
.oam-metro .stn.is-sel circle,
.oam-metro .stn.is-sel rect { transform: scale(1.18); }
.oam-metro .sel-ring {
  fill: none; stroke: var(--blue-500, #3b82f6); stroke-width: 2;
  stroke-dasharray: 4 3; opacity: .85;
  animation: oam-ring 1.2s linear infinite;
  transform-box: fill-box; transform-origin: center;
}
.oam-metro .lbl { font-size: 12px; font-weight: 800; fill: var(--ink); }
.oam-metro .sub { font-size: 10.5px; fill: var(--muted); font-weight: 650; }
.oam-metro .tchip { font-size: 10px; font-weight: 800; }
.oam-metro .lname { font-size: 13px; font-weight: 900; fill: var(--ink); }
.oam-metro .lstate { font-size: 10.5px; font-weight: 800; }
.oam-metro .edge { font-size: 9.5px; fill: var(--muted); font-weight: 700; }
.oam-metro .pulse { animation: oam-pulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes oam-pulse { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes oam-dash { to { stroke-dashoffset: -22; } }
@keyframes oam-ring { to { stroke-dashoffset: -14; } }
@keyframes oam-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes oam-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes oam-detail-in {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: none; }
}
.oam-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-2); }
.oam-legend .muted { color: var(--muted); }

.oam-detail {
  padding: 14px; position: sticky; top: 64px; align-self: start; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.oam-detail.is-swap > * { animation: oam-detail-in .28s cubic-bezier(.2, .9, .2, 1) both; }
.oam-detail .line-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--muted); }
.oam-detail .line-tag i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.oam-detail h3 { margin: 8px 0 2px; font-size: 18px; font-weight: 900; }
.oam-detail .who { color: var(--muted); font-size: 12px; font-weight: 700; }
.oam-detail dl { margin: 12px 0 0; display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; font-size: 12.5px; }
.oam-detail dt { color: var(--muted); font-weight: 750; }
.oam-detail dd { margin: 0; color: var(--ink-2); line-height: 1.5; word-break: break-word; }
.oam-detail .err { margin-top: 12px; padding: 10px; border-radius: 10px; background: rgba(220,38,38,.07); border: 1px solid rgba(220,38,38,.25); color: var(--st-alert, #dc2626); font-size: 12px; line-height: 1.5; }
.oam-detail .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.oam-detail .story { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.55; }
.oam-st {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 10.5px; font-weight: 750; border: 1px solid var(--line); background: var(--panel-2);
}
.oam-st[data-s="soon"] { background: rgba(37,99,235,.1); border-color: rgba(37,99,235,.25); color: var(--blue-700, #1d4ed8); }
.oam-st[data-s="done"] { background: rgba(14,159,110,.1); border-color: rgba(14,159,110,.25); color: var(--st-done, #0e9f6e); }
.oam-st[data-s="fail"] { background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.25); color: var(--st-alert, #dc2626); }
.oam-st[data-s="run"] { background: rgba(37,99,235,.12); border-color: rgba(37,99,235,.3); color: var(--blue-700, #1d4ed8); }
.oam-st[data-s="wait"] { background: #fffbeb; border-color: #fcd34d; color: #b45309; }

.oam-river { padding: 8px 6px 4px; overflow-x: auto; }
.oam-river svg { display: block; width: 100%; min-width: 760px; height: auto; }
.oam-river .lane-lbl { font-size: 11.5px; font-weight: 800; fill: var(--ink-2); }
.oam-river .tick { font-size: 10px; fill: var(--muted); font-weight: 650; }
.oam-river .grid { stroke: var(--line); stroke-width: 1; }
.oam-river .lane-bg { fill: var(--panel-2, #f6f8fc); }
.oam-river .now {
  stroke: var(--st-alert, #dc2626); stroke-width: 2;
  animation: oam-now 1.8s ease-in-out infinite;
}
.oam-river .now-lbl { font-size: 10.5px; font-weight: 900; fill: var(--st-alert, #dc2626); }
.oam-river .dot {
  transform-box: fill-box; transform-origin: center;
  transition: transform .15s ease;
}
.oam-river .dot:hover { transform: scale(1.25); }
@keyframes oam-now {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.oam-slot {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: start;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12.5px;
  animation: oam-rise .32s cubic-bezier(.2, .9, .2, 1) both;
}
.oam-slot:nth-child(n+8) { animation: none; }
.oam-slot:last-child { border-bottom: 0; }
.oam-slot .at { font-variant-numeric: tabular-nums; font-weight: 800; }
.oam-slot .who { font-weight: 800; }
.oam-slot .what { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.oam-slot a { color: var(--blue-600); text-decoration: none; font-weight: 650; }

.oam-foot { margin: 16px 0 0; font-size: 12px; color: var(--muted); }
.oam-foot a { color: var(--blue-600); font-weight: 700; text-decoration: none; }
.oam-status { margin: 12px 0; color: var(--muted); font-size: 13px; }
.oam-empty { padding: 18px; color: var(--muted); text-align: center; font-size: 13px; }

@media (max-width: 980px) {
  .oam-hero, .oam-metro-wrap { grid-template-columns: 1fr; }
  .oam-impact, .oam-ops { grid-template-columns: repeat(2, 1fr); }
  .oam-detail { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .oam-hero,
  .oam-imp,
  .oam-ops-line,
  .oam-panel,
  .oam-view:not([hidden]),
  .oam-detail.is-swap > *,
  .oam-slot,
  .oam-metro .pulse,
  .oam-metro .trk.is-future,
  .oam-metro .sel-ring,
  .oam-river .now,
  .office-auto-desk .oam-ops-line,
  .office-auto-desk .oam-gate,
  .office-auto-desk .oam-next {
    animation: none !important;
  }
  .oam-imp:hover,
  .oam-ops-line:hover,
  .oam-metro .stn:hover circle,
  .oam-metro .stn:hover rect,
  .oam-metro .stn.is-sel circle,
  .oam-metro .stn.is-sel rect,
  .oam-river .dot:hover {
    transform: none !important;
  }
}

/* ドック内の運行カード */
.office-auto-desk .oam-ops { grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.office-auto-desk .oam-gate {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center;
  padding: 12px; border-radius: 12px; border: 1px solid #fcd34d;
  background: linear-gradient(135deg, #fffbeb, #fff); margin-bottom: 10px;
  animation: oam-rise .4s cubic-bezier(.2, .9, .2, 1) both;
}
.office-auto-desk .oam-gate .t { font-size: 22px; font-weight: 900; color: #b45309; }
.office-auto-desk .oam-gate .n { font-size: 13px; font-weight: 800; }
.office-auto-desk .oam-gate .m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.office-auto-desk .oam-next {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center;
  padding: 12px; border-radius: 12px; border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, var(--blue-50, #eff6ff), #fff); margin-bottom: 10px;
  animation: oam-rise .42s cubic-bezier(.2, .9, .2, 1) .06s both;
}
.office-auto-desk .oam-next .t { font-size: 20px; font-weight: 900; color: var(--blue-700, #1d4ed8); }
html[data-office-theme="night"] .office-auto-desk .oam-gate { background: rgba(245,158,11,.12); }
html[data-office-theme="night"] .office-auto-desk .oam-next { background: rgba(37,99,235,.16); border-color: #24396a; }
