:root {
  --ink: #08111c;
  --ink-2: #101b29;
  --ink-3: #162436;
  --line: #d9dee6;
  --muted: #667282;
  --paper: #f6f3ec;
  --paper-2: #ffffff;
  --gold: #c9a46a;
  --gold-2: #f0d9ad;
  --silver: #d6dbe2;
  --teal: #5aa6a1;
  --teal-2: #dcefed;
  --rose: #c46f68;
  --green: #3f8d69;
  --warning: #b8873f;
  --shadow: 0 18px 60px rgba(8, 17, 28, 0.13);
  --radius: 8px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 164, 106, 0.2), transparent 34rem),
    linear-gradient(135deg, #f8f5ee 0%, #eef3f2 52%, #f9fbfc 100%);
  font-family: Arial, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--ink);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid rgba(240, 217, 173, 0.35);
  background: #0b1420;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
  letter-spacing: 0;
}

.brand span {
  color: rgba(255, 255, 255, 0.63);
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(240, 217, 173, 0.22);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--gold-2);
}

.sidebar-card {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(240, 217, 173, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-card span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
}

.sidebar-card strong {
  font-size: 0.88rem;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar h1,
.hero-copy h2,
.panel h3 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.55rem, 2.3vw, 2.4rem);
}

.topbar-actions,
.inline-controls,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.date-chip {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 700;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 15px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  color: #111;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  box-shadow: 0 10px 25px rgba(201, 164, 106, 0.25);
}

.secondary-button {
  color: var(--ink);
  background: var(--paper-2);
  border-color: var(--line);
}

.ghost-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.13);
  text-decoration: none;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.hero-panel,
.panel,
.stat-card {
  border: 1px solid rgba(8, 17, 28, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.hero-panel {
  overflow: hidden;
  min-height: 230px;
  color: #fff;
  background:
    linear-gradient(100deg, rgba(8, 17, 28, 0.98), rgba(16, 27, 41, 0.85) 54%, rgba(214, 219, 226, 0.2)),
    url("../assets/logo.png") center / cover no-repeat;
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 20px;
  min-height: 230px;
  align-items: center;
  padding: clamp(22px, 4vw, 42px);
  background: rgba(8, 17, 28, 0.55);
}

.hero-copy {
  max-width: 720px;
}

.hero-copy h2 {
  font-size: clamp(1.75rem, 4vw, 3.7rem);
  line-height: 1;
  max-width: 11ch;
}

.hero-copy p:not(.eyebrow) {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.6;
}

.hero-logo {
  justify-self: end;
  width: min(100%, 370px);
  padding: 10px;
}

.hero-logo img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid rgba(240, 217, 173, 0.25);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.28);
}

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

.stat-card {
  padding: 18px;
  display: grid;
  gap: 6px;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
}

.stat-card strong {
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  color: var(--ink);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel h3 {
  font-size: 1.12rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input[type="color"] {
  padding: 4px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 164, 106, 0.19);
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 12px;
}

.timeline-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  display: inline-block;
}

.legend-dot.available {
  background: var(--teal);
}

.legend-dot.reserved {
  background: var(--gold);
}

.legend-dot.done {
  background: var(--green);
}

.availability-map {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.availability-grid {
  min-width: 920px;
  display: grid;
  grid-template-columns: 170px repeat(var(--slots), minmax(64px, 1fr));
}

.grid-cell,
.grid-head,
.room-head {
  min-height: 48px;
  border-right: 1px solid #edf0f4;
  border-bottom: 1px solid #edf0f4;
}

.grid-head,
.room-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 44px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 800;
}

.room-head {
  left: 0;
  z-index: 3;
  justify-items: start;
  padding: 0 12px;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.room-label {
  position: sticky;
  left: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 8px 12px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid #edf0f4;
}

.room-label strong {
  font-size: 0.9rem;
}

.room-label small {
  color: var(--muted);
}

.slot-cell {
  min-height: 58px;
  padding: 5px;
  background: #fff;
}

.slot-button {
  width: 100%;
  height: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: var(--teal-2);
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 800;
}

.slot-button:hover {
  border-color: var(--teal);
}

.slot-button.busy {
  background: rgba(201, 164, 106, 0.22);
  border-color: rgba(201, 164, 106, 0.32);
}

.slot-button.done {
  background: rgba(63, 141, 105, 0.15);
  border-color: rgba(63, 141, 105, 0.28);
}

.slot-button.cancelled {
  color: var(--muted);
  background: #f4f5f7;
  text-decoration: line-through;
}

.upcoming-list,
.schedule-list,
.registry-list {
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  background: #f8fafb;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.mini-card,
.schedule-card,
.registry-item,
.week-day {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.mini-card,
.schedule-card,
.registry-item {
  padding: 12px;
}

.mini-card {
  display: grid;
  gap: 5px;
}

.mini-card strong,
.schedule-card strong,
.registry-item strong {
  color: var(--ink);
}

.mini-card span,
.schedule-card span,
.registry-item span,
.mini-card small,
.schedule-card small,
.registry-item small {
  color: var(--muted);
}

.status-pill,
.room-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 25px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--teal-2);
  color: #265c58;
}

.status-pill.s-agendado {
  color: #765324;
  background: rgba(201, 164, 106, 0.22);
}

.status-pill.s-em-atendimento {
  color: #265c58;
  background: var(--teal-2);
}

.status-pill.s-concluido {
  color: #276044;
  background: rgba(63, 141, 105, 0.16);
}

.status-pill.s-cancelado {
  color: #7a4340;
  background: rgba(196, 111, 104, 0.15);
}

.week-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.week-day {
  min-height: 190px;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.week-day header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.week-day header strong {
  font-size: 0.9rem;
}

.week-day header span {
  color: var(--muted);
  font-size: 0.78rem;
}

.room-availability {
  padding: 8px;
  border-left: 3px solid var(--gold);
  background: #fbfcfd;
  border-radius: 6px;
}

.room-availability strong {
  display: block;
  font-size: 0.82rem;
}

.room-availability small {
  color: var(--muted);
  line-height: 1.45;
}

.form-grid,
.filters-grid {
  display: grid;
  gap: 12px;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.form-grid.compact {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.wide-field {
  grid-column: 1 / -1;
}

.forms-stack {
  display: grid;
  gap: 18px;
}

.registry-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.item-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  min-height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 800;
}

.icon-button.danger {
  color: #893f3b;
  background: rgba(196, 111, 104, 0.11);
}

.schedule-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.schedule-card h4 {
  margin: 0 0 5px;
  font-size: 0.98rem;
}

.schedule-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.filters-grid {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  align-items: end;
  margin-bottom: 14px;
}

.history-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfd;
}

td {
  color: var(--ink);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 13px 15px;
  color: #fff;
  background: var(--ink);
  border: 1px solid rgba(240, 217, 173, 0.25);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .form-grid.compact,
  .filters-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
  }

  .nav-item span:last-child {
    display: none;
  }

  .sidebar-card {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .inline-controls {
    width: 100%;
  }

  .topbar-actions > *,
  .inline-controls > * {
    flex: 1;
  }

  .hero-content {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 20px;
  }

  .hero-panel {
    min-height: 0;
  }

  .hero-copy h2 {
    max-width: 100%;
    font-size: 1.85rem;
    line-height: 1.08;
  }

  .hero-logo {
    justify-self: start;
    width: min(100%, 280px);
  }
}

@media (max-width: 620px) {
  .stats-grid,
  .form-grid,
  .form-grid.compact,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .hero-logo {
    display: none;
  }

  .panel-header,
  .schedule-card,
  .registry-item {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .item-actions {
    justify-content: flex-start;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }
}
