:root {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e2ec;
  --blue: #981b1f;
  --blue-2: #d7252b;
  --cyan: #e33136;
  --gold: #c7a24a;
  --green: #0f766e;
  --red: #b42318;
  --shadow: 0 18px 46px rgba(91, 15, 18, .13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 460px);
}

.login-art {
  min-height: 620px;
  padding: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(15, 47, 99, .94), rgba(0, 163, 173, .72)),
    radial-gradient(circle at 80% 12%, rgba(199, 162, 74, .34), transparent 32%),
    #0f2f63;
}

.login-art h1 {
  max-width: 780px;
  margin: 0 0 18px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .95;
}

.login-art p {
  max-width: 650px;
  color: rgba(255, 255, 255, .88);
  font-size: 18px;
  line-height: 1.6;
}

.login-panel {
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-panel h2,
.topbar h1,
.panel h2 {
  margin: 0;
}

.logo-line,
.brand,
.action-row,
.panel-head,
.record-card,
.record-actions,
.mini-actions {
  display: flex;
  align-items: center;
}

.logo-line,
.brand {
  gap: 12px;
}

.engie-logo,
.argos-logo {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0;
}

.argos-logo {
  color: #fff;
  background: var(--blue);
}

.light {
  border-color: rgba(255,255,255,.46);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #08162f;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}

.brand small,
.muted,
.record-card p,
.notice p,
.metric small,
.empty,
.tip p {
  color: var(--muted);
}

.logo-stack {
  display: grid;
  gap: 6px;
}

.logo-stack .engie-logo,
.logo-stack .argos-logo {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
}

.brand small {
  display: block;
  color: rgba(255,255,255,.68);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  color: rgba(255,255,255,.78);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255,255,255,.12);
}

.user-card {
  margin-top: auto;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255,255,255,.09);
  display: grid;
  gap: 8px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar,
.content-grid,
.chat-layout,
.form-row,
.locked-grid,
.scale-grid,
.photo-grid,
.metrics {
  display: grid;
  gap: 18px;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.metric,
.panel,
.scale-card,
.record-card,
.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 20px;
  display: grid;
  gap: 6px;
}

.metric strong {
  font-size: 36px;
  color: var(--blue);
}

.content-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
}

.panel {
  padding: 22px;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  box-shadow: 0 12px 24px rgba(15, 47, 99, .22);
}

.btn.ghost {
  color: var(--blue);
  background: #edf3fb;
}

.prime-login {
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 82% 18%, rgba(227, 49, 54, .28), transparent 30%),
    linear-gradient(135deg, #24080a, #651116 55%, #991b20);
}

.prime-login-card {
  position: relative;
  width: min(420px, 100%);
  min-height: 500px;
  padding: 96px 34px 34px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  color: #fff;
  background: #21191b;
  box-shadow: 0 28px 80px rgba(0,0,0,.38);
}

.prime-login-card h2 {
  text-align: center;
  font-size: 30px;
}

.login-prime-logo {
  position: absolute;
  top: -54px;
  left: 50%;
  width: 170px;
  height: 120px;
  padding: 10px;
  object-fit: contain;
  transform: translateX(-50%);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 15px 35px rgba(0,0,0,.25);
}

.login-subtitle {
  margin: 8px 0 24px;
  text-align: center;
  color: #d6c7c8;
}

.prime-login-card label {
  color: #f8eeee;
}

.prime-login-card input {
  border-color: #d8c4c6;
  background: #fff7f7;
}

.login-footer {
  display: block;
  margin-top: 24px;
  text-align: center;
  color: #a99597;
}

.sidebar {
  background: linear-gradient(180deg, #26080a, #5b1014 58%, #7f151a);
}

.prime-brand-logo {
  width: 82px;
  height: 58px;
  padding: 5px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.btn.primary {
  background: linear-gradient(135deg, #a51d22, #e33136);
  box-shadow: 0 12px 24px rgba(165, 29, 34, .25);
}

.btn.ghost {
  color: #8f181d;
  background: #fff0f1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #d7252b;
  box-shadow: 0 0 0 3px rgba(215, 37, 43, .16);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.users-table th,
.users-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.users-table th {
  color: #7b6670;
  font-size: 12px;
  background: #fff8f8;
}

.users-table td:nth-child(2) {
  display: grid;
  gap: 4px;
}

.status-pill,
.developer-badge {
  display: inline-flex;
  width: fit-content;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.status-pill.active {
  color: #067647;
  border: 1px solid #12b76a;
  background: #ecfdf3;
}

.status-pill.inactive {
  color: #b42318;
  border: 1px solid #f04438;
  background: #fef3f2;
}

.developer-badge {
  color: #9b1c21;
  background: #fff0f1;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: #6b7280;
  font-weight: 900;
}

.icon-btn.edit {
  background: #c52228;
}

.icon-btn.danger {
  background: #ef3340;
}

.icon-btn:disabled {
  cursor: not-allowed;
  opacity: .35;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(26, 4, 6, .68);
}

.modal-card {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.35);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.permission-grid legend {
  padding: 0 8px;
  color: #8f181d;
  font-weight: 900;
}

.permission-option,
.switch-line {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.permission-option input,
.switch-line input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #c52228;
}

@media (max-width: 700px) {
  .prime-login {
    padding: 72px 18px 18px;
  }

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

.btn.danger {
  color: #fff;
  background: var(--red);
  box-shadow: 0 10px 22px rgba(180, 35, 24, .18);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .5;
  transform: none;
  box-shadow: none;
}

.full {
  width: 100%;
}

.form,
.route-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 163, 173, .18);
}

input[readonly] {
  background: #f4f7fb;
  color: #475467;
}

textarea {
  resize: vertical;
}

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

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

.chat-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
}

.chat-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.bot-message {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 8px;
  background: #eef8fa;
}

.bot-message p {
  margin: 5px 0 0;
  color: #475467;
  line-height: 1.55;
}

.bot-avatar {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: #fff;
  font-weight: 900;
}

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

.photo-box {
  min-height: 170px;
  border: 1px dashed #aebdcc;
  border-radius: 8px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  color: var(--blue);
}

.photo-box span {
  display: grid;
  gap: 6px;
  justify-items: center;
  line-height: 1.35;
}

.photo-box small {
  color: #667085;
  font-weight: 800;
}

.photo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.photo-action {
  position: relative;
  overflow: hidden;
  min-height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #edf3fb;
  color: var(--blue);
  font-weight: 900;
  font-size: 12px;
}

.photo-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-box img {
  width: 100%;
  height: 136px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.photo-box input {
  margin-top: 8px;
  padding: 8px;
  font-size: 12px;
}

.camera-panel {
  display: grid;
  gap: 12px;
}

.camera-preview {
  min-height: 220px;
  border: 1px dashed #aebdcc;
  border-radius: 8px;
  background: #f8fafc;
  color: #475467;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 12px;
  text-align: center;
  font-weight: 800;
}

.camera-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.km-card {
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: center;
}

.km-card img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.km-summary-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.km-summary {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.km-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.km-summary p {
  margin: 8px 0 0;
  color: #475467;
  font-weight: 700;
}

.km-summary h3 {
  margin: 10px 0 0;
  color: var(--blue);
}

.records-folder {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.records-folder summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--blue);
  font-weight: 900;
}

.folder-content {
  padding: 0 16px 16px;
}

.tag-record-list {
  display: grid;
  gap: 12px;
}

.tag-record-folder {
  overflow: hidden;
}

.tag-record-folder summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #f8fafc;
  border-bottom: 1px solid transparent;
}

.tag-record-folder[open] summary {
  border-bottom-color: var(--line);
}

.tag-record-folder summary span {
  display: grid;
  gap: 3px;
}

.tag-record-folder summary small {
  color: var(--muted);
  font-weight: 700;
}

.tag-folder-content {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.record-export-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .7fr);
  gap: 24px;
  align-items: center;
  border-left: 5px solid var(--cyan);
}

.record-export-copy p:last-child {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.record-export-summary {
  display: grid;
  gap: 7px;
  justify-items: end;
  text-align: right;
}

.record-export-summary small {
  color: var(--muted);
  font-weight: 800;
}

.record-export-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.tag-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(5, minmax(126px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.scale-management {
  align-items: start;
}

.employee-list {
  display: grid;
  gap: 12px;
}

.employee-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafa;
}

.employee-card h3 {
  margin: 8px 0 4px;
}

.employee-card p {
  margin: 0 0 4px;
  color: var(--muted);
}

.employee-card small {
  color: var(--muted);
}

.tag-filter-actions,
.tag-selection-actions {
  display: flex;
  gap: 8px;
}

.tag-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #c9e8eb;
  border-radius: 8px;
  background: #f3fbfc;
}

.tag-selection-bar > div:first-child {
  display: grid;
  gap: 3px;
}

.tag-selection-bar small {
  color: var(--muted);
  font-weight: 700;
}

.checklist {
  position: sticky;
  top: 22px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: #475467;
  font-weight: 700;
}

.check-item.ok {
  color: var(--green);
}

.tip {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #fff7e0;
}

.record-card {
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: none;
}

.record-card.selected {
  border-color: var(--cyan);
  background: #f0fbfc;
  box-shadow: 0 0 0 2px rgba(0, 163, 173, .12);
}

.record-select {
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 9px;
  align-self: stretch;
  padding-right: 14px;
  border-right: 1px solid var(--line);
  color: var(--blue);
}

.record-select input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cyan);
}

.record-select input:disabled + span {
  color: var(--muted);
}

.record-card h3 {
  margin: 9px 0 5px;
}

.record-card p {
  margin: 0;
}

.record-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

.record-actions {
  gap: 10px;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: #e8eef7;
  font-weight: 900;
  font-size: 12px;
}

.filters {
  display: flex;
  gap: 10px;
}

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

.scale-card {
  padding: 16px;
  box-shadow: none;
  display: grid;
  gap: 14px;
}

.notice {
  padding: 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  box-shadow: none;
}

.notice p {
  margin: 7px 0;
  line-height: 1.55;
}

.attachment-link,
.attachment-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #edf3fb;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.attachment-preview {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.notice-image-link {
  display: inline-grid;
  gap: 6px;
  max-width: min(100%, 360px);
  margin: 8px 10px 8px 0;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.notice-image {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f7fa;
}

.km-card.historical {
  opacity: 0.72;
  border-style: dashed;
  background: #f8f8f8;
}

.link {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
}

.danger-text {
  color: var(--red);
}

.alert {
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0;
}

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

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

@media (max-width: 1180px) {
  .metrics,
  .scale-grid,
  .photo-grid,
  .tag-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-layout,
  .content-grid,
  .record-export-panel {
    grid-template-columns: 1fr;
  }

  .record-export-summary {
    justify-items: start;
    text-align: left;
  }

  .checklist {
    position: static;
  }
}

@media (max-width: 860px) {
  .login,
  .shell {
    grid-template-columns: 1fr;
  }

  .login-art {
    min-height: auto;
    padding: 34px 24px;
    gap: 64px;
  }

  .login-panel,
  .main {
    padding: 22px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

  .form-row,
  .locked-grid,
  .metrics,
  .scale-grid,
  .photo-grid,
  .tag-filter-grid {
    grid-template-columns: 1fr;
  }

  .record-card,
  .notice,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .record-select {
    width: 100%;
    min-width: 0;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .record-actions,
  .filters,
  .tag-filter-actions,
  .tag-selection-actions,
  .record-export-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .tag-selection-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-card {
    align-items: stretch;
    flex-direction: column;
  }
}
