html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ================================================================
   サイドメニュー式レイアウト（LogViewer デスクトップ版と同系統の配色）
   ================================================================ */
body {
  margin-bottom: 0;
}

:root {
  --sidebar-bg: #1e2130;
  --sidebar-hover: #2d3246;
  --sidebar-active: #3478f6;
  --sidebar-text: #c7ccdb;
  --content-bg: #f5f6fa;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar,
.app-sidebar-offcanvas {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.app-sidebar {
  flex: 0 0 220px;
  height: 100vh;
  position: sticky;
  top: 0;
  transition: flex-basis 0.15s ease, width 0.15s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-collapse-toggle {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
}

.sidebar-collapse-toggle:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

/* ================================================================
   折りたたみ状態（デスクトップのみ。localStorageで状態を保持しJSで
   bodyへsidebar-collapsedクラスを付け外しする）
   ================================================================ */
body.sidebar-collapsed .app-sidebar {
  flex-basis: 64px;
  width: 64px;
}

body.sidebar-collapsed .sidebar-brand {
  padding: 18px 10px;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-tenant-name,
body.sidebar-collapsed .sidebar-label {
  display: none;
}

body.sidebar-collapsed .sidebar-collapse-toggle {
  margin-left: 0;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}

.sidebar-brand small {
  font-weight: 400;
  color: var(--sidebar-text);
}

.sidebar-brand-icon {
  font-size: 1.4rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.sidebar-icon {
  width: 1.3em;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  max-width: 220px;
}

.sidebar-logout {
  color: var(--sidebar-text);
  cursor: pointer;
}

.sidebar-logout:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
}

.app-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-topbar-toggle {
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 8px;
}

.app-topbar-toggle .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.app-topbar-brand {
  font-weight: 600;
  font-size: 0.95rem;
}

.app-content {
  flex: 1 1 auto;
  padding: 20px;
  overflow-x: auto;
}

.app-footer {
  padding: 12px 20px;
  border-top: 1px solid #dee2e6;
  font-size: 0.85rem;
}

@media (max-width: 767.98px) {
  .app-content {
    padding: 14px;
  }
}

/* ================================================================
   ダッシュボードのKPIカード（平常時は白、異常時は色で塗りつぶす）
   ================================================================ */
.kpi-card {
  height: 100%;
  padding: 16px 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e3e7ee;
  color: #1e2130;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(30, 33, 48, 0.1);
}

.kpi-label {
  font-size: 0.8rem;
  color: #6b7280;
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.15;
  margin: 4px 0 8px;
}

.kpi-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef0f6;
  color: #4b5262;
}

.kpi-ok .kpi-badge {
  background: #e1f5ee;
  color: #085041;
}

.kpi-warn {
  border-color: #e9b45f;
  background: #fff8ec;
}

.kpi-warn .kpi-value {
  color: #854f0b;
}

.kpi-warn .kpi-badge {
  background: #faeeda;
  color: #633806;
}

.kpi-bad {
  background: #e24b4a;
  border-color: #e24b4a;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(226, 75, 74, 0.35);
  animation: kpiPulse 2.4s ease-in-out infinite;
}

.kpi-bad .kpi-label {
  color: #fcebeb;
}

.kpi-bad .kpi-badge {
  background: #ffffff;
  color: #791f1f;
}

@keyframes kpiPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(226, 75, 74, 0.35); }
  50% { box-shadow: 0 8px 30px rgba(226, 75, 74, 0.6); }
}

@media (prefers-reduced-motion: reduce) {
  .kpi-bad { animation: none; }
  .kpi-card { transition: none; }
}

/* ================================================================
   ダッシュボードの「最近の認証イベント」（優先対応アラート風の表）
   ================================================================ */
.alert-panel {
  background: #fbfcff;
  border: 1px solid #e3e7ee;
  border-radius: 16px;
  padding: 20px 22px 14px;
  box-shadow: 0 6px 20px rgba(30, 33, 48, 0.06);
}

.alert-panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e2130;
}

.alert-panel-sub {
  font-size: 0.8rem;
  color: #6b7a99;
  margin-bottom: 12px;
}

.alert-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.alert-table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.78rem;
  color: #6b7a99;
  padding: 8px 10px;
  border-bottom: 1px solid #d9e0ec;
  white-space: nowrap;
}

.alert-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #e6ebf3;
  color: #1e2130;
  vertical-align: middle;
}

.alert-table tbody tr:last-child td {
  border-bottom: none;
}

.alert-table tbody tr:hover td {
  background: #f1f5fc;
}

.alert-time {
  white-space: nowrap;
  color: #4b5262;
}

.alert-main {
  font-weight: 600;
}

.alert-sub {
  font-size: 0.75rem;
  color: #6b7a99;
  margin-top: 1px;
  word-break: break-all;
}

.alert-empty {
  text-align: center;
  color: #6b7a99;
  padding: 24px 0 !important;
}

.sev {
  display: inline-block;
  min-width: 64px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
}

.sev-critical { background: #8b1538; color: #ffffff; }
.sev-high     { background: #6b3d10; color: #ffd166; }
.sev-medium   { background: #fdf0d2; color: #7a5200; }
.sev-info     { background: #e8eef9; color: #4b5b7a; }

.trend {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.trend i {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: #38bdf8;
}

/* ================================================================
   ダッシュボードのグラフカード（ログインの成功・失敗／脆弱性の枠）
   ================================================================ */
.chart-panel {
  height: 100%;
  background: #fbfcff;
  border: 1px solid #e3e7ee;
  border-radius: 16px;
  padding: 20px 22px 16px;
  box-shadow: 0 6px 20px rgba(30, 33, 48, 0.06);
  display: flex;
  flex-direction: column;
}

.chart-plot {
  position: relative;
  height: 210px;
  margin: 18px 0 0 34px;
}

.chart-grid {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid #e6ebf3;
}

.chart-grid span {
  position: absolute;
  left: -34px;
  top: -8px;
  width: 28px;
  text-align: right;
  font-size: 0.7rem;
  color: #8a96b0;
}

.chart-days {
  position: absolute;
  inset: 0;
  display: flex;
}

.chart-day {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  padding: 0 4px;
}

.chart-bar {
  position: relative;
  width: 36%;
  max-width: 46px;
  min-height: 2px;
  border-radius: 6px 6px 0 0;
  transition: filter 0.15s ease;
}

.chart-day:hover .chart-bar {
  filter: brightness(0.92);
}

.chart-bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  font-size: 0.7rem;
  color: #4b5262;
  white-space: nowrap;
}

.chart-bar-ok { background: #34d399; }
.chart-bar-ng { background: #fb7185; }

.chart-xaxis {
  display: flex;
  margin: 6px 0 0 34px;
}

.chart-xaxis span {
  flex: 1 1 0;
  text-align: center;
  font-size: 0.72rem;
  color: #6b7a99;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin: 12px 0 0 34px;
  font-size: 0.8rem;
  color: #4b5262;
}

.chart-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

.chart-placeholder {
  flex: 1 1 auto;
  min-height: 210px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #c9d2e3;
  border-radius: 12px;
  color: #8a96b0;
  font-size: 0.9rem;
}

/* ================================================================
   セキュリティダッシュボード
   ================================================================ */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.chart-legend-head {
  margin: 0;
}

.chart-compact .chart-bar span {
  display: none;
}

.sec-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #e3e7ee;
  border-left: 5px solid #1d9e75;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 14px;
}

.sec-banner-warn { border-left-color: #f59e0b; }
.sec-banner-bad  { border-left-color: #dc2626; background: #fff6f6; }

.sec-banner-title {
  font-weight: 700;
  color: #1e2130;
}

.sec-banner-sub {
  font-size: 0.8rem;
  color: #6b7a99;
  margin-top: 2px;
}

.sec-banner-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.sec-banner-actions .form-select {
  width: auto;
}

.sec-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 991.98px) {
  .sec-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.sec-kpi {
  background: #ffffff;
  border: 2px solid #1d9e75;
  border-radius: 14px;
  padding: 14px 16px;
}

.sec-kpi-warn { border-color: #f59e0b; }
.sec-kpi-bad  { border-color: #dc2626; }
.sec-kpi-idle { border-color: #d3d9e6; border-style: dashed; }

.sec-kpi-label {
  font-size: 0.78rem;
  color: #6b7a99;
}

.sec-kpi-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1e2130;
}

.sec-kpi-idle .sec-kpi-value { color: #b3bccd; }
.sec-kpi-value-ok   { color: #0f8a5f; }
.sec-kpi-value-warn { color: #b7791f; }
.sec-kpi-value-bad  { color: #dc2626; }

.sec-kpi-sub {
  font-size: 0.75rem;
  color: #6b7a99;
}

.sec-kpi-sub-bad { color: #dc2626; }

.hbar-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hbar-row {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr) 2.6em;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: #1e2130;
}

.hbar-track {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: #eceff5;
  overflow: hidden;
}

.hbar-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.hbar-value {
  text-align: right;
  font-weight: 600;
}

.heat-peak {
  font-weight: 700;
  color: #b91c1c;
}

.heat-strip {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
  margin-top: 14px;
}

.heat-cell {
  height: 34px;
  border-radius: 5px;
}

.heat-0 { background: #e9ecf3; }
.heat-1 { background: #fecaca; }
.heat-2 { background: #f87171; }
.heat-3 { background: #b91c1c; }

.heat-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.72rem;
  color: #6b7a99;
}

.sec-page .sev-critical { background: #fde2e2; color: #b42318; }
.sec-page .sev-high     { background: #fdf0c8; color: #8a5a00; }
.sec-page .sev-medium   { background: #dff0fb; color: #1d5f8a; }
.sec-page .sev-info     { background: #e8eef9; color: #4b5b7a; }

.risk-score { font-weight: 700; }
.risk-high { color: #dc2626; }
.risk-mid  { color: #b7791f; }
.risk-low  { color: #0f8a5f; }

.alert-note {
  font-size: 0.72rem;
  color: #8a96b0;
  margin-top: 10px;
}

.alert-empty-box {
  margin-top: 14px;
  padding: 28px 0;
  text-align: center;
  color: #8a96b0;
  font-size: 0.85rem;
  border: 1px dashed #d3d9e6;
  border-radius: 12px;
}

.tl-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 0 0 14px;
  border-left: 2px solid #e1e6f0;
}

.tl-list li {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 0 0 12px 12px;
  font-size: 0.85rem;
}

.tl-list li::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc2626;
  border: 2px solid #fbfcff;
}

.tl-time {
  flex: 0 0 auto;
  min-width: 6.5em;
  color: #4b5262;
}

.tl-body b {
  color: #1e2130;
}

.tl-meta {
  display: block;
  font-size: 0.75rem;
  color: #6b7a99;
  word-break: break-all;
}

/* ================================================================
   Logs（アクセスログ）
   ================================================================ */
.log-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.log-kpi {
  background: #ffffff;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  padding: 12px 16px;
}

.log-kpi-label { font-size: 0.75rem; color: #6b7a99; }
.log-kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.25; color: #1e2130; }
.log-kpi-sub   { font-size: 0.72rem; color: #6b7a99; }
.log-kpi-ok    { color: #0f8a5f; }
.log-kpi-warn  { color: #c2410c; }
.log-kpi-bad   { color: #dc2626; }

.log-card {
  background: #ffffff;
  border: 1px solid #e3e7ee;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.log-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.log-card-title { font-weight: 700; color: #1e2130; }
.log-card-sub   { font-size: 0.75rem; color: #6b7a99; margin-top: 2px; }

.log-filter-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.6fr) repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.lf-label {
  display: block;
  font-size: 0.72rem;
  color: #6b7a99;
  margin-bottom: 3px;
}

.lf-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lf-range .form-control { min-width: 0; }

.lf-actions {
  display: flex;
  gap: 8px;
}

.log-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
}

.log-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #4b5262;
  cursor: pointer;
}

.log-chip { cursor: pointer; }

.log-chip input { position: absolute; opacity: 0; pointer-events: none; }

.log-chip span {
  display: inline-block;
  font-size: 0.78rem;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid #d3d9e6;
  background: #f4f6fb;
  color: #4b5262;
}

.log-chip input:checked + span {
  background: #3478f6;
  border-color: #3478f6;
  color: #ffffff;
}

.log-chip input:focus-visible + span {
  outline: 2px solid #258cfb;
  outline-offset: 2px;
}

.log-chip-warn span {
  background: #fdeaea;
  border-color: #f5b5b5;
  color: #b42318;
}

.log-chip-warn input:checked + span {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.log-pagesize { width: auto; }

.log-scroll {
  max-height: 68vh;
  overflow: auto;
  border-top: 1px solid #e3e7ee;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.log-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f6fb;
  text-align: left;
  font-weight: 500;
  font-size: 0.74rem;
  color: #6b7a99;
  padding: 9px 12px;
  white-space: nowrap;
  border-bottom: 1px solid #e3e7ee;
}

.log-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #edf0f6;
  color: #1e2130;
  vertical-align: middle;
}

.log-table tbody tr:hover td { background: #f6f9ff; }

.log-table .c-time    { white-space: nowrap; color: #4b5262; }
.log-table .c-machine { white-space: nowrap; font-weight: 600; }
.log-table .c-event   { font-weight: 600; }
.log-table .ev-detail { margin-top: 4px; font-weight: 400; font-size: 0.74rem; color: #5b6476; min-width: 280px; max-width: 560px; overflow-wrap: anywhere; }
.log-table .ev-detail > div + div { margin-top: 2px; }
.log-table .c-ip      { color: #2563eb; white-space: nowrap; }
.log-table .c-error   { color: #b42318; }
.log-table .is-empty  { color: #b3bccd; }

.log-row-threat td { background: #fff1f1; }

.log-empty-row td {
  text-align: center;
  color: #8a96b0;
  padding: 28px 0;
}

.res {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.res::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.res-ok     { background: #e1f5ee; color: #0f6e4f; }
.res-ng     { background: #fde8e8; color: #b42318; }
.res-threat { background: #b42318; color: #ffffff; }
.res-info   { background: #e3eefc; color: #1d5fb8; }
.res-other  { background: #eceff5; color: #4b5b7a; }

.log-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.log-pager-total {
  font-size: 0.75rem;
  color: #6b7a99;
}

@media (max-width: 991.98px) {
  .log-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .log-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lf-period { grid-column: 1 / -1; }
  .lf-actions { grid-column: 1 / -1; }
  .lf-actions .btn { flex: 1 1 0; }
}

@media (max-width: 767.98px) {
  .log-kpi { padding: 10px 12px; }
  .log-kpi-value { font-size: 1.45rem; }

  .log-card { padding: 14px; }

  .log-filter-grid { grid-template-columns: minmax(0, 1fr); }
  .log-filter-grid > * { min-width: 0; }

  .lf .form-control,
  .lf .form-select,
  .lf-range .form-control { font-size: 16px; }

  .lf-actions .btn { padding-top: 9px; padding-bottom: 9px; }

  .log-chip span,
  .log-check { padding-top: 5px; padding-bottom: 5px; }

  /* 表をやめて、1件ずつのカードにする（横スクロール不要） */
  .log-scroll {
    max-height: none;
    overflow: visible;
    border-top: none;
  }

  .log-table,
  .log-table tbody { display: block; }

  .log-table thead { display: none; }

  .log-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #e3e7ee;
    border-radius: 12px;
    background: #ffffff;
  }

  .log-table tr.log-row-threat {
    border-color: #f5b5b5;
    background: #fff6f6;
  }

  .log-table tbody tr:hover td,
  .log-table tr.log-row-threat td { background: transparent; }

  .log-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
    border-bottom: none;
    grid-column: 1 / -1;
    font-size: 0.8rem;
    word-break: break-all;
  }

  .log-table td::before {
    content: attr(data-label);
    flex: 0 0 5.5em;
    color: #8a96b0;
    font-size: 0.72rem;
  }

  .log-table .c-event {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.9rem;
  }

  .log-table .c-event::before,
  .log-table .c-result::before,
  .log-table .c-time::before { display: none; }

  .log-table .c-result {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
  }

  .log-table .c-time {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.74rem;
    color: #6b7a99;
    margin-bottom: 4px;
  }

  .log-table .is-empty { display: none; }

  .log-empty-row { display: block; border: none; background: none; }
  .log-empty-row td { display: block; }
  .log-empty-row td::before { display: none; }

  .log-pager { flex-direction: column-reverse; align-items: stretch; }
  .log-pager nav { align-self: center; }
  .log-pager-total { text-align: center; }
  .log-pager .page-link { padding: 0.45rem 0.8rem; }
}

/* ================================================================
   登録マシン
   ================================================================ */
.mc-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mc-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mc-search-input { flex: 1 1 auto; min-width: 0; }
.mc-dept-select  { flex: 0 0 auto; width: auto; max-width: 180px; }
.mc-csv          { flex: 0 0 auto; white-space: nowrap; }

.mc-seg {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid #d3d9e6;
  border-radius: 8px;
  overflow: hidden;
}

.mc-seg button {
  border: 0;
  background: #ffffff;
  color: #4b5262;
  padding: 7px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.mc-seg button + button { border-left: 1px solid #d3d9e6; }
.mc-seg button b { font-weight: 700; margin-left: 2px; }
.mc-seg button.active { background: #1e2130; color: #ffffff; }

.mc-chips { margin-top: 12px; gap: 6px 8px; }

.mc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #eef1f7;
  color: #4b5b7a;
  text-decoration: none;
}

.mc-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.mc-chip .flag { width: 16px; height: 12px; vertical-align: -1px; }

.mc-chip-online { background: #eaf1f8; color: #3f5878; }
.mc-chip-attn   { background: #fdf0e3; color: #b4540a; }
.mc-chip-disk   { background: #fde8ec; color: #be123c; }

.mc-chip.active {
  border-color: currentColor;
  box-shadow: 0 0 0 2px rgba(52, 120, 246, 0.18);
  font-weight: 700;
}

.mc-clear {
  font-size: 0.78rem;
  color: #6b7a99;
  margin-left: 4px;
}

.mc-hint { margin-top: 0; white-space: nowrap; }

.mc-table .detail-row { cursor: pointer; }

.mc-table th,
.mc-table td { padding-left: 9px; padding-right: 9px; }

.mc-machine { min-width: 170px; }

.mc-machine-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mc-table .mc-cpu { min-width: 150px; }

.mc-dept .js-user:empty { display: none; }

.mc-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #e6edfb;
  color: #3b63c4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mc-icon-server { background: #ececf8; color: #5a5f8f; }

.mc-machine-text,
.mc-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mc-strong { font-weight: 600; color: #1e2130; }
.mc-sub    { font-size: 0.72rem; color: #6b7a99; }

.js-dept:empty::before,
.js-user:empty::before { content: "–"; color: #b3bccd; }

.mc-table .mc-ip {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #3b63c4;
  white-space: nowrap;
}

.mc-table .mc-time,
.mc-table .mc-user { white-space: nowrap; }

.mc-table .mc-os { min-width: 130px; }

.st {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.st::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.st-ok   { background: #e1f5ee; color: #0f6e4f; }
.st-attn { background: #fdf0e3; color: #b4540a; }

.mc-disk { min-width: 140px; }

.mc-bar {
  display: block;
  width: 90px;
  height: 7px;
  border-radius: 999px;
  background: #e8ebf2;
  overflow: hidden;
  margin-bottom: 3px;
}

.mc-bar i { display: block; height: 100%; border-radius: 999px; }
.mc-bar-ok   { background: #38a169; }
.mc-bar-warn { background: #f5a623; }
.mc-bar-bad  { background: #dc2646; }

/* ================================================================
   キー稼働状況（登録マシンと同じ部品を共用）
   ================================================================ */
.ks-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.ks-kpis .log-kpi-value { font-size: 1.6rem; }

.ks-kpi-slash {
  font-size: 0.85rem;
  font-weight: 500;
  color: #6b7a99;
}

.kpi-bar {
  height: 6px;
  border-radius: 999px;
  background: #e8ebf2;
  overflow: hidden;
  margin: 6px 0 4px;
}

.kpi-bar i { display: block; height: 100%; border-radius: 999px; }
.kpi-bar-green { background: #16a068; }
.kpi-bar-blue  { background: #2563eb; }

.st-bad { background: #fde8ec; color: #be123c; }
.st-off { background: #eceff5; color: #5b6477; }

.ks-table .mc-machine { min-width: 110px; }
.ks-table .ks-wg      { white-space: nowrap; color: #4b5262; }
.ks-table .ks-ver     { white-space: nowrap; }
.ks-table .ks-ver-old { color: #dc2626; font-weight: 700; }
.ks-table .ks-stale   { color: #b4540a; font-weight: 600; }

.assigned-user-cell:empty::before { content: "–"; color: #b3bccd; }

.ks-table .ks-accounts { white-space: nowrap; }
.ks-acc-count { margin-right: 6px; font-weight: 600; }

.ks-user-table th { font-size: 0.72rem; color: #6b7a99; font-weight: 500; white-space: nowrap; }
.ks-user-table td { font-size: 0.8rem; vertical-align: middle; }
.ks-mark { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.ks-mark-on  { background: #e1f5ee; color: #0f6e4f; }
.ks-mark-off { background: #fdeaea; color: #b42318; }

@media (max-width: 1199.98px) {
  .ks-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
  .ks-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ks-kpis .log-kpi:last-child { grid-column: 1 / -1; }
  .ks-table .mc-machine { min-width: 0; }
  .ks-table .mc-machine .mc-strong { font-size: 0.95rem; }

  /* 回復キー・OTP・ワンタッチ・LINE通知は2列×2段にまとめる */
  .ks-table td.ks-flag { grid-column: auto; align-items: center; }
  .ks-table td.ks-flag::before { flex: 0 0 auto; }}

@media (max-width: 991.98px) {
  .mc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .mc-search-row { flex-wrap: wrap; }
  .mc-search-input { flex: 1 1 100%; }
}

@media (max-width: 767.98px) {
  .mc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mc-kpis .log-kpi:last-child { grid-column: 1 / -1; }

  .mc-search-input { font-size: 16px; }
  .mc-seg { flex: 1 1 100%; }
  .mc-seg button { flex: 1 1 0; padding: 9px 6px; }
  .mc-dept-select { flex: 1 1 100%; max-width: none; font-size: 16px; }
  .mc-csv { flex: 1 1 100%; padding-top: 9px; padding-bottom: 9px; }

  .mc-hint { display: none; }

  /* 1台ずつのカード表示。1段目はマシン名と状態 */
  .mc-table td { padding-left: 0; padding-right: 0; }

  .mc-table td::before {
    flex: 0 0 7.2em;
    text-align: left;
    white-space: nowrap;
  }

  .mc-table .mc-machine { grid-column: 1; grid-row: 1; min-width: 0; padding-bottom: 6px; }
  .mc-table .mc-machine::before { display: none; }
  .mc-table .mc-status { grid-column: 2; grid-row: 1; justify-content: flex-end; align-self: center; }
  .mc-table .mc-status::before { display: none; }

  .mc-table .mc-stack { text-align: right; align-items: flex-end; }
  .mc-table td.mc-os,
  .mc-table td.mc-cpu,
  .mc-table td.mc-disk { min-width: 0; text-align: right; }
  .mc-table .mc-bar { margin-left: auto; }
  .mc-table .mc-machine-text { text-align: left; }
}

/* ================================================================
   LINE通知
   ================================================================ */
.line-qr {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto 14px;
  border: 1px solid #e3e7ee;
  border-radius: 10px;
}

.line-steps {
  margin: 0;
  padding-left: 1.3em;
  font-size: 0.85rem;
  color: #4b5262;
}

.line-steps li { margin-bottom: 4px; }

.line-add-form {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e6ebf3;
}

.line-rules {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
  color: #1e2130;
}

.line-rules li { padding: 6px 0; border-bottom: 1px solid #edf0f6; }
.line-rules li:last-child { border-bottom: none; }
.line-rules .sev { min-width: 52px; margin-right: 8px; }

/* ================================================================
   ログイン系ページ（未認証時）専用レイアウト — サイドメニューなし
   ================================================================ */
.login-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(52, 120, 246, 0.35), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(52, 120, 246, 0.18), transparent 50%),
    linear-gradient(160deg, #0c0f1a 0%, #1a1f33 55%, #0c0f1a 100%);
}

.login-shell {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 40px 34px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.login-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3478f6, #1e2130);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin: 0 auto 18px;
  box-shadow: 0 10px 24px rgba(52, 120, 246, 0.45);
}

.login-title {
  text-align: center;
  font-weight: 700;
  color: #1e2130;
  margin-bottom: 2px;
}

.login-subtitle {
  text-align: center;
  color: #8a92a6;
  font-size: 0.85rem;
  margin-bottom: 28px;
}

.login-card .form-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 600;
}

.login-card .form-control {
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid #dfe3ee;
}

.login-card .form-control:focus {
  border-color: #3478f6;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, 0.15);
}

.login-card .btn-primary {
  background: linear-gradient(135deg, #3478f6, #255fd1);
  border: none;
  border-radius: 10px;
  padding: 11px 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.login-card .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(52, 120, 246, 0.35);
}

.login-card a {
  color: #3478f6;
}

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #9aa5b1;
  font-size: 0.8rem;
  margin: 18px 0 14px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #e3e7ee;
}

.login-divider span {
  padding: 0 12px;
}

.login-card .btn-outline-primary {
  border-radius: 10px;
  padding: 10px 0;
  font-weight: 600;
  border-color: #3478f6;
  color: #3478f6;
}

.login-card .btn-outline-primary:hover {
  background: #3478f6;
  border-color: #3478f6;
}

.login-footer-note {
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.75rem;
  margin-top: 20px;
}

/* ================================================================
   認証中スプラッシュ（2段階認証コード送信時のオーバーレイ）
   ================================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 2000;
}

.auth-overlay.visible {
  display: flex;
}

.auth-spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 6px solid rgba(52, 120, 246, 0.15);
  border-top-color: #3478f6;
  border-right-color: #3478f6;
  animation: authSpin 0.85s linear infinite;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}

.auth-overlay-text {
  margin-top: 26px;
  color: #1e2130;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* ================================================================
   applippli-keyログイン（ワンタッチ連携）受信待機ポップアップ
   ================================================================ */
.onetouch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 30, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2100;
  padding: 16px;
}

.onetouch-modal-box {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.onetouch-modal-box .auth-spinner {
  width: 48px;
  height: 48px;
  border-width: 5px;
}

.onetouch-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #9aa5b1;
  cursor: pointer;
}

.onetouch-modal-close:hover {
  color: #1e2130;
}
/* ================================================================
   サイドバーのマシン一覧（「マシン」の下）
   ================================================================ */
.sidebar-nav { overflow-y: auto; min-height: 0; }

.sidebar-count {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-machines { padding: 2px 0 6px; }

.sidebar-machine-filter {
  display: block;
  width: calc(100% - 36px);
  margin: 4px 18px 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
}

.sidebar-machine-filter::placeholder { color: rgba(255, 255, 255, 0.45); }
.sidebar-machine-filter:focus { outline: none; border-color: var(--sidebar-active); }

.sidebar-machine-list {
  position: relative;
}

.sidebar-machine {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 18px 5px 30px;
  font-size: 0.8rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-machine:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-machine.active {
  background: rgba(52, 120, 246, 0.22);
  border-left-color: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.sidebar-machine-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-machine-tag {
  font-size: 0.62rem;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #c7ccdb;
}

.sidebar-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.sidebar-dot.is-online { background: #34d399; }
.sidebar-dot.is-attn   { background: #f5a623; }

body.sidebar-collapsed .sidebar-machines { display: none; }

/* ================================================================
   マシン詳細（/Machines/{id}）
   ================================================================ */
.md-back {
  display: inline-block;
  font-size: 0.8rem;
  color: #6b7a99;
  text-decoration: none;
  margin-bottom: 6px;
}

.md-back:hover { color: #3478f6; }

.md-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.md-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; }
.md-title-text { min-width: 0; flex: 1 1 auto; }

.md-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e2130;
  margin: 0;
  overflow-wrap: anywhere;
}

.md-sub { font-size: 0.8rem; color: #6b7a99; }
.md-sub .flag { width: 16px; height: 12px; vertical-align: -1px; }
.md-status { flex: 0 0 auto; }

.md-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #dde2ec;
  margin-bottom: 14px;
  overflow-x: auto;
  overflow-y: hidden;
}

.md-tab {
  padding: 9px 18px;
  font-size: 0.9rem;
  color: #4b5b7a;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.md-tab:hover { color: #1e2130; }

.md-tab.active {
  color: #3478f6;
  border-bottom-color: #3478f6;
  font-weight: 700;
}

.md-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.md-kpi-time { font-size: 1.35rem; }

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

.md-dl {
  display: grid;
  grid-template-columns: 8.5em minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 0.85rem;
}

.md-dl dt { font-weight: 500; color: #6b7a99; }
.md-dl dd { margin: 0; color: #1e2130; overflow-wrap: anywhere; }
.md-dl dd.is-empty { color: #b3bccd; }
.md-dl .flag { width: 16px; height: 12px; vertical-align: -1px; }
.md-bar { display: block; max-width: 260px; margin: 5px 0 3px; }

.md-note { font-size: 0.75rem; color: #6b7a99; margin-top: 12px; }
.md-profile-edit { margin-top: 12px; border-top: 1px solid #eef1f6; padding-top: 10px; }
.md-profile-edit > summary { cursor: pointer; font-size: 0.8125rem; font-weight: 600; color: #2563eb; list-style: none; }
.md-profile-edit > summary::-webkit-details-marker { display: none; }
.md-profile-edit > summary::before { content: "✎ "; }
.md-profile-edit[open] > summary { margin-bottom: 10px; }
.md-profile-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 12px; align-items: end; }
.md-profile-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; font-weight: 600; color: #6b7a99; margin: 0; }
.md-profile-actions { display: flex; justify-content: flex-end; }
.md-empty { font-size: 0.85rem; color: #6b7a99; }
.md-nowrap { white-space: nowrap; }

.md-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  font-size: 0.8rem;
}

.md-warn-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-radius: 50%;
  background: #f5a623;
  vertical-align: 1px;
}

.md-alerts { list-style: none; margin: 0; padding: 0; }

.md-alerts li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 0;
  border-top: 1px solid #eef1f6;
  font-size: 0.85rem;
}

.md-alerts li:first-child { border-top: 0; }
.md-alert-event { font-weight: 600; color: #1e2130; }
.md-alert-meta { font-size: 0.75rem; color: #6b7a99; margin-left: auto; }

.md-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.md-log-filter .log-chips { margin-top: 12px; gap: 6px 8px; }

.md-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef1f7;
  color: #6b7a99;
}

.md-map-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 320px;
  border: 1px dashed #c9d1e0;
  border-radius: 12px;
  background: repeating-linear-gradient(45deg, #f7f9fc, #f7f9fc 12px, #f1f4f9 12px, #f1f4f9 24px);
  color: #9aa5b8;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

@media (max-width: 991.98px) {
  .md-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767.98px) {
  .md-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md-title { font-size: 1.15rem; }
  .md-tab { padding: 9px 14px; flex: 1 0 auto; text-align: center; }
  .md-filter-row { grid-template-columns: minmax(0, 1fr); }
  .md-filter-row .lf-actions .btn { flex: 1 1 0; }
  .md-dl { grid-template-columns: 7em minmax(0, 1fr); }
  .md-alert-meta { margin-left: 0; width: 100%; }
  .md-map-frame { height: 220px; }
}
/* マシン詳細：ユーザーごとのキー設定の解除（OTP・ワンタッチ） */
.md-alert-msg { font-size: 0.85rem; padding: 8px 12px; margin-bottom: 12px; }
.md-key-cell { white-space: nowrap; }
.md-inline-form { display: inline; margin: 0 0 0 6px; }
.md-key-btn {
  font-size: 0.7rem;
  line-height: 1.4;
  padding: 1px 8px;
  border: 1px solid #c9d1e0;
  border-radius: 6px;
  background: #fff;
  color: #4a5670;
  cursor: pointer;
}
.md-key-btn:hover { background: #f2f5fa; }
.md-key-btn-danger { border-color: #f1b4bd; color: #be123c; }
.md-key-btn-danger:hover { background: #fde8ec; }
.md-mark-pending { background: #fdf0e3; color: #b4540a; }
.md-cmd-history { margin-top: 14px; padding-top: 10px; border-top: 1px solid #eef1f6; }
.md-cmd-title { font-size: 0.75rem; font-weight: 600; color: #6b7a99; margin-bottom: 4px; }
.md-cmd-list { list-style: none; margin: 0; padding: 0; }
.md-cmd-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 0;
  border-top: 1px solid #f3f5f9;
  font-size: 0.8rem;
}
.md-cmd-list li:first-child { border-top: 0; }
.md-cmd-what { font-weight: 600; color: #1e2130; }
.md-cmd-list .md-alert-meta { margin-left: 0; width: 100%; }

/* ログの接続元IPが無い行（コンソールでのログインなど）に表示する、PCのローカルIPの目印 */
.ip-local {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eceff5;
  color: #5b6477;
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: 1px;
}

/* マシン詳細：位置情報タブの地図 */
.md-map {
  display: block;
  width: 100%;
  height: 360px;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
}
.md-map-links { text-align: right; font-size: 0.75rem; margin: 4px 0 10px; }
.md-loc-note { margin-top: 10px; font-size: 0.72rem; color: #6b7a99; line-height: 1.6; }
@media (max-width: 767.98px) {
  .md-map { height: 240px; }
}

/* 位置情報タブの地図に立てるPCのマーク（Leafletのマーカー） */
.md-map { z-index: 0; }
.md-pc-marker { background: none; border: 0; }
.md-pc-marker-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
}
.md-pc-marker-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid #fff;
}
.md-badge-ok { background: #e1f5ee; color: #0f6e4f; }
.md-badge-off { background: #fdf0e3; color: #b4540a; }
.md-badge { white-space: nowrap; }

/* スマホ連携（スマホアプリから届いた端末情報） */
.ph-search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ph-search-row input { flex: 1 1 260px; max-width: 420px; }
.ph-table td { font-size: 0.82rem; vertical-align: middle; }
.ph-device { font-weight: 600; color: #1e2130; }
.ph-id { margin-left: 6px; font-size: 0.7rem; color: #8a94ab; font-family: ui-monospace, Consolas, monospace; }
.ph-sub { font-size: 0.72rem; color: #6b7a99; margin-left: 4px; }
.ph-kpi-warn { color: #b4540a; }
.ph-warn-card { border-color: #f3d3ae; }
.ph-mismatch { color: #b42318; font-weight: 600; }
.ph-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e1f5ee;
  color: #0f6e4f;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: 1px;
}
.ph-chip-own { font-weight: 500; opacity: .8; margin-left: 2px; }
.ph-chip-map { margin-left: 4px; font-size: 0.7rem; white-space: nowrap; }
.md-phone-marker-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0f6e4f;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
}
.md-phone-marker-badge.is-old { background: #7fb8a3; }
.md-phone-marker-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #fff;
}

/* サイドバー：スクロールはサイドバー全体の1本だけにし、つまみは細く目立たなくする */
.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.38); }

/* 「マシン」の行：リンクと、子階層（各マシン）の開閉ボタン */
.sidebar-row { display: flex; align-items: center; }
.sidebar-row .sidebar-link { flex: 1 1 auto; min-width: 0; padding-right: 6px; }
.sidebar-machines-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
}
.sidebar-machines-toggle:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-machines-toggle:focus-visible { outline: 2px solid var(--sidebar-active); outline-offset: -2px; }
.sidebar-machines-toggle svg { transition: transform 0.15s ease; }
.sidebar-machines-collapsed .sidebar-machines-toggle svg { transform: rotate(-90deg); }
.sidebar-machines-collapsed .sidebar-machines { display: none; }
body.sidebar-collapsed .sidebar-machines-toggle { display: none; }
@media (prefers-reduced-motion: reduce) { .sidebar-machines-toggle svg { transition: none; } }
/* マシン詳細：ハードウェア・OSの「スマホ」欄（連携しているスマホを1行ずつ） */
.md-phone-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.md-phone-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }

/* ユーザーごとのキー設定：Windowsのアカウント自体が無効なユーザーはグレーアウト */
.ks-user-table tr.ks-user-disabled td { color: #9aa3b5; }
.ks-user-table tr.ks-user-disabled .ks-mark { opacity: 0.45; }
.ks-user-table tr.ks-user-disabled .fw-semibold { font-weight: 500 !important; }
.ks-disabled-tag { margin-left: 4px; font-size: 0.72rem; font-weight: 600; color: #8a94ab; }

/* お客様アカウントの権限（管理者／閲覧のみ） */
.ro-note { font-size: .82rem; color: #6b7280; background: #f3f4f6; border-radius: 6px; padding: 6px 10px; }
.tu-role { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.tu-role-admin { background: #dbeafe; color: #1d4ed8; }
.tu-role-ro { background: #f3f4f6; color: #4b5563; }
.tu-me { font-size: .7rem; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #ecfdf5; color: #047857; }
.tu-table td { vertical-align: middle; }
.tu-owner { font-size: .7rem; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #fff4e0; color: #a85b00; font-weight: 700; }
.tu-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tu-add input { max-width: 320px; }
.tu-add select { width: auto; }
.tu-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* システムログ・システム監査ログ */
.al-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.al-filter label { display: block; font-size: .72rem; color: #5b6476; margin-bottom: 2px; }
.al-filter .form-control, .al-filter .form-select { width: auto; }
.al-table td { vertical-align: top; font-size: .85rem; }
.al-table td.al-user { white-space: nowrap; }
.al-cat { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: #eef2f7; color: #334155; }
.al-cat-login { background: #e8f0fe; color: #1d4ed8; }
.al-cat-users { background: #f3e8ff; color: #7e22ce; }
.al-cat-settings { background: #fff4e0; color: #a85b00; }
.al-fail { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #fde8eb; color: #c92a45; margin-left: 4px; }
.al-detail { color: #5b6476; overflow-wrap: anywhere; min-width: 220px; }
.al-staff { font-size: .7rem; padding: 1px 6px; border-radius: 999px; background: #fff4e0; color: #a85b00; margin-left: 4px; }
.al-pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: .85rem; }

/* マシン詳細：Windowsアカウントの無効化・有効化の確認画面 */
.md-dialog { border: none; border-radius: 12px; padding: 20px 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.md-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.md-dialog-title { font-size: 1rem; font-weight: 700; margin: 0 0 8px; }
.md-dialog-note { font-size: .82rem; color: #4b5563; background: #f9fafb; border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.md-cmd-reason { font-size: .78rem; color: #374151; margin-left: 6px; }

/* 検証用ベータ版（本番リリース時に削除） */
.beta-banner { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; border-radius: 10px; padding: 10px 14px; font-size: .88rem; margin-bottom: 14px; }
.beta-hash { font-family: ui-monospace, Consolas, monospace; font-size: .7rem; color: #6b7280; word-break: break-all; margin-top: 2px; }
.beta-notes { margin: 0; padding-left: 1.2rem; font-size: .88rem; line-height: 1.8; }

/* マシン詳細：PC稼働時間（ベータ版） */
.up-month-nav { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 0 12px; }
.up-month-label { font-size: 1.15rem; font-weight: 700; min-width: 9em; text-align: center; }
.up-month-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid #d1d5db; color: #374151; text-decoration: none; background: #fff; }
.up-month-btn:hover { background: #f3f4f6; }
.up-month-btn.is-disabled { color: #d1d5db; border-color: #e5e7eb; }
.up-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; font-size: .85rem; color: #4b5563; margin-bottom: 10px; }
.up-summary strong { color: #111827; font-size: 1rem; }
.up-table td, .up-table th { text-align: center; }
.up-table tr.up-empty td { color: #9ca3af; }
.up-table tr.up-sun td:first-child { color: #dc2626; }
.up-table tr.up-sat td:first-child { color: #2563eb; }
.up-note { font-size: .78rem; color: #6b7280; margin-top: 10px; line-height: 1.6; }
.up-tag { display: inline-block; font-size: .68rem; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #eef2ff; color: #4338ca; vertical-align: 1px; }
.up-tag-bad { background: #fee2e2; color: #b91c1c; }
.up-warn strong { color: #b91c1c; }

/* PC稼働時間：日ごとの稼働時間の棒グラフ */
.up-chart { margin: 4px 0 14px; }
.up-chart-title { font-size: .8rem; color: #6b7280; margin-bottom: 4px; }
.up-chart-wrap { position: relative; }
.up-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.up-grid { stroke: #eef0f3; stroke-width: 1; }
.up-axis { stroke: #cbd2da; stroke-width: 1; }
.up-tick { font-size: 10px; fill: #6b7280; }
.up-tick.is-today { fill: #111827; font-weight: 700; }
.up-hit { fill: transparent; }
.up-bar { fill: #2563eb; }
.up-bar.is-now { fill: #60a5fa; }
.up-bar-slot.is-hover .up-hit { fill: rgba(37, 99, 235, .06); }
.up-bar-slot.is-hover .up-bar { fill: #1d4ed8; }
.up-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: #111827; color: #fff; font-size: .75rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }

/* 脆弱性（PCの弱いところ）：ダッシュボードの深刻度別の件数、セキュリティ画面のカード */
.sev-low { background: #eef1f5; color: #5b6478; }
.sec-page .sev-low { background: #eef1f5; color: #5b6478; }
.vuln-bars { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 14px; margin-top: 18px; min-height: 180px; }
.vuln-row { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.vuln-row:hover .vuln-track { background: #e3e8f1; }
.vuln-row .sev { min-width: 64px; text-align: center; }
.vuln-track { flex: 1 1 auto; height: 10px; border-radius: 5px; background: #eef1f6; overflow: hidden; }
.vuln-fill { display: block; height: 100%; border-radius: 5px; }
.vuln-fill-critical { background: #b42318; }
.vuln-fill-high { background: #d97706; }
.vuln-fill-medium { background: #3b82c4; }
.vuln-fill-low { background: #9aa4b6; }
.vuln-num { min-width: 28px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
a.sec-kpi-link { display: block; color: inherit; text-decoration: none; }
a.sec-kpi-link:hover { box-shadow: 0 2px 8px rgba(20, 30, 60, 0.08); }

/* スマホの会社用・個人用（マシン詳細のハードウェア・OS / 連携しているスマホ） */
.md-own-select { width: auto; display: inline-block; padding-top: 1px; padding-bottom: 1px; font-size: 12px; min-height: 0; }
.md-own-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.md-own-tag.md-own-company, .md-own-select.md-own-company { background-color: #e3f1fb; color: #1565a8; border-color: #b9dbf3; }
.md-own-tag.md-own-personal, .md-own-select.md-own-personal { background-color: #fdf0e1; color: #a85d10; border-color: #f2d3ad; }
.md-own-tag.md-own-none { background: #f1f3f5; color: #7a8290; }

/* ダッシュボード「脆弱性の深刻度」の KEV・CVE の件数（脆弱性検査へのリンク） */
.vuln-cve { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; text-decoration: none; color: inherit; }
.vuln-cve-item { border: 1px solid #dde5ee; border-radius: 8px; padding: 6px 10px; background: #fff; }
.vuln-cve:hover .vuln-cve-item { border-color: #b9cdf0; }
.vuln-cve-item small { display: block; font-size: 11px; font-weight: 600; color: #5f6d82; }
.vuln-cve-item strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.vuln-cve-item em { font-style: normal; font-size: 12px; color: #5f6d82; margin-left: 6px; }
.md-own-tag.md-own-other, .md-own-select.md-own-other { background-color: #eef5ea; color: #3d7a2a; border-color: #cfe4c4; }
.md-own-otherbox:not([hidden]) { display: inline-flex; gap: 4px; align-items: center; margin-left: 4px; }
.md-own-text { width: 11.5em; display: inline-block; padding-top: 1px; padding-bottom: 1px; font-size: 12px; min-height: 0; }
.md-own-save { padding: 1px 8px; font-size: 12px; }

/* セキュリティ画面の検知カテゴリ別：行を押すと、そのカテゴリで絞ったLogs画面を開く */
a.hbar-link { color: inherit; text-decoration: none; border-radius: 6px; margin: 0 -6px; padding-left: 6px; padding-right: 6px; }
a.hbar-link:hover, a.hbar-link:focus-visible { background: rgba(37, 99, 235, 0.06); }
a.hbar-link:hover .hbar-label { text-decoration: underline; }

/* Logs の検索条件：検知カテゴリを足して6列になったため、中くらいの幅では2段に分ける（期間が潰れないように） */
@media (min-width: 992px) and (max-width: 1399.98px) {
  .log-filter-grid { grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr)); }
  .lf-actions { justify-content: flex-end; }
}

/* キー稼働状況の詳細パネル：OTP・ワンタッチの「解除」「取消」（印の下に置く） */
.ks-key-btn { display: block; margin-top: 3px; }

/* ================================================================
   マシンのパネル（_MachinePanel）：サイドバーの「マシン」を押すと、サイドバーの右に横から開く。
   開いている間は本文が右にずれて、一覧と本文が並ぶ。デスクトップ（md以上）だけ。
   ================================================================ */
.machine-panel {
  flex: 0 0 0;
  width: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  background: #fff;
  border-right: 1px solid transparent;
  transition: flex-basis 0.28s ease, width 0.28s ease, border-color 0.28s ease;
}
.machine-panel-open .machine-panel {
  flex-basis: 260px;
  width: 260px;
  border-right-color: #dde5ee;
}
.machine-panel-inner {
  width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.2s ease, transform 0.28s ease;
}
.machine-panel-open .machine-panel-inner { opacity: 1; transform: none; }
.mp-no-anim .machine-panel,
.mp-no-anim .machine-panel-inner { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .machine-panel, .machine-panel-inner { transition: none; }
}

.mp-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 12px 10px 16px;
  border-bottom: 1px solid #eef2f6;
}
.mp-title { flex: 1 1 auto; font-weight: 700; font-size: 0.95rem; color: #142033; }
.mp-count {
  display: inline-block;
  min-width: 22px;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2f6fed;
  font-size: 0.75rem;
  text-align: center;
  vertical-align: 2px;
}
.mp-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-weight: 400; font-size: 0.75rem; color: #5f6d82; }
.mp-all {
  padding: 3px 9px;
  border: 1px solid #dde5ee;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #2f6fed;
  text-decoration: none;
  white-space: nowrap;
}
.mp-all:hover { background: #eef4ff; }
.mp-close {
  border: 1px solid #dde5ee;
  background: #fff;
  color: #526174;
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 0.95rem;
  line-height: 1.4;
}
.mp-close:hover { background: #eef2f6; color: #142033; }
.mp-close:focus-visible, .mp-all:focus-visible { outline: 2px solid #2f6fed; outline-offset: 1px; }

.mp-filter {
  margin: 10px 12px 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  border: 1px solid #dde5ee;
  border-radius: 8px;
  background: #f8fafc;
}
.mp-filter:focus { outline: none; border-color: #2f6fed; background: #fff; }

.mp-list { flex: 1 1 auto; overflow-y: auto; padding: 2px 6px 12px; }
.mp-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #142033;
  text-decoration: none;
  font-size: 0.82rem;
}
.mp-item:hover { background: #f1f5f9; color: #142033; }
.mp-item.active { background: #e8f0fe; color: #1d4ed8; font-weight: 600; }
.mp-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-name small { display: block; font-weight: 400; font-size: 0.7rem; color: #7a879a; }
.mp-tag {
  font-size: 0.62rem;
  padding: 0 5px;
  border-radius: 4px;
  background: #eef2f6;
  color: #526174;
}
.mp-empty { padding: 10px; font-size: 0.8rem; color: #7a879a; }

/* デスクトップでは、サイドバーの中のマシンの一覧を出さずにパネルで見せる（モバイルのサイドバーには残す）。 */
@media (min-width: 768px) {
  .app-sidebar .sidebar-machines,
  .app-sidebar .sidebar-machines-toggle { display: none !important; }
}
.app-sidebar-offcanvas .sidebar-panel-chevron { display: none; }
.sidebar-panel-chevron {
  margin-left: 6px;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.28s ease;
}
/* パネルを開いている間は、「マシン」を選んだ状態（今の画面の項目と同じ青）にする。 */
.machine-panel-open .app-sidebar .sidebar-machines-link {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}
.machine-panel-open .app-sidebar .sidebar-machines-link .sidebar-count { background: rgba(255, 255, 255, 0.25); color: #fff; }
/* 開いている間は「マシン」だけを選んだ状態に見せ、今の画面の項目の色は消す（たたむと元の青に戻る）。 */
.machine-panel-open .app-sidebar .sidebar-link.active:not(.sidebar-machines-link) {
  background: transparent;
  color: var(--sidebar-text);
  font-weight: 400;
}
.machine-panel-open .app-sidebar .sidebar-link.active:not(.sidebar-machines-link):hover { background: var(--sidebar-hover); color: #fff; }
.machine-panel-open .app-sidebar .sidebar-panel-chevron { transform: rotate(180deg); }
