* { box-sizing: border-box; }

:root {
  --primary: #673de6;
  --primary-2: #8b5cf6;
  --danger: #ff2d55;
  --bg: #090d14;
  --card: #111822;
  --card-2: #151d29;
  --text: #f9fafb;
  --muted: #a5adba;
  --border: #263241;
  --input: #101720;
  --shadow: rgba(0, 0, 0, 0.30);
  --logo-filter: none;
}

html[data-theme="light"] {
  --bg: #f4f5f7;
  --card: #ffffff;
  --card-2: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --input: #ffffff;
  --shadow: rgba(17, 24, 39, 0.08);
  --logo-filter: invert(1);
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(103, 61, 230, .14), transparent 32%),
    radial-gradient(circle at 88% 20%, rgba(139, 92, 246, .10), transparent 26%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 36px;
  box-shadow: 0 24px 70px var(--shadow);
}

.logo-box {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.logo-box img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
  filter: var(--logo-filter);
}

.auth-logo-box {
  justify-content: center;
  width: 320px;
  height: 120px;
  margin: 0 auto 34px;
}

.auth-logo-box img {
  max-height: 108px !important;
}

.theme-floating {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 16px;
}

h1, h2, p { margin-top: 0; }
h1 { font-size: 34px; letter-spacing: -0.04em; }
h2 { margin-bottom: 0; }
p { color: var(--muted); }

.form, .form-sections { display: grid; gap: 16px; }

label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  opacity: 0.94;
}

.required {
  color: var(--danger) !important;
  font-weight: 900;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  box-shadow: none;
  background: var(--input);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  outline: none;
}

input::placeholder, textarea::placeholder { color: var(--muted); }

input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(103, 61, 230, 0.16);
}

input[readonly] {
  opacity: 0.75;
  cursor: not-allowed;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

button {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: 13px 18px;
  border-radius: 14px;
  font-weight: 900;
  cursor: pointer;
}

button:hover { filter: brightness(1.05); }

button.ghost {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 74px;
  background: rgba(9, 13, 20, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.86);
}

.top-logo-box {
  width: 260px;
  height: 58px;
}

.top-logo-box img {
  max-height: 52px !important;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  min-width: 46px;
  height: 46px;
  border-radius: 16px;
  padding: 0;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  padding: 28px;
}

.panel {
  background: rgba(17, 24, 39, 0.72);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 12px 35px var(--shadow);
}

html[data-theme="light"] .panel {
  background: var(--card);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.form-block {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.block-title span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-weight: 900;
}

.block-title h2 { font-size: 20px; }

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  position: relative;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

.actions {
  display: flex;
  justify-content: flex-end;
}

.actions button {
  min-width: 190px;
  font-size: 16px;
}

.suggestions {
  position: absolute;
  top: 72px;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 45px var(--shadow);
  overflow: hidden;
  z-index: 4;
}

.suggestion {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.suggestion:hover { background: rgba(103, 61, 230, 0.14); }

.side h2 {
  margin-bottom: 18px;
}

.side input {
  margin-bottom: 8px;
}

.orders-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.order-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: var(--card-2);
}

.order-card strong { display: block; }
.order-card small { color: var(--muted); display: block; margin: 5px 0 10px; }
.order-card a { color: var(--primary-2); font-weight: 900; text-decoration: none; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 10;
}

.hidden { display: none; }

.modal-box {
  width: 100%;
  max-width: 500px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 30px 90px rgba(0,0,0,.35);
}

.confirm-box {
  border: 1px solid var(--border);
  background: var(--card-2);
  border-radius: 18px;
  padding: 16px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .span-3, .span-4 { grid-column: span 2; }
}

@media (max-width: 640px) {
  .layout { padding: 14px; }
  .topbar { padding: 0 16px; }
  .panel { padding: 20px; border-radius: 22px; }
  .grid-form { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
  .actions button { width: 100%; }
  .auth-logo-box { width: 240px; height: 90px; }
  .top-logo-box { width: 170px; height: 48px; }
}


/* === AJUSTES V4 === */
.topbar {
  height: 86px !important;
  padding: 0 34px !important;
  background: rgba(8, 12, 18, 0.92) !important;
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.92) !important;
}

.top-logo-box {
  width: 390px !important;
  height: 76px !important;
}

.top-logo-box img {
  max-height: 72px !important;
  max-width: 390px !important;
}

.auth-logo-box {
  width: 760px !important;
  max-width: 92vw !important;
  height: 250px !important;
  margin-bottom: 40px !important;
}

.auth-logo-box img {
  max-height: 230px !important;
  max-width: 760px !important;
}

.top-actions {
  gap: 14px !important;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.82);
  color: var(--text);
  padding: 6px;
  border-radius: 14px;
  min-height: 46px;
}

html[data-theme="light"] .theme-switch {
  background: #ffffff;
}

.theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  transition: .15s ease;
}

html[data-theme="dark"] .theme-dark,
html[data-theme="light"] .theme-light {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.login-theme {
  position: fixed;
  top: 24px;
  right: 24px;
}

button,
.actions button,
.form button,
.logout-btn {
  font-size: 17px !important;
  line-height: 1.2 !important;
  padding: 15px 22px !important;
}

.form button {
  width: 100%;
}

.logout-btn {
  min-height: 48px;
}

.side h2 {
  margin-bottom: 24px !important;
}

.side input {
  margin-top: 2px !important;
}

.field::after,
input::after {
  display: none !important;
  content: none !important;
}

input, textarea {
  border-bottom: 1px solid var(--border) !important;
}

@media (max-width: 900px) {
  .top-logo-box {
    width: 220px !important;
  }
  .top-logo-box img {
    max-width: 220px !important;
  }
  .auth-logo-box {
    width: 360px !important;
    height: 140px !important;
  }
  .auth-logo-box img {
    max-height: 130px !important;
  }
  .theme-option b {
    display: none;
  }
}


/* === HOTFIX V4.1: LOGO E TEMA === */
.logo-box,
.auth-logo-box,
.top-logo-box {
  overflow: visible !important;
}

.logo-box img,
.auth-logo-box img,
.top-logo-box img {
  display: block !important;
  object-fit: contain !important;
  object-position: center !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  filter: none !important;
}

.auth-logo-box {
  width: 100% !important;
  height: auto !important;
  margin: 0 auto 34px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.auth-logo-box img {
  width: 310px !important;
  max-width: 86% !important;
  height: auto !important;
  max-height: none !important;
}

.top-logo-box {
  width: auto !important;
  height: 64px !important;
  display: flex !important;
  align-items: center !important;
}

.top-logo-box img {
  width: 170px !important;
  max-width: 170px !important;
  height: auto !important;
  max-height: 56px !important;
}

.login-theme {
  position: fixed !important;
  top: 22px !important;
  right: 28px !important;
  left: auto !important;
  z-index: 50 !important;
}

.theme-switch {
  cursor: pointer !important;
  user-select: none !important;
  background: rgba(17, 24, 39, 0.88) !important;
}

html[data-theme="light"] .theme-switch {
  background: #ffffff !important;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 18% 0%, rgba(103, 61, 230, .14), transparent 32%),
    radial-gradient(circle at 88% 20%, rgba(139, 92, 246, .10), transparent 26%),
    #090d14 !important;
  color: #f9fafb !important;
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 18% 0%, rgba(103, 61, 230, .09), transparent 32%),
    radial-gradient(circle at 88% 20%, rgba(139, 92, 246, .06), transparent 26%),
    #f4f5f7 !important;
  color: #111827 !important;
}

@media (max-width: 640px) {
  .auth-logo-box img {
    width: 240px !important;
  }

  .top-logo-box img {
    width: 135px !important;
    max-width: 135px !important;
  }
}
