.sheet {
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--paper);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-2);
  transition: transform 280ms ease;
  will-change: transform;
}
.sheet-handle-zone { padding: 10px 16px 4px; touch-action: none; cursor: grab; }
.sheet-close { display: none; }
.sheet-handle {
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: var(--line);
}
.sheet-header { display: flex; align-items: center; gap: 8px; padding: 0 16px 8px; flex-shrink: 0; }
.sheet-head { min-height: 34px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sheet-body {
  flex: 1;
  min-height: 0;
  max-height: calc(76vh - 92px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 16px calc(20px + var(--safe-b));
}
.sheet-section { padding: 12px 0; border-top: 1px solid var(--line); }
.sheet-section:first-child { border-top: 0; padding-top: 4px; }
.location-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: var(--shadow-1);
}
.location-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px;
}
.location-card-copy { flex: 1; min-width: 0; }
.location-card-title { font-size: var(--fs-14); font-weight: 600; }
.location-card-subtitle { margin-top: 2px; font-size: var(--fs-12); color: var(--text-muted); }
.location-card-action {
  min-height: 44px;
  min-width: 44px;
  color: var(--primary);
  font-size: var(--fs-12);
  font-weight: 600;
  white-space: nowrap;
}
.location-card-action:hover { color: var(--primary-hover); }
.sheet-title { font-size: var(--fs-20); line-height: 1.25; }
.sheet-sub { font-size: var(--fs-12); color: var(--text-muted); margin-top: 4px; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--mist);
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text-muted);
}
.status-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
}
.status-chip.is-warn::before { background: var(--amber); }
.status-chip.is-off::before { background: var(--text-muted); }
.dir-fields { display: flex; flex-direction: column; gap: 10px; }
.dir-field { display: flex; flex-direction: column; gap: 4px; }
.dir-input {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: 16px;
  text-align: left;
  width: 100%;
}
input.dir-input { text-align: left; }
.dir-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.dir-results { display: flex; flex-direction: column; gap: 4px; }
.dir-results[hidden] { display: none; }
.route-mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-top: 12px;
  padding: var(--space-sm);
  background: var(--mist);
  border-radius: var(--radius-sm);
}
.dir-options { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.dir-summary { margin-top: 14px; }
.navigation-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.navigation-panel[hidden] { display: none; }
.navigation-panel h3 { font-size: var(--fs-16); color: var(--heading); }
.navigation-panel p { margin-top: 8px; line-height: 1.4; overflow-wrap: anywhere; }
#navigation-instruction { margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); background: #EFF6FF; color: #1E40AF; font-size: var(--fs-16); font-weight: 700; }
.navigation-panel[data-state="preparing"] #navigation-instruction,
.navigation-panel[data-state="navigating"] #navigation-instruction { border-left: 4px solid #2563EB; }
.navigation-panel[data-state="rerouting"] #navigation-message { padding: 8px 10px; border: 1px solid #93C5FD; border-radius: var(--radius-sm); background: #EFF6FF; color: #1E40AF; }
.navigation-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.navigation-metrics p { display: flex; flex-direction: column; gap: 3px; min-width: 0; margin: 0; padding: 9px 10px; border-radius: var(--radius-sm); background: #F8FAFC; color: #64748B; font-size: var(--fs-12); }
.navigation-metrics strong { color: #1E293B; font-size: var(--fs-14); }
.navigation-panel[data-state="navigating"] .navigation-metrics strong { color: #1E40AF; }
.navigation-arrival { margin-top: 12px; padding: 14px; border: 1px solid #86EFAC; border-radius: var(--radius-sm); background: #F0FDF4; color: #166534; }
.navigation-arrival[hidden] { display: none; }
.navigation-arrival h4 { font-size: var(--fs-16); color: #166534; }
.navigation-arrival p { color: #166534; }
.navigation-arrival strong { font-weight: 700; }
.navigation-panel[data-state="arrived"] #navigation-instruction { border: 1px solid #86EFAC; background: #F0FDF4; color: #166534; }
.dir-summary-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
.dir-summary-main { font-size: var(--fs-16); font-weight: 600; }
.dir-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.dir-destination { font-size: var(--fs-20); font-weight: 700; overflow-wrap: anywhere; margin-bottom: 8px; }
.dir-primary { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; background: var(--paper); }
.movement-status { color: #1E40AF; font-size: var(--fs-12); }
.dir-live-actions { display: flex; gap: 8px; }
.dir-live-actions > button { flex: 1; min-width: 0; }
#dir-status:empty { display: none; }
@media (max-width: 899px) {
  body[data-sheet-content="directions"] .sheet-body { overflow: hidden; padding-bottom: var(--safe-b); }
  #directions-view:not([hidden]) { display: flex; flex-direction: column; height: 100%; min-height: 0; }
  .dir-scroll { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 12px; }
  .dir-scroll > * { flex-shrink: 0; }
  .dir-primary { flex-shrink: 0; padding-bottom: 12px; border-top: 1px solid var(--line); }
  .sheet {
    bottom: var(--sheet-bottom, 0px);
    height: var(--sheet-height, 80dvh);
    max-height: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.18);
    transform: translateY(var(--sheet-offset, 100%));
    transition: transform 280ms ease-out, visibility 0s;
  }
  .sheet[data-state="closed"] { visibility: hidden; pointer-events: none; transition: transform 280ms ease-out, visibility 0s 280ms; }
  .sheet.is-instant, .sheet.is-dragging { transition: none; }
  .sheet-handle-zone { display: flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: var(--control-size); padding: 8px 16px; width: 100%; }
  .sheet-handle { width: 36px; margin: 0; }
  .sheet-close { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; color: var(--text-muted); font-size: 24px; font-weight: 400; line-height: 1; }
  .sheet-close:hover { background: var(--mist); color: var(--ink); }
  .sheet-body { flex: 0 0 auto; height: max(0px, calc(var(--sheet-visible-height, 0px) - var(--sheet-header-height, 96px))); max-height: none; padding-bottom: calc(20px + var(--safe-b)); }
  .sheet[data-state="collapsed"] .sheet-body { visibility: hidden; }
  .sheet[data-state="collapsed"] .sheet-title { font-size: var(--fs-16); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sheet-navigation { display: flex; flex-shrink: 0; gap: 8px; padding: 0 16px 8px; }
  .sheet-navigation .tab { flex: 1; justify-content: center; border: 0; border-radius: 10px; box-shadow: none; padding: 0 12px; }
  .sheet-navigation .tab.is-active { color: var(--primary-hover); background: var(--primary-soft); }
  .sheet[data-state="collapsed"] { padding-bottom: var(--safe-b); }
  .sheet[data-state="collapsed"] .sheet-header { display: none; }
  .location-card, .suggestion-host { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }
@media (min-width: 900px) {
  .sheet-navigation { display: none; }
  .sheet {
    display: none;
    left: 88px;
    right: auto;
    bottom: 24px;
    top: 140px;
    width: 380px;
    border-radius: var(--radius-lg);
    transform: none;
  }
  .sheet.is-open { display: flex; transform: none; }
  .sheet-handle-zone { display: none; }
  .sheet-header { padding-top: 16px; }
  .sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    height: 44px;
    border-radius: 999px;
    font-size: 24px;
    line-height: 1;
  }
  .sheet-close:hover { background: var(--mist); }
  .sheet-body { max-height: none; height: auto; }
  body[data-tab="directions"] .sheet { width: 420px; top: 96px; }
}
.sidebar-rail { display: none; }
@media (min-width: 900px) {
  .sidebar-rail {
    position: fixed;
    top: calc(108px + 1.5cm);
    left: 16px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 56px;
    padding: 8px 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
    box-shadow: var(--shadow-1);
  }
  .rail-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 48px;
    padding: 4px 0;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
  }
  .rail-action:hover { background: var(--primary-soft); color: var(--primary); }
  .rail-icon { font-size: 20px; line-height: 1; }
}
.gps-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 12px;
  background: #EFF6FF;
  color: #2563EB;
  font-size: 12px;
}
.gps-status[hidden], .gps-status [hidden] { display: none; }
.gps-status[data-state="ready"] { background: #F0FDF4; color: #166534; }
.gps-status-icon { flex: 0 0 auto; font-size: 18px; line-height: 1.2; }
.gps-status-content { flex: 1; min-width: 0; }
.gps-status-content p { margin: 0; }
#gps-status-label { font-weight: 600; }
#gps-status-description { color: #1E293B; margin-top: 4px; }
#gps-status-details { margin-top: 4px; color: #64748B; overflow-wrap: anywhere; }
#gps-status-details summary { cursor: pointer; color: #2563EB; }
.gps-status-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.gps-status-actions button { min-height: 44px; color: #2563EB; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.gps-status button:focus-visible, .gps-status summary:focus-visible { outline: 2px solid #2563EB; outline-offset: 2px; border-radius: 4px; }
