/* common.css — Formulários CRA Tintas (espelha o design do painel administrativo) */

:root {
  color-scheme: light;
  --bg: #fffdf8;
  --surface: #f5f1e9;
  --surface-strong: #ede7da;
  --fg: #191816;
  --muted: #6f6c65;
  --faint: #9a968c;
  --border: rgba(25, 24, 22, 0.14);
  --border-strong: rgba(25, 24, 22, 0.26);
  --accent: #9f2721;
  --accent-deep: #741b17;
  --accent-hover: oklch(0.52 0.17 30);
  --accent-press: oklch(0.41 0.14 30);
  --on-accent: #fffdf8;
  --olive: #596047;
  --olive-bg: oklch(0.935 0.02 108);
  --danger-ink: oklch(0.36 0.15 28);
  --danger-bg: oklch(0.945 0.02 30);
  --shadow-sm: 0 1px 2px rgba(25, 24, 22, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(25, 24, 22, 0.22);
  --radius: 8px;
  --radius-lg: 12px;
  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.145 0 0);
  --surface: oklch(0.195 0 0);
  --surface-strong: oklch(0.245 0 0);
  --fg: oklch(0.93 0 0);
  --muted: oklch(0.65 0 0);
  --faint: oklch(0.5 0 0);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --accent: oklch(0.645 0.15 30);
  --accent-deep: oklch(0.585 0.14 30);
  --accent-hover: oklch(0.6 0.14 30);
  --accent-press: oklch(0.55 0.14 30);
  --on-accent: oklch(0.2 0 0);
  --olive: oklch(0.68 0.085 108);
  --olive-bg: oklch(0.29 0.03 108);
  --danger-ink: oklch(0.735 0.12 28);
  --danger-bg: oklch(0.29 0.045 30);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.62);
}

* { box-sizing: border-box; }
html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
svg { display: block; }
img { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 1.5px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}

/* ── Login layout ─────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-main {
  width: 100%;
  max-width: 440px;
  padding: 40px;
}
.login-card {
  width: 100%;
  max-width: 400px;
}
@media (min-width: 1100px) {
  .login-card { max-width: 440px; }
}
.login-card .brand {
  padding: 0 0 26px;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.login-card .login-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 26px;
}

/* ── Brand ────────────────────────────────────────────────── */

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 20px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  display: block;
  flex: none;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-word {
  display: grid;
  line-height: 1;
}
.brand-word b {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-word span {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ── Eyebrow ──────────────────────────────────────────────── */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Form cards ───────────────────────────────────────────── */

.form-cards {
  display: grid;
  gap: 12px;
}
.form-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  text-align: left;
  transition: background 0.16s, border-color 0.16s, box-shadow 0.16s;
  width: 100%;
}
.form-card:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.form-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  place-items: center;
  flex: none;
  transition: background 0.16s;
}
.form-card:hover .form-card-icon {
  background: var(--surface-strong);
}
.form-card-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}
.form-card-body {
  flex: 1;
  min-width: 0;
}
.form-card-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.form-card-desc {
  font-size: 12.5px;
  color: var(--muted);
}
.form-card-arrow {
  width: 16px;
  height: 16px;
  color: var(--faint);
  flex: none;
  transition: transform 0.16s, color 0.16s;
}
.form-card:hover .form-card-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

/* ── Login form ───────────────────────────────────────────── */

.login-form {
  display: grid;
  gap: 16px;
}
.login-form .form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}

/* ── Field ────────────────────────────────────────────────── */

.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}
.field .hint {
  font-size: 11.5px;
  color: var(--faint);
}

/* ── Input ────────────────────────────────────────────────── */

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13.5px;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}
.input::placeholder {
  color: var(--faint);
}
.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.input.invalid {
  border-color: var(--danger-ink);
}
.input.invalid:focus {
  outline-color: var(--danger-ink);
}
.field .field-error {
  display: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--danger-ink);
}
.field.has-error .field-error {
  display: block;
}
.field.has-error .input {
  border-color: var(--danger-ink);
}

/* ── Check ────────────────────────────────────────────────── */

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
}
.check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, border-color 0.16s, transform 0.1s;
}
.btn svg {
  width: 16px;
  height: 16px;
  display: flex;
  flex-shrink: 0;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  width: 100%;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:active {
  background: var(--accent-press);
}
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface);
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid currentColor;
}
.link-btn:hover {
  color: var(--accent);
}

/* ── Icon button (theme toggle) ───────────────────────────── */

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background 0.16s, color 0.16s;
}
.icon-btn svg {
  width: 19px;
  height: 19px;
  display: flex;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--fg);
}
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
}
.theme-toggle .ico-sun { display: none; }
.theme-toggle .ico-moon { display: block; }
[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

/* ── Footer ───────────────────────────────────────────────── */

.login-foot {
  margin-top: 34px;
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.04em;
}
.login-foot a {
  color: var(--muted);
  transition: color 0.16s;
}
.login-foot a:hover {
  color: var(--accent);
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 480px) {
  .login-main {
    padding: 24px 16px;
  }
  .login-card h1 {
    font-size: 20px;
  }
  .form-card {
    padding: 14px;
  }
  .form-card-icon {
    width: 38px;
    height: 38px;
  }
  .form-card-icon svg {
    width: 18px;
    height: 18px;
  }
}
