:root {
  --color-background: #17191b;
  --color-foreground: #f5f4f1;
  --color-muted: #989da2;
  --color-border: #373b3f;
  --color-surface: #202326;
  --color-primary: #d9272e;
  --color-navy: #151719;
  --color-warning: #e2a94b;
  --color-success: #31b675;
  --color-nav-idle: #c5c9d4;
  --color-nav-active-bg: #ffffff1f;
  --color-input: #24272a;
  --color-white: #ffffff;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-display: "Red Hat Display", "Inter", system-ui, sans-serif;
  --font-nui: "Gotham Condensed", "Inter Tight", "Inter", system-ui, sans-serif;
  --text-label: 11px;
  --text-caption: 13px;
  --text-body: 14px;
  --text-ui: 16px;
  --text-title: 32px;
  --radius-sm: 4px;
  --radius-md: 10px;
  --sidebar-width: 240px;
}

html.theme-light {
  --color-background: #f6f3ee;
  --color-foreground: #202124;
  --color-muted: #656a6f;
  --color-border: #e4e2dc;
  --color-surface: #ffffff;
  --color-navy: #ffffff;
  --color-nav-idle: #4b5056;
  --color-nav-active-bg: #f0ece4;
  --color-input: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

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

img {
  max-width: 100%;
}

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

.shell {
  display: flex;
  min-height: 100vh;
  background: var(--color-background);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-navy);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand img {
  width: 44px;
  height: 60px;
  object-fit: contain;
  object-position: top left;
}

.brand-kicker {
  color: var(--color-muted);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 14px;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--color-nav-idle);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 18px;
}

.nav a .rail {
  width: 3px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 2px;
}

.nav a.is-active {
  background: var(--color-nav-active-bg);
  color: var(--color-white);
  font-weight: 600;
}

html.theme-light .nav a.is-active {
  color: var(--color-foreground);
}

.nav a.is-active .rail {
  background: var(--color-primary);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-foreground);
  width: 100%;
  cursor: pointer;
}

.theme-toggle span {
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.switch {
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: var(--color-border);
  display: flex;
  align-items: center;
  padding: 2px;
  flex-shrink: 0;
}

.switch.on {
  background: var(--color-primary);
  justify-content: flex-end;
}

.switch i {
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: #f5f4f1;
  display: block;
}

.user-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-block strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  color: var(--color-white);
}

html.theme-light .user-block strong {
  color: var(--color-foreground);
}

.user-block .store-name,
.user-block .role-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--color-nav-idle);
}

.user-block .password-link {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  text-decoration: underline;
  text-underline-position: from-font;
  color: var(--color-white);
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

html.theme-light .user-block .password-link {
  color: var(--color-foreground);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 64px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.kicker {
  color: var(--color-primary);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 14px;
  text-transform: uppercase;
  margin: 0 0 8px;
}

h1 {
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 36px;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-foreground);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  cursor: pointer;
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--color-border);
}

.list {
  display: flex;
  flex-direction: column;
}

.list-head,
.list-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 140px 120px 120px 200px;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  min-height: 72px;
}

.list-head {
  min-height: 36px;
}

.list-head span {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 14px;
  text-transform: uppercase;
}

.nui {
  font-family: var(--font-nui);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

.nui.is-empty {
  font-family: var(--font-sans);
  color: var(--color-muted);
  font-size: 14px;
}

.cell-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}

.cell-sub {
  font-size: 13px;
  line-height: 18px;
  color: var(--color-muted);
  margin-top: 2px;
}

.status-warning {
  color: var(--color-warning);
}

.status-success {
  color: var(--color-success);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 14px;
  text-align: center;
  text-transform: uppercase;
}

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

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-muted);
  font-size: 13px;
}

.stepper .is-current {
  color: var(--color-foreground);
  font-weight: 600;
}

.stepper .line {
  width: 48px;
  height: 1px;
  background: var(--color-border);
}

.form {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-nui {
  max-width: 320px;
}

.field > label,
.legend {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.field > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field > select,
.field > textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  background: var(--color-input);
  color: var(--color-foreground);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  outline: none;
}

.field > input::placeholder,
.field > textarea::placeholder {
  color: var(--color-muted);
  opacity: 1;
}

.field > input[type="file"] {
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--color-foreground);
}

.field-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  width: fit-content;
}

.field-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}

.field-check span {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-foreground);
}

.signature-preview {
  max-width: 240px;
  max-height: 80px;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 8px;
}

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

.field > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.field > select:focus,
.field > textarea:focus {
  border-color: #777;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-row label {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-foreground);
}

.choice-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-row input:checked + span,
.choice-row label:has(input:checked) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: #ffffff14;
  border: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 500;
}

html.theme-light .chip {
  background: #f0ece4;
}

.agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-input);
  color: var(--color-foreground);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0;
  text-transform: none;
}

.agent-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.agent-chip:has(input:checked) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.help {
  font-size: 12px;
  line-height: 18px;
  color: var(--color-muted);
  margin: 0;
}

.errorlist {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--color-primary);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 16px;
}

.pair {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.pair dt {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-weight: 600;
}

.pair dd {
  margin: 0;
  font-size: 14px;
  line-height: 22px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline li {
  display: flex;
  gap: 12px;
  color: var(--color-muted);
  font-size: 14px;
  padding: 8px 0;
  list-style: none;
}

.timeline {
  margin: 0;
  padding: 0;
}

.timeline .dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--color-border);
  margin-top: 5px;
  flex-shrink: 0;
}

.timeline .is-current {
  color: var(--color-foreground);
  font-weight: 600;
}

.timeline .is-current .dot {
  background: var(--color-primary);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
}

.revise-form {
  flex-basis: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.change-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.change-list p {
  margin: 0;
}

.files a {
  text-decoration: underline;
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entrega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.entrega-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-input);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.entrega-card img,
.thumb-fallback {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top center;
  background: #111;
}

.thumb-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.entrega-name {
  padding: 10px 12px 12px;
  font-size: 13px;
  line-height: 18px;
  word-break: break-word;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 72px 40px;
  background: #000000d8;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-stage {
  margin: 0;
  width: min(960px, 100%);
  height: min(86vh, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lightbox-pages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lightbox-pages img {
  width: 100%;
  border-radius: var(--radius-md);
  background: #111;
}

.lightbox-caption {
  color: #fff;
  text-align: center;
  font-size: 13px;
  line-height: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lightbox-open {
  color: #fff;
  text-decoration: underline;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: #ffffff1a;
  color: #fff;
  cursor: pointer;
}

.lightbox-close {
  top: 16px;
  right: 16px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.lightbox-nav {
  top: 50%;
  width: 40px;
  height: 40px;
  border-radius: 99px;
  transform: translateY(-50%);
  font-size: 0;
}

.lightbox-nav.is-prev {
  left: 16px;
}

.lightbox-nav.is-next {
  right: 16px;
}

.lightbox-nav.is-prev::before,
.lightbox-nav.is-next::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: 0 auto;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
}

.lightbox-nav.is-prev::before {
  transform: rotate(-135deg);
}

.lightbox-nav.is-next::before {
  transform: rotate(45deg);
}

.entrega-form {
  margin-top: 16px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  padding: 24px 20px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-input);
  color: var(--color-muted);
  text-align: center;
  cursor: pointer;
}

.dropzone.is-over {
  border-color: var(--color-primary);
  color: var(--color-foreground);
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.dropzone-copy {
  font-size: 14px;
  line-height: 22px;
}

.drop-list {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  color: var(--color-foreground);
  font-size: 13px;
  line-height: 20px;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-card .brand {
  margin-bottom: 32px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 40;
}

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
}

.modal h1 {
  font-size: 24px;
  line-height: 28px;
  margin-bottom: 20px;
}

.store-cards {
  display: grid;
  gap: 12px;
}

.store-card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
}

.store-card:has(input:checked) {
  border-color: var(--color-primary);
}

.store-card.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.store-card input {
  margin-right: 8px;
}

.note {
  font-size: 13px;
  line-height: 20px;
  color: var(--color-muted);
}

.hidden {
  display: none !important;
}

.empty {
  color: var(--color-muted);
  font-size: 14px;
}

@media (max-width: 1100px) {
  .list-head,
  .list-row {
    grid-template-columns: 1fr 110px 90px 90px 180px;
  }
}

@media (max-width: 800px) {
  .shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
  }

  .main {
    padding: 24px;
  }

  .detail-grid,
  .list-head,
  .list-row {
    display: block;
  }

  .row-2 {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .list-head {
    display: none;
  }

  .list-row {
    padding: 16px 0;
  }
}
