:root {
  --navy: #0b1f33;
  --blue: #1769aa;
  --cyan: #1c9ab7;
  --yellow: #f5b301;
  --green: #168244;
  --red: #b3261e;
  --ink: #162033;
  --muted: #637083;
  --line: #d9e1ea;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --soft: #eaf3fa;
  --radius: 8px;
  font-family: Cambria, Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--navy);
  color: white;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 22px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand img {
  background: white;
  border-radius: 6px;
  height: 42px;
  object-fit: contain;
  padding: 4px;
  width: 92px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
}

.brand-subtitle {
  color: #c7d7e8;
  font-size: 12px;
  margin-top: 2px;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.user-badge {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #e5edf6;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  white-space: nowrap;
}

.sync-badge {
  background: rgba(28, 154, 183, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #e5edf6;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  white-space: nowrap;
}

.top-actions button {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 18px;
}

.login-page {
  align-items: center;
  background: linear-gradient(120deg, #0b1f33 0%, #11385a 48%, #f4f7fb 48%);
  display: flex;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(11, 31, 51, 0.18);
  margin: 0 auto;
  max-width: 430px;
  padding: 28px;
  width: 100%;
}

.login-panel img {
  display: block;
  height: 110px;
  margin: 0 auto 12px;
  object-fit: contain;
  width: min(240px, 100%);
}

.login-panel h1,
.login-panel p {
  text-align: center;
}

.login-panel p {
  line-height: 1.45;
  margin: 8px auto 18px;
  max-width: 340px;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #344256;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

.inline-field {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 84px;
}

.percent-control {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, 1fr) 82px;
}

.percent-control input[type="range"] {
  accent-color: var(--navy);
  min-height: 28px;
  padding: 0;
}

.percent-box {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  overflow: hidden;
}

.percent-box input {
  border: 0;
  min-height: 40px;
  padding-right: 4px;
  text-align: right;
}

.percent-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.other-equipment-input {
  margin-top: 8px;
}

.equipment-picker {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.selected-equipment-list {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  min-height: 42px;
  padding: 8px;
}

.selected-equipment-list.empty-selection {
  background: #f8fafc;
}

.selection-chip {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 6px;
  min-height: 28px;
  padding: 4px 6px 4px 10px;
}

.selection-chip button {
  border-radius: 999px;
  font-size: 12px;
  min-height: 22px;
  padding: 0 7px;
}

.activity-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.hidden {
  display: none;
}

.activity-picker {
  margin-bottom: 10px;
}

.safety-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.check-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-item {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  padding: 9px;
}

.check-item input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.primary {
  background: var(--navy);
  color: white;
}

.secondary {
  background: var(--soft);
  color: var(--navy);
}

.ghost {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.danger {
  background: #fff1ef;
  color: var(--red);
}

.hero-strip,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.hero-strip {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 18px;
}

.hero-strip p {
  margin: 6px 0 0;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
}

.compact-input {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
  width: 150px;
}

.metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cyan);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 92px;
  padding: 14px;
  text-align: left;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 5px;
}

.metric-button:hover {
  border-color: var(--blue);
  box-shadow: 0 6px 18px rgba(23, 105, 170, 0.12);
}

.content-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.25fr 0.75fr;
}

.panel {
  padding: 16px;
}

.panel-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.list {
  display: grid;
  gap: 10px;
}

.unit-row,
.action-row {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.report-row {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.report-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  justify-content: flex-start;
  padding-top: 8px;
}

.report-actions button,
.compact-button {
  border-radius: 7px;
  font-size: 12px;
  min-height: 30px;
  padding: 6px 9px;
}

.unit-row:hover,
.report-row:hover,
.action-row:hover {
  border-color: var(--blue);
}

.unit-title,
.report-title {
  font-weight: 800;
}

.unit-meta,
.report-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.status-control {
  margin-bottom: 12px;
}

.operating-form {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
  padding-bottom: 14px;
}

.operating-form .toolbar {
  grid-column: 1 / -1;
}

.chip {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}

.chip.green {
  background: #e8f6ee;
  color: var(--green);
}

.chip.yellow {
  background: #fff6dc;
  color: #8a5c00;
}

.chip.gray {
  background: #eef2f6;
  color: #526071;
}

.chip.red {
  background: #fdecea;
  color: var(--red);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.tabs button {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.tabs button.active {
  background: var(--navy);
  color: white;
}

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 0.8fr 1.2fr;
}

.info-table {
  border-collapse: collapse;
  width: 100%;
}

.info-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  vertical-align: top;
}

.info-table td:first-child {
  color: var(--muted);
  font-weight: 700;
  padding-right: 14px;
  width: 42%;
}

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

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

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.modal-backdrop {
  align-items: center;
  background: rgba(10, 20, 33, 0.55);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 20;
}

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28);
  max-height: 88vh;
  max-width: 940px;
  overflow: auto;
  padding: 18px;
  width: 100%;
}

.modal pre {
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.client-report {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.client-report-header {
  align-items: center;
  border-bottom: 3px solid var(--navy);
  display: flex;
  gap: 18px;
  padding-bottom: 16px;
}

.client-report-header img {
  height: 66px;
  object-fit: contain;
  width: 150px;
}

.client-report-header p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
}

.client-report-header h1 {
  font-size: 25px;
  margin: 3px 0;
}

.client-report-header span {
  color: var(--blue);
  font-weight: 800;
}

.client-report-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 16px 0;
}

.client-report-summary.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-report-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.client-report-summary span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.client-report-summary strong {
  display: block;
  margin-top: 4px;
}

.client-report-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.client-report-section h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.client-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 12px;
}

.client-detail h3 {
  color: var(--navy);
  font-size: 13px;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.client-detail p {
  margin: 0;
}

.picture-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin: 12px 0;
}

.picture-thumb {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0;
  overflow: hidden;
}

.picture-thumb img {
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  width: 100%;
}

.picture-thumb figcaption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  padding: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picture-thumb p {
  color: var(--ink);
  font-size: 12px;
  margin: 0;
  padding: 0 8px 8px;
}

@media (max-width: 860px) {
  .topbar,
  .hero-strip,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .content-grid,
  .detail-grid,
  .report-form,
  .operating-form {
    grid-template-columns: 1fr;
  }

  .unit-row,
  .report-row,
  .action-row,
  .inline-field,
  .percent-control,
  .equipment-picker,
  .check-grid,
  .client-report-summary,
  .client-report-summary.compact {
    grid-template-columns: 1fr;
  }

  .client-report-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-page {
    background: var(--bg);
  }
}
