:root {
  color-scheme: dark;
  --bg: #101113;
  --panel: #191a1f;
  --panel-soft: #202128;
  --text: #f3f1fb;
  --muted: #aaa7b8;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #7f77dd;
  --accent-strong: #948dfa;
  --selected-table: #3f82ff;
  --booked: #7a3a3a;
  --danger: #c45a5a;
  --available: #343640;
  --success: #78b889;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.login-panel,
.panel {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: 8px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
}

.stack {
  display: grid;
  gap: 16px;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 92px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.avatar {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  padding: 0;
}

.user-menu {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  width: 190px;
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
}

.user-dropdown span {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: capitalize;
}

.page {
  display: none;
  gap: 16px;
}

.page.active {
  display: grid;
}

.panel {
  padding: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 0.5px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

select {
  appearance: none;
}

select.usage-select-confirmed {
  border-color: var(--success);
  box-shadow: inset 4px 0 0 var(--success);
}

select.usage-select-missing {
  border-color: var(--danger);
  box-shadow: inset 4px 0 0 var(--danger);
}

input:disabled {
  opacity: 0.82;
}

.primary,
.ghost,
.danger {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: white;
  font-weight: 750;
}

.primary {
  background: var(--accent);
}

.ghost {
  background: var(--panel-soft);
  color: var(--text);
  border: 0.5px solid var(--line);
}

.danger {
  background: var(--danger);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.selector-shell {
  min-width: 0;
}

.floor-plan {
  overflow: hidden;
  border-radius: 8px;
  border: 0.5px solid var(--line);
  background: #131418;
}

.floor-plan svg {
  display: block;
  width: 100%;
  height: auto;
}

.table-shape {
  fill: var(--available);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
  transition: fill 160ms ease, transform 160ms ease;
}

.table-button {
  cursor: pointer;
}

.table-button.selected .table-shape {
  fill: var(--selected-table);
}

.table-button.booked {
  cursor: not-allowed;
}

.table-button.booked .table-shape {
  fill: var(--booked);
}

.table-text {
  fill: white;
  font-weight: 800;
  pointer-events: none;
}

.table-detail {
  fill: white;
  font-size: 9px;
  font-weight: 700;
  pointer-events: none;
}

.list {
  display: grid;
  gap: 10px;
}

.list-empty {
  margin: 0;
  color: var(--muted);
}

.row,
.stock-card,
.note-row {
  background: var(--panel-soft);
  border: 0.5px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.row {
  display: grid;
  gap: 6px;
}

.reservation-row {
  border-left: 4px solid transparent;
}

.reservation-row.usage-confirmed,
.reservation-row.reservation-upcoming {
  border-left-color: var(--success);
  background: rgba(120, 184, 137, 0.12);
}

.reservation-row.usage-missing,
.reservation-row.reservation-past {
  border-left-color: var(--danger);
  background: rgba(196, 90, 90, 0.12);
}

.row-title,
.card-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.muted {
  color: var(--muted);
}

.reservation-note {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.35;
}

.reservation-summary {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.reservation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(127, 119, 221, 0.16);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: capitalize;
}

.badge.confirmed {
  background: rgba(120, 184, 137, 0.16);
  color: var(--success);
}

.badge.missing {
  background: rgba(196, 90, 90, 0.16);
  color: #ff9b9b;
}

.stock-grid {
  display: grid;
  gap: 18px;
}

.category-group {
  display: grid;
  gap: 10px;
}

.category-group h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 850;
  text-transform: uppercase;
}

.category-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.usage-list .category-items {
  grid-template-columns: 1fr;
}

.stock-card {
  display: grid;
  gap: 12px;
}

.quantity {
  font-size: 2rem;
  font-weight: 850;
}

.quantity.low {
  color: #ff8e8e;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.usage-form,
.usage-list,
.admin-form {
  display: grid;
  gap: 18px;
}

.usage-row {
  grid-template-columns: 1fr 92px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--panel-soft);
  border: 0.5px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.usage-row span {
  display: grid;
  gap: 3px;
}

.usage-row small {
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-stock-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: var(--panel-soft);
  border: 0.5px solid var(--line);
  border-radius: 8px;
}

.admin-stock-row span {
  display: grid;
  gap: 3px;
}

.admin-stock-row small {
  color: var(--muted);
  font-size: 0.8rem;
}

.adjust-controls {
  display: grid;
  grid-template-columns: 1fr 44px 44px;
  gap: 8px;
}

.adjust-controls button {
  padding: 0;
  font-size: 1.2rem;
}

.log-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--panel-soft);
  border: 0.5px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
}

.log-row span {
  display: grid;
  gap: 3px;
}

.log-row small {
  color: var(--muted);
  font-size: 0.8rem;
}

.log-row b {
  white-space: nowrap;
}

.log-create {
  border-left-color: var(--accent);
  background: rgba(127, 119, 221, 0.12);
}

.log-add {
  border-left-color: var(--success);
  background: rgba(120, 184, 137, 0.12);
}

.log-use {
  border-left-color: var(--danger);
  background: rgba(196, 90, 90, 0.12);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(520px, calc(100% - 28px));
  padding: 6px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 26, 31, 0.94);
  backdrop-filter: blur(14px);
}

.nav-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.nav-button.active {
  background: var(--accent);
  color: white;
}

.error {
  min-height: 20px;
  margin: 0;
  color: #ff9b9b;
}

.success-message {
  min-height: 20px;
  margin: 0;
  color: var(--success);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
}

@media (min-width: 760px) {
  .app-shell {
    padding: 26px 24px 98px;
  }

  .page.active {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    align-items: start;
  }

  #usage-page.active {
    grid-template-columns: 1fr;
  }

  #create-item-page.active,
  #manage-stock-page.active,
  #registro-page.active,
  #users-page.active {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-stock-row {
    grid-template-columns: 1fr 210px;
    align-items: center;
  }

}
