:root {
  color-scheme: dark;

  /* Paleta inspirada no fato do mascote */
  --bg: #020617;
  --bg-elevated: #050816;
  --bg-card: #050816;
  --border-subtle: #1f2937;

  --accent: #fbbf24;          /* dourado / mel */
  --accent-soft: rgba(251,191,36,0.18);

  --danger: #ef4444;

  --text-main: #f9fafb;
  --text-muted: #9ca3af;

  --chip-bg: #020617;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #1e293b, var(--bg) 45%, #000 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  background: linear-gradient(to right, rgba(15,23,42,0.95), rgba(15,23,42,0.7));
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mascot-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid var(--accent);
  box-shadow:
    0 0 0 2px rgba(15,23,42,0.9),
    0 0 18px rgba(251,191,36,0.7);
  background: #0b1120;
}

header .right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.pill {
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--border-subtle);
  background: #020617;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(251,191,36,0.9);
}

.pill.small {
  font-size: 11px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #111827;
  box-shadow: 0 8px 24px rgba(251,191,36,0.4);
}

.btn-primary:hover:enabled {
  background: #facc15;
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(251,191,36,0.55);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover:enabled {
  border-color: var(--accent);
  background: rgba(15,23,42,0.9);
}

.btn-danger {
  background: var(--danger);
  color: #fee2e2;
}

.btn-danger:hover:enabled {
  filter: brightness(1.05);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
  transform: none;
}

main {
  flex: 1;
  display: flex;
  padding: 18px;
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid #111827;
  box-shadow: 0 18px 60px rgba(0,0,0,0.65);
  padding: 18px;
}

.login-wrapper {
  max-width: 750px;
  margin: 40px auto;
  width: 100%;
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.login-form-col {
  border-right: 1px dashed #1f2937;
  padding-right: 12px;
}

.login-mascot-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
}

.login-mascot-bubble {
  background: radial-gradient(circle at top, rgba(251,191,36,0.22), rgba(15,23,42,0.95));
  border-radius: 18px;
  padding: 14px 14px 10px;
  border: 1px solid rgba(148,163,184,0.5);
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,0.75);
}

.login-mascot-bubble img {
  width: 140px;
  max-width: 100%;
  display: block;
  margin: 0 auto 8px;
}

.login-mascot-bubble p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.login-mascot-bubble strong {
  color: var(--accent);
}

@media (max-width: 800px) {
  .login-card {
    grid-template-columns: 1fr;
  }
  .login-form-col {
    border-right: none;
    border-bottom: 1px dashed #1f2937;
    padding-right: 0;
    padding-bottom: 14px;
    margin-bottom: 10px;
  }
  .login-mascot-col {
    padding-left: 0;
  }
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

label {
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
  color: var(--text-muted);
}

input, textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #020617;
  color: var(--text-main);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(251,191,36,0.4);
}

textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 200px;
}

.field {
  margin-bottom: 10px;
}

.muted {
  font-size: 12px;
  color: var(--text-muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > * {
  flex: 1;
}

.alert {
  font-size: 12px;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  margin-bottom: 10px;
}

.alert-info {
  border-color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  color: #bfdbfe;
}

.alert-error {
  border-color: #b91c1c;
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.alert-success {
  border-color: #15803d;
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
}

/* Layout app */

.sidebar {
  width: 220px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.nav-item {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 7px 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.nav-item span.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.content-header h2 {
  margin: 0;
  font-size: 17px;
}

.chip {
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #020617;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid #111827;
  text-align: left;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

tr:hover td {
  background: rgba(15, 23, 42, 0.9);
}

.badge {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: #bbf7d0;
}

.badge-muted {
  background: #020617;
  color: var(--text-muted);
  border: 1px solid #1f2937;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
}

.badge-dot.off {
  background: #ef4444;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.toolbar label {
  margin-bottom: 0;
}

.toolbar input[type="checkbox"] {
  width: auto;
}

.hidden {
  display: none !important;
}

/* Overlay / modal para formulário de medicamentos */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
}

.overlay-panel {
  position: relative;
  z-index: 41;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.overlay-header h3 {
  margin: 0;
  font-size: 16px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  border-radius: 999px;
}

.icon-btn:hover {
  background: #111827;
  color: var(--text-main);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

@media (max-width: 900px) {
  main {
    flex-direction: column;
  }
  .sidebar {
    flex-direction: row;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
