/* =========================================================================
   D'LIMA Obras — Design System
   Luxo arquitetonico sereno: preto quente + bronze fosco, tipografia editorial.
   100% self-contained (sem CDN, sem fontes externas) — funciona offline.
   ========================================================================= */

:root {
  /* Cores */
  --bg: #0e0d0b;
  --bg-deep: #080706;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.045);
  --gold: #c8a24e;
  --gold-bright: #e6c988;
  --bronze: #9c7b3e;
  --text: #ece6d9;
  --text-muted: #968f7e;
  --text-faint: #6b6555;
  --line: rgba(200, 162, 78, 0.16);
  --line-soft: rgba(236, 230, 217, 0.08);
  --danger: #d98a6a;
  --elev: #14130f;

  /* Tipografia */
  --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Georgia", "Times New Roman", Cambria, serif;

  /* Forma e movimento */
  --radius: 14px;
  --radius-sm: 9px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.75);
}

/* ===================== Tema claro (fundo branco) ===================== */
:root[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-deep: #ece7dc;
  --surface: rgba(60, 50, 28, 0.045);
  --surface-2: rgba(60, 50, 28, 0.08);
  --gold: #9a7a2f;
  --gold-bright: #7c5f23;
  --bronze: #8a6b32;
  --text: #2a2620;
  --text-muted: #6b6557;
  --text-faint: #9a9182;
  --line: rgba(154, 122, 47, 0.3);
  --line-soft: rgba(40, 38, 32, 0.12);
  --danger: #b5552f;
  --elev: #ffffff;
  --shadow: 0 24px 60px -28px rgba(60, 50, 28, 0.4);
}
:root[data-theme="light"] .sidebar { background: rgba(60, 50, 28, 0.03); }
:root[data-theme="light"] .bg-atmos::after { opacity: 0.14; }

/* Botao discreto de alternar tema */
.theme-toggle {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0.4rem 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: color 0.2s;
}
.theme-toggle:hover { color: var(--gold-bright); }

/* Link "Esqueci minha senha" */
.link-forgot {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
  transition: color 0.2s;
}
.link-forgot:hover { color: var(--gold-bright); }
.theme-toggle.fixed {
  position: fixed;
  left: 1.1rem;
  bottom: 1rem;
  z-index: 6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 162, 78, 0.22) transparent;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(200, 162, 78, 0.22);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 162, 78, 0.5);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ----------------------------------------------------------- Atmosfera de fundo */
.bg-atmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(200, 162, 78, 0.10), transparent 55%),
    radial-gradient(90% 70% at -10% 110%, rgba(156, 123, 62, 0.08), transparent 55%),
    var(--bg);
}
/* Grid de planta baixa */
.bg-atmos::before {
  content: "";
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 100% at 70% 0%, #000 10%, transparent 70%);
  mask-image: radial-gradient(120% 100% at 70% 0%, #000 10%, transparent 70%);
  opacity: 0.5;
}
/* Grao */
.bg-atmos::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------- Tipografia base */
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

/* ============================================================= LOGIN / AUTH */
.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Lado da marca */
.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 5vw, 4.5rem);
  border-right: 1px solid var(--line-soft);
  overflow: hidden;
}
.auth-aside::after {
  /* linha diagonal decorativa (traço de prancheta) */
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 1px;
  height: 140%;
  background: linear-gradient(transparent, var(--gold), transparent);
  transform: rotate(18deg);
  opacity: 0.25;
}

.brand-mark {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}
.brand-mark .word {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text);
  padding-left: 0.42em;
}
.brand-mark .tick {
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 18px 2px rgba(200, 162, 78, 0.5);
}
.brand-sub {
  margin-top: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-left: 0.5em;
}

.aside-center {
  max-width: 30ch;
}
.aside-center h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--text);
}
.aside-center h2 em {
  font-style: italic;
  color: var(--gold-bright);
}
.aside-center p {
  margin-top: 1.4rem;
  color: var(--text-muted);
  max-width: 34ch;
  font-size: 1.02rem;
}

.aside-foot {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.aside-foot .bar {
  width: 34px;
  height: 1px;
  background: var(--gold);
  opacity: 0.6;
}

/* Lado do formulario */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem);
}
.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card h1 {
  margin-top: 0.9rem;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  letter-spacing: -0.01em;
}
.auth-sub {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.auth-form {
  margin-top: 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.field label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}
.field input {
  width: 100%;
  padding: 0.95rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}
.field input::placeholder {
  color: var(--text-faint);
}
.field input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(200, 162, 78, 0.1);
}

.form-error {
  min-height: 1.2rem;
  font-size: 0.85rem;
  color: var(--danger);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.3s;
}
.form-error.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Botao */
.btn {
  position: relative;
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #e6c988, #c8a24e 55%, #9c7b3e);
  color: #1a1407;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    filter 0.25s var(--ease);
}
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s var(--ease);
}
.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -14px rgba(200, 162, 78, 0.6);
}
.btn:hover:not(:disabled)::after {
  left: 130%;
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  cursor: progress;
  filter: saturate(0.6) brightness(0.92);
}
.btn .btn-label {
  position: relative;
  z-index: 1;
}
.btn .spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(26, 20, 7, 0.35);
  border-top-color: #1a1407;
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn-label {
  opacity: 0;
}
.btn.is-loading .spinner {
  opacity: 1;
}
.btn.is-success {
  background: linear-gradient(135deg, #b7d39a, #7ea863);
}

/* Botoes utilitarios compartilhados (login, admin e cliente) */
.btn-sm {
  width: auto;
  padding: 0.7rem 1.1rem;
  font-size: 0.72rem;
}
.btn-line {
  width: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.btn-line:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: var(--surface);
}

.auth-note {
  margin-top: 1.75rem;
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-align: center;
}

/* ============================================================= PLACEHOLDER PANELS */
.panel-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .brand-mark .word {
  font-size: 1.05rem;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: var(--surface);
}
.panel-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.panel-card {
  max-width: 440px;
}
.panel-card .eyebrow {
  display: block;
  margin-bottom: 1rem;
}
.panel-card h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
}
.panel-card p {
  margin-top: 1rem;
  color: var(--text-muted);
}
.panel-card .who {
  margin-top: 1.5rem;
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--gold-bright);
}

/* ----------------------------------------------------------------- Animacoes */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.reveal {
  opacity: 0;
  animation: rise 0.8s var(--ease) forwards;
}
.reveal.d1 { animation-delay: 0.05s; }
.reveal.d2 { animation-delay: 0.15s; }
.reveal.d3 { animation-delay: 0.25s; }
.reveal.d4 { animation-delay: 0.35s; }
.reveal.d5 { animation-delay: 0.45s; }
.reveal.d6 { animation-delay: 0.55s; }

@keyframes shakex {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.shake {
  animation: shakex 0.45s both;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .shake,
  .btn::after,
  .spinner {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ----------------------------------------------------------------- Responsivo */
@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
    min-height: 38vh;
    gap: 2rem;
  }
  .auth-aside::after {
    display: none;
  }
}
@media (max-width: 480px) {
  .auth-aside {
    padding: 1.75rem 1.5rem;
    min-height: auto;
  }
  .aside-center {
    display: none;
  }
}
