/* Smartchain Logistics Connector — Dashboard */
:root {
    --navy: #1C2545;
    --navy2: #141c38;
    --green: #45B84C;
    --green-dk: #35933A;
    --green-lt: #EBF7EC;
    --bg: #F5F7FA;
    --card: #ffffff;
    --border: #E0E4EC;
    --text: #1C2545;
    --muted: #6B7394;
    --orange: #F59E0B;
    --orange-lt: #FEF3DC;
    --red: #EF4444;
    --red-lt: #FDE8E8;
    --blue: #3B82F6;
    --blue-lt: #E6EFFE;
    --grey-lt: #EEF0F4;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1428; --card: #182040; --border: #2b3560; --text: #E7EAF4; --muted: #9AA3C4;
        --green-lt: #183a26; --orange-lt: #3d2f12; --red-lt: #401c22; --blue-lt: #1b2a4d; --grey-lt: #222b4d;
    }
    .btn.primary, .light .fix { background: var(--green-dk); border-color: var(--green-dk); }
    .btn.primary:hover { background: var(--green); border-color: var(--green); }
    .btn:hover { border-color: var(--muted); }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--green-dk); }
code, .mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; word-break: break-all; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 6px; }
h1 small { font-size: 15px; font-weight: 400; }
.muted { color: var(--muted); }
.small, small { font-size: 12px; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy2); color: #fff; display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; margin-bottom: 14px; }
.brand small { display: block; font-size: 11px; opacity: .7; font-weight: 400; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 800; }
.company { background: rgba(255,255,255,.07); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.company-name { display: block; font-weight: 700; }
.company-did { display: block; font-size: 10.5px; opacity: .6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Consolas, monospace; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item { color: rgba(255,255,255,.82); text-decoration: none; padding: 8px 10px; border-radius: 7px; display: flex; justify-content: space-between; align-items: center; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(69,184,76,.22); color: #fff; font-weight: 600; }
.nav-section { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .5; margin: 14px 10px 4px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 10px; font-size: 12px; }
.sidebar-foot .user small { opacity: .6; margin-left: 4px; }
.sidebar-foot .user-link { color: #fff; text-decoration: none; }
.sidebar-foot .user-link:hover { text-decoration: underline; }
.sidebar-foot .link-button { color: rgba(255,255,255,.75); padding: 4px 0; }
.oss { opacity: .45; margin-top: 8px; font-size: 11px; }
.content { padding: 28px 32px; min-width: 0; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }

/* Panels & grid */
.panel { background: var(--card); border: 1.5px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.panel.alert { border-color: var(--red); background: var(--red-lt); }
.panel.request { border-color: var(--orange); }
.danger-zone { border-color: var(--red); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2.compose { grid-template-columns: 380px 1fr; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-top: 8px; }
.row > .field { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Traffic lights */
.lights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.light { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1.5px solid var(--border); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
.light strong { display: block; }
.light small { color: var(--muted); }
.light .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--muted); }
.light.green .dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-lt); }
.light.orange .dot { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-lt); }
.light.red .dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-lt); }
.light.red { border-color: var(--red); }
.light .fix { margin-left: auto; background: var(--navy); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.todo { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.todo small { margin-left: auto; color: var(--muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 10px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; background: var(--grey-lt); color: var(--muted); white-space: nowrap; }
.badge.green { background: var(--green-lt); color: var(--green-dk); }
.badge.orange { background: var(--orange-lt); color: #B26B00; }
.badge.red { background: var(--red-lt); color: var(--red); }
.badge.blue { background: var(--blue-lt); color: var(--blue); }
.nav-item .badge { padding: 1px 7px; }
.right { margin-left: auto; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1.5px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table .summary { color: var(--muted); max-width: 360px; }
.table .actions { white-space: nowrap; text-align: right; }
.table .dir { color: var(--muted); white-space: nowrap; }
.faded { opacity: .5; }
.error-text { display: block; color: var(--red); }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--card); border: 1.5px dashed var(--border); border-radius: 12px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.req { color: var(--red); }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--border); border-radius: 7px; padding: 7px 9px; min-width: 0; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; }
input.invalid { border-color: var(--red); background: var(--red-lt); }
textarea.json { width: 100%; font-family: Consolas, monospace; font-size: 12.5px; }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
fieldset.nested { border: 1.5px solid var(--border); border-radius: 9px; padding: 8px 12px 2px; margin: 0 0 10px; }
fieldset.nested legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.schema-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.schema-form fieldset.nested { grid-column: 1 / -1; }
.schema-form .schema-form { grid-template-columns: 1fr 1fr; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 7px; padding: 8px 14px; border: 1.5px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; margin: 4px 4px 4px 0; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--green-dk); border-color: var(--green-dk); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-button { background: none; border: none; color: var(--green-dk); cursor: pointer; padding: 0; font: inherit; }

/* Callouts */
.callout { border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; background: var(--blue-lt); border: 1px solid var(--blue); }
.callout.green { background: var(--green-lt); border-color: var(--green); }
.callout.orange { background: var(--orange-lt); border-color: var(--orange); }
.callout.red { background: var(--red-lt); border-color: var(--red); }
code.big { font-size: 14px; display: inline-block; margin-top: 6px; }

/* Data */
.data-view { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 4px 14px; margin: 6px 0 10px; }
.data-view dt { color: var(--muted); font-size: 12.5px; }
.data-view dd { margin: 0; }

/* Conversation */
.conversation { display: grid; grid-template-columns: 1fr 420px; gap: 18px; align-items: start; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.msg { background: var(--card); border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; max-width: 92%; }
.msg.in { align-self: flex-start; border-left: 4px solid var(--blue); }
.msg.out { align-self: flex-end; border-right: 4px solid var(--green); }
.msg header { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.msg header small { color: var(--muted); }
.msg.chat .chat-text { margin: 4px 0 0; white-space: pre-wrap; font-size: 14.5px; }
.sig { color: var(--green-dk); font-size: 11.5px; font-weight: 600; }
.action-panel { position: sticky; top: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters .search { flex: 1; min-width: 260px; }
details.help { margin-top: 12px; }
details.help pre { background: var(--grey-lt); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }

/* Wire view */
.checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.check-card { background: var(--card); border: 1.5px solid var(--border); border-left-width: 5px; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.check-card span { color: var(--muted); font-size: 12.5px; }
.check-card.green { border-left-color: var(--green); }
.check-card.orange { border-left-color: var(--orange); }
.check-card.red { border-left-color: var(--red); }
pre.wire, pre.json { background: var(--grey-lt); border-radius: 8px; padding: 12px 14px; font-family: Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; max-height: 560px; overflow: auto; }
.wire-part.h, .legend.h { color: #d4389b; }
.wire-part.p, .legend.p { color: #7c4dff; }
.wire-part.s, .legend.s { color: #00a3c4; }
@media (prefers-color-scheme: dark) { .wire-part.h, .legend.h { color: #ff7ac6; } .wire-part.p, .legend.p { color: #b49cff; } .wire-part.s, .legend.s { color: #4fd8f0; } }
.legend { font-family: Consolas, monospace; font-weight: 600; }
.wire-link { font-size: 11px; color: var(--muted); text-decoration: none; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; }
.wire-link:hover { color: var(--text); border-color: var(--muted); }

/* Auth pages */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy2), var(--navy)); padding: 16px; }
.auth-card { background: var(--card); border-radius: 14px; padding: 28px; width: 100%; max-width: 400px; }
.auth-brand { color: var(--text); margin-bottom: 18px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--orange-lt); padding: 10px 16px; z-index: 1000; }

@media (max-width: 1000px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .lights, .grid-2, .grid-2.compose, .conversation { grid-template-columns: 1fr; }
    .schema-form { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}

/* Clubs */
.club-card { display: flex; gap: 10px; align-items: flex-start; }
.club-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; border: 1.5px solid var(--border); background: var(--card); }
.club-logo.placeholder { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--green-dk)); border: none; }
.badge.club { background: #F3E8FF; color: #7A3DB8; }
.pre-wrap { white-space: pre-wrap; }
.conditions { max-height: 260px; overflow: auto; border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; background: var(--bg); }
.form-question { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.data-view.compact { margin: 0; gap: 2px 10px; font-size: 12.5px; }
@media (prefers-color-scheme: dark) { .badge.club { background: #3a2758; color: #d7b8ff; } }

/* Process map (BPMN, vertical swimlanes) */
.process-map svg { width: 100%; height: auto; display: block; font-family: inherit; }
.pm-lane { fill: var(--card); stroke: var(--border); stroke-width: 1; }
.pm-lane.alt { fill: var(--bg); }
.pm-lane-title { font-size: 11.5px; font-weight: 700; fill: var(--text); }
.pm-lane-sub { font-size: 11px; font-weight: 600; fill: var(--text); }
.pm-flow { fill: none; stroke: var(--muted); stroke-width: 1.3; }
.pm-flow.done { stroke: var(--green-dk); stroke-width: 2; }
.pm-arrowhead { fill: var(--muted); }
.pm-arrowhead.done { fill: var(--green-dk); }
.pm-flow-label { font-size: 9.5px; fill: var(--muted); font-style: italic; }
.pm-shape { fill: var(--card); stroke: var(--muted); stroke-width: 1.4; }
.pm-node.start .pm-shape { stroke-width: 1.4; }
.pm-node .pm-shape.end { stroke-width: 3.2; }
.pm-node.external .pm-shape { stroke-dasharray: 5 3; fill: var(--grey-lt); }
.pm-node.done .pm-shape { fill: var(--green-lt); stroke: var(--green-dk); }
.pm-node.next .pm-shape { stroke: var(--blue); stroke-dasharray: 4 3; stroke-width: 2; }
.pm-node.selected .pm-shape { stroke: var(--orange); stroke-width: 3.2; stroke-dasharray: none; }
.pm-node.clickable { cursor: pointer; }
.pm-label { font-size: 10.5px; fill: var(--text); }
.pm-label.small { font-size: 9.5px; }
.pm-gateway-x { font-size: 15px; font-weight: 700; fill: var(--muted); }
.pm-marker { font-size: 13px; fill: var(--orange); }
.pm-note { font-size: 9.5px; fill: var(--muted); font-style: italic; }
.pm-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.pm-legend .sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: -1px; border: 1.5px solid var(--muted); background: var(--card); }
.pm-legend .sw.done { background: var(--green-lt); border-color: var(--green-dk); }
.pm-legend .sw.selected { border: 2.5px solid var(--orange); }
.pm-legend .sw.next { border: 1.5px dashed var(--blue); }
.pm-legend .sw.external { border-style: dashed; background: var(--grey-lt); }
.compose-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 620px); gap: 18px; align-items: start; }
.compose-layout > .stack-col { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.process-panel { position: sticky; top: 16px; }
.conversation.with-map { grid-template-columns: minmax(0, 1fr) minmax(0, 580px); }
.side-col { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.msg.selected { box-shadow: 0 0 0 2.5px var(--orange); }
.msg { cursor: pointer; }
.msg .step-tag { font-size: 11px; color: var(--muted); }
@media (max-width: 1100px) { .compose-layout, .conversation.with-map { grid-template-columns: 1fr; } .process-panel { position: static; } }
.compose-layout.no-map { grid-template-columns: 1fr; }
.message-type { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 8px 10px; margin-bottom: 10px; border: 1.5px dashed var(--border); border-radius: 8px; }
.message-type code { color: var(--text); }
.pm-verb { font-family: Consolas, "Cascadia Mono", monospace; font-size: 8.5px; fill: var(--muted); }
.pm-owner { font-size: 9.5px; fill: var(--muted); font-style: italic; }
.pm-node .pm-shape.final { stroke-width: 3; }
.pm-legend .sw.final { border-width: 3px; }
