:root {
    font-family: "Segoe UI", "Arial", sans-serif;
    color: #172547;
    background: #f4f6fa;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --ink: #172547;
    --muted: #75809a;
    --blue: #285be7;
    --line: #e0e5ee;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #f4f6fa; }
body { font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 3; width: 224px;
    padding: 24px 14px; color: #fff; background: #172547;
    display: flex; flex-direction: column;
}
.brand { display: block; padding: 4px 12px 30px; font-size: 23px; font-weight: 750; letter-spacing: .04em; }
.brand small { display: block; margin-top: 7px; color: #b8c2d8; font-size: 11px; font-weight: 400; letter-spacing: 0; }
.side-nav { display: grid; gap: 6px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; color: #d0d8e8; border-radius: 5px; }
.side-nav a span { width: 18px; font-size: 18px; text-align: center; }
.side-nav a.active, .side-nav a:hover { color: #fff; background: #304b9c; }
.main-content { min-height: 100vh; margin-left: 224px; }
.topbar { height: 64px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); color: #59647c; }
.user-session { display: flex; align-items: center; gap: 14px; }
.user-session form { margin: 0; }
.logout-button { min-height: 34px; color: var(--ink); }
.content { padding: 30px 32px 48px; max-width: 1600px; margin: 0 auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-heading h1, .login-page h1 { margin: 2px 0 0; color: var(--ink); font-size: 26px; line-height: 1.2; font-weight: 700; }
.eyebrow { margin: 0; color: #65718b; font-size: 10px; font-weight: 700; letter-spacing: .11em; }
.result-count { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.search-input, .filter-select, .create-user-form input, .create-user-form select, .login-form input {
    min-height: 40px; padding: 8px 11px; color: var(--ink); background: #fff; border: 1px solid #d8deea; border-radius: 5px; outline-color: #8ca8ff;
}
.search-input { width: min(420px, 100%); }
.filter-select { min-width: 155px; }
.button { min-height: 40px; padding: 0 15px; border: 1px solid var(--blue); border-radius: 5px; color: #fff; background: var(--blue); font-weight: 600; cursor: pointer; }
.button:hover { background: #1d4ac5; }
.button-secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.button-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 13px 14px; color: #68738b; background: #f9fafc; border-bottom: 1px solid var(--line); font-size: 11px; text-align: left; font-weight: 650; }
td { padding: 13px 14px; border-bottom: 1px solid #edf0f5; color: #39445a; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcff; }
.number-cell { color: #233d84; font-weight: 650; }
.status { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 4px; font-size: 11px; font-weight: 650; }
.status-submitted { color: #5c6370; background: #edf0f4; }
.status-assigned { color: #765800; background: #fff1c7; }
.status-inprogress { color: #244eb4; background: #e4ecff; }
.status-resolved, .status-active { color: #176542; background: #e2f4e9; }
.status-canceled { color: #a13a3a; background: #fde8e7; }
.user-name { display: flex; align-items: center; gap: 9px; }
.avatar { width: 30px; height: 30px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #244eb4; background: #e6edff; font-size: 11px; font-weight: 700; }
.text-button { padding: 5px 0; color: #285be7; background: none; border: 0; cursor: pointer; }
.empty-state, .access-note { padding: 42px 20px; color: var(--muted); text-align: center; }
.create-user-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: -8px 0 20px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.create-user-form label, .login-form label { display: grid; gap: 6px; color: #58647b; font-size: 12px; }
.create-user-form input { width: 210px; }
.form-message { align-self: center; color: #176542; }
.confirmation-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 16px; padding: 13px 15px; background: #fff8e5; border: 1px solid #f1dda8; border-radius: 6px; }
.confirmation-bar label, .inline-form label, .date-filter { display: grid; gap: 5px; color: #58647b; font-size: 12px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.inline-form input, .inline-form select, .date-filter input { min-height: 38px; padding: 7px 10px; color: var(--ink); background: #fff; border: 1px solid #d8deea; border-radius: 5px; }
.inline-form label { min-width: 190px; }
.inline-form input { min-width: 190px; }
.date-filter input { min-width: 140px; }
.store-create { margin-bottom: 18px; }
.store-create h2, .balance-panel h2, .section-title { margin: 0 0 14px; font-size: 16px; }
.balance-panel { margin-bottom: 20px; }
.muted-note { margin-top: 14px; color: var(--muted); font-size: 12px; }
.action-cell { display: flex; align-items: center; gap: 12px; }
.action-cell .text-button { white-space: nowrap; }
.assignment-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.login-page { position: fixed; top: 50%; left: 50%; z-index: 4; width: min(420px, calc(100vw - 32px)); margin: 0; padding: 34px; transform: translate(-50%, -50%); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 45px #18284912; }
.login-mark { width: 48px; height: 48px; margin-bottom: 22px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--ink); font-weight: 750; }
.login-form { display: grid; gap: 15px; margin-top: 24px; }
.login-form input { width: 100%; }
.login-submit { margin-top: 5px; }
.form-error { margin: 0; color: #b42318; }
.inspection-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.inspection-summary div { display: grid; gap: 7px; min-width: 0; }
.inspection-summary span, .panel-heading span { color: var(--muted); font-size: 12px; }
.inspection-summary strong { overflow-wrap: anywhere; font-weight: 600; }
.inspection-workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); gap: 16px; align-items: start; }
.work-panel { min-width: 0; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.work-panel h2 { margin: 0 0 14px; font-size: 15px; }
.request-description { white-space: pre-wrap; line-height: 1.6; }
.file-gallery { display: flex; flex-wrap: wrap; gap: 9px; }
.file-gallery img { width: 140px; height: 100px; object-fit: cover; border-radius: 5px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading h2 { margin-bottom: 14px; }
.message-list { max-height: 390px; overflow: auto; margin: 12px 0; border-top: 1px solid var(--line); }
.message-item { padding: 13px 0; border-bottom: 1px solid #edf0f5; }
.message-item p { margin: 5px 0; white-space: pre-wrap; }
.message-item time { color: var(--muted); font-size: 11px; }
.message-form, .decision-form { display: grid; gap: 9px; }
.message-form textarea, .decision-form textarea { min-height: 82px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; font: inherit; resize: vertical; }
.decision-form { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.decision-panel { margin-top: 20px; padding: 16px; background: #f4f7ff; border-left: 3px solid var(--blue); }
.decision-panel p { white-space: pre-wrap; }
.decision-panel span { color: var(--muted); font-size: 12px; }
.object-link { padding: 0; text-align: left; font-weight: 600; text-decoration: underline; overflow-wrap: anywhere; }
.object-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.document-name { max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
#blazor-error-ui { display: none; }

@media (max-width: 760px) {
    .sidebar { width: 180px; padding: 16px 10px; }
    .brand { padding: 4px 8px 20px; font-size: 20px; }
    .side-nav { grid-template-columns: minmax(0, 1fr); }
    .side-nav a { gap: 8px; padding: 0 8px; }
    .side-nav a span { flex: 0 0 18px; }
    .main-content { margin-left: 180px; }
    .topbar { height: 54px; padding: 0 16px; }
    .content { padding: 22px 14px 36px; }
    .page-heading h1 { font-size: 23px; }
    .page-heading { align-items: flex-start; flex-wrap: wrap; }
    .create-user-form { display: grid; }
    .create-user-form input, .create-user-form select { width: 100%; }
    .inspection-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inspection-workspace { grid-template-columns: minmax(0, 1fr); }
    .confirmation-bar { align-items: stretch; }
    .inline-form { align-items: stretch; flex-direction: column; }
    .inline-form label, .inline-form input { width: 100%; }
    .login-page { padding: 25px 20px; }
}