/* ==========================================================================
   admin.css — Back-office da equipa
   Moreno Home Conciergeries

   Carregado APENAS nas páginas de /admin. Reutiliza todos os componentes
   do hóspede e acrescenta apenas o que é específico do painel (tabelas,
   filtros, gaveta de detalhe do pedido).
   ========================================================================== */

.admin { --content-max: 1440px; }

/* Em admin a sidebar está sempre disponível a partir de tablet horizontal */
.admin .content {
  padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + var(--sp-8));
}

.admin .sidebar__head .brand__sub { color: var(--gold); }

.admin-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--gold-line);
  background: var(--gold-dim);
  color: var(--gold-soft);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Cabeçalho de página
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.page-head h1 { font-size: var(--fs-xl); }
.page-head p { font-size: var(--fs-sm); }
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Barra de filtros
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.toolbar__search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}
.toolbar__search .icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}
.toolbar__search .input { padding-left: var(--sp-10); min-height: 44px; }
.toolbar .select { width: auto; min-width: 150px; min-height: 44px; }

/* --------------------------------------------------------------------------
   Tabela
   -------------------------------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table { min-width: 760px; font-size: var(--fs-sm); }

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-faint);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-clickable { cursor: pointer; }

.table__ref {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.table__main { font-weight: 600; }
.table__sub { color: var(--text-muted); font-size: var(--fs-xs); }
.table__num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table__actions { text-align: right; white-space: nowrap; }

/* Versão em cartões (mobile) — gerada pelo mesmo componente de tabela */
.record-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.record {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.record__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.record__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-3);
}
.record__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
}
.record__value {
  font-size: var(--fs-sm);
  font-weight: 500;
  /* Emails e referências longas não têm espaços onde quebrar: sem isto,
     transbordam a célula e alargam a página no telemóvel. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 767px) {
  .table-wrap { display: none; }
}
@media (min-width: 768px) {
  .record-list { display: none; }
}

/* --------------------------------------------------------------------------
   Gaveta de detalhe (pedido, cliente, apartamento)
   -------------------------------------------------------------------------- */

.side-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  justify-content: flex-end;
}
.side-panel__scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  animation: fade-in var(--t-base) var(--ease);
}
.side-panel__panel {
  position: relative;
  width: min(100%, 480px);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slide-in-right var(--t-base) var(--ease);
  overflow: hidden;
}
@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to   { transform: none; }
}
.side-panel__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  background: var(--black);
  color: var(--text-on-dark);
}
.side-panel__head h3 { font-size: var(--fs-md); }
.side-panel__head .muted { color: var(--text-on-dark-muted); }
.side-panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.side-panel__foot {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-bottom: calc(var(--sp-4) + var(--safe-bottom));
}
.side-panel__foot .btn { flex: 1 1 auto; }

.panel-section__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-faint);
  margin-bottom: var(--sp-3);
}

/* --------------------------------------------------------------------------
   Estados / atribuição
   -------------------------------------------------------------------------- */

.status-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-2);
}
.status-picker button {
  padding: var(--sp-3) var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--t-fast) var(--ease);
}
.status-picker button:hover { border-color: var(--border-strong); }
.status-picker button.is-active {
  background: var(--black);
  border-color: var(--black);
  color: var(--cream);
}

.assignee-list { display: flex; flex-direction: column; gap: var(--sp-2); }

/* --------------------------------------------------------------------------
   Login do back-office
   -------------------------------------------------------------------------- */

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--black);
}
.auth-aside {
  display: none;
  position: relative;
  padding: var(--sp-12) var(--sp-10);
  color: var(--text-on-dark);
  background: var(--black);
  overflow: hidden;
}
.auth-aside__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}
.auth-aside__inner { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside h2 { font-family: var(--font-display); font-size: var(--fs-3xl); max-width: 14ch; }
.auth-aside p { color: var(--text-on-dark-muted); max-width: 40ch; }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6) var(--sp-4) calc(var(--sp-8) + var(--safe-bottom));
  background: var(--bg);
}
.auth-box { width: min(100%, 420px); }
.auth-box__head { text-align: center; margin-bottom: var(--sp-6); }
.auth-box__head .brand { justify-content: center; margin-bottom: var(--sp-5); }
.auth-box__head h1 { font-family: var(--font-display); font-size: var(--fs-xl); }
.auth-box__head p { font-size: var(--fs-sm); margin-top: var(--sp-1); }

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: var(--sp-5);
}
.tabs button {
  flex: 1 1 0;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--t-fast) var(--ease);
}
.tabs button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.demo-hint {
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.demo-hint strong { color: var(--text); }
.demo-hint code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: var(--fs-sm);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
}
.demo-hint button { color: var(--gold); font-weight: 600; }

@media (min-width: 1024px) {
  .auth-shell { grid-template-columns: 1.05fr 1fr; }
  .auth-aside { display: block; }
}
