@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@400;600;700&display=swap');

:root {
  --bg: #f6efe6;
  --bg-deep: #efe2d2;
  --panel: #ffffff;
  --ink: #1f1a15;
  --muted: #6b5f55;
  --accent: #e85d04;
  --accent-soft: #ffb15c;
  --line: rgba(31, 26, 21, 0.12);
  --shadow: 0 20px 50px rgba(31, 26, 21, 0.12);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body.page {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff2df 0%, var(--bg) 45%)
    fixed;
  position: relative;
  overflow-x: hidden;
  animation: fadeIn 0.6s ease-out;
}

.bg-orbit {
  position: absolute;
  inset: -30% auto auto -20%;
  width: 70vmax;
  height: 70vmax;
  background: radial-gradient(circle, rgba(232, 93, 4, 0.22), transparent 60%);
  filter: blur(10px);
  z-index: 0;
  pointer-events: none;
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px;
  gap: 16px;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}

.nav {
  display: flex;
  gap: 16px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.nav a:hover {
  color: var(--ink);
}

.content {
  position: relative;
  z-index: 1;
  padding: 0 48px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.footer {
  position: relative;
  z-index: 1;
  padding: 16px 48px 32px;
  color: var(--muted);
  font-size: 0.85rem;
}

.messages {
  display: grid;
  gap: 12px;
}

.message {
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff0df;
  border: 1px solid rgba(232, 93, 4, 0.3);
  color: #6f2f00;
  font-weight: 600;
}

.card {
  background: var(--panel);
  border-radius: 20px;
  padding: 32px;
  max-width: 520px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(31, 26, 21, 0.08);
  animation: rise 0.6s ease-out;
}

.card.wide {
  max-width: 760px;
}

.card.full {
  max-width: 100%;
  width: 100%;
}

.card-header.space-between {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.card-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.card-header p {
  margin: 0;
  color: var(--muted);
}

.card-header .note {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.form.grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

label span {
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: #fffaf4;
}

input:focus,
select:focus {
  outline: 2px solid rgba(232, 93, 4, 0.4);
  border-color: transparent;
}

label.full {
  grid-column: 1 / -1;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  grid-column: 1 / -1;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  align-items: center;
}

.actions.right {
  margin-left: auto;
  justify-content: flex-end;
  justify-self: end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(31, 26, 21, 0.18);
}

.button.tiny {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.button:disabled,
.button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 12px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(31, 26, 21, 0.12);
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
  min-width: 160px;
  padding: 6px;
  display: none;
  z-index: 5;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.menu-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  font-weight: 600;
}

.menu-item:hover {
  background: rgba(232, 93, 4, 0.12);
}

.card-foot {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  color: var(--muted);
}

.card-foot a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.assistant-hero {
  max-width: 100%;
  width: 100%;
  background: linear-gradient(120deg, #fff5eb, #fff);
}

.assistant-header {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.assistant-status {
  min-width: 260px;
  background: #fffaf4;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 12px 24px rgba(31, 26, 21, 0.08);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(31, 26, 21, 0.08);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
}

.chip.hot {
  background: rgba(232, 93, 4, 0.2);
  color: #7a2b00;
}

.chip.muted {
  background: rgba(31, 26, 21, 0.06);
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(31, 26, 21, 0.08);
  font-weight: 700;
  font-size: 0.95rem;
}

.badge.good {
  background: rgba(29, 145, 83, 0.16);
  color: #0f7a4d;
}

.badge.neutral {
  background: rgba(31, 26, 21, 0.06);
  color: var(--muted);
}

.step-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.step-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.step-card.active {
  border-color: rgba(232, 93, 4, 0.35);
  box-shadow: 0 10px 24px rgba(232, 93, 4, 0.16);
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.step-title {
  font-weight: 700;
}

.tenant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.tenant-info h2 {
  margin: 4px 0;
}

.tenant-switch {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.tenant-switch label {
  min-width: 260px;
}

.tenant-switch select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fffaf4;
}

.tab-bar {
  display: flex;
  gap: 10px;
  margin: 8px 0 4px;
  flex-wrap: wrap;
}

.tab-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-button.active {
  background: rgba(232, 93, 4, 0.12);
  color: #7a2b00;
  border-color: rgba(232, 93, 4, 0.35);
  box-shadow: 0 8px 20px rgba(232, 93, 4, 0.18);
}

.tab-panels {
  display: grid;
  gap: 18px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.mini-list {
  margin: 12px 0 0;
  padding: 0 0 0 14px;
  color: var(--muted);
}

.mini-list li {
  margin: 4px 0;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.dual-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: #fffaf4;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(31, 26, 21, 0.08);
}

.panel h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

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

.table-head,
.table-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.table-head {
  background: #fff3e3;
  font-weight: 700;
  color: #5a412b;
}

.table-row:nth-child(even) {
  background: #fffaf4;
}

.table-4 .table-head,
.table-4 .table-row {
  grid-template-columns: 1.6fr 1fr 0.8fr 1.4fr;
}

.table-5 .table-head,
.table-5 .table-row {
  grid-template-columns: 1.8fr 1fr 1.1fr 0.9fr 1.1fr;
}

.table-6 .table-head,
.table-6 .table-row {
  grid-template-columns: 1.6fr 1fr 1fr 1fr 0.7fr 0.9fr;
}

.table-6.users .table-head,
.table-6.users .table-row {
  grid-template-columns: 1.5fr 0.8fr 1fr 1fr 1fr 0.9fr 0.9fr 1.2fr 0.7fr;
}

.table-8 .table-head,
.table-8 .table-row {
  grid-template-columns: 1.2fr 1fr 1.2fr 0.8fr 0.8fr 0.7fr 1.4fr 0.8fr;
}

.table.web-users .mono {
  word-break: break-all;
}

.table.settings-table .table-head,
.table.settings-table .table-row {
  grid-template-columns: 1.2fr 0.9fr 0.8fr 1.2fr 1.2fr 0.5fr 0.5fr;
}

.table.settings-table .mono {
  word-break: break-word;
}

.table-empty {
  padding: 14px;
  color: var(--muted);
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px 0;
}

.cell-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 6px 10px;
  background: rgba(232, 93, 4, 0.12);
  border-radius: 999px;
  font-weight: 700;
}

.monitor {
  display: grid;
  gap: 20px;
}

.monitor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.monitor-header h1 {
  margin: 0;
  font-size: 2.1rem;
}

.monitor-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.monitor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 26, 21, 0.08);
}

.status[data-tone="active"] {
  background: rgba(232, 93, 4, 0.2);
  color: #7a2b00;
}

.status[data-tone="error"] {
  background: rgba(190, 36, 36, 0.2);
  color: #7a1b1b;
}

.monitor-frame {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(31, 26, 21, 0.1);
  background: #fff;
  min-height: 70vh;
  box-shadow: var(--shadow);
}

.monitor-frame iframe {
  width: 100%;
  height: 70vh;
  border: none;
}

.maximize-indicator {
  position: absolute;
  top: 24px;
  right: 24px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.maximize-indicator.active {
  opacity: 1;
  transform: scale(1);
  animation: pulse 1.2s ease-out;
}

.empty {
  padding: 40px;
  color: var(--muted);
}

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

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  width: min(1100px, 98vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  z-index: 1;
  border: 1px solid rgba(31, 26, 21, 0.08);
}

#userModal .modal-dialog {
  width: min(1200px, 98vw);
}

#userModal .form.grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

#userModal label input,
#userModal label select,
#userModal .input-with-button input {
  height: 48px;
}

#userModal .narrow-select {
  width: auto;
  min-width: 220px;
  max-width: 100%;
}

#userModal .input-with-button {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

#userModal .actions {
  flex-wrap: wrap;
  gap: 12px;
}

#newClientPreview {
  max-height: 52vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  margin: 0;
}

@keyframes rise {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(232, 93, 4, 0.5);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(232, 93, 4, 0);
  }
}

@media (max-width: 900px) {
  .site-header,
  .content,
  .footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .monitor-frame iframe {
    height: 60vh;
  }

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

  .card-header.space-between {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .monitor-actions {
    width: 100%;
    justify-content: space-between;
  }

  .button {
    width: 100%;
  }
}
