:root {
  --bg: #1B1B1B;
  --panel: #232323;
  --gold: #ECB74C;
  --gold-dark: #D4A03D;
  --text: #EAEAEA;
  --muted: rgba(234, 234, 234, .70);
  --muted-2: rgba(234, 234, 234, .55);
  --line: rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .10);
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --info: #60A5FA;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(1200px 520px at 60% -50%, rgba(236, 183, 76, .12), transparent 60%),
    radial-gradient(900px 380px at 10% -40%, rgba(255, 255, 255, .05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

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

input,
textarea,
select {
  font-size: 16px;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
}

.font-serif {
  font-family: "Jeju Myeongjo", Georgia, serif;
}

.hidden {
  display: none !important;
}

.status-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  transition: opacity .35s ease, visibility .35s ease;
}

.status-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: rgba(236, 183, 76, .85);
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.loader-ring {
  width: 64px;
  height: 64px;
  border: 2px solid rgba(236, 183, 76, .12);
  border-top-color: var(--gold);
  border-radius: 999px;
  animation: spin .9s linear infinite;
}

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

.card-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .04) 0%, rgba(255, 255, 255, .02) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .30);
  backdrop-filter: blur(10px);
}

.status-card {
  width: min(100%, 430px);
  padding: 36px;
  text-align: center;
}

.status-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--gold);
  background: rgba(236, 183, 76, .10);
  border: 1px solid rgba(236, 183, 76, .26);
}

.status-title {
  margin: 0 0 10px;
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 24px;
  color: #fff;
}

.status-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.status-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.app-layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 32px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 32px;
}

.sidebar {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  margin-bottom: 34px;
}

.brand img {
  height: 40px;
  width: auto;
}

.brand span {
  color: rgba(236, 183, 76, .92);
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 20px;
  letter-spacing: .02em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 16px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 14px;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .05);
}

.nav-link.is-active {
  color: var(--gold);
  background: rgba(236, 183, 76, .10);
  border-right: 2px solid var(--gold);
}

.side-user {
  margin-top: auto;
  padding: 16px;
}

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

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(236, 183, 76, .10);
  color: var(--gold);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user-name {
  margin: 0;
  font-size: 14px;
  color: #fff;
}

.side-user-role {
  margin: 2px 0 0;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

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

.mobile-menu-button {
  display: none;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  cursor: pointer;
  background: transparent;
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22C55E;
  box-shadow: 0 0 8px rgba(34, 197, 94, .60);
}

.page-title {
  margin: 0;
  color: #fff;
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: clamp(26px, 2.2vw, 36px);
  line-height: 1.14;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted-2);
  font-size: 13px;
  letter-spacing: .03em;
  line-height: 1.55;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.icon-button:hover {
  color: var(--gold);
  border-color: rgba(236, 183, 76, .35);
  background: rgba(255, 255, 255, .04);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.subnav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  scrollbar-width: none;
}

.subnav::-webkit-scrollbar {
  display: none;
}

.subnav-link {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.subnav-link:hover,
.subnav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.subnav-link.is-active {
  border-color: rgba(255, 255, 255, .08);
  cursor: default;
}

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

.metric-card {
  padding: 18px;
}

.metric-label {
  margin: 0 0 8px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.metric-value {
  margin: 0;
  color: #fff;
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 24px;
  line-height: 1.2;
}

.metric-note {
  margin: 8px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  align-items: end;
  gap: 14px;
  padding: 18px;
}

.filter-wide {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) minmax(170px, 1fr) auto;
}

.form-field label {
  display: block;
  margin: 0 0 8px 4px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 12px;
  outline: none;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: rgba(234, 234, 234, .34);
}

.form-select {
  appearance: none;
  padding-right: 42px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23EAEAEA' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
}

.form-select option {
  background: var(--panel);
  color: var(--text);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: rgba(255, 255, 255, .075);
  border-color: rgba(236, 183, 76, .52);
  box-shadow: 0 0 0 2px rgba(236, 183, 76, .10);
}

.field-error {
  border-color: rgba(239, 68, 68, .55) !important;
  background: rgba(239, 68, 68, .06) !important;
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.1;
  transition: filter .18s ease, background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.btn-gold {
  color: #fff;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
}

.btn-gold:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 4px 15px rgba(236, 183, 76, .28);
}

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

.btn-outline:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .18);
}

.btn-danger {
  color: #FCA5A5;
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .22);
}

.data-panel {
  min-height: 420px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.panel-title {
  margin: 0;
  color: #fff;
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 20px;
}

.panel-note {
  color: var(--muted-2);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  scrollbar-width: none;
}

.table-wrap::-webkit-scrollbar {
  display: none;
}

.data-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 14px 20px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, .02);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  vertical-align: middle;
  font-size: 14px;
}

.data-table tr {
  transition: background .18s ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, .025);
}

.cell-title {
  margin: 0 0 4px;
  color: #fff;
  font-weight: 500;
}

.cell-subtitle {
  margin: 0;
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: .04em;
}

.numeric {
  color: #fff;
  font-family: "Jeju Myeongjo", Georgia, serif;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-neutral {
  color: var(--muted);
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .10);
}

.badge-success {
  color: #34D399;
  background: rgba(16, 185, 129, .10);
  border-color: rgba(16, 185, 129, .28);
}

.badge-warning {
  color: #FBBF24;
  background: rgba(245, 158, 11, .10);
  border-color: rgba(245, 158, 11, .28);
}

.badge-info {
  color: #93C5FD;
  background: rgba(96, 165, 250, .10);
  border-color: rgba(96, 165, 250, .28);
}

.badge-danger {
  color: #FCA5A5;
  background: rgba(239, 68, 68, .10);
  border-color: rgba(239, 68, 68, .28);
}

.badge-gold {
  color: var(--gold);
  background: rgba(236, 183, 76, .10);
  border-color: rgba(236, 183, 76, .26);
}

.mobile-list {
  display: none;
}

.mobile-card {
  padding: 16px;
}

.mobile-card + .mobile-card {
  margin-top: 12px;
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}

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

.detail-card {
  padding: 20px;
}

.detail-card-wide {
  grid-column: span 2;
}

.detail-card-full {
  grid-column: 1 / -1;
}

.detail-label {
  margin: 0 0 8px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.detail-value {
  margin: 0;
  color: #fff;
  font-size: 15px;
  line-height: 1.55;
}

.detail-value.large {
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 28px;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(236, 183, 76, .45);
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 62vh;
  min-height: 360px;
  overflow-y: auto;
  padding: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(236, 183, 76, .35) transparent;
}

.message {
  width: min(72%, 680px);
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .04);
}

.message.mine {
  align-self: flex-end;
  background: rgba(236, 183, 76, .10);
  border-color: rgba(236, 183, 76, .22);
}

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

.message-author {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.message-time {
  color: var(--muted-2);
  font-size: 11px;
}

.message-body {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}

.form-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.state-box {
  display: flex;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  padding: 44px 24px;
  text-align: center;
}

.state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  background: rgba(255, 255, 255, .05);
  border-radius: 999px;
}

.state-title {
  margin: 0 0 8px;
  color: #fff;
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 20px;
}

.state-text {
  max-width: 430px;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}

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

.page-number {
  min-width: 34px;
  text-align: center;
  color: #fff;
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  color: #fff;
  background: rgba(35, 35, 35, .94);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .35);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

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

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.mobile-menu-bg {
  position: absolute;
  inset: 0;
  background: rgba(27, 27, 27, .82);
  backdrop-filter: blur(8px);
}

.mobile-menu-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(82vw, 330px);
  padding: 28px;
  background: var(--panel);
  box-shadow: 24px 0 50px rgba(0, 0, 0, .36);
  overflow-y: auto;
}

.mobile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  color: var(--gold);
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 20px;
}

.mobile-menu-close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: transparent;
  cursor: pointer;
}

.mobile-menu-panel .nav-link {
  min-height: 48px;
  font-size: 16px;
}

.footer {
  margin-top: 22px;
  padding: 28px 0 10px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  color: rgba(234, 234, 234, .40);
  font-size: 10px;
  letter-spacing: .22em;
  text-align: center;
  text-transform: uppercase;
}

.fade-in {
  animation: fadeIn .36s cubic-bezier(.16, 1, .3, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.skeleton {
  min-height: 18px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .03) 25%, rgba(255, 255, 255, .08) 50%, rgba(255, 255, 255, .03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (max-width: 1180px) {
  .app-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    padding: 22px;
  }

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

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

  .filters .btn {
    width: 100%;
  }

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

@media (max-width: 920px) {
  .app-layout {
    display: block;
    padding: 18px 16px 28px;
  }

  .sidebar {
    display: none;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions .profile-button {
    display: none;
  }

  .summary-grid,
  .filters,
  .filter-wide,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-card-wide {
    grid-column: auto;
  }

  .table-wrap {
    display: none;
  }

  .mobile-list {
    display: block;
    padding: 0 0 4px;
  }

  .data-panel {
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .data-panel .panel-head,
  .data-panel .pagination {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .04) 0%, rgba(255, 255, 255, .02) 100%);
    border-radius: var(--radius);
    margin-bottom: 12px;
  }

  .message {
    width: 92%;
  }

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

@media (max-width: 560px) {
  .topbar {
    gap: 12px;
  }

  .top-actions {
    gap: 8px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .page-title {
    font-size: 25px;
  }

  .filters {
    padding: 14px;
  }

  .panel-head,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .pager-buttons {
    justify-content: center;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn,
  .status-actions .btn {
    width: 100%;
  }
}
