/* Online editing layer: shares the page palette so the travel design stays untouched. */

.editor-bar {
  position: sticky;
  top: calc(48px + var(--safe-top));
  z-index: 19;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(19, 38, 47, 0.08);
  background: rgba(238, 245, 243, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 12px;
}
.editor-bar[hidden] { display: none; }
.editor-bar__role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 650;
}
.editor-bar__role::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lake);
}
.editor-bar__role[data-role="viewer"]::before,
.editor-bar__role[data-role="anonymous"]::before { background: var(--terracotta); }
.editor-bar__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-bar__button { padding: 8px 14px; font-size: 12px; }
.editor-login { display: flex; align-items: center; gap: 6px; }
.editor-login input {
  min-width: 190px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
}
.editor-login[hidden] { display: none; }

.editor-primary,
.editor-mini-button,
.editor-danger {
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.editor-primary {
  padding: 9px 18px;
  background: var(--ink);
  color: #fff;
}
.editor-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.editor-mini-button {
  padding: 7px 14px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  font-size: 12px;
}
.editor-mini-button:hover { border-color: var(--lake); color: var(--lake); }
.editor-danger {
  padding: 7px 14px;
  background: transparent;
  border-color: rgba(184, 70, 53, 0.35);
  color: var(--warning);
  font-size: 12px;
}
.editor-danger:hover { background: rgba(184, 70, 53, 0.08); }

/* hotel section */
.hotel-list { display: grid; gap: 12px; }
.hotel-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hotel-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hotel-card h3 { margin: 0; font-size: 16px; }
.hotel-card__edit {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
}
.hotel-card__stay { margin: 8px 0 4px; font-weight: 650; color: var(--lake); font-size: 13px; }
.hotel-card__meta { margin: 2px 0; color: var(--muted); font-size: 12px; }
.hotel-card__notes { margin: 8px 0 0; font-size: 13px; white-space: pre-wrap; }
.hotel-empty { color: var(--muted); font-size: 13px; margin: 0; }

/* editor dialog */
.editor-dialog {
  width: min(920px, 96vw);
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.editor-dialog::backdrop { background: rgba(19, 38, 47, 0.42); }
.editor-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.editor-dialog > header span { font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.editor-dialog > header h2 { margin: 2px 0 0; font-size: 18px; }
.editor-dialog > header button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
}
.editor-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 20px 0;
}
.editor-tabs button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--paper);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
}
.editor-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.editor-body {
  padding: 14px 20px 20px;
  overflow-y: auto;
  max-height: calc(88vh - 210px);
  display: grid;
  gap: 14px;
}
.editor-toolbar { display: flex; justify-content: flex-end; }
.editor-list { display: grid; gap: 10px; }
.editor-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.editor-row__main { display: grid; gap: 3px; min-width: 0; }
.editor-row__main strong { font-size: 14px; }
.editor-row__main strong.is-done { text-decoration: line-through; color: var(--muted); }
.editor-row__main span { font-size: 12px; color: var(--muted); }
.editor-row__actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.editor-badge {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px !important;
  font-weight: 650;
}
.editor-badge.is-pending { background: rgba(182, 92, 58, 0.12); color: var(--terracotta); }
.editor-badge.is-ok { background: var(--lake-soft); color: var(--lake); }
.editor-empty { margin: 0; color: var(--muted); font-size: 13px; }

.editor-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.editor-form label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 650; }
.editor-form input,
.editor-form select,
.editor-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}
.editor-form textarea { resize: vertical; }
.editor-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.editor-inline-form { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.editor-form__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.editor-hint { margin: 0; font-size: 12px; color: var(--muted); }

.editor-segments { display: grid; gap: 12px; }
.editor-segment {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.editor-segment legend { padding: 0 6px; font-size: 12px; color: var(--muted); font-weight: 650; }

.editor-schedule { display: grid; gap: 8px; }
.editor-schedule-item {
  display: grid;
  gap: 8px;
  grid-template-columns: 90px 160px 1fr auto;
  align-items: center;
}
.editor-schedule-item input,
.editor-schedule-item select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
}

.editor-block { display: grid; gap: 10px; }
.editor-block h3 { margin: 0; font-size: 15px; }
.editor-token {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
}
.editor-status { margin: 0; padding: 0 20px 16px; min-height: 18px; font-size: 12px; color: var(--muted); }
.editor-status[data-tone="ok"] { color: var(--forest); }
.editor-status[data-tone="warn"] { color: var(--warning); }

/* Viewer sessions: the API rejects writes anyway, this only hides dead controls. */
html[data-access-role="viewer"] .todo-form,
html[data-access-role="viewer"] .todo-delete,
html[data-access-role="anonymous"] .todo-form,
html[data-access-role="anonymous"] .todo-delete,
html[data-access-role="viewer"] .ledger-entry-card,
html[data-access-role="viewer"] .ledger-row-actions,
html[data-access-role="viewer"] .ledger-onboarding,
html[data-access-role="viewer"] .ledger-text-button,
html[data-access-role="viewer"] .ledger-primary-button,
html[data-access-role="viewer"] .ledger-bill-note-trigger,
html[data-access-role="anonymous"] .ledger-entry-card,
html[data-access-role="anonymous"] .ledger-row-actions,
html[data-access-role="anonymous"] .ledger-onboarding,
html[data-access-role="anonymous"] .ledger-text-button,
html[data-access-role="anonymous"] .ledger-primary-button {
  display: none !important;
}

@media (max-width: 720px) {
  .editor-body { max-height: calc(88vh - 230px); }
  .editor-schedule-item { grid-template-columns: 1fr 1fr; }
  .editor-schedule-text { grid-column: 1 / -1; }
  .editor-row { flex-direction: column; }
  .editor-bar__role { font-size: 11px; }
}
