:root {
    color-scheme: light;
    --navy: #102b46;
    --blue: #2475b7;
    --blue-dark: #195f98;
    --background: #f5f7f9;
    --card: #fff;
    --text: #1d2a36;
    --muted: #6f7c88;
    --border: #e2e8ed;
    --green: #28734a;
    --amber: #946018;
    --red: #a43b3b;
    font-family: Arial, Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); }
a { color: var(--blue); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px; display: flex; flex-direction: column; overflow-y: auto; background: var(--navy); color: #fff; }
.sidebar-brand { display: flex; align-items: center; margin: 0 10px 30px; }
.sidebar-brand img { display: block; width: 170px; max-width: 100%; height: auto; }
.menu { display: grid; gap: 5px; }
.menu a { display: flex; align-items: center; min-height: 42px; padding: 10px 12px; border-radius: 8px; color: #dce7f1; font-size: 13px; text-decoration: none; }
.menu a:hover, .menu a.active { background: rgb(255 255 255 / 12%); color: #fff; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; margin-right: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-group { border-radius: 8px; }
.menu-group.active { padding-bottom: 6px; background: rgb(255 255 255 / 8%); }
.submenu { display: grid; margin: 0 0 2px 40px; }
.submenu a { min-height: 30px; padding: 6px 8px; color: #aebfd0; font-size: 11px; }
.menu-group:not(.active) .submenu { display: none; }
.sidebar-facility { margin-top: auto; padding: 18px 12px 5px; border-top: 1px solid rgb(255 255 255 / 10%); }
.sidebar-facility span { display: block; margin-bottom: 5px; color: #86a2b9; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-facility strong { display: block; color: #e7eef4; font-size: 12px; line-height: 1.4; }
.main { min-width: 0; }
.topbar { position: relative; min-height: 76px; padding: 13px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--card); border-bottom: 1px solid var(--border); }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.user-area { display: flex; align-items: center; gap: 10px; text-align: right; }
.user-area strong, .user-area span { display: block; }
.user-area strong { font-size: 13px; }
.user-area div span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.user-avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #d6e0e7; border-radius: 50%; background: #edf4f8; color: var(--navy); font-size: 11px; font-weight: 700; }
.facility-selector { position: absolute; left: 50%; top: 50%; min-width: 190px; padding: 8px 12px; display: grid; grid-template-columns: 1fr auto; transform: translate(-50%, -50%); border: 1px solid var(--border); border-radius: 7px; background: #fbfcfd; }
.facility-selector span { grid-column: 1; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.facility-selector strong { grid-column: 1; margin-top: 2px; color: var(--navy); font-size: 12px; }
.facility-selector svg { grid-column: 2; grid-row: 1 / 3; width: 17px; align-self: center; fill: none; stroke: #758391; stroke-width: 1.8; }
.content { max-width: 1720px; padding: 22px 24px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.page-heading h2 { margin: 3px 0 6px; color: var(--navy); font-size: 22px; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0; color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.primary-button, .mobile-report-button { display: inline-flex; min-height: 42px; padding: 10px 16px; align-items: center; justify-content: center; border: 1px solid var(--blue); border-radius: 8px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; }
.primary-button:hover, .mobile-report-button:hover { background: var(--blue-dark); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric-card, .recent-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.metric-card { position: relative; min-height: 92px; padding: 17px 18px; overflow: hidden; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #8294a3; }
.metric-card span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 26px; line-height: 1; }
.metric-progress::before { background: var(--blue); }
.metric-hold::before { background: var(--amber); }
.metric-completed::before { background: var(--green); }
.recent-panel { overflow: hidden; }
.panel-heading { min-height: 67px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.panel-heading h2 { margin: 3px 0 0; font-size: 17px; }
.panel-heading > a { font-size: 12px; font-weight: 700; text-decoration: none; }
.fault-list { display: grid; }
.fault-row { min-width: 0; padding: 14px 18px; display: grid; grid-template-columns: 110px minmax(190px, 1.25fr) minmax(210px, 1fr) auto; align-items: center; gap: 18px; border-bottom: 1px solid #edf1f4; color: inherit; text-decoration: none; }
.fault-row:last-child { border-bottom: 0; }
.fault-row:hover { background: #f8fafb; }
.fault-reference strong, .fault-reference time, .fault-location span, .fault-location strong, .fault-subject span, .fault-subject strong, .fault-subject small { display: block; }
.fault-reference strong { margin-bottom: 5px; color: var(--navy); font-size: 14px; }
.fault-reference time, .fault-location span, .fault-subject span, .fault-subject small { color: var(--muted); font-size: 11px; }
.fault-location strong, .fault-subject strong { margin-top: 4px; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.fault-subject small { margin-top: 3px; line-height: 1.35; }
.fault-status { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.status { display: inline-flex; min-height: 25px; padding: 4px 9px; align-items: center; border-radius: 999px; background: #edf1f4; color: #536270; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-assigned, .status-in_progress { background: #edf5fa; color: var(--blue-dark); }
.status-on_hold { background: #fff6e7; color: var(--amber); }
.status-completed { background: #eaf7f1; color: var(--green); }
.status-cancelled { background: #fff0f0; color: var(--red); }
.row-arrow { color: #99a5af; font-size: 21px; }
.empty-state { padding: 42px 20px; text-align: center; }
.empty-state strong { font-size: 14px; }
.empty-state p { margin: 7px 0 15px; color: var(--muted); font-size: 12px; }
.empty-state a { font-size: 12px; font-weight: 700; }
.report-card { max-width: 900px; padding: 22px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.report-card form { display: grid; gap: 18px; }
.report-card fieldset { min-width: 0; margin: 0; padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--border); }
.report-card legend { width: 100%; margin-bottom: 14px; color: var(--navy); font-size: 14px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.report-card label { display: block; color: #384754; font-size: 12px; font-weight: 700; }
.report-card select, .report-card input, .report-card textarea, .report-card button { width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid #ccd7df; border-radius: 7px; background: #fff; color: var(--text); font: inherit; }
.report-card select, .report-card input { min-height: 42px; }
.report-card select:focus, .report-card input:focus, .report-card textarea:focus { outline: 2px solid rgb(46 111 159 / 20%); border-color: var(--blue); }
.report-card select:disabled, .report-card input:disabled { background: #f3f5f7; color: #89949d; }
.report-card textarea { min-height: 105px; resize: vertical; }
.report-card button { min-height: 44px; border-color: var(--blue); background: var(--blue); color: #fff; font-weight: 700; cursor: pointer; }
.report-card button:hover { background: var(--blue-dark); }
.report-card .muted { color: var(--muted); font-size: 11px; font-weight: 400; }
.report-card .error { margin: 0; padding: 11px 13px; border-left: 3px solid var(--red); border-radius: 5px; background: #fff0f0; color: #842d2d; font-size: 12px; }
.mobile-menu, .mobile-report-button { display: none; }
.nav-backdrop[hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.list-heading { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.list-heading h2 { margin: 3px 0 0; color: var(--navy); font-size: 18px; }
.ownership-tabs { display: flex; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.ownership-tabs a { padding: 7px 12px; border-radius: 6px; color: #5c6b77; font-size: 11px; font-weight: 700; text-decoration: none; }
.ownership-tabs a[aria-current="page"] { background: #eaf3fa; color: var(--blue-dark); }
.fault-filters { margin-bottom: 13px; padding: 12px; display: grid; grid-template-columns: minmax(150px, 1.25fr) repeat(3, minmax(115px, .75fr)) minmax(275px, 1.4fr) auto auto auto; gap: 8px; align-items: stretch; border: 1px solid var(--border); border-radius: 9px; background: #fff; box-shadow: 0 2px 7px rgb(25 50 73 / 4%); }
.fault-filters label { min-width: 0; }
.fault-filters input, .fault-filters select, .fault-filters button { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #d6dfe6; border-radius: 6px; background: #fff; color: var(--text); font: inherit; font-size: 11px; }
.fault-filters input:focus, .fault-filters select:focus { outline: 2px solid rgb(36 117 183 / 15%); border-color: var(--blue); }
.filter-search input { padding-left: 31px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23778693' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 9px center; background-size: 15px; }
.date-range { min-width: 0; height: 38px; padding: 0 7px; display: flex; align-items: center; gap: 4px; border: 1px solid #d6dfe6; border-radius: 6px; }
.date-range span { flex: 0 0 auto; margin-right: 2px; color: #687683; font-size: 10px; }
.date-range input { min-width: 96px; padding: 0 2px; border: 0; }
.date-range i { color: #a1abb3; font-style: normal; }
.fault-filters .filter-submit { width: auto; padding: 0 12px; border-color: #bdcbd6; color: var(--navy); font-weight: 700; cursor: pointer; }
.clear-button, .new-fault-button { height: 38px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; border-radius: 6px; font-size: 11px; font-weight: 700; text-decoration: none; }
.clear-button { border: 1px solid #d2dce4; color: #5b6975; }
.new-fault-button { min-height: 38px; }
.fault-table-card { overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: #fff; box-shadow: 0 3px 12px rgb(24 48 70 / 5%); }
.fault-table-scroll { overflow-x: auto; }
.fault-table { width: 100%; min-width: 1480px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.fault-table th { position: sticky; top: 0; z-index: 2; height: 42px; padding: 9px 10px; background: #f8fafb; border-bottom: 1px solid #dce4ea; color: #64727e; font-size: 9px; font-weight: 700; letter-spacing: .025em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.fault-table th:nth-child(1) { width: 92px; }.fault-table th:nth-child(2) { width: 92px; }.fault-table th:nth-child(3) { width: 105px; }.fault-table th:nth-child(4) { width: 130px; }.fault-table th:nth-child(5) { width: 145px; }.fault-table th:nth-child(6) { width: 175px; }.fault-table th:nth-child(7) { width: 190px; }.fault-table th:nth-child(8) { width: 185px; }.fault-table th:nth-child(9) { width: 135px; }.fault-table th:nth-child(10) { width: 190px; }.fault-table th:nth-child(11) { width: 80px; }
.fault-table td { height: 58px; padding: 9px 10px; border-bottom: 1px solid #edf1f4; color: #33414d; font-size: 10.5px; line-height: 1.35; vertical-align: middle; overflow-wrap: anywhere; }
.fault-table tbody tr:last-child td { border-bottom: 0; }
.fault-table tbody tr:hover { background: #f7fafc; cursor: pointer; }
.fault-table td strong, .fault-table td small, .fault-table time small { display: block; }
.fault-table td strong { color: #273744; font-size: 10.5px; }
.fault-table td small { margin-top: 3px; color: #7b8791; font-size: 9px; line-height: 1.3; }
.fault-number { color: var(--blue-dark); font-weight: 800; text-decoration: none; }
.mine-badge { margin-top: 4px; width: fit-content; padding: 2px 5px; display: block; border: 1px solid #c8dceb; border-radius: 999px; color: var(--blue-dark); font-size: 8px; font-weight: 700; }
.description-cell { color: #65727d; }
.duration { color: #566570; font-weight: 700; white-space: nowrap; }
.table-footer { min-height: 54px; padding: 8px 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.pagination { display: flex; gap: 4px; }
.pagination a { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #d8e1e7; border-radius: 5px; color: #596874; text-decoration: none; }
.pagination a[aria-current="page"] { border-color: var(--blue); background: var(--blue); color: #fff; font-weight: 700; }
.page-size { justify-self: end; }
.page-size label { display: flex; align-items: center; gap: 7px; }
.page-size select { height: 29px; border: 1px solid #d8e1e7; border-radius: 5px; background: #fff; color: inherit; font-size: 10px; }
.empty-icon { width: 38px; height: 38px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: #eef4f8; color: var(--blue); font-size: 20px; }
.status-guide { margin-top: 12px; padding: 9px 12px; display: flex; flex-wrap: wrap; gap: 11px 22px; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #6c7882; font-size: 9.5px; }
.status-guide > strong { color: #45535f; font-size: 10px; }.status-guide span { display: flex; align-items: center; gap: 6px; }.guide-dot { width: 6px; height: 6px; border-radius: 50%; background: #87939d; }.dot-progress { background: var(--blue); }.dot-wait { background: #d48721; }.dot-success { background: var(--green); }
.queues { display: flex; gap: 6px; margin-bottom: 12px; }.queues a { padding: 7px 10px; border-radius: 6px; background: #fff; font-size: 11px; text-decoration: none; }.queues a[aria-current="page"] { background: var(--blue); color: #fff; }

@media (max-width: 960px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; position: fixed; inset: 0 auto 0 0; z-index: 1001; width: 232px; box-shadow: 8px 0 24px rgb(0 0 0 / 18%); }
    .sidebar.mobile-open { display: flex; }
    .mobile-menu { position: fixed; top: 16px; left: 14px; z-index: 1002; width: 42px; height: 42px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: #fff; border: 1px solid #dce4eb; border-radius: 8px; cursor: pointer; }
    .mobile-menu span { width: 20px; height: 2px; background: var(--navy); }
    .nav-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgb(14 29 42 / 38%); }
    body.nav-open { overflow: hidden; }
    .topbar { padding-left: 70px; }
    .fault-row { grid-template-columns: 96px minmax(170px, 1fr) minmax(190px, 1fr) auto; gap: 13px; }
    .facility-selector { position: static; min-width: 160px; margin-left: auto; transform: none; }
    .fault-filters { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
    .date-range { grid-column: span 2; }
}

@media (max-width: 700px) {
    .topbar { min-height: 70px; padding-right: 14px; }
    .topbar p, .user-area div span { display: none; }
    .topbar-title { display: none; }
    .facility-selector { min-width: 0; flex: 1; margin-left: 0; }
    .user-area strong { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .content { padding: 18px 14px 86px; }
    .page-heading { align-items: flex-start; margin-bottom: 16px; }
    .page-heading h2 { font-size: 19px; }
    .page-heading .primary-button { display: none; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .metric-card { min-height: 82px; padding: 14px 15px; }
    .metric-card strong { font-size: 23px; }
    .panel-heading { min-height: 62px; padding: 13px 14px; }
    .fault-row { position: relative; padding: 14px; grid-template-columns: 1fr auto; gap: 10px 12px; }
    .fault-reference { grid-column: 1; }
    .fault-reference time { margin-top: 3px; }
    .fault-location { grid-column: 1 / -1; }
    .fault-subject { grid-column: 1 / -1; }
    .fault-status { position: absolute; top: 13px; right: 12px; }
    .row-arrow { display: none; }
    .fault-location span, .fault-subject span { margin-bottom: 2px; }
    .mobile-report-button { position: fixed; z-index: 900; right: 14px; bottom: 14px; left: 14px; display: flex; box-shadow: 0 5px 18px rgb(23 50 77 / 18%); }
    .report-card { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .list-heading { align-items: flex-start; flex-direction: column; }
    .fault-filters { grid-template-columns: 1fr 1fr; }
    .filter-search, .date-range { grid-column: 1 / -1; }
    .date-range span { display: none; }
    .clear-button, .new-fault-button { width: 100%; }
    .table-footer { grid-template-columns: 1fr auto; gap: 10px; }
    .pagination { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
    .page-size { grid-column: 2; grid-row: 2; }
}
