/* Admin portal (villa-admin.2kpawresort.com). Builds on villacam.css tokens and fonts.
   Phone-first: staff often work from phones at the front desk. */

.admin .admin-bar { padding-bottom: 0; }

.admin .admin-bar > .wrap {
  justify-content: space-between;
  padding-bottom: 9px;
}

.link-button {
  border: 0;
  background: none;
  color: var(--cream);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px 0;
}

.admin-nav {
  background: var(--deep-pine);
}

.admin-nav .wrap {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-nav a {
  flex: none;
  padding: 12px 12px;
  color: rgba(249, 241, 230, 0.78);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.admin-nav a[aria-current="page"] {
  color: var(--cream);
  border-bottom-color: var(--gold);
}

.admin-nav a:focus-visible,
.link-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

.admin-main { padding-top: 16px; padding-bottom: 24px; }

.admin-footer {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 13px;
}

/* ---- cards and type ------------------------------------------------------- */

.card {
  margin-bottom: 16px;
  padding: 20px 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.card h1,
.card h2 {
  margin: 4px 0 14px;
  color: var(--heading);
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
}

.card h1 { font-size: 1.7rem; }
.card h2 { font-size: 1.3rem; }

.muted { color: var(--muted); }

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(49, 83, 66, 0.08);
  font-size: 0.9em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.flash {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.flash.ok { background: rgba(49, 83, 66, 0.12); color: var(--heading); }
.flash.error { background: #f6e1dc; color: #7a2716; }

@media (prefers-color-scheme: dark) {
  .flash.error { background: #4a2a22; color: #f6d8cf; }
  code { background: rgba(249, 241, 230, 0.1); }
}

/* ---- forms -------------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .wide { grid-column: 1 / -1; }
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--heading);
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select,
.move-form select,
.link-field {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid rgba(49, 83, 66, 0.35);
  border-radius: 10px;
  background: var(--white);
  color: var(--cocoa);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming into fields */
}

@media (prefers-color-scheme: dark) {
  .field input,
  .field select,
  .move-form select,
  .link-field {
    background: var(--deep-pine);
    color: var(--cream);
    border-color: rgba(249, 241, 230, 0.35);
  }
}

.field input:focus,
.field select:focus,
.move-form select:focus {
  outline: 2px solid var(--heading);
  outline-offset: 1px;
}

.field.check label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 600;
}

.field.check input { width: 22px; min-height: 22px; margin-top: 2px; }

/* ---- sign-in page: brand panel + form; split screen on desktop ---------------- */

.signin-page { min-height: 100vh; min-height: 100dvh; }

.signin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.signin-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 24px 24px;
  background: var(--pine);
  color: var(--cream);
  text-align: center;
}

.signin-brand-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.signin-brand .emblem { width: 72px; }

.signin-product {
  margin: 10px 0 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.1;
}

/* Tagline and place line are for the roomy desktop panel only. */
.signin-tagline,
.signin-place { display: none; }

.signin-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 20px max(32px, env(safe-area-inset-bottom));
}

.signin-form {
  width: 100%;
  max-width: 400px;
}

.signin-form h1 {
  margin: 6px 0 0;
  color: var(--heading);
  font-family: var(--display);
  font-weight: 600;
  font-size: 2.25rem;
  line-height: 1.1;
}

.signin-lead {
  margin: 8px 0 24px;
  color: var(--text);
}

.signin-form .flash { margin-bottom: 16px; }

/* Google's sign-in button (branding guidelines): white fill, #747775 outline, #1F1F1F text,
   standard multi-colour "G". Same look on light and dark pages. */
.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid #747775;
  border-radius: 999px;
  background: #ffffff;
  color: #1f1f1f;
  font-family: Roboto, "Google Sans", Arial, sans-serif;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.25px;
  text-decoration: none;
  transition: background-color 0.15s, box-shadow 0.15s;
}

.google-button:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.google-button:focus-visible {
  outline: 2px solid var(--heading);
  outline-offset: 3px;
}

.google-g { width: 20px; height: 20px; flex: none; }

.signin-help {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.dev-signin { margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--rule); }
.dev-signin .button { margin-top: 12px; }

/* Desktop: Pine brand half on the left, form centred on the right. */
@media (min-width: 900px) {
  .signin-layout { flex-direction: row; }

  .signin-brand {
    flex: 0 0 46%;
    justify-content: space-between;
    padding: 48px;
  }

  .signin-brand-inner { margin: auto 0; }
  .signin-brand .emblem { width: 160px; }
  .signin-product { margin-top: 20px; font-size: 2.6rem; }

  .signin-tagline {
    display: block;
    margin: 14px 0 0;
    font-family: var(--display);
    font-style: italic;
    font-weight: 400;
    font-size: 36px; /* Brand Book: tagline at least 24 px cap height */
    line-height: 1.05;
    opacity: 0.92;
  }

  .signin-place {
    display: block;
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.7;
  }

  .signin-main { align-items: center; padding: 48px; }
}

/* ---- small buttons ------------------------------------------------------- */

.button.small-secondary,
.button.small-danger {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
}

.button.small-secondary {
  background: transparent;
  color: var(--heading);
  box-shadow: inset 0 0 0 1.5px var(--heading);
}

.button.small-danger {
  background: transparent;
  color: #9a2f19;
  box-shadow: inset 0 0 0 1.5px #9a2f19;
}

@media (prefers-color-scheme: dark) {
  .button.small-danger { color: #f0a08c; box-shadow: inset 0 0 0 1.5px #f0a08c; }
}

.button.whatsapp { background: #1f6f4a; color: var(--white); }

.button .icon { width: 18px; height: 18px; }

/* ---- links list -------------------------------------------------------- */

.link-list,
.staff-list,
.history,
.status-grid {
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-item,
.staff-list li {
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}

.link-item:first-child,
.staff-list li:first-child { border-top: 0; }

.link-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.link-pet {
  color: var(--heading);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
}

.link-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.link-actions form { margin: 0; }

.move-form { display: flex; gap: 8px; }
.move-form select { width: auto; min-height: 44px; font-size: 15px; }

.status-expired .link-pet,
.status-revoked .link-pet { color: var(--muted); }

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chip-active { background: rgba(49, 83, 66, 0.14); color: var(--heading); }
.chip-expired { background: rgba(77, 60, 46, 0.12); color: var(--muted); }
.chip-revoked { background: #f1ddd6; color: #8a2c17; }

@media (prefers-color-scheme: dark) {
  .chip-active { background: rgba(249, 241, 230, 0.16); }
  .chip-revoked { background: #4a2a22; color: #f6d8cf; }
}

.link-box { margin: 16px 0 4px; }
.link-field { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }

/* ---- tables ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table th {
  padding: 8px 10px 8px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 10px 10px 10px 0;
  border-top: 1px solid var(--rule);
  vertical-align: middle;
}

.table .actions { white-space: nowrap; text-align: right; }
.table .actions .button { margin-left: 4px; }
.table.compact td { padding: 6px 10px 6px 0; font-size: 14px; white-space: nowrap; }
.is-disabled td { color: var(--muted); }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.dot-on { background: #2f8a55; }
.dot-idle { background: var(--gold); }
.dot-off { background: rgba(77, 60, 46, 0.3); }

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.status-tile {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.status-tile .dot { margin-top: 6px; flex: none; }

.history li {
  padding: 8px 0;
  border-top: 1px solid var(--rule);
  font-size: 14px;
}

.history .when { color: var(--muted); }
.history pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; }

.nvr {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.nvr summary { cursor: pointer; padding: 4px 0; }
.nvr form { margin-top: 12px; }

/* Narrow screens: table rows become stacked cards (villas list). */
@media (max-width: 639px) {
  .table.cards thead { display: none; }
  .table.cards,
  .table.cards tbody,
  .table.cards tr { display: block; width: 100%; }
  .table.cards tr { padding: 12px 0; border-top: 1px solid var(--rule); }
  .table.cards tr:first-child { border-top: 0; }
  .table.cards td { display: block; padding: 2px 0; border: 0; }
  .table.cards td.num,
  .table.cards td.name { display: inline; font-size: 1.05rem; }
  .table.cards td.num::after { content: " ·"; }
  .table.cards td[data-label]::before {
    content: attr(data-label) "  ";
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .table.cards .actions { padding-top: 8px; text-align: left; }
  .table.cards .actions .button { margin: 0 6px 0 0; }
  .table-wrap:has(.cards) { overflow-x: visible; margin: 0; padding: 0; }
}
