:root {
  color-scheme: light;
  --pf-primary: #0f4c81;
  --pf-primary-dark: #0a3357;
  --pf-bg: #f4f6f8;
  --pf-card-bg: #ffffff;
  --pf-text: #1c2733;
  --pf-text-muted: #5b6b7a;
  --pf-border: #dbe2e8;
  --pf-danger: #c0392b;
  --pf-warning: #d68910;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--pf-bg);
  color: var(--pf-text);
}

.pf-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--pf-primary);
  color: #fff;
  font-size: 15px;
}

.pf-header__title { font-weight: 700; }
.pf-header__user { font-size: 12px; opacity: 0.85; }

.pf-main {
  padding: 16px;
  padding-bottom: 96px; /* leave room for bottom nav */
  max-width: 720px;
  margin: 0 auto;
}

.pf-main--centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-bottom: 16px;
}

.pf-card {
  background: var(--pf-card-bg);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
  padding: 20px;
}

.pf-login { width: 100%; max-width: 360px; text-align: center; }
.pf-login h1 { margin-top: 0; }

.pf-stub-note { color: var(--pf-text-muted); line-height: 1.5; }

.pf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 10px;
  border: none;
  background: var(--pf-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.pf-btn:active { background: var(--pf-primary-dark); }
.pf-btn--block { display: flex; width: 100%; }

.pf-list { list-style: none; padding: 0; margin: 0; }
.pf-list li { padding: 12px 0; border-bottom: 1px solid var(--pf-border); }
.pf-list li:last-child { border-bottom: none; }
.pf-list a { color: var(--pf-primary); text-decoration: none; font-weight: 600; }

/* Bottom navigation: Inicio | Hoteles | + | Acciones | Más */
.pf-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr 1fr;
  align-items: center;
  background: #fff;
  border-top: 1px solid var(--pf-border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}

.pf-bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--pf-text-muted);
  text-decoration: none;
  padding: 6px 0;
}

.pf-icon { font-size: 20px; line-height: 1; }

.pf-bottom-nav__fab {
  width: 52px;
  height: 52px;
  margin: 0 auto;
  transform: translateY(-14px);
  border-radius: 50%;
  border: none;
  background: var(--pf-primary);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(15, 76, 129, 0.4);
  cursor: pointer;
}

.pf-quick-sheet[hidden] { display: none; }

.pf-quick-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
}

.pf-quick-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 31, 0.45);
}

.pf-quick-sheet__panel {
  position: relative;
  width: 100%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pf-quick-sheet__option {
  display: block;
  padding: 16px 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--pf-text);
  text-decoration: none;
  border-bottom: 1px solid var(--pf-border);
}

.pf-quick-sheet__cancel {
  margin-top: 8px;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--pf-bg);
  font-size: 16px;
  font-weight: 600;
  color: var(--pf-text-muted);
}

/* Phase 2: portfolio dashboard, hotel list/detail, asset passport */

.pf-page-title { margin: 0 0 4px; font-size: 22px; }
.pf-section-title { margin: 0 0 10px; font-size: 16px; }

.pf-indicator-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.pf-indicator-grid--compact { margin: 12px 0 0; }

.pf-indicator {
  background: var(--pf-card-bg);
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  padding: 12px;
}

.pf-indicator__value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.pf-indicator__label { font-size: 12px; color: var(--pf-text-muted); margin-top: 4px; }

.pf-indicator--warning .pf-indicator__value { color: var(--pf-warning); }
.pf-indicator--danger .pf-indicator__value { color: var(--pf-danger); }

.pf-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pf-input {
  flex: 1 1 160px;
  padding: 10px 12px;
  border: 1px solid var(--pf-border);
  border-radius: 8px;
  background: var(--pf-card-bg);
  color: var(--pf-text);
  font-size: 14px;
}

.pf-hotel-list { display: flex; flex-direction: column; gap: 8px; }

.pf-hotel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--pf-card-bg);
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  padding: 14px;
  text-decoration: none;
  color: var(--pf-text);
}

.pf-hotel-row__main { display: flex; flex-direction: column; gap: 2px; }
.pf-hotel-row__name { font-weight: 600; }
.pf-hotel-row__meta { font-size: 12px; color: var(--pf-text-muted); }
.pf-hotel-row__stats { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.pf-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--pf-bg);
  color: var(--pf-text-muted);
  white-space: nowrap;
}

.pf-badge--warning { background: rgba(214, 137, 16, 0.15); color: var(--pf-warning); }
.pf-badge--danger { background: rgba(192, 57, 43, 0.15); color: var(--pf-danger); }

.pf-hotel-header { margin-bottom: 12px; }
.pf-hotel-header__meta { color: var(--pf-text-muted); margin: 0; }

.pf-agenda { margin-bottom: 12px; }
.pf-agenda__flag { font-weight: 600; }
.pf-agenda__flag--danger { color: var(--pf-danger); }
.pf-agenda__flag--warning { color: var(--pf-warning); }

.pf-tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--pf-border);
}

.pf-tabs__item {
  flex: 0 0 auto;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pf-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.pf-tabs__item--active {
  color: var(--pf-primary);
  border-bottom-color: var(--pf-primary);
}

.pf-system { margin-bottom: 12px; }
.pf-system__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}

.pf-subsystem { margin: 8px 0 8px 12px; }
.pf-subsystem__title { font-size: 14px; margin: 8px 0 4px; }

.pf-breadcrumb { font-size: 12px; color: var(--pf-text-muted); margin: 0 0 10px; }
.pf-breadcrumb a { color: var(--pf-primary); text-decoration: none; }

.pf-quick-actions-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.pf-btn--secondary {
  background: var(--pf-bg);
  color: var(--pf-primary);
  border: 1px solid var(--pf-primary);
}

.pf-list--context { color: var(--pf-text-muted); font-size: 14px; }

/* Admin: hotel add/edit form */

.pf-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pf-form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.pf-form-group { display: flex; flex-direction: column; gap: 6px; }
.pf-label { font-size: 13px; font-weight: 600; color: var(--pf-text-muted); }
.pf-error { margin: 0; font-size: 12px; color: var(--pf-danger); }
.pf-form-success {
  background: rgba(15, 118, 76, 0.12);
  color: #0f764c;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}
.pf-form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Phase 3: visit workflow, inspection, observations, dictation */

.pf-form-inline { display: flex; gap: 8px; }
.pf-textarea { resize: vertical; font-family: inherit; }

.pf-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.pf-btn--small { padding: 8px 12px; font-size: 13px; }

.pf-badge--ok { background: rgba(15, 118, 76, 0.15); color: #0f764c; }

.pf-stage-bar {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  margin-bottom: 12px;
}

.pf-stage-bar__item {
  flex: 1 0 auto;
  text-align: center;
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--pf-card-bg);
  border: 1px solid var(--pf-border);
  color: var(--pf-text-muted);
  white-space: nowrap;
}

.pf-stage-bar__item--done {
  background: rgba(15, 118, 76, 0.12);
  color: #0f764c;
  border-color: transparent;
}

.pf-stage-bar__item--active {
  background: var(--pf-primary);
  color: #fff;
  border-color: transparent;
}

.pf-inspection-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.pf-inspection-row form { display: inline-flex; }
.pf-inspection-row__actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pf-asset-inspection-list { list-style: none; margin: 0; padding: 0; }
.pf-asset-inspection-list li { border-top: 1px solid var(--pf-border); }

.pf-observation-card {
  border: 1px solid var(--pf-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.pf-observation-card__head { display: flex; gap: 6px; margin-bottom: 6px; }
.pf-observation-card__chain { font-size: 12px; color: var(--pf-text-muted); margin: 0 0 6px; }

.pf-dictation-row { display: flex; gap: 8px; align-items: flex-start; }
.pf-dictation-row .pf-textarea { flex: 1; }

.pf-mic-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--pf-border);
  background: var(--pf-card-bg);
  font-size: 16px;
  cursor: pointer;
}

.pf-mic-btn--active {
  background: var(--pf-danger);
  border-color: var(--pf-danger);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --pf-bg: #10161c;
    --pf-card-bg: #1a2229;
    --pf-text: #e8edf2;
    --pf-text-muted: #9aa8b4;
    --pf-border: #2a3540;
  }
  :root:not([data-theme="light"]) .pf-bottom-nav,
  :root:not([data-theme="light"]) .pf-quick-sheet__panel {
    background: #1a2229;
  }
  :root:not([data-theme="light"]) .pf-quick-sheet__cancel {
    background: #232d36;
  }
}
