:root {
  --ink: #10151a;
  --muted: #67717b;
  --line: #d8dde2;
  --paper: #f4f5f6;
  --panel: #ffffff;
  --brand: #cf2029;
  --brand-dark: #a81720;
  --brand-soft: #fce8e9;
  --steel: #2c333a;
  --steel-soft: #eceff1;
  --danger: #cf2029;
  --amber: #f2b705;
  --green: #287345;
  --shadow: 0 18px 40px rgba(16, 21, 26, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  align-items: center;
  background: var(--ink);
  border-bottom: 3px solid var(--brand);
  color: #fff;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(230px, 1fr) auto minmax(180px, auto);
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 42px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.user-menu,
.nav,
.photo-actions,
.filter-form {
  align-items: center;
  display: flex;
}

.brand {
  gap: 12px;
}

.brand-icon {
  align-items: center;
  background: var(--brand);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand small,
.hint,
.page-title p,
.metric-row small,
.photo-meta small,
.list-item span,
.dropzone span {
  color: var(--muted);
}

.topbar .brand small,
.topbar .user-menu {
  color: rgba(255, 255, 255, 0.72);
}

.brand span:last-child {
  display: grid;
  gap: 2px;
}

.nav {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  gap: 4px;
  padding: 4px;
}

.nav a {
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.72);
  padding: 9px 12px;
  white-space: nowrap;
}

.nav a.active {
  background: var(--brand);
  box-shadow: 0 1px 4px rgba(16, 21, 26, 0.24);
  color: #fff;
}

.user-menu {
  gap: 10px;
  justify-content: end;
}

.layout {
  margin: 0 auto;
  max-width: 1220px;
  padding: 28px clamp(16px, 4vw, 42px) 52px;
}

.login-layout {
  min-height: 100vh;
  padding: clamp(22px, 5vw, 64px);
}

.login-panel {
  align-items: stretch;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.1fr) minmax(310px, 430px);
  margin: 0 auto;
  max-width: 980px;
  min-height: calc(100vh - 128px);
}

.login-copy {
  background:
    linear-gradient(135deg, rgba(207, 32, 41, 0.94), rgba(16, 21, 26, 0.95)),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(255, 255, 255, 0.12) 25px);
  align-items: flex-start;
  border-radius: 8px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: clamp(28px, 6vw, 54px);
  position: relative;
  text-align: left;
}

.login-copy h1 {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1;
  margin: 0 0 18px;
}

.login-copy p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.55;
  margin: 0;
  max-width: 540px;
}

.card,
.info-panel,
.list-panel,
.empty-state,
.photo-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card,
.card {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.login-card {
  align-self: center;
}

label {
  color: #2c333a;
  display: grid;
  gap: 7px;
  font-weight: 700;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #cfd6de;
  border-radius: 7px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(207, 32, 41, 0.14);
  outline: 0;
}

.primary-button,
.secondary-button,
.icon-button {
  align-items: center;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
}

.primary-button {
  background: var(--brand);
  color: #fff;
  min-height: 46px;
  padding: 11px 16px;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: var(--steel-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 40px;
  padding: 9px 13px;
}

.icon-button {
  background: var(--steel-soft);
  color: var(--ink);
  height: 40px;
  width: 40px;
}

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

.flash {
  align-items: center;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 14px;
}

.flash.success {
  background: #e9f4eb;
  border: 1px solid #c9e2cf;
  color: var(--green);
}

.flash.error {
  background: var(--brand-soft);
  border: 1px solid #f0b8bc;
  color: var(--danger);
}

.rule-alert {
  align-items: flex-start;
  background: #fff8df;
  border: 1px solid #efd77d;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 12px;
}

.rule-alert svg {
  color: var(--brand);
  flex: 0 0 auto;
  margin-top: 2px;
}

.rule-alert div {
  display: grid;
  gap: 4px;
}

.rule-alert span {
  color: #5f5362;
  line-height: 1.4;
}

.page-title {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-title h1,
.section-head h2 {
  margin: 0;
}

.page-title p {
  color: var(--brand);
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

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

.two-columns {
  grid-template-columns: minmax(0, 1fr) minmax(290px, 380px);
}

.dropzone {
  align-items: center;
  background: linear-gradient(180deg, #fff, #fafafa);
  border: 2px dashed #b9c0c7;
  border-radius: 8px;
  cursor: pointer;
  justify-items: center;
  min-height: 168px;
  padding: 24px;
  text-align: center;
}

.dropzone input,
.position-card input {
  height: 1px;
  opacity: 0;
  padding: 0;
  position: absolute;
  width: 1px;
}

.field-group {
  display: grid;
  gap: 12px;
}

.field-group p {
  color: var(--muted);
  line-height: 1.45;
  margin: 4px 0 0;
}

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

.position-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 14px;
  position: relative;
}

.position-card:active {
  transform: translateY(1px);
}

.position-card:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(207, 32, 41, 0.08);
}

.position-card svg {
  color: var(--brand);
}

.position-card span {
  font-weight: 900;
}

.position-card small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.position-preview {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  display: block;
  grid-column: 1 / -1;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.selected-files {
  display: grid;
  gap: 8px;
}

.file-chip {
  align-items: center;
  background: #f7f8f9;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
}

.check-row {
  align-items: center;
  display: flex;
  gap: 10px;
  font-weight: 700;
}

.check-row input {
  min-height: auto;
  width: auto;
}

.is-hidden {
  display: none;
}

.info-panel {
  align-content: start;
  display: grid;
  gap: 18px;
  padding: 22px;
}

.info-panel h2 {
  margin: 0;
}

.info-panel p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.metric-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  padding-top: 18px;
}

.metric-row span {
  color: var(--brand);
  font-size: 38px;
  font-weight: 900;
}

.section-head {
  margin: 34px 0 14px;
}

.photo-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.photo-card {
  overflow: hidden;
}

.photo-thumb {
  aspect-ratio: 4 / 3;
  background: var(--steel);
  display: block;
  overflow: hidden;
}

.photo-thumb img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.photo-meta {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.photo-title {
  align-items: start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 8px;
  white-space: nowrap;
}

.badge.problem {
  background: var(--brand-soft);
  color: var(--danger);
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.problem-text {
  background: #fff8df;
  border: 1px solid #efd77d;
  border-radius: 7px;
  line-height: 1.45;
  margin: 0;
  padding: 10px;
}

.photo-actions {
  border-top: 1px solid var(--line);
  gap: 10px;
  justify-content: space-between;
  padding-top: 12px;
}

.photo-actions span {
  color: var(--muted);
  font-size: 13px;
}

.filter-form {
  gap: 10px;
}

.list-panel {
  align-content: start;
  display: grid;
  overflow: hidden;
}

.list-item {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 74px;
  padding: 14px 16px;
}

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

.list-item div {
  display: grid;
  gap: 3px;
}

.empty-state {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 36px;
}

svg {
  height: 18px;
  width: 18px;
}

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

  .topbar {
    position: static;
  }

  .nav,
  .user-menu,
  .page-title,
  .filter-form {
    justify-content: start;
  }

  .nav,
  .page-title,
  .filter-form {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .login-panel {
    min-height: auto;
  }

  .login-copy {
    min-height: 340px;
  }

  .info-panel {
    order: -1;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .layout,
  .login-layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .layout {
    padding-top: 18px;
  }

  .login-layout {
    padding-top: 14px;
  }

  .login-panel {
    gap: 14px;
  }

  .login-copy {
    min-height: 220px;
    padding: 26px 22px;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .login-copy p {
    font-size: 16px;
  }

  .card,
  .info-panel {
    padding: 16px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 50px;
  }

  .primary-button {
    min-height: 54px;
    width: 100%;
  }

  .secondary-button {
    min-height: 46px;
  }

  .upload-form .primary-button {
    bottom: 10px;
    box-shadow: 0 12px 28px rgba(16, 21, 26, 0.24);
    position: sticky;
    z-index: 5;
  }

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

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

  .position-card {
    align-items: center;
    grid-template-columns: 24px 1fr 72px;
    min-height: 86px;
  }

  .position-card small {
    grid-column: 2;
  }

  .position-preview {
    grid-column: 3;
    grid-row: 1 / span 2;
    height: 62px;
    width: 72px;
  }

  .dropzone {
    min-height: 118px;
    padding: 18px;
  }

  .rule-alert {
    padding: 12px;
  }

  .page-title {
    align-items: stretch;
    flex-direction: column;
  }

  .page-title h1 {
    font-size: 26px;
  }

  .topbar {
    gap: 12px;
    padding: 12px 14px;
  }

  .brand-icon {
    height: 38px;
    width: 38px;
  }

  .nav {
    overflow-x: auto;
    width: 100%;
  }

  .user-menu {
    justify-content: space-between;
  }
}
