:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --text: #1f2933;
  --muted: #66717d;
  --line: #d7dfe7;
  --nav: #182230;
  --nav-2: #223045;
  --green: #1f7a5c;
  --green-soft: #e7f5ee;
  --blue: #1f5f91;
  --blue-soft: #e8f1ff;
  --amber: #9b6500;
  --amber-soft: #fff4dd;
  --red: #a73535;
  --red-soft: #ffe8e8;
  --shadow: 0 18px 60px rgba(24, 34, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Helvetica Neue", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.no-script {
  max-width: 420px;
  margin: 80px auto;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 236px;
  justify-content: center;
  align-items: center;
  gap: 40px;
  padding: 40px;
}

.login-card {
  width: min(100%, 420px);
  max-width: 420px;
  min-width: 0;
  justify-self: center;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lock-mark {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 18px;
  font-weight: 700;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 28px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.login-card__subtitle {
  margin: 12px 0 26px;
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field span {
  font-size: 13px;
  font-weight: 700;
  color: #384555;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 7px;
  padding: 12px 13px;
  background: #fbfcfd;
  color: var(--text);
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(31, 95, 145, 0.14);
  border-color: var(--blue);
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.tab-btn,
.nav-btn {
  min-height: 40px;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
}

.secondary-btn {
  background: var(--green);
  color: #fff;
}

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

.ghost-btn {
  background: #edf2f6;
  color: #344150;
}

.link-btn {
  min-height: 40px;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.login-footer {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-error {
  display: none;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.login-error.is-visible {
  display: block;
}

.prototype-phone {
  width: 236px;
  padding: 12px;
  border-radius: 28px;
  background: #121820;
}

.prototype-phone__screen {
  min-height: 458px;
  padding: 26px 20px;
  border-radius: 20px;
  background: #f8fafc;
}

.prototype-phone h2 {
  margin: 88px 0 12px;
  font-size: 22px;
  line-height: 1.2;
}

.prototype-phone p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  min-height: 100vh;
  background: var(--nav);
  color: #dce5ee;
  padding: 20px 14px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 24px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #2f7db3;
  color: #fff;
  font-weight: 700;
}

.brand__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.brand__subtitle {
  margin: 2px 0 0;
  color: #9fb0c3;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  color: #dce5ee;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.is-active {
  background: var(--nav-2);
}

.nav-count {
  min-width: 26px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #314259;
  color: #dce5ee;
  font-size: 12px;
  text-align: center;
}

.sidebar-foot {
  margin-top: 28px;
  padding: 14px 10px;
  border-top: 1px solid #2d3a4b;
  color: #9fb0c3;
  font-size: 12px;
  line-height: 1.5;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
}

.session-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role-select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel);
}

.session-user {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: #344150;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric__label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.metric__value {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel__head h2 {
  margin: 0;
  font-size: 18px;
}

.panel__body {
  padding: 16px 18px;
}

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

.quick-action {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 12px;
  color: #fff;
  text-align: left;
}

.quick-action strong {
  display: block;
  font-size: 15px;
}

.quick-action span {
  font-size: 12px;
  opacity: 0.85;
}

.quick-action.scan {
  background: #123a5d;
}

.quick-action.container {
  background: #176b55;
}

.quick-action.task {
  background: #6a4b16;
}

.quick-action.problem {
  background: #7b2d36;
}

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

.empty-state {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
}

.row-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.row-card h3 {
  margin: 0;
  font-size: 16px;
}

.row-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.green {
  background: var(--green-soft);
  color: var(--green);
}

.badge.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.red {
  background: var(--red-soft);
  color: var(--red);
}

.split-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.split-controls input,
.split-controls select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel);
}

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

.container-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.container-card h3 {
  margin: 0;
  font-size: 16px;
}

.container-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 10px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.container-card dt,
.container-card dd {
  margin: 0;
}

.container-card dd {
  color: var(--text);
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-time {
  color: var(--muted);
  font-weight: 700;
}

.no-access {
  max-width: 560px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.no-access h2 {
  margin: 0 0 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(14, 21, 31, 0.52);
  z-index: 20;
}

.modal-backdrop.is-open {
  display: grid;
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal__head,
.modal__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal__foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal h2 {
  margin: 0;
  font-size: 19px;
}

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

.preview-table th,
.preview-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.preview-table th {
  width: 38%;
  color: var(--muted);
  font-weight: 700;
}

.bottom-nav {
  display: none;
}

@media (max-width: 980px) {
  .login-page {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .prototype-phone {
    display: none;
  }

  .login-card {
    width: min(100%, 360px);
    max-width: 360px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-area {
    padding: 18px 14px 88px;
  }

  .topbar {
    display: grid;
  }

  .session-panel {
    justify-content: flex-start;
  }

  .metrics,
  .layout,
  .container-grid {
    grid-template-columns: 1fr;
  }

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

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 10px 10px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    z-index: 10;
  }

  .bottom-nav .nav-btn {
    display: grid;
    justify-content: center;
    min-height: 44px;
    padding: 0 8px;
    color: var(--muted);
    background: transparent;
    font-size: 12px;
  }

  .bottom-nav .nav-btn.is-active {
    color: var(--blue);
    background: var(--blue-soft);
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 20px 14px;
    overflow-x: hidden;
  }

  .login-card {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    padding: 24px 18px;
  }

  .login-card h1 {
    font-size: 24px;
  }

  .login-actions {
    display: grid;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .metric__value {
    font-size: 26px;
  }

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

  .split-controls {
    display: grid;
  }
}
