:root {
  --ink: #172b45;
  --muted: #60758c;
  --line: #d6e1ec;
  --paper: #ffffff;
  --wash: #eef3f8;
  --green-950: #0b3159;
  --green-900: #104777;
  --green-800: #1d63a3;
  --green-700: #2874b6;
  --green-600: #347fbf;
  --green-100: #e4eef8;
  --mint-100: #e4eef8;
  --lime: #8fb7df;
  --amber: #d69022;
  --red: #bb4b45;
  --blue: #1d63a3;
  --shadow: 0 18px 55px rgba(20, 66, 111, .10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100vh; background: var(--wash); color: var(--ink); font: 15px/1.5 Inter, "Segoe UI", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; padding: 28px 20px; color: #fff; background: linear-gradient(160deg, #0b3159, #14548c 58%, #1d63a3); display: flex; flex-direction: column; z-index: 30; }
.brand { display: grid; gap: 8px; justify-items: center; padding: 0 4px 24px; border-bottom: 1px solid rgba(255,255,255,.16); }
.brand-logo { display: block; width: 205px; max-width: 100%; height: auto; }
.brand-subtitle { color: #c8ddf2; font-size: 11px; letter-spacing: .05em; }
.main-nav { display: grid; gap: 7px; margin-top: 27px; }
.main-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 12px; color: #d2e3f4; font-weight: 650; transition: .18s ease; }
.main-nav a span { width: 22px; text-align: center; font-size: 17px; }
.main-nav a:hover, .main-nav a.active { color: #fff; background: rgba(255,255,255,.11); transform: translateX(2px); }
.main-nav a.active { box-shadow: inset 3px 0 #9fc5e8; }
.sidebar-note { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(0,0,0,.11); }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note small { color: #bed5ea; font-size: 11px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #7ed6aa; box-shadow: 0 0 0 5px rgba(126,214,170,.14); }

.app-shell { min-height: 100vh; margin-left: 260px; }
.topbar { min-height: 104px; padding: 22px clamp(24px, 4vw, 55px); display: flex; align-items: center; gap: 18px; justify-content: space-between; background: rgba(238,243,248,.94); border-bottom: 1px solid rgba(175,195,216,.7); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.topbar h1 { margin: 0; font: 720 clamp(24px, 3vw, 34px)/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.03em; }
.eyebrow { margin: 0 0 4px; color: var(--green-600); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-brand-mobile { display: none; }
.topbar-brand-mobile img { display: block; width: 132px; height: auto; }
.date-chip { padding: 8px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: #fff; font-size: 12px; }
.content { width: min(1500px, 100%); min-height: calc(100vh - 150px); padding: 34px clamp(24px, 4vw, 55px) 45px; }
.footer { padding: 18px 55px 26px; color: #879790; font-size: 12px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border: 1px solid transparent; border-radius: 11px; font-weight: 750; transition: .18s ease; }
.button:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(29,99,163,.16); }
.button.primary { background: var(--green-800); color: #fff; }
.button.secondary { background: #fff; border-color: var(--line); color: var(--green-900); }
.button.danger { color: #fff; background: var(--red); }
.button.compact { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.menu-button { display: none; }

.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.45fr .8fr; gap: 30px; padding: clamp(26px, 4vw, 44px); border-radius: 24px; color: #fff; background: linear-gradient(135deg, #0e477c, #1d63a3); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; width: 330px; height: 330px; border-radius: 50%; right: -110px; top: -160px; border: 55px solid rgba(159,197,232,.14); }
.hero h2 { max-width: 750px; margin: 7px 0 12px; font: 700 clamp(29px, 4vw, 49px)/1.05 Georgia, serif; letter-spacing: -.045em; }
.hero p { max-width: 680px; margin: 0; color: #d8e8f7; font-size: 16px; }
.hero-actions { align-self: end; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; z-index: 1; }
.hero .button.primary { color: #0b3159; background: #b9d6ef; }
.hero .button.secondary { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.24); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.metric-card { padding: 21px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 22px rgba(20,66,111,.05); }
.metric-card .label { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.metric-card .value { display: block; margin: 12px 0 2px; font: 700 35px/1 Georgia, serif; }
.metric-card small { color: var(--muted); }
.metric-card .metric-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--green-100); color: var(--green-800); }

.layout-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 22px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 7px 26px rgba(20,66,111,.05); }
.panel-header { display: flex; justify-content: space-between; gap: 15px; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 16px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 22px; }
.panel + .panel { margin-top: 20px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; color: #5c7590; background: #f1f6fb; font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid #e8eff6; vertical-align: middle; }
tbody tr:hover { background: #f7fafe; }
.table-link { color: var(--green-800); font-weight: 800; }
.cell-title { display: block; font-weight: 750; color: var(--ink); }
.cell-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.empty-state { padding: 42px 24px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { color: #16705b; background: #e3f4ee; }
.badge.warning { color: #9d650e; background: #fff2d8; }
.badge.danger { color: #a43b36; background: #fae6e4; }
.badge.info { color: #2d6d97; background: #e4f0f8; }
.badge.neutral { color: #65736f; background: #edf1ef; }

.filters { display: grid; grid-template-columns: minmax(240px, 1.4fr) repeat(2, minmax(150px, .5fr)) auto; gap: 12px; align-items: end; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #405a75; font-size: 12px; font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #c8d7e6; border-radius: 10px; outline: none; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 115px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(52,127,191,.12); }
.field small { color: var(--muted); font-size: 11px; }
.required::after { content: " *"; color: var(--red); }
.form-section { padding: 23px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin: 0 0 17px; font-size: 15px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 23px; background: #fafcfb; border-radius: 0 0 var(--radius) var(--radius); }

.alert { margin-bottom: 18px; padding: 13px 15px; border-radius: 11px; border: 1px solid; font-weight: 650; }
.alert.success { color: #12604f; border-color: #b9dfd4; background: #e7f5f0; }
.alert.error { color: #963d37; border-color: #edc3bf; background: #fbeceb; }
.alert.warning { color: #855608; border-color: #edd39f; background: #fff4df; }

.quick-list { display: grid; gap: 3px; }
.quick-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #edf2ef; }
.quick-item:last-child { border-bottom: 0; }
.quick-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--green-800); background: var(--green-100); font-weight: 900; }
.quick-item strong, .quick-item small { display: block; }
.quick-item small { color: var(--muted); }
.quick-item time { color: #7c8b86; font-size: 11px; }

.detail-header { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 25px; }
.device-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; color: #fff; background: var(--green-800); font-size: 25px; font-weight: 900; }
.device-photo-link { display: block; width: 92px; height: 92px; border-radius: 18px; overflow: hidden; background: var(--mint-100); border: 1px solid var(--line); }
.device-photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.equipment-photo-control { display: flex; align-items: center; gap: 18px; }
.equipment-photo-preview, .equipment-photo-placeholder { width: 112px; height: 90px; border-radius: 14px; border: 1px solid var(--line); background: var(--mint-100); }
.equipment-photo-preview { display: block; object-fit: cover; }
.equipment-photo-placeholder { display: grid; place-items: center; color: var(--green-800); font-size: 24px; font-weight: 900; }
.equipment-photo-control > div:last-child { flex: 1; }
.detail-header h2 { margin: 0 0 4px; font: 700 28px/1.1 Georgia, serif; }
.detail-header p { margin: 0; color: var(--muted); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.data-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
.data-item { min-height: 86px; padding: 17px 20px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.data-item:nth-child(3n) { border-right: 0; }
.data-item dt { margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.data-item dd { margin: 0; font-weight: 700; word-break: break-word; }

.timeline { position: relative; display: grid; gap: 0; }
.timeline::before { content: ""; position: absolute; left: 18px; top: 10px; bottom: 10px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 25px 51px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: 10px; top: 4px; width: 18px; height: 18px; border: 5px solid #e4eef8; border-radius: 50%; background: var(--green-600); }
.timeline-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #f8fbfe; }
.timeline-card header { display: flex; gap: 10px; justify-content: space-between; align-items: start; }
.timeline-card h4 { margin: 0; font-size: 14px; }
.timeline-card p { margin: 10px 0 0; color: #455d76; white-space: pre-line; }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 11px; }

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 22px; background: rgba(8,34,61,.66); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card { width: min(720px, 100%); max-height: 90vh; overflow: auto; border-radius: 18px; background: #fff; box-shadow: 0 25px 80px rgba(0,0,0,.28); transform: translateY(12px); transition: transform .2s ease; }
.modal.open .modal-card { transform: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 22px; border-top: 1px solid var(--line); background: #fafcfb; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 18px; }
.section-heading h2 { margin: 0; font: 700 25px/1.15 Georgia, serif; }
.section-heading p { margin: 5px 0 0; color: var(--muted); }
.area-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.area-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.area-card header { display: flex; justify-content: space-between; gap: 10px; }
.area-card h3 { margin: 0; font-size: 15px; }
.area-card p { min-height: 42px; margin: 8px 0 17px; color: var(--muted); }
.area-count { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 8px; color: var(--green-800); background: var(--green-100); font-weight: 900; font-size: 12px; }

.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.report-card { min-height: 280px; padding: 26px; display: flex; flex-direction: column; gap: 18px; border: 1px solid var(--line); border-radius: 19px; background: #fff; box-shadow: var(--shadow); }
.report-card.featured { background: linear-gradient(145deg, #104777, #1d63a3); color: #fff; border-color: transparent; }
.report-card.danger-card { border-top: 5px solid var(--red); }
.report-card .eyebrow { margin: 0 0 4px; }
.report-card.featured .eyebrow { color: #b9d6ef; }
.report-card h3 { margin: 0 0 8px; font: 700 27px/1.1 Georgia, serif; }
.report-card p { margin: 0; color: var(--muted); }
.report-card.featured p:not(.eyebrow) { color: #d8e8f7; }
.report-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--green-100); color: var(--green-800); font-size: 22px; font-weight: 900; }
.report-card.featured .report-icon { background: rgba(255,255,255,.13); color: #b9d6ef; }
.report-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: auto; }
.report-card.featured .button.secondary { color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.08); }
.report-card.featured .button.primary { color: #0b3159; background: #b9d6ef; }
.individual-report-form { display: grid; grid-template-columns: minmax(280px, 1fr) auto auto; gap: 18px; align-items: end; }
.checkbox-field { display: flex; align-items: center; gap: 8px; min-height: 43px; color: var(--muted); font-size: 12px; font-weight: 700; }
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--green-700, #176757); }
.report-features { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.report-features div { padding: 16px; border-radius: 12px; background: #f1f6fb; }
.report-features strong, .report-features span { display: block; }
.report-features span { margin-top: 5px; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-grid { grid-template-columns: 1fr; }
  .area-grid { grid-template-columns: repeat(2, 1fr); }
  .individual-report-form { grid-template-columns: 1fr; align-items: stretch; }
  .form-grid.three { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.25); }
  .sidebar.open { transform: none; }
  .app-shell { margin-left: 0; }
  .menu-button { display: grid; }
  .topbar { min-height: 82px; padding: 16px 18px; }
  .topbar-actions .date-chip { display: none; }
  .topbar h1 { font-size: 23px; }
  .content { padding: 24px 17px 35px; }
  .hero { grid-template-columns: 1fr; }
  .hero-actions { justify-content: flex-start; }
  .filters, .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .data-grid { grid-template-columns: repeat(2, 1fr); }
  .data-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .data-item:nth-child(2n) { border-right: 0; }
  .detail-header { grid-template-columns: auto 1fr; }
  .detail-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 520px) {
  .metric-grid, .area-grid, .data-grid { grid-template-columns: 1fr; }
  .report-grid, .report-features { grid-template-columns: 1fr; }
  .data-item { border-right: 0 !important; }
  .topbar-actions .button { width: 40px; overflow: hidden; padding: 0; color: #fff; font-size: 0; }
  .topbar-actions .button::before { content: "+"; color: #fff; font-size: 22px; line-height: 1; }
  .topbar { gap: 12px; }
  .topbar-brand-mobile { display: block; margin-right: auto; padding: 7px 10px; border-radius: 9px; background: #1d63a3; }
  .topbar-title { display: none; }
  .footer { padding: 15px 18px 24px; }
}
.button-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
