:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --ink: #172126;
  --muted: #687880;
  --line: #dce3e6;
  --accent: #126b73;
  --accent-dark: #0b4d55;
  --ok: #26734d;
  --warn: #9a5b00;
  --shadow: 0 14px 34px rgba(26, 43, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Yu Gothic UI", "Meiryo", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
}

.actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input {
  width: min(360px, 54vw);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.auto-refresh,
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.auto-refresh input,
.filter-toggle input {
  width: 16px;
  height: 16px;
}

button {
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary,
.button-link {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
}

.secondary:hover,
.button-link:hover {
  background: #eef7f5;
  text-decoration: none;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 8px;
  padding: 0 16px;
}

.button-link[aria-disabled="true"] {
  pointer-events: none;
  color: var(--muted);
  opacity: 0.55;
}

.summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 12px;
  margin-bottom: 14px;
}

.summary div,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary div {
  min-height: 86px;
  padding: 15px;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.panel {
  overflow: hidden;
}

.list-panel {
  max-height: calc(100vh - 188px);
  overflow-y: auto;
}

.card-list {
  display: grid;
}

.drivecast-card {
  display: grid;
  gap: 8px;
  width: 100%;
  height: auto;
  min-height: 108px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 15px;
  text-align: left;
}

.drivecast-card:hover,
.drivecast-card.is-selected {
  background: #eef7f5;
}

.card-main,
.card-meta {
  display: grid;
  gap: 4px;
}

.card-main span,
.card-meta,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.map-panel {
  min-height: calc(100vh - 188px);
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 74px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.map-header h2 {
  margin: 0;
  font-size: 20px;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-frame-wrap {
  position: relative;
  height: min(68vh, 720px);
  min-height: 420px;
  background: #e8eef0;
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.map-empty {
  display: grid;
  position: absolute;
  inset: 0;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.map-note {
  margin: 0;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  border-top: 1px solid var(--line);
}

.empty {
  padding: 18px;
  color: var(--muted);
}

.mobile-action-bar {
  display: none;
}

.status-ok {
  color: var(--ok);
}

.status-warn {
  color: var(--warn);
}

a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  body {
    padding-bottom: 96px;
  }

  .header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search input,
  button {
    width: 100%;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .list-panel,
  .map-panel {
    max-height: none;
    min-height: 0;
  }

  .map-panel {
    display: none;
  }

  .mobile-action-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 20;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 28px rgba(23, 33, 38, 0.18);
  }

  .mobile-action-bar span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-action-bar strong {
    display: block;
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-action-bar button,
  .mobile-action-bar .button-link {
    width: 100%;
    min-width: 78px;
    padding: 0 12px;
  }

  .mobile-action-bar .button-link {
    min-width: 96px;
  }
}
