:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e2e8f0;
    --text: #172033;
    --muted: #667085;
    --primary: #0b6bcb;
    --primary-dark: #07559f;
    --info: #6f42c1;
    --success: #16794b;
    --warning: #a25b00;
    --danger: #b42318;
    --shadow: 0 10px 30px rgba(15, 23, 42, .06);
    --radius: 14px;
    --sidebar: 248px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code, .mono, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.topbar { height: 70px; background: #0d1b2a; color: white; display: flex; align-items: center; padding: 0 22px; position: sticky; top: 0; z-index: 50; box-shadow: 0 3px 16px rgba(0,0,0,.15); }
.brand { display: flex; align-items: center; gap: 11px; min-width: calc(var(--sidebar) - 22px); }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: #a8b6c7; font-size: 11px; margin-top: 1px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; background: linear-gradient(135deg, #1aa160, #0b6bcb); color: white; font-weight: 800; letter-spacing: -.5px; }
.brand-mark-large { width: 48px; height: 48px; font-size: 17px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.token-indicator { display: inline-flex; align-items: center; gap: 7px; color: #c7d2df; font-size: 12px; }
.token-indicator .dot { width: 8px; height: 8px; border-radius: 50%; background: #e67e22; }
.token-indicator.connected .dot { background: #34c77b; box-shadow: 0 0 0 3px rgba(52,199,123,.13); }
.user-chip { display: flex; align-items: center; gap: 8px; color: #e6edf5; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; background: #25364a; border: 1px solid #344a63; border-radius: 50%; font-weight: 700; }
.mobile-menu-button { display: none; margin-right: 10px; }
.icon-button { border: 0; background: transparent; color: inherit; font-size: 22px; }
.app-layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - 70px); }
.sidebar { background: #102235; color: #cbd7e5; padding: 20px 14px; position: sticky; top: 70px; height: calc(100vh - 70px); display: flex; flex-direction: column; }
.sidebar-nav { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 9px; color: #becbd9; font-weight: 600; }
.nav-link:hover { background: #17304a; color: #fff; }
.nav-link.active { background: #1d4264; color: white; box-shadow: inset 3px 0 0 #34c77b; }
.nav-icon { width: 22px; text-align: center; font-size: 18px; }
.sidebar-note { margin-top: auto; border: 1px solid #27425c; border-radius: 10px; padding: 12px; background: #0c1d2e; font-size: 12px; }
.sidebar-note strong { color: white; }
.sidebar-note p { margin: 5px 0 0; color: #96a9bc; }
.main-content { padding: 28px; min-width: 0; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin: 2px 0 5px; font-size: 28px; letter-spacing: -.6px; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: var(--primary) !important; font-size: 11px; font-weight: 800; }
.heading-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 17px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: linear-gradient(180deg, #fff, #fbfdff); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.kpi-card span { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.kpi-card strong { display: block; font-size: 26px; margin: 8px 0 2px; letter-spacing: -.5px; }
.kpi-card small { color: #8491a3; }
.button { border: 1px solid transparent; border-radius: 8px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 700; transition: .15s ease; white-space: nowrap; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: #edf4fb; color: #0a559c; border-color: #cfe1f4; }
.button-info { background: #f1edfb; color: #5f35a5; border-color: #ded2f5; }
.button-ghost { background: transparent; border-color: var(--border); color: inherit; }
.topbar .button-ghost { border-color: #3a4c60; color: #eaf1f8; }
.button-danger-ghost { background: #fff7f6; color: var(--danger); border-color: #f3cbc6; }
.button-small { padding: 6px 9px; font-size: 12px; }
.button-block { width: 100%; }
.text-link { color: var(--primary); font-weight: 700; }
.text-link.strong { font-weight: 800; }
.alert { padding: 12px 14px; border-radius: 9px; border: 1px solid; margin-bottom: 16px; }
.alert ul { margin: 7px 0 0 18px; padding: 0; }
.alert-success { background: #effaf4; color: #12603d; border-color: #bde7d1; }
.alert-danger { background: #fff3f1; color: #912018; border-color: #f4c5c0; }
.alert-warning { background: #fff9ec; color: #81500d; border-color: #f0d9aa; }
.alert-info { background: #f3f0fb; color: #52308c; border-color: #d9cef1; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800; }
.status-large { padding: 7px 12px; font-size: 12px; }
.status-success { background: #eaf8f1; color: var(--success); }
.status-danger { background: #fff0ee; color: var(--danger); }
.status-warning { background: #fff6e6; color: var(--warning); }
.status-info { background: #f0ebfb; color: var(--info); }
.status-neutral { background: #eef2f6; color: #536274; }
.code-chip { display: inline-block; background: #eef5ff; color: #155eaa; border: 1px solid #d1e4fb; border-radius: 6px; padding: 2px 6px; font-family: monospace; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-size: 12px; font-weight: 750; color: #364153; }
.field small { color: var(--muted); font-size: 11px; }
.field em { color: var(--danger); font-style: normal; }
.field-full { grid-column: 1 / -1; }
.field-span-2 { grid-column: span 2; }
.field input, .field select, .field textarea, .search-field input { width: 100%; border: 1px solid #cfd8e4; border-radius: 8px; padding: 9px 10px; background: white; color: var(--text); outline: none; }
.field textarea { resize: vertical; min-height: 74px; }
.field input:focus, .field select:focus, .field textarea:focus, .search-field input:focus { border-color: #5b9bd7; box-shadow: 0 0 0 3px rgba(11,107,203,.10); }
.field input[readonly] { background: #f6f8fb; color: #5b6879; }
.field-required-highlight input { border-color: #d8a63e; background: #fffdf7; }
.party-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.party-card { border: 1px solid var(--border); border-radius: 11px; padding: 16px; background: #fbfcfe; }
.party-card h3 { margin: 0 0 14px; font-size: 15px; }
.items-stack { display: grid; gap: 14px; }
.item-card { border: 1px solid #dbe4ee; border-radius: 11px; padding: 16px; background: #fcfdff; }
.item-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.item-card-header h3 { margin: 0; font-size: 15px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 12px; background: rgba(255,255,255,.95); border: 1px solid var(--border); padding: 12px; border-radius: 11px; box-shadow: 0 9px 30px rgba(17,24,39,.13); z-index: 20; backdrop-filter: blur(8px); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.data-table th { text-align: left; background: #f6f8fb; color: #536174; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 11px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfdff; }
.empty-cell { text-align: center; color: var(--muted); padding: 30px !important; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.inline-form { display: inline-flex; margin: 0; }
.table-toolbar { display: flex; align-items: end; gap: 15px; margin-bottom: 14px; }
.search-field { display: grid; gap: 5px; width: min(420px, 100%); }
.search-field span { font-size: 12px; font-weight: 700; }
.result-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 14px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow); }
.summary-strip > div { background: white; padding: 16px; }
.summary-strip span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.summary-strip strong { font-size: 15px; word-break: break-word; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.detail-list { margin: 0; display: grid; }
.detail-list > div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1f5; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { margin: 0; font-weight: 600; word-break: break-word; }
.api-actions-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(90deg, #f8fbff, #fff); }
.api-actions-panel h2 { margin: 0 0 4px; font-size: 17px; }
.api-actions-panel p { margin: 0; color: var(--muted); }
.wide-table { min-width: 1900px; }
.code-panel pre { margin: 0; background: #0e1a26; color: #d9e7f5; border-radius: 10px; padding: 16px; overflow: auto; max-height: 520px; font-size: 12px; line-height: 1.55; }
.response-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.token-form { display: flex; align-items: end; gap: 12px; }
.grow { flex: 1; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 15% 20%, rgba(28,132,213,.12), transparent 32%), radial-gradient(circle at 85% 80%, rgba(25,158,92,.12), transparent 30%), #eef3f8; }
.auth-card { width: min(430px, 100%); background: white; border: 1px solid var(--border); box-shadow: 0 25px 70px rgba(31,48,68,.14); border-radius: 18px; padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.auth-brand h1 { margin: 0; font-size: 21px; }
.auth-brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.stack-form { display: grid; gap: 14px; }
.auth-footnote { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 16px; color: var(--muted); font-size: 12px; }
.auth-footnote strong { color: var(--text); }
.auth-footnote p { margin: 3px 0 0; }
@media (max-width: 1180px) {
    .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid .panel:last-child { grid-column: 1 / -1; }
    .summary-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .mobile-menu-button { display: inline-block; }
    .brand { min-width: 0; }
    .token-indicator, .user-chip span:not(.avatar) { display: none; }
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 45; top: 70px; left: 0; width: var(--sidebar); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 12px 0 30px rgba(0,0,0,.15); }
    .sidebar.open { transform: translateX(0); }
    .main-content { padding: 20px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .party-grid, .response-grid, .detail-grid { grid-template-columns: 1fr; }
    .detail-grid .panel:last-child { grid-column: auto; }
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
    .api-actions-panel { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 640px) {
    .topbar { padding: 0 12px; }
    .topbar .brand small { display: none; }
    .topbar-actions { gap: 6px; }
    .main-content { padding: 16px 12px 90px; }
    .page-heading { flex-direction: column; }
    .page-heading h1 { font-size: 24px; }
    .panel { padding: 15px; border-radius: 11px; }
    .form-grid, .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: auto; }
    .summary-strip { grid-template-columns: 1fr; }
    .token-form { align-items: stretch; flex-direction: column; }
    .form-actions { justify-content: stretch; }
    .form-actions .button { flex: 1 1 auto; }
    .sticky-actions { bottom: 6px; }
}
