/* Portal do lojista — tokens preservados do CRM Demovelli. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0d0e12;
  --surface: #171a21;
  --surface2: #1d212b;
  --border: rgba(197, 168, 128, 0.20);
  --border2: rgba(197, 168, 128, 0.34);
  --gold: #d4af37;
  --gold-light: #e0c060;
  --gold-dim: rgba(197, 168, 128, 0.10);
  --primary: #c5a880;
  --primary-hover: #b5956a;
  --text: #f3f4f6;
  --text2: #aeb5c0;
  --err: #f87171;
  --ok: #34d399;
  --radius: 10px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.40);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface2: #f7f4ee;
  --border: rgba(120, 95, 55, 0.22);
  --border2: rgba(120, 95, 55, 0.38);
  --gold: #80631f;
  --gold-light: #765719;
  --gold-dim: rgba(169, 132, 42, 0.12);
  --primary: #8a693a;
  --primary-hover: #76582f;
  --text: #23262d;
  --text2: #515966;
  --err: #b42318;
  --ok: #146c43;
  --shadow-sm: 0 4px 12px rgba(60, 50, 30, 0.08);
  --shadow-md: 0 18px 48px rgba(60, 50, 30, 0.14);
  color-scheme: light;
}

html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--gold-light); }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

.eyebrow {
  margin: 0 0 .45rem;
  color: var(--gold-light);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .8rem; font-size: clamp(2rem, 8vw, 3.55rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { margin-bottom: .45rem; font-size: 1.4rem; line-height: 1.2; }

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 42px;
  border: 1px solid var(--border2);
  border-radius: 9px;
  background: var(--gold-dim);
  color: var(--gold-light);
  font-size: 1.15rem;
  font-weight: 850;
}

.auth-page { display: grid; min-height: 100vh; }
.auth-shell {
  display: grid;
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.2rem;
  align-items: center;
  gap: 1.5rem;
}
.auth-brand { padding: 1rem .25rem; }
.auth-intro { max-width: 38rem; margin-bottom: 1.6rem; color: var(--text2); font-size: 1.02rem; }
.brand-signature { display: flex; align-items: center; gap: .75rem; font-weight: 780; letter-spacing: .01em; }
.auth-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 1.3rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-heading h2 { font-size: 1.65rem; }

.form-stack { display: grid; gap: 1rem; }
.field { display: grid; gap: .42rem; color: var(--text); font-size: .88rem; font-weight: 720; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: .72rem .85rem;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
}
.field input::placeholder { color: var(--text2); opacity: .82; }
.field input:disabled { cursor: not-allowed; opacity: .65; }
.field-help, .auth-footnote, .secondary-text { color: var(--text2); }
.field-help { margin: -.35rem 0 0; font-size: .82rem; }
.auth-footnote { margin: 1.2rem 0 0; font-size: .85rem; }
.field-grid { display: grid; gap: 1rem; }
.check-row { display: grid; grid-template-columns: 24px 1fr; align-items: start; gap: .7rem; color: var(--text2); font-size: .9rem; }
.check-row input { width: 20px; height: 20px; margin: .12rem 0 0; accent-color: var(--primary); }

.button, .icon-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}
.button { gap: .45rem; padding: .68rem 1rem; border: 1px solid var(--border2); font-weight: 760; }
.button-primary { border-color: transparent; background: var(--primary); color: #12141a; }
:root[data-theme="light"] .button-primary { background: var(--primary-hover); color: #fff; }
.button-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.button-quiet, .icon-button { border: 1px solid var(--border2); background: transparent; color: var(--text); }
.button-quiet:hover, .icon-button:hover { background: var(--gold-dim); }
.button-block { width: 100%; min-height: 48px; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.icon-button { min-width: 50px; padding: .55rem .7rem; font-size: .78rem; font-weight: 760; }

.notice { margin: 0 0 1rem; padding: .75rem .85rem; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; }
.notice-neutral { background: var(--gold-dim); color: var(--text2); }
.notice-success { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--ok); }
.notice-error { border-color: color-mix(in srgb, var(--err) 55%, transparent); background: color-mix(in srgb, var(--err) 10%, transparent); color: var(--err); }
.form-error { min-height: 1.25rem; margin: -.25rem 0 0; color: var(--err); font-size: .86rem; font-weight: 650; }

.portal-shell { min-height: 100vh; }
.portal-header {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.portal-brand { display: flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; }
.portal-brand > span:last-child { display: grid; line-height: 1.15; }
.portal-brand small { margin-top: .2rem; color: var(--text2); font-size: .68rem; font-weight: 600; }
.portal-actions { display: flex; gap: .45rem; }
.portal-nav {
  display: flex;
  gap: .25rem;
  padding: .65rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.portal-nav a { min-height: 44px; padding: .7rem .85rem; border-radius: 8px; color: var(--text2); font-size: .88rem; font-weight: 720; text-decoration: none; white-space: nowrap; }
.portal-nav a[aria-current="page"] { background: var(--gold-dim); color: var(--gold-light); }
.portal-main { width: min(100%, 1040px); margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.welcome-block { margin: .5rem 0 1.6rem; }
.welcome-block h1, .page-heading h1 { font-size: clamp(1.9rem, 7vw, 2.8rem); }
.welcome-store { color: var(--text2); }
.empty-state {
  display: grid;
  justify-items: start;
  max-width: 760px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.empty-state > p:not(.eyebrow) { max-width: 38rem; color: var(--text2); }
.empty-icon { display: grid; width: 54px; height: 54px; place-items: center; margin-bottom: 1.2rem; border-radius: 12px; background: var(--gold-dim); color: var(--gold-light); font-size: 1.4rem; font-weight: 850; }
.portal-main > .notice { margin-top: 1.2rem; }

.profile-main { max-width: 1040px; }
.page-heading { max-width: 640px; margin-bottom: 1.4rem; }
.page-heading > p:last-child { color: var(--text2); }
.profile-grid { display: grid; gap: 1rem; }
.profile-card { padding: 1.2rem; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); background: var(--surface); box-shadow: var(--shadow-sm); }
.identity-card { display: flex; align-items: center; gap: 1rem; }
.identity-card h2 { overflow-wrap: anywhere; }
.logo-preview { display: grid; width: 88px; height: 88px; place-items: center; flex: 0 0 88px; overflow: hidden; border: 1px dashed var(--border2); border-radius: 12px; background: var(--surface2); }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview span { color: var(--gold-light); font-size: 1.75rem; font-weight: 850; }
.file-picker { display: grid; min-height: 72px; place-items: center; padding: .8rem; border: 1px dashed var(--border2); border-radius: 9px; background: var(--surface2); color: var(--text); cursor: pointer; text-align: center; }
.file-picker span { font-weight: 760; }
.file-picker small { color: var(--text2); overflow-wrap: anywhere; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (min-width: 720px) {
  .auth-shell { grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr); padding: 2rem; }
  .auth-shell-compact { align-items: center; }
  .auth-card { padding: 1.8rem; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .portal-header, .portal-nav { padding-left: max(1.5rem, calc((100vw - 1040px) / 2)); padding-right: max(1.5rem, calc((100vw - 1040px) / 2)); }
  .portal-main { padding: 2.2rem 1.5rem 4rem; }
  .empty-state { padding: 2.2rem; }
  .profile-grid { grid-template-columns: minmax(260px, .85fr) minmax(360px, 1.15fr); align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
