@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
  --bg: #09090b;
  --sidebar: #0d0d10;
  --surface: #131316;
  --surface-2: #19191e;
  --surface-3: #222229;
  --border: #2a2a31;
  --text: #f5f3f8;
  --muted: #94919b;
  --accent: #b99aff;
  --accent-strong: #a67cff;
  --accent-soft: rgba(185, 154, 255, .12);
  --danger: #ff788a;
  --success: #64d9a3;
  --warning: #f1c76b;
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font: 14px/1.5 Inter, sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand { font-family: Manrope, sans-serif; }
h1 { margin-bottom: 7px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
small { color: var(--muted); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 246px; flex-direction: column; border-right: 1px solid var(--border); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 12px; min-height: 78px; padding: 17px 22px; }
.brand-mark { display: grid; width: 39px; height: 39px; place-items: center; border: 1px solid rgba(185,154,255,.45); border-radius: 12px; color: #17131c; background: linear-gradient(145deg, #d5c2ff, #9f77fc); box-shadow: 0 0 28px rgba(185,154,255,.2); font-size: 19px; font-weight: 800; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-size: 18px; letter-spacing: -.04em; }
.brand small { margin-top: 4px; color: #76727e; font: 10px/1 Inter, sans-serif; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: flex; flex: 1; flex-direction: column; gap: 5px; padding: 17px 13px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; color: #a9a6af; font-weight: 500; transition: .18s ease; }
.nav a span { width: 20px; color: #7f7b87; font-size: 18px; text-align: center; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { border-color: rgba(185,154,255,.16); color: #e9ddff; background: var(--accent-soft); }
.nav a.active span { color: var(--accent); }
.nav-label { margin: 20px 12px 6px; color: #5f5c64; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin: 13px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.avatar { display: inline-grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: #1a1423; background: var(--accent); font-style: normal; font-weight: 800; }
.avatar.large { width: 52px; height: 52px; border-radius: 15px; font-size: 20px; }
.user-copy { min-width: 0; flex: 1; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy small { margin-top: 2px; font-size: 10px; }
.icon-button, .menu-button { border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.workspace { width: calc(100% - 246px); margin-left: 246px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; min-height: 78px; align-items: center; justify-content: space-between; padding: 13px 32px; border-bottom: 1px solid var(--border); background: rgba(9,9,11,.86); backdrop-filter: blur(18px); }
.topbar > div strong, .topbar > div span { display: block; }
.topbar > div strong { font-family: Manrope, sans-serif; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px var(--success); }
.menu-button { display: none; font-size: 21px; }
.main-content { width: min(1500px, 100%); margin: auto; padding: 31px 34px 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.page-heading p { margin: 0; color: var(--muted); }
.title-line { display: flex; align-items: center; gap: 14px; }
.title-line h1 { margin: 3px 0 6px; }
.back-link, .clear-link, .panel-head a { color: var(--accent); font-size: 12px; font-weight: 600; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--surface-3); cursor: pointer; font-weight: 600; transition: transform .15s, border-color .15s, background .15s; }
.button:hover { transform: translateY(-1px); border-color: #4b4653; }
.button.primary { border-color: #b99aff; color: #17121f; background: linear-gradient(135deg, #cbb5ff, #a67cff); box-shadow: 0 8px 25px rgba(166,124,255,.16); }
.button.compact { min-height: 38px; padding: 8px 14px; font-size: 12px; }
.notice { margin-bottom: 20px; padding: 12px 15px; border: 1px solid var(--border); border-radius: 10px; }
.notice.success { border-color: rgba(100,217,163,.3); color: #aaf1ce; background: rgba(100,217,163,.08); }
.notice.error { border-color: rgba(255,120,138,.3); color: #ffadb8; background: rgba(255,120,138,.08); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card, .panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.stat-card { display: flex; min-height: 126px; align-items: center; gap: 15px; padding: 19px; }
.stat-card div { display: flex; flex-direction: column; }
.stat-card small { font-size: 11px; }
.stat-card strong { font: 800 29px/1.2 Manrope, sans-serif; letter-spacing: -.04em; }
.stat-card em { color: #6f6c75; font-size: 10px; font-style: normal; }
.stat-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; font-size: 20px; }
.stat-icon.lilac { color: var(--accent); background: var(--accent-soft); }
.stat-icon.gray { color: #bbb7c2; background: #24242a; }
.stat-icon.rose { color: var(--danger); background: rgba(255,120,138,.1); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(250px, .8fr); gap: 18px; }
.panel { min-width: 0; padding: 19px; }
.panel-head { display: flex; min-height: 43px; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.panel-head .eyebrow { display: block; margin-bottom: 5px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; border-bottom: 1px solid var(--border); color: #74717a; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid #24242a; color: #c4c1c9; font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(185,154,255,.025); }
td > small, td > a + small { display: block; margin-top: 3px; font-size: 9px; }
.primary-link, .accent { color: var(--accent); font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.wrap { overflow-wrap: anywhere; white-space: normal; }
.badge { display: inline-flex; max-width: 210px; align-items: center; justify-content: center; padding: 4px 8px; border: 1px solid #38363e; border-radius: 20px; color: #bbb7c2; background: #222228; font-size: 9px; font-weight: 700; line-height: 1.2; text-align: center; }
.status-active, .status-confirmed, .status-succeeded, .status-approved, .status-broadcast { border-color: rgba(100,217,163,.22)!important; color: var(--success)!important; background: rgba(100,217,163,.08)!important; }
.status-disputed, .status-failed, .status-rejected, .status-cancelled { border-color: rgba(255,120,138,.22)!important; color: var(--danger)!important; background: rgba(255,120,138,.08)!important; }
.status-pending_approval, .status-pending_deposit, .status-completion_pending, .status-pending_confirmations, .status-processing, .status-requested, .status-detected, .status-broadcasting { border-color: rgba(241,199,107,.22)!important; color: var(--warning)!important; background: rgba(241,199,107,.08)!important; }
.status-frozen, .status-draft, .status-replaced, .status-completed { border-color: rgba(185,154,255,.22)!important; color: var(--accent)!important; background: var(--accent-soft)!important; }
.status-list { display: flex; flex-direction: column; gap: 6px; }
.status-list > div { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #24242a; color: #b1adb7; font-size: 11px; }
.status-list span { display: flex; align-items: center; gap: 9px; }
.dot { width: 7px; height: 7px; padding: 0; border-radius: 50%; background: currentColor!important; }
.volume { display: flex; flex-direction: column; margin-top: 18px; padding: 15px; border: 1px solid rgba(185,154,255,.12); border-radius: 11px; background: var(--accent-soft); }
.volume strong { margin-top: 4px; color: var(--accent); font: 700 20px Manrope, sans-serif; }
.filterbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.search { position: relative; min-width: 230px; flex: 1; }
.search > span { position: absolute; top: 9px; left: 13px; color: var(--muted); font-size: 18px; }
.search input { padding-left: 38px; }
input, select, textarea, .control { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; outline: 0; color: var(--text); background: #0e0e11; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus, .control:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(166,124,255,.1); }
select { width: auto; min-width: 170px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; min-height: 18px; accent-color: var(--accent-strong); }
.person { display: flex; align-items: center; gap: 10px; }
.person strong, .person small { display: block; }
.row-arrow { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--border); border-radius: 8px; color: var(--accent); background: var(--surface-2); }
.empty-cell { padding: 32px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding-top: 15px; color: var(--muted); font-size: 11px; }
.pagination div { display: flex; gap: 7px; }
.pagination a { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--border); border-radius: 8px; }
.details-grid { display: grid; grid-template-columns: minmax(270px, .75fr) minmax(0, 1.7fr); align-items: start; gap: 18px; }
.details-grid .wide { min-width: 0; }
.profile-card { align-self: start; }
.data-list { margin: 0; }
.data-list div { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px; padding: 11px 12px 11px 0; border-bottom: 1px solid #25252b; }
.data-list div:last-child { border-bottom: 0; }
.data-list dt { color: var(--muted); font-size: 11px; }
.data-list dd { min-width: 0; margin: 0; color: #d3d0d8; font-size: 11px; text-align: right; overflow-wrap: anywhere; }
.form-panel { max-width: 930px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px 16px; }
.form-grid label, .stack-form label, .login-form label { display: flex; min-width: 0; flex-direction: column; gap: 7px; color: #c5c1cc; font-size: 11px; font-weight: 600; }
.form-grid label > span i { color: var(--accent); font-style: normal; }
.form-grid .checkbox-row { flex-direction: row; align-items: center; }
.form-grid .checkbox-row > span { order: 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--border); }
.field-error { color: var(--danger)!important; }
.deal-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.deal-summary article { display: flex; flex-direction: column; gap: 3px; }
.deal-summary strong { overflow: hidden; font: 700 18px Manrope, sans-serif; text-overflow: ellipsis; }
.deal-summary a { color: var(--accent); font-size: 10px; }
.deal-summary span { color: var(--muted); font-size: 10px; }
.tabs { display: flex; gap: 3px; margin-bottom: 16px; padding: 4px; overflow-x: auto; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.tabs button { padding: 8px 13px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: #e7dcff; background: var(--accent-soft); }
.tabs b { margin-left: 4px; color: var(--accent); font-size: 9px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.subsection { margin-top: 19px; padding-top: 18px; border-top: 1px solid var(--border); }
.subsection h3 { font-size: 13px; }
.timeline-row, .action-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid #25252b; font-size: 11px; }
.timeline-row > i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(185,154,255,.35); }
.timeline-row > span:nth-child(2), .action-row > span:first-child { flex: 1; }
.timeline-row strong, .timeline-row small, .action-row strong, .action-row small { display: block; }
.timeline-row time, .action-row time { color: var(--muted); font-size: 9px; }
.chat-list { display: flex; flex-direction: column; gap: 10px; }
.chat-message { max-width: 76%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px 12px 12px 3px; background: var(--surface-2); }
.chat-message.role-seller { align-self: flex-end; border-color: rgba(185,154,255,.2); border-radius: 12px 12px 3px 12px; background: var(--accent-soft); }
.chat-message.role-bot, .chat-message.role-system { max-width: 86%; align-self: center; background: #101013; }
.chat-meta { display: flex; justify-content: space-between; gap: 30px; color: var(--accent); font-size: 10px; }
.chat-meta span { color: var(--muted); }
.chat-message p { margin: 7px 0 3px; color: #d0ccd4; font-size: 12px; }
.file-chip { display: inline-flex; margin-top: 7px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; color: var(--accent); font-size: 10px; }
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.readonly-value { display: block; min-height: 38px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #101013; color: #d0ccd4; font-size: 12px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.admin-card { display: flex; align-items: center; gap: 13px; }
.admin-card > div:nth-child(2) { min-width: 0; flex: 1; }
.admin-card h2 { margin-bottom: 3px; }
.admin-card p { overflow: hidden; margin-bottom: 10px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; }
.deal-action-options { display: flex; flex-direction: column; gap: 10px; }
.deal-action-option { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.deal-action-option summary { cursor: pointer; font-size: 12px; font-weight: 650; }
.deal-action-option[open] summary { margin-bottom: 12px; color: var(--accent); }
.action-help { margin-top: 12px; font-size: 11px; }
.version-list { display: flex; flex-direction: column; gap: 9px; }
.version-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.version-item summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; cursor: pointer; }
.version-item[open] > summary { margin-bottom: 14px; }
.version-title { color: var(--text); font-size: 12px; font-weight: 650; }
.version-item summary small { flex-basis: 100%; }
.version-content .data-list div { grid-template-columns: minmax(0, 25%) minmax(0, 1fr); }
.contract-copy { overflow-wrap: anywhere; white-space: normal; line-height: 1.7; }
.contract-list { margin: 0; padding-left: 18px; }
.contract-heading { margin-top: 18px; }
.explorer-link { display: block; margin-top: 4px; color: var(--accent); font-size: 10px; }
.settings-language-field { display: flex; flex-direction: column; gap: 9px; }
.field-label { color: #c4c1c9; font-size: 11px; font-weight: 600; }
.language-choices > div { display: flex; flex-wrap: wrap; gap: 14px; }
.language-choices label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.settings-record-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.settings-record-card { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.settings-record-card > div { min-height: 76px; }
.settings-record-card h2 { margin-bottom: 5px; font-size: 15px; }
.settings-record-card p { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.settings-record-value { max-width: 420px; overflow-wrap: anywhere; }
.settings-record-actions { white-space: nowrap; }
.settings-record-actions form { display: inline-block; margin-left: 5px; }
.danger-button { border-color: rgba(255,120,138,.3); color: var(--danger); }
.danger-button:hover { border-color: var(--danger); }
.audit-filterbar { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.audit-filterbar label { display: flex; flex-direction: column; gap: 5px; color: #c4c1c9; font-size: 10px; font-weight: 600; }
.audit-filterbar select { width: 100%; min-width: 0; }
.audit-filterbar .audit-search { grid-column: span 2; }
.audit-filterbar > .button { align-self: end; justify-self: start; }

.login-page { display: grid; min-height: 100vh; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 15%, #191421 0, #09090b 44%); }
.login-glow { position: fixed; width: 420px; height: 420px; border-radius: 50%; background: rgba(166,124,255,.07); filter: blur(80px); }
.glow-one { top: -220px; left: -120px; }.glow-two { right: -180px; bottom: -250px; }
.login-card { position: relative; z-index: 2; width: min(430px, calc(100% - 32px)); padding: 32px; border: 1px solid #302d35; border-radius: 20px; background: rgba(18,18,22,.91); box-shadow: 0 35px 100px rgba(0,0,0,.5); backdrop-filter: blur(18px); }
.login-brand { min-height: 0; padding: 0; }
.login-copy { margin: 38px 0 25px; }
.login-copy h1 { margin: 7px 0; }
.login-copy p { margin: 0; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .button { width: 100%; margin-top: 5px; }
.login-foot { margin: 22px 0 0; color: #615e66; font-size: 9px; letter-spacing: .09em; text-align: center; text-transform: uppercase; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .deal-summary { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-record-grid { grid-template-columns: 1fr; }
  .audit-filterbar { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-102%); box-shadow: 20px 0 60px rgba(0,0,0,.55); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .workspace { width: 100%; margin-left: 0; }
  .menu-button { display: block; }
  .topbar { justify-content: flex-start; gap: 15px; padding: 13px 18px; }
  .connection { margin-left: auto; }
  .main-content { padding: 24px 18px 45px; }
  .dashboard-grid, .details-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .stats-grid, .deal-summary, .admin-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .filterbar { align-items: stretch; flex-direction: column; }
  .filterbar select { width: 100%; }
  .audit-filterbar { grid-template-columns: 1fr; }
  .audit-filterbar .audit-search { grid-column: auto; }
  .connection { display: none; }
  .chat-message { max-width: 93%; }
}
