/* Drive modal */
.drive-modal-panel {
  width: min(560px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drive-modal-title {
  margin: 0;
  font-size: 20px;
}

.drive-modal-subtitle {
  margin: -8px 0 0 0;
  font-size: 13px;
}

.drive-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drive-modal-field > label {
  font-size: 13px;
  font-weight: 600;
}

.drive-modal-field input[type="date"],
.drive-modal-field input[type="text"],
.drive-modal-field input[type="search"],
.drive-modal-field textarea {
  padding: 8px 10px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  width: 100%;
}

.drive-modal-field input[type="search"]:focus,
.drive-modal-field input[type="date"]:focus,
.drive-modal-field input[type="text"]:focus,
.drive-modal-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.drive-modal-field textarea {
  resize: vertical;
  min-height: 64px;
}

.drive-modal-time-options,
.drive-modal-direction-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drive-modal-time-option,
.drive-modal-direction-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.drive-modal-time-option:has(input:checked),
.drive-modal-direction-option:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
}

.drive-modal-trim-field {
  position: relative;
}

.drive-modal-conditions {
  gap: 10px;
}

.drive-modal-notes-count {
  margin: 0;
  font-size: 11px;
  text-align: right;
}

.drive-modal-media {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drive-modal-media[hidden] {
  display: none;
}

.drive-modal-media-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drive-modal-media-header h3 {
  margin: 0;
  font-size: 15px;
}

.drive-modal-media-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drive-modal-media-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px;
  background: var(--panel-2);
  border-radius: 6px;
}

.drive-modal-media-thumb {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
}

.drive-modal-media-empty {
  margin: 0;
  font-size: 12px;
  font-style: italic;
}

.drive-modal-media-del,
.drive-modal-media-pending-remove {
  font-size: 12px;
  padding: 4px 10px;
}

.drive-modal-media-pending {
  border: 1px dashed var(--accent);
}

.drive-modal-media-pending-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.drive-modal-actions {
  justify-content: flex-end;
  gap: 8px;
}

.drive-modal-status {
  margin: 0;
  font-size: 13px;
}

.drive-modal-rating-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.drive-modal-rating-row:last-child {
  border-bottom: none;
}

/* Drive card */
.drive-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.drive-card.is-mine {
  border-color: var(--accent-dim);
}

/* Placeholder for drives without media. Standalone block (not paired with
 * .usermedia) so the same rule renders the empty slot identically on the
 * route page and in /garage. */
.drive-thumb-empty {
  width: 96px;
  height: 96px;
  border-radius: 6px;
  background-color: var(--panel-2);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b98a5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><line x1='2' y1='2' x2='22' y2='22'/><path d='M10.41 10.41a2 2 0 1 1-2.83-2.83'/><line x1='13.5' y1='13.5' x2='6' y2='21'/><line x1='18' y1='12' x2='21' y2='15'/><path d='M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.05-.22 1.41-.59'/><path d='M21 15V5a2 2 0 0 0-2-2H9'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px 40px;
}

.drive-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.drive-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.drive-driver {
  font-weight: 600;
  color: var(--text);
}

.drive-date {
  font-size: 12px;
  color: var(--muted);
}

.drive-meta,
.drive-conditions {
  margin: 0;
  font-size: 13px;
}

.drive-notes {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.drive-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.drive-edit-btn,
.drive-delete-btn {
  font-size: 12px;
  padding: 4px 10px;
}

.drive-delete-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
