:root {
  --bg-dark: #040404;
  --bg-darker: #000000;
  --card-bg: rgba(8, 8, 8, 0.82);
  --card-bg-2: rgba(18, 18, 18, 0.75);
  --text: #fafafa;
  --text-soft: #cfcfcf;
  --orange-1: #ff8a00;
  --orange-2: #ff6400;
  --orange-3: #ffbb6a;
  --orange-4: #ff9f1a;
  --danger: #ff6d6d;
  --ok: #79dfa1;
  --warning: #ffd27a;
  --border: rgba(255, 255, 255, 0.14);
  --focus: rgba(255, 138, 0, 0.65);
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at -10% -15%, rgba(255, 122, 0, 0.30) 0%, rgba(255, 122, 0, 0) 62%),
    radial-gradient(900px 460px at 104% 115%, rgba(255, 98, 0, 0.24) 0%, rgba(255, 98, 0, 0) 62%),
    radial-gradient(560px 320px at 50% 98%, rgba(255, 166, 47, 0.10) 0%, rgba(255, 166, 47, 0) 65%),
    linear-gradient(145deg, var(--bg-darker) 0%, #080808 52%, var(--bg-dark) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 42px);
  mask-image: radial-gradient(circle at center, black 52%, transparent 95%);
  opacity: 0.36;
}

body::after {
  background: conic-gradient(from 0deg at 50% 50%, rgba(255, 112, 0, 0.20), rgba(255, 140, 40, 0), rgba(255, 112, 0, 0.20));
  filter: blur(110px);
  opacity: 0.3;
  animation: aura 12s linear infinite;
}

.page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3.5vw, 48px);
}

.hidden {
  display: none !important;
}

.card {
  position: relative;
  isolation: isolate;
  width: min(100%, 580px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    linear-gradient(170deg, var(--card-bg-2) 0%, var(--card-bg) 48%, rgba(8, 8, 8, 0.88) 100%);
  backdrop-filter: blur(9px);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3.2vw, 34px);
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 24px;
  z-index: -1;
  background: linear-gradient(125deg, rgba(255, 187, 106, 0.52) 0%, rgba(255, 128, 0, 0.15) 38%, rgba(255, 96, 0, 0.48) 100%);
  filter: blur(0.6px);
}

.card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.auth-card {
  width: min(100%, 560px);
}

.panel-card {
  width: min(100%, 1180px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.logo {
  width: clamp(42px, 8vw, 60px);
  height: clamp(42px, 8vw, 60px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(255, 128, 0, 0.28);
}

.kicker {
  margin: 0 0 3px;
  font-size: 0.79rem;
  letter-spacing: 0.14em;
  color: var(--orange-3);
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.32rem, 2.9vw, 1.95rem);
  line-height: 1.06;
  text-wrap: balance;
}

.subtitle {
  margin: -6px 0 12px;
  color: var(--text-soft);
  font-size: 0.93rem;
}

.form {
  display: grid;
  gap: 14px;
}

.field-group {
  display: grid;
  gap: 8px;
}

label {
  font-size: 0.93rem;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}

input,
select,
button {
  width: 100%;
  border-radius: 13px;
  font: inherit;
}

input,
select {
  border: 1px solid var(--border);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.02) 100%);
  color: var(--text);
  padding: 13px 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background-color 140ms ease;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

input:hover,
select:hover {
  border-color: rgba(255, 177, 92, 0.45);
}

select option {
  color: #131313;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--orange-1);
  box-shadow: 0 0 0 3px var(--focus), 0 0 28px rgba(255, 128, 0, 0.16);
  transform: translateY(-1px);
}

button {
  border: 0;
  cursor: pointer;
  color: #161616;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 14px 16px;
  background:
    linear-gradient(130deg, var(--orange-3) 0%, var(--orange-4) 36%, var(--orange-1) 64%, var(--orange-2) 100%);
  background-size: 160% 160%;
  transition: transform 140ms ease, filter 160ms ease, opacity 140ms ease, box-shadow 160ms ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  box-shadow: 0 14px 28px rgba(255, 119, 0, 0.35);
}

#btn-login {
  margin-top: 8px;
}

button:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  background-position: right center;
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.62;
  cursor: wait;
  box-shadow: none;
}

.btn-danger {
  color: #fff5f5;
  background: linear-gradient(125deg, #ff6d6d 0%, #ff4848 60%, #d82525 100%);
  box-shadow: 0 14px 28px rgba(210, 28, 28, 0.34);
}

.btn-danger:hover {
  filter: brightness(1.02);
}

.session-row {
  margin: -6px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.session-line {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost {
  width: auto;
  margin-top: 0;
  padding: 9px 12px;
  font-size: 0.85rem;
  color: var(--orange-3);
  background: rgba(255, 140, 26, 0.1);
  border: 1px solid rgba(255, 140, 26, 0.25);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(255, 140, 26, 0.18);
  filter: none;
}

.create-user-block {
  margin-bottom: 14px;
}

.create-user-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.create-user-form .field-group {
  gap: 6px;
}

#btn-create-user {
  margin-top: 0;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
  font-size: 0.88rem;
}

.checkbox-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--orange-2);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 440px) 1fr;
  gap: 14px;
  align-items: end;
}

.panel-meta {
  margin: 0;
  text-align: right;
  font-size: 0.9rem;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(92vw, 360px);
  pointer-events: none;
}

.toast {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(160deg, rgba(16, 16, 16, 0.97) 0%, rgba(10, 10, 10, 0.97) 100%);
  color: var(--text);
  padding: 12px 14px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
  font-size: 0.9rem;
  line-height: 1.3;
  transform: translateY(10px);
  opacity: 0;
  animation: toast-in 180ms ease forwards;
  pointer-events: auto;
}

.toast-success {
  border-color: rgba(121, 223, 161, 0.54);
}

.toast-warning {
  border-color: rgba(255, 210, 122, 0.54);
}

.toast-error {
  border-color: rgba(255, 109, 109, 0.58);
}

.toast.is-leaving {
  animation: toast-out 180ms ease forwards;
}

.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(22, 22, 22, 0.3);
  border-top-color: rgba(22, 22, 22, 1);
  border-radius: 50%;
  display: none;
  animation: spin 0.8s linear infinite;
}

.is-loading .btn-loader {
  display: inline-block;
}

.is-loading .btn-text {
  opacity: 0.96;
}

.status {
  margin: 14px 0 0;
  min-height: 22px;
  font-size: 0.92rem;
  color: var(--text-soft);
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--ok);
}

.status.warning {
  color: var(--warning);
}

.funcionarios-list {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.empty-state {
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
}

.funcionario-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px;
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.015) 100%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
}

.funcionario-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.funcionario-name {
  margin: 0;
  font-size: 1.03rem;
}

.funcionario-email {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.87rem;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.73rem;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
}

.badge.admin {
  color: #19120a;
  border-color: rgba(255, 184, 112, 0.45);
  background: linear-gradient(120deg, var(--orange-3), var(--orange-1));
  font-weight: 700;
}

.funcionario-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 12px;
}

.side-actions {
  display: grid;
  gap: 12px;
}

.action-block {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.action-title {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.inline-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-group button {
  width: auto;
  padding: 10px 12px;
  font-size: 0.82rem;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.system-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.system-name {
  margin: 0 0 8px;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.toggle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.toggle-line:last-child {
  margin-bottom: 0;
}

.toggle-line.compact {
  margin-bottom: 0;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.24);
  transition: all 140ms ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f3f3f3;
  top: 2px;
  left: 2px;
  transition: all 140ms ease;
}

.switch input:checked + .slider {
  background: linear-gradient(120deg, var(--orange-3), var(--orange-2));
  border-color: rgba(255, 187, 106, 0.65);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: #191512;
}

.switch input:disabled + .slider {
  opacity: 0.45;
}

.permissions-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.permissions-actions.start {
  justify-content: flex-start;
}

.permissions-actions button {
  width: auto;
  padding: 9px 12px;
  font-size: 0.82rem;
}

.password-note {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--text-soft);
  opacity: 0.82;
}

.danger-block {
  border-color: rgba(255, 109, 109, 0.36);
  background: linear-gradient(180deg, rgba(255, 109, 109, 0.10) 0%, rgba(255, 109, 109, 0.04) 100%);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes aura {
  0% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(180deg) scale(1.05);
  }

  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 980px) {
  .create-user-form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .panel-meta {
    text-align: left;
  }

  .funcionario-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .card {
    border-radius: 20px;
  }

  .card::before {
    border-radius: 20px;
  }

  .card::after {
    border-radius: 18px;
  }

  .card-header {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .session-actions {
    width: 100%;
  }

  .session-actions .btn-ghost {
    flex: 1;
  }

  .create-user-form {
    grid-template-columns: 1fr;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 10px;
  }

  .inline-group {
    grid-template-columns: 1fr;
  }

  .inline-group button {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .page {
    padding: 10px;
  }

  .card {
    padding: 16px;
  }

  label {
    font-size: 0.88rem;
  }

  input,
  select,
  button {
    font-size: 0.93rem;
  }
}
