:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #1a1a2e;
  --muted: rgba(26, 26, 46, 0.55);
  --line: #eaeae5;
  --brand: #1a1a2e;
  --brand-strong: #101020;
  --gold: #e8b84b;
  --danger: #e74c3c;
  --warning: #e8a838;
  --success: #2ecc71;
  --accent: #6c63ff;
  --info: #3498db;
  --shadow: 0 18px 50px rgba(26, 26, 46, 0.12);
}

* {
  box-sizing: border-box;
}

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(245, 245, 240, 0.92)),
    radial-gradient(circle at top right, rgba(232, 184, 75, 0.18), transparent 34%),
    var(--bg);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.home-view {
  min-height: 100vh;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 5vw, 72px);
  border-bottom: 1px solid rgba(234, 234, 229, 0.82);
  background: rgba(245, 245, 240, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.site-brand strong {
  display: block;
  font-size: 15px;
}

.site-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.site-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  padding: 0 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.site-links a:hover {
  background: rgba(255, 255, 255, 0.72);
}

.compact-btn {
  min-height: 38px;
}

.home-main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(34px, 6vw, 70px) 0 72px;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
}

.hero-copy h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(40px, 6.6vw, 78px);
  line-height: 1;
  letter-spacing: 0;
}

.hero-lead {
  max-width: 640px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-actions a,
.hero-actions button {
  min-height: 44px;
  text-decoration: none;
}

.app-preview {
  position: relative;
  justify-self: center;
  width: min(100%, 430px);
  aspect-ratio: 4 / 5;
  border: 1px solid rgba(234, 234, 229, 0.9);
  border-radius: 24px;
  background: var(--brand);
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(26, 26, 46, 0.22);
}

.app-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: inherit;
  pointer-events: none;
}

.app-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(34px, 6vw, 56px);
}

.home-info-grid article {
  display: grid;
  align-content: start;
  min-height: 180px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 30px rgba(26, 26, 46, 0.06);
}

.home-info-grid i {
  width: 24px;
  height: 24px;
  color: var(--gold);
}

.home-info-grid h2 {
  margin: 18px 0 8px;
  font-size: 18px;
  line-height: 1.2;
}

.home-info-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.back-home-btn {
  justify-self: flex-start;
  margin-bottom: 4px;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 48px;
  align-items: center;
  min-height: 100vh;
  padding: 48px clamp(20px, 6vw, 92px);
}

.login-brand {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  max-width: 640px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: var(--brand);
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(26, 26, 46, 0.22);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-brand h1,
.topbar h1,
.login-card h2,
.dialog-header h2 {
  margin: 0;
  line-height: 1.05;
}

.login-brand h1 {
  font-size: clamp(44px, 7vw, 86px);
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.login-card label,
.field-group label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.18);
}

.primary-btn,
.ghost-btn,
.danger-btn,
.soft-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
}

.primary-btn {
  background: var(--brand);
  color: var(--gold);
}

.primary-btn:hover {
  background: var(--brand-strong);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled,
.soft-btn:disabled,
.icon-btn:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.ghost-btn,
.soft-btn,
.icon-btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

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

.icon-btn {
  width: 42px;
  padding: 0;
}

.primary-btn svg,
.ghost-btn svg,
.danger-btn svg,
.soft-btn svg,
.icon-btn svg,
.nav-item svg {
  width: 18px;
  height: 18px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-view {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: var(--brand);
  color: #fff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  padding: 0 12px;
  text-align: left;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  background: var(--gold);
  color: var(--ink);
}

.nav-badge {
  display: none;
  min-width: 24px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  padding: 3px 8px;
  font-size: 12px;
  text-align: center;
}

.nav-badge.show {
  display: inline-block;
}

.sidebar-logout {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

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

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

.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(380px, 42vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
}

.search-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-wrap input {
  min-height: 38px;
  border: 0;
  padding: 0;
}

.search-wrap input:focus {
  box-shadow: none;
}

.content-section {
  display: grid;
  gap: 18px;
}

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

.stat-card,
.panel,
.list-card,
.item-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: 0 8px 24px rgba(26, 26, 46, 0.06);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.panel-note {
  margin: 6px 0 0;
  font-size: 13px;
}

.panel-body {
  padding: 16px;
}

.grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.item-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.item-card.clickable:hover {
  border-color: rgba(232, 184, 75, 0.65);
  transform: translateY(-1px);
}

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

.avatar,
.thumb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: rgba(232, 184, 75, 0.14);
  color: var(--brand);
  font-weight: 900;
  overflow: hidden;
}

.thumb {
  width: 72px;
  height: 72px;
}

.avatar img,
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  background: #f5f5f0;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.chip.success {
  background: rgba(46, 204, 113, 0.12);
  color: #168247;
}

.chip.warning {
  background: rgba(232, 184, 75, 0.2);
  color: var(--warning);
}

.chip.danger {
  background: rgba(194, 65, 59, 0.12);
  color: var(--danger);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-form {
  display: grid;
  gap: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.switch-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f8f5;
  padding: 0 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.switch-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--gold);
}

.inline-fields {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(220px, 1fr);
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.detail-dialog {
  width: min(920px, calc(100vw - 28px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: transparent;
}

.detail-dialog::backdrop {
  background: rgba(31, 42, 36, 0.45);
}

.dialog-shell {
  max-height: min(820px, calc(100vh - 28px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-body {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 18px;
}

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

.detail-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f8f5;
}

.detail-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.media-tile {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f8f5;
}

.media-tile img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.media-tile a {
  display: block;
  padding: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.chat-thread {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #f5f5f0;
}

.message-bubble {
  max-width: 78%;
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 4px 14px rgba(26, 26, 46, 0.08);
}

.message-bubble.admin-side {
  justify-self: end;
  background: rgba(232, 184, 75, 0.16);
}

.message-bubble small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: none;
  max-width: 360px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  gap: 12px;
  background: rgba(245, 245, 240, 0.86);
  color: var(--muted);
  font-weight: 800;
}

.loading-overlay.show {
  display: grid;
}

.loader {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(232, 184, 75, 0.22);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .site-nav {
    align-items: flex-start;
  }

  .hero-section,
  .home-info-grid,
  .login-view,
  .dashboard-view {
    grid-template-columns: 1fr;
  }

  .app-preview {
    justify-self: start;
    width: min(100%, 420px);
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

  .topbar-actions,
  .search-wrap {
    width: 100%;
  }

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

@media (max-width: 620px) {
  .site-nav {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .site-links {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .site-links a,
  .site-links button {
    justify-content: center;
    width: 100%;
  }

  .home-main {
    width: min(100% - 28px, 1180px);
    padding: 28px 0 54px;
  }

  .hero-copy h1 {
    font-size: 38px;
    line-height: 1.04;
  }

  .hero-lead {
    font-size: 15px;
    line-height: 1.6;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions a,
  .hero-actions button {
    width: 100%;
  }

  .app-preview {
    width: 100%;
    border-radius: 18px;
  }

  .home-info-grid article {
    min-height: 0;
    padding: 18px;
  }

  .login-view,
  .main-panel,
  .sidebar {
    padding: 16px;
  }

  .login-brand {
    flex-direction: column;
  }

  .nav-list,
  .stats-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 42px;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .message-bubble {
    max-width: 100%;
  }
}
