:root {
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.82);
  --ink: #161616;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --soft-line: rgba(0, 0, 0, 0.06);
  --accent: #0a84ff;
  --accent-ink: #fff;
  --danger: #ff453a;
  --warn-bg: #fff1e8;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.1);
  --radius: 18px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 0%, rgba(10, 132, 255, 0.12), transparent 34%),
    linear-gradient(135deg, #f7f7f9 0%, #eef0f3 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 18px;
  border-bottom: 1px solid var(--soft-line);
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  width: 86px;
  height: auto;
  display: block;
}

.brand-title {
  display: flex;
  align-items: center;
}

.brand-title strong {
  font-size: 13px;
}

.brand-title span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 5px 4px 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  font-size: 13px;
}

.layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 14px 18px 34px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.toolbar-left,
.toolbar-right,
.inline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.select-wrap {
  position: relative;
}

.status-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  justify-content: space-between;
  color: var(--ink);
  background: var(--panel);
  border: 0;
  border-radius: 999px;
  padding: 9px 13px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

.dropdown,
.columns-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  min-width: 340px;
  max-width: min(440px, calc(100vw - 36px));
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 14px;
}

.dropdown {
  left: 0;
  right: auto;
}

.dropdown button,
.columns-popover button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  background: transparent;
  border-radius: 12px;
  padding: 9px 10px;
  text-align: left;
}

.dropdown button:hover,
.columns-popover button:hover {
  background: #f0f0f2;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  padding: 0 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border: 0;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.55);
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
  color: var(--ink);
}

.toolbar .icon-btn[data-action="toggle-columns"] {
  width: 28px;
  height: 28px;
  background: transparent;
  box-shadow: none;
  opacity: 0.72;
}

.toolbar .icon-btn[data-action="toggle-columns"]:hover {
  opacity: 1;
  background: transparent;
}

.table-shell {
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.06);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  border-bottom: 1px solid var(--soft-line);
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.orders-table th {
  background: rgba(248, 248, 250, 0.96);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.orders-table col.col-select {
  width: 38px;
}

.orders-table col.col-number {
  width: 96px;
}

.orders-table col.col-customerName {
  width: 142px;
}

.orders-table col.col-items {
  width: auto;
}

.orders-table col.col-customerComment,
.orders-table col.col-operatorComment {
  width: 150px;
}

.orders-table col.col-statusLabel,
.orders-table col.col-delivery,
.orders-table col.col-createdAt,
.orders-table col.col-updatedAt {
  width: 130px;
}

.orders-table col.col-address {
  width: 220px;
}

.orders-table tr {
  transition: background 180ms ease, box-shadow 180ms ease;
}

.orders-table tbody tr:hover {
  background: rgba(10, 132, 255, 0.06);
}

.orders-table tr.updated {
  animation: pulseRow 2s ease;
}

@keyframes pulseRow {
  0% { background: rgba(10, 132, 255, 0.18); }
  100% { background: transparent; }
}

.number-cell {
  display: grid;
  gap: 2px;
  font-weight: 600;
  white-space: nowrap;
}

.urgent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-radius: 999px;
  color: #b42318;
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 500;
}

.thumb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 78px;
  flex-wrap: wrap;
}

.thumb {
  width: 76px;
  height: 76px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
}

.thumb.placeholder {
  background: linear-gradient(135deg, #f2f2f4, #fff);
}

.item-detail {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 13px;
}

.thumb-wrap,
.item-image-wrap {
  position: relative;
  width: max-content;
}

.qty-badge {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  transform: translate(-42%, -42%);
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

.list-qty {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 400;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.cell-select,
.head-select {
  padding: 0 !important;
  text-align: center !important;
}

.row-check {
  min-height: 64px;
  width: 100%;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.row-check input {
  pointer-events: none;
}

.item-detail:last-child {
  margin-bottom: 0;
}

.item-title {
  font-weight: 750;
  font-size: 15px;
  line-height: 1.25;
}

.model-options {
  display: grid;
  gap: 2px;
  margin-top: 3px;
  color: #202024;
  font-size: 14px;
  line-height: 1.24;
}

.model-options span {
  color: #202024;
}

.model-options b {
  font-weight: 650;
}

.props {
  display: grid;
  gap: 1px;
  margin-top: 5px;
  color: #38383c;
  font-size: 13px;
  line-height: 1.28;
}

.props .prop-name {
  color: #9a9aa0;
}

.props b {
  font-weight: 750;
}

.notice {
  margin-bottom: 14px;
  border: 1px solid rgba(255, 159, 10, 0.28);
  background: #fff8e8;
  color: #6b4300;
  border-radius: 8px;
  padding: 11px 12px;
}

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

.login-panel {
  width: min(390px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 8px 0 4px;
  font-size: 28px;
}

.login-logo {
  width: 128px;
  height: auto;
  display: block;
  margin-bottom: 10px;
}

.login-panel form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

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

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.error {
  color: var(--danger);
  font-size: 13px;
}

.detail-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.detail-head {
  margin-bottom: 16px;
}

.detail-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.comment-box,
.files-panel,
.items-panel {
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  padding: 13px;
}

.side-panel {
  display: grid;
  gap: 12px;
  position: relative;
}

.items-panel.plain {
  padding: 0;
  background: transparent;
}

.order-meta {
  display: grid;
  gap: 3px;
  color: #2f2f31;
  font-size: 15px;
  line-height: 1.35;
}

.order-client {
  font-weight: 800;
}

.detail-items {
  width: 100%;
}

.detail-page-item {
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 22px;
}

.detail-page-item .detail-thumb {
  width: 200px;
  height: 200px;
  border-radius: 16px;
}

.detail-page-item .item-title {
  font-size: 19px;
  font-weight: 760;
  line-height: 1.25;
}

.detail-page-item .model-options {
  font-size: 16px;
  gap: 4px;
  margin-top: 6px;
}

.detail-page-item .props {
  font-size: 14px;
  gap: 4px;
  margin-top: 10px;
}

.detail-page-item .qty-badge {
  min-width: 34px;
  height: 34px;
  font-size: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

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

.file-tile {
  position: relative;
  min-height: 108px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.file-tile > .file-thumb {
  width: 100%;
  height: 108px;
  object-fit: contain;
}

.file-name {
  padding: 7px;
  font-size: 12px;
  border-top: 1px solid var(--soft-line);
  background: rgba(255, 255, 255, 0.86);
}

.file-tile:hover .file-preview {
  opacity: 1;
  pointer-events: none;
}

.file-preview {
  position: fixed;
  right: 500px;
  top: 72px;
  z-index: 60;
  width: min(520px, calc(100vw - 580px));
  height: min(520px, calc(100vh - 140px));
  opacity: 0;
  pointer-events: none;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.floating-actions {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: flex;
  gap: 10px;
}

.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
}

.columns-title {
  font-size: 13px;
  font-weight: 800;
  margin: 1px 2px 5px;
}

.columns-title.secondary {
  margin-top: 12px;
  color: var(--muted);
}

.columns-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0 2px 8px;
}

.column-zone {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.035);
}

.column-chip {
  width: auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 10px !important;
  border-radius: 999px !important;
  background: #fff !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  cursor: grab;
}

.column-chip.active {
  background: #111 !important;
  color: #fff !important;
}

.column-chip.dragging {
  opacity: 0.58;
  cursor: grabbing;
}

@media (max-width: 900px) {
  .layout {
    padding: 16px;
  }

  .toolbar,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-grid,
  .detail-page-grid,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 7px 12px;
  }

  .table-shell {
    overflow-x: auto;
  }

  .orders-table {
    min-width: 900px;
  }

  .detail-page-item {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .detail-page-item .detail-thumb {
    width: 150px;
    height: 150px;
  }

  .file-preview {
    left: 16px;
    right: 16px;
    top: 70px;
    width: auto;
  }

  .floating-actions {
    left: 16px;
    right: 16px;
  }

  .floating-actions .btn {
    flex: 1;
  }
}
