:root {
    --navy: #123b5d;
    --navy-deep: #0b2a44;
    --blue: #176fa6;
    --cyan: #29a8b8;
    --ink: #1c2d3b;
    --muted: #667887;
    --line: #dce5eb;
    --surface: #ffffff;
    --canvas: #f3f6f8;
    --danger: #b42332;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(41,168,184,.35); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 72px; flex: 0 0 72px; display: flex; align-items: center; gap: 14px;
    padding: 0 28px; color: white; background: linear-gradient(105deg, var(--navy-deep), var(--navy));
    box-shadow: 0 2px 12px rgba(9,31,49,.2); position: relative; z-index: 10;
}
.brand-mark { width: 38px; height: 38px; display: grid; align-content: center; gap: 4px; padding: 7px; border: 1px solid rgba(255,255,255,.3); border-radius: 9px; }
.brand-mark span { height: 3px; background: #fff; border-radius: 3px; }
.brand-mark span:nth-child(2) { width: 72%; background: #51c3cf; }
.brand-mark span:nth-child(3) { width: 88%; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 17px; letter-spacing: .01em; }
.brand-copy span { margin-top: 3px; font-size: 12px; color: #bdd1df; }
.connection { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 30px; background: rgba(255,255,255,.08); color: #d8e7ef; font-size: 12px; }
.connection i { width: 8px; height: 8px; background: #5ad08b; border-radius: 50%; box-shadow: 0 0 0 4px rgba(90,208,139,.14); }

.inbox-layout { height: calc(100vh - 72px); min-height: 620px; display: grid; grid-template-columns: minmax(320px, 390px) minmax(0, 1fr); }
.case-pane { background: #edf2f5; border-right: 1px solid #cfdbe2; display: flex; flex-direction: column; min-height: 0; }
.pane-heading { display: flex; align-items: center; justify-content: space-between; padding: 26px 24px 17px; }
.eyebrow { display: block; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.pane-heading h1 { margin: 0; font-size: 27px; line-height: 1; color: var(--navy-deep); letter-spacing: -.02em; }
.count-badge { min-width: 32px; height: 32px; display: grid; place-items: center; background: var(--navy); color: white; border-radius: 50%; font-size: 13px; font-weight: 700; }
.case-toolbar { height: 45px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(207,219,226,.7); border-bottom: 1px solid #d5e0e6; color: var(--muted); font-size: 12px; }
.text-button { border: 0; padding: 5px 0; background: transparent; cursor: pointer; font-size: 12px; font-weight: 650; }
.text-button.danger { color: var(--danger); }
.text-button:disabled, button:disabled { opacity: .45; cursor: default; }
.case-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.case-card { position: relative; width: 100%; border: 1px solid transparent; border-radius: 9px; padding: 15px 16px 13px 18px; margin-bottom: 8px; background: rgba(255,255,255,.7); color: inherit; text-align: left; cursor: pointer; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.case-card:hover { transform: translateY(-1px); background: #fff; border-color: #c9d7df; box-shadow: 0 4px 13px rgba(24,58,80,.07); }
.case-card.selected { background: #fff; border-color: #9eb8c9; box-shadow: 0 5px 18px rgba(24,58,80,.12); }
.case-accent { position: absolute; inset: 0 auto 0 0; width: 4px; background: transparent; }
.case-card.selected .case-accent { background: var(--cyan); }
.case-card.new-case { animation: newArrival 1.2s ease-out; }
@keyframes newArrival { 0% { background: #cdeff1; transform: translateY(-7px); } 100% { background: #fff; transform: none; } }
.case-card-top { display: flex; justify-content: space-between; min-height: 20px; }
.case-kind { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.attachment-count { color: var(--muted); font-size: 11px; }
.case-card > strong { display: block; margin-top: 4px; color: var(--navy-deep); font-size: 15px; }
.case-title { display: block; margin-top: 4px; color: #526774; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; color: #71838e; font-size: 11px; }
.case-meta small { font-family: Consolas, monospace; text-transform: uppercase; color: #8da0ab; }

.loading-state, .detail-placeholder { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; min-height: 180px; }
.spinner { width: 18px; height: 18px; border: 2px solid #b9c9d3; border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: #d7e0e5; border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-list { text-align: center; padding: 74px 28px 30px; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; background: #dce7ec; color: var(--blue); font-size: 27px; }
.empty-list h2 { margin: 0 0 8px; color: var(--navy); font-size: 17px; }
.empty-list p { margin: 0 auto 18px; max-width: 250px; font-size: 13px; line-height: 1.5; }
.empty-list code { padding: 6px 9px; border-radius: 5px; background: #dde7ec; color: #466171; font-size: 11px; }

.detail-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.no-selection { margin: auto; max-width: 430px; padding: 40px; text-align: center; color: var(--muted); }
.no-selection h2 { margin: 20px 0 8px; color: var(--navy); font-size: 21px; }
.no-selection p { margin: 0; line-height: 1.55; font-size: 14px; }
.document-symbol { width: 68px; height: 82px; margin: auto; padding: 24px 14px 10px; border: 2px solid #a8bcc9; border-radius: 5px; display: grid; align-content: start; gap: 8px; position: relative; }
.document-symbol:after { content: ""; position: absolute; right: -2px; top: -2px; border-left: 18px solid transparent; border-bottom: 18px solid #a8bcc9; }
.document-symbol span { height: 3px; border-radius: 2px; background: #b8c8d1; }
.detail-header { padding: 25px 34px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg,#fff,#fafcfd); }
.detail-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.detail-heading-row h2 { margin: 0; color: var(--navy-deep); font-size: clamp(22px,2vw,29px); line-height: 1.2; letter-spacing: -.025em; }
.detail-heading-row p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.outline-danger { flex: 0 0 auto; border: 1px solid #dcb9bd; border-radius: 6px; padding: 8px 12px; background: #fff; color: var(--danger); cursor: pointer; font-size: 12px; font-weight: 650; }
.outline-danger:hover { background: #fff5f5; border-color: #cd9299; }
.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-top: 21px; }
.summary-card { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.summary-card.primary { border-color: #bdd9de; background: #f4fbfb; }
.summary-icon { flex: 0 0 31px; height: 31px; display: grid; place-items: center; border-radius: 7px; color: var(--blue); background: #e6f0f5; font-size: 11px; font-weight: 800; }
.summary-card.primary .summary-icon { color: #117985; background: #d8f0f1; }
.summary-card div { min-width: 0; display: flex; flex-direction: column; }
.summary-card small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.summary-card strong { margin-top: 3px; overflow: hidden; color: var(--navy-deep); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.summary-card .mono { font-family: Consolas, monospace; text-transform: uppercase; }
.detail-scroll { flex: 1; overflow-y: auto; padding: 25px 34px 50px; background: #f6f8fa; }

.data-section { max-width: 1120px; margin: 0 auto 17px; padding: 20px 22px 22px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 2px 6px rgba(21,50,69,.025); }
.section-heading { display: flex; align-items: center; gap: 10px; padding-bottom: 13px; margin-bottom: 14px; border-bottom: 1px solid #e9eef1; }
.section-heading > span { width: 4px; height: 18px; border-radius: 3px; background: var(--cyan); }
.section-heading h3 { margin: 0; color: var(--navy); font-size: 15px; }
.section-heading em { min-width: 23px; height: 23px; margin-left: auto; display: grid; place-items: center; border-radius: 50%; background: #e8f0f4; color: var(--blue); font-size: 11px; font-style: normal; font-weight: 700; }
.compact-group-content { display: grid; gap: 14px; }
.compact-subsection { padding-top: 2px; }
.compact-subsection > h4 { margin: 0 0 9px; color: #31556d; font-size: 12px; }
.compact-group-content > .field-grid + .field-grid { padding-top: 2px; border-top: 1px solid #edf1f3; }
.field-grid { margin: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 32px; }
.field { padding: 10px 0; border-bottom: 1px solid #edf1f3; min-width: 0; }
.field dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; line-height: 1.35; text-transform: uppercase; letter-spacing: .045em; }
.field dd { margin: 0; color: #203746; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.field-wide { grid-column: 1 / -1; }
.nested-object { margin-top: 13px; padding: 14px 16px; border: 1px solid #e2e9ed; border-radius: 7px; background: #fafcfd; }
.nested-object h4, .array-field > h4 { margin: 0 0 8px; color: #31556d; font-size: 12px; }
.nested-object .nested-object { background: #fff; }
.array-field { margin-top: 13px; }
.array-field > h4 { padding: 0 2px; }
.array-field > h4 span { margin-left: 5px; padding: 2px 6px; border-radius: 10px; background: #e5eef3; color: var(--blue); font-size: 9px; }
.array-items { display: grid; gap: 9px; }
.array-item { padding: 14px 16px; border: 1px solid #dfe8ed; border-radius: 7px; background: #f9fbfc; }
.array-number { margin-bottom: 6px; color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.single-value { font-size: 13px; color: #203746; }
.muted { color: var(--muted); font-size: 13px; }
.attachment-list { display: grid; gap: 8px; }
.attachment-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 10px 12px; border: 1px solid #e1e8ec; border-radius: 7px; }
.file-icon { width: 43px; height: 38px; display: grid; place-items: center; border-radius: 5px; background: #e6f0f5; color: var(--blue); font-size: 8px; font-weight: 850; }
.attachment-row div { min-width: 0; display: flex; flex-direction: column; }
.attachment-row strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.download-button { padding: 7px 10px; border: 1px solid #b9ccd7; border-radius: 5px; color: var(--navy); background: #fff; text-decoration: none; font-size: 11px; font-weight: 650; }
.download-button:hover { background: #f0f6f8; }
.raw-json { max-width: 1120px; margin: 10px auto 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.raw-json summary { padding: 14px 18px; color: var(--navy); cursor: pointer; font-size: 12px; font-weight: 650; }
.raw-json pre { max-height: 480px; overflow: auto; margin: 0; padding: 18px; border-top: 1px solid var(--line); background: #142834; color: #dbe9ef; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.55 Consolas, monospace; }
.toast-message { position: fixed; right: 24px; bottom: 22px; z-index: 100; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 8px; background: var(--navy-deep); color: #fff; box-shadow: 0 8px 25px rgba(8,34,54,.28); font-size: 13px; animation: toastIn .25s ease-out; }
.toast-message span { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: #4ac187; font-size: 11px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

#blazor-error-ui { display: none; }
.blazor-error-boundary { padding: 1rem; background: var(--danger); color: white; }
h1:focus { outline: none; }

@media (max-width: 1050px) {
    .inbox-layout { grid-template-columns: 330px minmax(0,1fr); }
    .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .detail-header, .detail-scroll { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 760px) {
    .topbar { height: 62px; flex-basis: 62px; padding: 0 16px; }
    .connection { font-size: 0; padding: 8px; }
    .inbox-layout { height: auto; min-height: calc(100vh - 62px); display: block; }
    .case-pane { min-height: 360px; max-height: 48vh; border-right: 0; border-bottom: 1px solid #cfdbe2; }
    .detail-pane { min-height: 52vh; }
    .detail-header { padding: 20px 16px; }
    .detail-scroll { padding: 18px 12px 40px; }
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .summary-card { padding: 9px; }
    .detail-heading-row { align-items: center; }
    .detail-heading-row h2 { font-size: 20px; }
    .outline-danger { padding: 7px 9px; font-size: 10px; }
    .data-section { padding: 17px 15px; }
    .field-grid { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .attachment-row { grid-template-columns: auto minmax(0,1fr); }
    .download-button { grid-column: 1 / -1; text-align: center; }
}
