:root {
    --bg: #f4f7fb;
    --bg-strong: #e9eef5;
    --text: #172236;
    --muted: #64748b;
    --line: rgba(123, 142, 173, 0.18);
    --line-strong: rgba(123, 142, 173, 0.28);
    --brand: #2f5fd6;
    --brand-deep: #2148a7;
    --green: #0f9f6e;
    --orange: #c56a18;
    --red: #cc5763;
    --glass: rgba(255, 255, 255, 0.88);
    --glass-strong: rgba(255, 255, 255, 0.94);
    --glass-soft: rgba(247, 249, 253, 0.96);
    --shadow: 0 10px 26px rgba(22, 34, 61, 0.06);
    --radius-lg: 14px;
    --radius-md: 12px;
    --radius-sm: 10px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
}

body.login-page {
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
}

body.is-telegram-webapp {
    overscroll-behavior-y: contain;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.app-shell {
    width: min(1380px, calc(100% - 28px));
    margin: 0 auto;
    padding: 20px 0 36px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 28px;
    border-radius: var(--radius-lg);
}

.login-copy {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
}

.login-copy h1 {
    margin: 0;
    font-size: clamp(1.55rem, 3vw, 2rem);
    line-height: 1.08;
}

.login-form {
    grid-template-columns: 1fr;
}

.login-steps {
    display: grid;
    gap: 10px;
}

.login-step {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.login-step strong {
    font-size: 0.95rem;
}

.login-step span {
    color: var(--muted);
    font-size: 0.92rem;
}

.bootstrap-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.login-secondary-form {
    margin-top: 10px;
}

.login-form .modal-actions {
    justify-content: stretch;
}

.login-form .button {
    width: 100%;
}

.telegram-miniapp-state {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(47, 95, 214, 0.08);
    border: 1px solid rgba(47, 95, 214, 0.16);
}

.telegram-miniapp-state.is-error {
    background: rgba(204, 87, 99, 0.08);
    border-color: rgba(204, 87, 99, 0.18);
}

.telegram-miniapp-state strong {
    font-size: 0.98rem;
}

.telegram-miniapp-state span {
    color: var(--muted);
    font-size: 0.92rem;
}

.telegram-miniapp-badge {
    width: fit-content;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--brand-deep);
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
}

.glass-card,
.glass-subpanel,
.panel,
.stat-card,
.inspector-card,
.slot-card,
.appointment-row,
.detail-card,
.week-day-card,
.current-appointment-banner,
.modal-card {
    background: var(--glass);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}

.topbar h1,
.panel-header h2,
.detail-section h3,
.inspector-card h3 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    max-width: none;
    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
    line-height: 1.1;
}

.topbar-copy {
    display: grid;
    gap: 4px;
}

.topbar-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-items: end;
    align-items: center;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    background: var(--glass-soft);
    border: 1px solid var(--line);
}

.user-chip strong,
.user-chip small {
    display: block;
    line-height: 1.1;
}

.user-chip small {
    color: var(--muted);
}

.logout-form {
    margin: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    text-transform: uppercase;
    font-size: 0.82rem;
    font-weight: 700;
}

.role-switcher {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.role-pill,
.button,
.icon-button,
.quick-button,
.segmented-control a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: var(--radius-sm);
    transition: 160ms ease;
}

.role-pill {
    min-height: 42px;
    padding: 0 14px;
    background: var(--glass-soft);
    color: var(--muted);
    border: 1px solid var(--line);
}

.role-pill.is-active {
    background: linear-gradient(135deg, rgba(52, 103, 235, 0.95), rgba(36, 72, 171, 0.95));
    color: #fff;
}

.icon,
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.icon svg,
.stat-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
}

.flash-success {
    color: #155f49;
}

.flash-error {
    color: #8b3640;
}

.stats-grid,
.workspace,
.form-grid,
.detail-grid,
.detail-columns,
.photo-grid {
    display: grid;
    gap: 14px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}

.stat-card {
    min-height: 84px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(47, 95, 214, 0.1);
    color: var(--brand);
}

.stat-card strong {
    display: block;
    font-size: 1.05rem;
    line-height: 1.1;
}

.stat-card span:last-child {
    color: var(--muted);
    font-size: 0.95rem;
}

.workspace {
    align-items: start;
    min-width: 0;
}

.operator-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
}

.calendar-panel,
.list-panel {
    grid-column: 1;
}

.slots-panel {
    grid-column: 2;
}

.list-panel {
    grid-column: 1 / -1;
}

.inspector-layout {
    grid-template-columns: 1fr;
}

.admin-layout {
    grid-template-columns: 1fr;
}

.panel {
    border-radius: var(--radius-lg);
    padding: 16px;
    min-width: 0;
}

.panel-header,
.section-head,
.appointment-row,
.detail-card,
.inspector-card-head,
.inspector-card-foot,
.day-focus,
.header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-header-tight {
    align-items: center;
}

.header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.segmented-control {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 4px;
    padding: 3px;
    background: rgba(244, 247, 252, 0.96);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.segmented-control a {
    min-height: 34px;
    padding: 0 12px;
    color: var(--muted);
}

.segmented-control a.is-active {
    background: rgba(47, 95, 214, 0.12);
    color: var(--brand-deep);
    font-weight: 700;
}

.month-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.icon-button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.calendar-weekdays {
    margin: 14px 0 8px;
    color: var(--muted);
    font-size: 0.8rem;
}

.calendar-day,
.calendar-empty,
.week-day-card {
    min-height: 74px;
    border-radius: var(--radius-md);
}

.calendar-day {
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.calendar-day.is-selected,
.week-day-card.is-selected,
.inspector-card.is-selected {
    border-color: rgba(52, 103, 235, 0.3);
    background: rgba(47, 95, 214, 0.08);
}

.calendar-day.is-blocked,
.week-day-card.is-blocked,
.inspector-day-chip.is-blocked,
.slot-card.is-blocked {
    border-color: rgba(214, 126, 47, 0.28);
    background: rgba(214, 126, 47, 0.08);
}

.day-number,
.week-day-head strong {
    font-weight: 700;
}

.day-meta,
.mobile-hint,
.detail-card span,
.detail-card small,
.slot-card span,
.slot-card small,
.appointment-main span,
.appointment-meta span,
.note-block p,
.empty-state,
.photo-count,
.summary-meta,
.mini-appointment small,
.week-day-meta {
    color: var(--muted);
}

.week-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
    align-items: start;
    min-width: 0;
}

.week-day-link,
.mini-appointment-link {
    color: inherit;
    text-decoration: none;
}

.week-day-link {
    display: grid;
    gap: 10px;
}

.week-day-card {
    padding: 10px;
    display: grid;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
    background: #fbfcff;
    align-content: start;
    min-height: 184px;
}

.week-day-head,
.mini-appointment,
.week-day-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.week-day-head {
    align-items: center;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(123, 142, 173, 0.12);
}

.week-day-head small {
    color: var(--muted);
    font-size: 0.76rem;
    white-space: nowrap;
}

.week-day-title {
    align-items: baseline;
    min-width: 0;
}

.week-day-title strong {
    font-size: 0.82rem;
    text-transform: uppercase;
}

.week-day-title span {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.week-day-meta {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    width: fit-content;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.week-day-meta.is-busy {
    color: var(--brand-deep);
    background: rgba(47, 95, 214, 0.1);
}

.week-day-meta.is-free {
    color: #537083;
    background: rgba(123, 142, 173, 0.1);
}

.week-day-meta.is-blocked {
    color: #9a5a1a;
    background: rgba(214, 126, 47, 0.12);
}

.week-day-list {
    display: grid;
    gap: 6px;
    align-content: start;
}

.mini-appointment {
    align-items: center;
    justify-content: flex-start;
    padding: 7px 8px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(97, 122, 160, 0.12);
    min-width: 0;
}

.mini-appointment-link:hover {
    border-color: rgba(47, 95, 214, 0.24);
    background: rgba(47, 95, 214, 0.05);
}

.mini-time {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--text);
    font-size: 0.92rem;
}

.mini-status {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.mini-empty,
.mini-more {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.84rem;
}

.mini-empty {
    color: var(--muted);
    background: rgba(123, 142, 173, 0.08);
    border: 1px dashed rgba(123, 142, 173, 0.18);
}

.mini-blocked {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.84rem;
    color: #9a5a1a;
    background: rgba(214, 126, 47, 0.1);
    border: 1px dashed rgba(214, 126, 47, 0.22);
}

.mini-more {
    color: var(--brand-deep);
    background: rgba(47, 95, 214, 0.08);
}

.day-focus {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid var(--line);
}

.day-block-hint {
    display: block;
    margin-top: 6px;
    color: #9a5a1a;
}

.inspector-table-panel,
.inspector-detail-panel {
    grid-column: 1;
}

.inspector-table-header {
    align-items: flex-start;
}

.inspector-toolbar {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.day-block-form {
    justify-self: stretch;
}

.inspector-filter-control {
    flex-wrap: wrap;
}

.inspector-table-wrap {
    margin-top: 12px;
}

.inspector-table {
    min-width: 980px;
}

.inspector-table tbody tr:hover {
    background: rgba(47, 95, 214, 0.03);
}

.inspector-table .action-cell {
    width: 56px;
    text-align: right;
}

.inspector-table .table-link {
    color: var(--brand-deep);
    font-weight: 600;
}

.inspector-table .is-selected-row {
    background: rgba(47, 95, 214, 0.05);
}

.inspector-table .icon-button {
    width: 34px;
    height: 34px;
}

.inspector-calendar-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(86px, 1fr);
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-top: 12px;
}

.inspector-day-chip {
    display: grid;
    gap: 4px;
    min-height: 84px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid var(--line);
    text-align: left;
}

.inspector-day-chip strong {
    font-size: 0.78rem;
    text-transform: uppercase;
}

.inspector-day-chip span {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
}

.inspector-day-chip small {
    color: var(--muted);
    font-size: 0.76rem;
}

.inspector-day-chip.is-selected {
    border-color: rgba(47, 95, 214, 0.32);
    background: rgba(47, 95, 214, 0.08);
}

.inspector-day-chip.is-selected.is-blocked {
    border-color: rgba(214, 126, 47, 0.34);
    background: rgba(214, 126, 47, 0.14);
}

.inspector-mobile-agenda {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.inspector-agenda-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid var(--line);
}

.agenda-main {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.agenda-time,
.agenda-body {
    display: grid;
    gap: 3px;
}

.agenda-time strong {
    font-size: 1rem;
}

.agenda-time span,
.agenda-body span {
    color: var(--muted);
    font-size: 0.88rem;
}

.agenda-body strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-body span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-list,
.appointment-list,
.inspector-cards {
    display: grid;
    gap: 10px;
}

.slot-list {
    margin-top: 12px;
}

.slot-card {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    text-align: left;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}

.slot-card.is-free {
    background: #fff;
}

.slot-card.is-busy {
    background: rgba(47, 95, 214, 0.06);
}

.slot-card.is-blocked {
    cursor: not-allowed;
    color: #8a5b2a;
}

.slot-card.is-blocked .slot-aside,
.slot-card.is-blocked span,
.slot-card.is-blocked small {
    color: #8a5b2a;
}

.day-block-empty {
    color: #8a5b2a;
}

.slot-card strong,
.appointment-main strong,
.detail-card strong,
.note-block strong {
    display: block;
}

.slot-aside {
    width: min(48%, 280px);
    text-align: right;
    font-size: 0.92rem;
    min-width: 0;
}

.appointment-row {
    padding: 12px 14px;
    border-radius: var(--radius-md);
}

.appointment-main,
.appointment-meta {
    display: grid;
    gap: 4px;
}

.appointment-main {
    flex: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-assigned {
    color: #3159bf;
    background: rgba(49, 89, 191, 0.12);
}

.status-confirmed {
    color: #116b87;
    background: rgba(17, 107, 135, 0.13);
}

.status-completed {
    color: #147153;
    background: rgba(20, 113, 83, 0.13);
}

.status-rescheduled {
    color: #a65c18;
    background: rgba(166, 92, 24, 0.13);
}

.inspector-card {
    padding: 13px;
    border-radius: var(--radius-lg);
    display: grid;
    gap: 10px;
}

.inspector-card-body {
    display: grid;
    gap: 6px;
}

.inspector-card-body p {
    margin: 0;
    color: var(--muted);
}

.detail-hero {
    margin: 14px 0 12px;
}

.detail-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    min-height: 38px;
    margin-bottom: 12px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(47, 95, 214, 0.08);
    color: var(--brand-deep);
    font-weight: 700;
    border: 1px solid rgba(47, 95, 214, 0.12);
}

.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card {
    padding: 14px;
    border-radius: var(--radius-lg);
    align-items: flex-start;
}

.detail-card .icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(47, 95, 214, 0.1);
    color: var(--brand);
}

.detail-card > div {
    display: grid;
    gap: 4px;
}

.detail-card a {
    color: var(--brand-deep);
    font-weight: 600;
}

.inspection-process-panel {
    display: grid;
    gap: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(47, 95, 214, 0.14);
    background: rgba(247, 250, 255, 0.9);
}

.inspection-process-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.inspection-process-head h3 {
    margin: 4px 0 0;
}

.inspection-process-state {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(47, 95, 214, 0.12);
    color: var(--brand-deep);
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.inspection-process-panel[data-is-started="0"] {
    gap: 10px;
}

.inspection-process-panel[data-is-started="0"] .inspection-flow {
    justify-content: flex-end;
    padding: 0;
    border: 0;
    background: transparent;
}

.inspection-process-panel[data-is-started="0"] .inspection-flow-actions {
    width: 100%;
    justify-content: flex-end;
}

.current-appointment-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    background: rgba(47, 95, 214, 0.08);
}

.current-appointment-banner strong,
.quick-button {
    font-weight: 700;
}

.quick-actions {
    padding: 8px;
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.quick-button {
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.detail-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.detail-section {
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    overflow: hidden;
}

.detail-section-body {
    padding: 0 14px 14px;
}

.mobile-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    cursor: pointer;
}

.mobile-summary::-webkit-details-marker {
    display: none;
}

.summary-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.mobile-hint {
    margin: 0 0 14px;
    font-size: 0.92rem;
}

.inline-form,
.stack-form,
.upload-form {
    display: grid;
    gap: 12px;
}

.report-items,
.report-actions,
.report-links {
    display: grid;
    gap: 12px;
}

.inspection-flow,
.inspection-flow-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inspection-flow {
    padding: 14px;
    border: 1px solid rgba(97, 122, 160, 0.12);
    border-radius: var(--radius-md);
    background: rgba(247, 250, 255, 0.92);
}

.inspection-flow-copy strong {
    display: block;
    margin-bottom: 4px;
}

.inspection-flow-actions {
    flex-wrap: wrap;
}

.report-workspace[hidden] {
    display: none;
}

.defect-catalog,
.report-composer,
.report-item-card {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(97, 122, 160, 0.12);
    border-radius: var(--radius-md);
    background: #fff;
}

.defect-catalog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.defect-catalog-head strong {
    display: block;
}

.defect-catalog-search {
    min-width: min(280px, 100%);
}

.defect-catalog-search input {
    width: 100%;
}

.defect-catalog-categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.defect-category-chip {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-weight: 700;
}

.defect-category-chip.is-active {
    background: rgba(47, 95, 214, 0.12);
    color: var(--brand-deep);
    border-color: rgba(47, 95, 214, 0.18);
}

.defect-catalog-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.defect-suggestion-card {
    display: grid;
    gap: 4px;
    text-align: left;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(97, 122, 160, 0.12);
    background: rgba(247, 250, 255, 0.88);
    color: var(--text);
}

.defect-suggestion-card span,
.defect-suggestion-card small {
    color: var(--muted);
}

.report-sync-bar,
.report-composer-head,
.report-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.report-sync-bar {
    padding: 12px 14px;
    border: 1px solid rgba(97, 122, 160, 0.12);
    border-radius: var(--radius-md);
    background: rgba(247, 250, 255, 0.92);
}

.report-sync-bar strong,
.report-composer-head strong {
    display: block;
}

.report-sync-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    background: rgba(97, 122, 160, 0.12);
    color: var(--text);
}

.report-sync-state[data-tone="success"] {
    background: rgba(55, 148, 110, 0.14);
    color: #1d6d50;
}

.report-sync-state[data-tone="pending"],
.report-sync-state[data-tone="progress"] {
    background: rgba(47, 95, 214, 0.12);
    color: var(--brand-deep);
}

.report-sync-state[data-tone="offline"],
.report-sync-state[data-tone="warning"] {
    background: rgba(196, 114, 40, 0.14);
    color: #9a5b1e;
}

.report-composer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 12px;
}

.report-composer-grid .field-wide {
    grid-column: 1 / -1;
}

.report-item-heading,
.report-item-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-item-tools .icon-button {
    width: 36px;
    min-width: 36px;
    padding: 0;
}

.report-item-heading {
    flex-wrap: wrap;
}

.report-item-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.report-item-text {
    margin: 0;
    line-height: 1.5;
}

.severity-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(97, 122, 160, 0.12);
    color: var(--muted);
}

.severity-critical {
    background: rgba(204, 87, 99, 0.14);
    color: #b54756;
}

.severity-major {
    background: rgba(197, 106, 24, 0.14);
    color: #9d5818;
}

.severity-minor {
    background: rgba(17, 107, 135, 0.14);
    color: #176982;
}

.report-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-links {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.report-empty[hidden] {
    display: none;
}

.inline-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.note-block {
    margin-top: 14px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid rgba(97, 122, 160, 0.12);
}

.note-block p {
    margin: 8px 0 0;
}

.upload-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(52, 103, 235, 0.28);
    background: rgba(247, 250, 255, 0.9);
}

.upload-copy {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-copy .icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(47, 95, 214, 0.1);
    color: var(--brand);
}

.upload-copy strong {
    display: block;
}

.upload-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.photo-grid {
    margin-top: 12px;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.photo-tile {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: rgba(224, 232, 244, 0.9);
}

.photo-tile img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.empty-state {
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.76);
    border: 1px dashed var(--line-strong);
}

label {
    display: grid;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-wide {
    grid-column: 1 / -1;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;
    color: var(--text);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #fff;
}

textarea {
    min-height: 118px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(52, 103, 235, 0.14);
    border-color: rgba(52, 103, 235, 0.48);
}

.button {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid transparent;
    font-weight: 700;
}

.button.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.button.ghost {
    color: var(--brand-deep);
    background: #fff;
    border-color: var(--line);
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.22);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.modal-card {
    position: relative;
    width: min(980px, calc(100% - 20px));
    max-height: calc(100vh - 24px);
    margin: 12px auto;
    overflow: auto;
    padding: 16px;
    border-radius: 16px;
    background: rgba(248, 251, 255, 0.92);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.admin-stats-grid {
    margin-bottom: 0;
}

.admin-filter-form {
    margin-top: 14px;
}

.admin-filter-actions {
    display: flex;
    justify-content: flex-end;
}

.admin-users-panel {
    margin-bottom: 14px;
}

.admin-user-form {
    margin-top: 14px;
}

.admin-user-row-form {
    margin: 0;
}

.admin-user-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) 160px minmax(180px, 1fr) minmax(180px, 1fr) 130px 120px 120px;
    gap: 10px;
    align-items: center;
}

.admin-user-state {
    color: var(--muted);
    font-size: 0.92rem;
}

.admin-user-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.admin-user-toggle input {
    width: 18px;
    min-height: 18px;
    margin: 0;
}

.chart-panel,
.admin-grid-panel,
.report-panel {
    margin-top: 14px;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 12px;
    align-items: end;
    min-height: 240px;
    margin-top: 12px;
}

.bar-item {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.bar-value,
.bar-label {
    font-size: 0.82rem;
    color: var(--muted);
}

.bar-column {
    width: 100%;
    max-width: 44px;
    border-radius: 10px 10px 0 0;
    background: linear-gradient(180deg, var(--brand), rgba(47, 95, 214, 0.3));
    min-height: 12px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    gap: 14px;
}

.admin-subpanel {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
}

.inspector-bars,
.status-report-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.inspector-bar-row {
    display: grid;
    gap: 8px;
}

.inspector-bar-head,
.status-report-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inspector-bar-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(123, 142, 173, 0.12);
    overflow: hidden;
}

.inspector-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), var(--brand-deep));
}

.report-table-wrap {
    width: 100%;
    overflow: auto;
    margin-top: 12px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.report-table th,
.report-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(123, 142, 173, 0.12);
    vertical-align: top;
}

.report-table th {
    font-size: 0.82rem;
    text-transform: uppercase;
    color: var(--muted);
}

.mobile-details {
    overflow: hidden;
}

@media (min-width: 861px) {
    .mobile-summary {
        padding-bottom: 12px;
    }

    .mobile-details > .mobile-summary {
        cursor: default;
    }
}

@media (max-width: 1180px) {
    .stats-grid,
    .operator-layout,
    .detail-grid,
    .detail-columns {
        grid-template-columns: 1fr 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .week-board {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .stats-grid,
    .operator-layout,
    .inspector-layout,
    .admin-grid,
    .detail-grid,
    .detail-columns,
    .form-grid,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .calendar-panel,
    .slots-panel,
    .list-panel {
        grid-column: auto;
    }

    .week-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .inspector-table {
        min-width: 760px;
    }

    .admin-user-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .app-shell {
        width: min(100% - 14px, 100%);
        padding-top: 14px;
    }

    .topbar {
        grid-template-columns: 1fr;
        display: grid;
    }

    .topbar-actions {
        justify-items: stretch;
        display: grid;
    }

    .role-switcher {
        width: 100%;
    }

    .role-pill,
    .button,
    .icon-button,
    .quick-button {
        width: 100%;
    }

    .user-chip,
    .logout-form {
        width: 100%;
    }

    .panel,
    .modal-card {
        padding: 16px;
    }

    .topbar-subtitle {
        font-size: 0.9rem;
    }

    .panel-header,
    .section-head,
    .appointment-row,
    .detail-card,
    .inspector-card-head,
    .inspector-card-foot,
    .day-focus,
    .header-actions,
    .upload-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .slot-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .slot-aside {
        width: 100%;
        text-align: left;
    }

    .segmented-control,
    .month-nav,
    .upload-actions,
    .modal-actions {
        width: 100%;
    }

    .month-nav,
    .modal-actions {
        justify-content: space-between;
    }

    .mobile-details:not([open]) .detail-section-body,
    .mobile-details:not([open]) .mobile-hint,
    .mobile-details:not([open]) .inspector-cards {
        display: none;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .upload-actions {
        width: 100%;
    }

    .upload-actions .button {
        flex: 1;
    }

    .week-board {
        grid-template-columns: 1fr;
    }

    .admin-filter-actions {
        justify-content: stretch;
    }

    .inspector-table {
        min-width: 640px;
    }

    .inspector-toolbar {
        justify-items: stretch;
    }

    .inspector-calendar-strip {
        grid-auto-columns: 88px;
    }

    .inspector-agenda-card,
    .agenda-main {
        grid-template-columns: 1fr;
    }

    .inspection-process-head,
    .inspection-flow,
    .inspection-flow-actions,
    .defect-catalog-head,
    .report-sync-bar,
    .report-composer-head,
    .report-composer-grid,
    .report-actions,
    .report-links {
        grid-template-columns: 1fr;
    }

    .inspection-process-head,
    .inspection-flow,
    .inspection-flow-actions,
    .defect-catalog-head,
    .report-sync-bar,
    .report-composer-head,
    .report-item-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .defect-catalog-list {
        grid-template-columns: 1fr;
    }
}

body[data-role="inspector"][data-inspector-has-selection="1"] .stats-grid,
body[data-role="inspector"][data-inspector-has-selection="1"] .inspector-table-panel {
    display: none;
}

body[data-role="inspector"][data-inspector-has-selection="1"] .inspector-detail-panel {
    grid-column: 1 / -1;
}
