@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@600;700;800&display=swap");

:root {
  --bg: #f3ede5;
  --surface: #fffdfa;
  --surface-strong: #18120f;
  --surface-soft: #f1e4d5;
  --surface-soft-strong: #e6c9ae;
  --border: rgba(90, 62, 39, 0.12);
  --border-strong: rgba(90, 62, 39, 0.2);
  --text: #211915;
  --muted: #786759;
  --muted-strong: #5d4c3e;
  --primary: #d57234;
  --primary-deep: #a94c1f;
  --primary-contrast: #fffaf5;
  --secondary: #3a2a20;
  --shadow: 0 28px 80px rgba(46, 30, 17, 0.12);
  --shadow-soft: 0 14px 34px rgba(46, 30, 17, 0.08);
  --shadow-strong: 0 24px 52px rgba(18, 12, 9, 0.18);
  --radius: 30px;
  --radius-sm: 20px;
  --app-width: 1500px;
}

html {
  color-scheme: light;
  background: var(--bg);
  overscroll-behavior-y: none;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 104, 75, 0.34) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(136, 104, 75, 0.3);
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Manrope", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(213, 114, 52, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(194, 160, 127, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f3ee 0%, #efe6dc 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: min(42vw, 420px);
  height: min(42vw, 420px);
  border-radius: 999px;
  pointer-events: none;
  filter: blur(24px);
  opacity: 0.5;
  z-index: -1;
}

body::before {
  top: -120px;
  right: -120px;
  background: radial-gradient(circle, rgba(255, 201, 156, 0.7) 0%, rgba(255, 201, 156, 0) 70%);
}

body::after {
  left: -140px;
  bottom: -160px;
  background: radial-gradient(circle, rgba(213, 114, 52, 0.18) 0%, rgba(213, 114, 52, 0) 72%);
}

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

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: rgba(213, 114, 52, 0.22);
  color: var(--secondary);
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand-name,
.sidebar-brand h1,
.btn,
.menu a {
  font-family: "Sora", "Manrope", sans-serif;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: -0.03em;
}

.auth-body,
.offline-body {
  display: grid;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.auth-body {
  min-height: 100vh;
  place-items: center;
}

.offline-body {
  min-height: 100vh;
  place-items: center;
}

.auth-layout {
  width: min(480px, 100%);
}

.auth-card,
.offline-card,
.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 251, 246, 0.82) 100%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  width: fit-content;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-lockup {
  margin-bottom: 24px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
}

.login-brand-logo {
  width: 84px;
  height: 84px;
}

.brand-copy {
  display: grid;
  gap: 6px;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--secondary);
}

.brand-tagline {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.auth-card h2,
.offline-card h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.98;
}

.auth-card,
.offline-card {
  padding: clamp(24px, 4vw, 40px);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--primary-deep);
  font-weight: 800;
}

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

.lead {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.app-shell {
  width: min(var(--app-width), 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 2vw, 24px);
  display: grid;
  grid-template-columns: minmax(228px, 258px) minmax(0, 1fr);
  gap: 20px;
}

.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-radius: calc(var(--radius) + 4px);
  color: var(--primary-contrast);
  background:
    radial-gradient(circle at top left, rgba(255, 197, 149, 0.14), transparent 28%),
    linear-gradient(180deg, #201915 0%, #17120f 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-strong);
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 86px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 248, 242, 0.09);
}

.sidebar-heading {
  display: grid;
  gap: 8px;
}

.menu {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.sidebar-greeting {
  margin: 0;
  color: rgba(255, 245, 237, 0.72);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.sidebar-brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 248, 242, 0.98) 0%, rgba(252, 228, 205, 0.92) 100%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
}

.sidebar-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.menu a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  color: rgba(255, 247, 239, 0.72);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.menu a::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.42;
  flex: 0 0 auto;
}

.menu a:hover,
.menu a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.menu a.active {
  transform: translateX(2px);
}

.menu a.active::before {
  opacity: 1;
  background: linear-gradient(180deg, #fffaf5 0%, #ffd7bb 100%);
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.06);
}

.menu a:hover {
  transform: translateX(1px);
}

.content {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 8px 0;
  min-width: 0;
}

.page-header,
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.section-title > div {
  display: grid;
  gap: 6px;
}

.section-title h3,
.card > h3,
.card > h2 {
  font-size: clamp(1.24rem, 2vw, 1.5rem);
  line-height: 1.05;
}

.page-toolbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  min-height: 0;
  padding: 0;
}

.page-toolbar .page-actions {
  width: fit-content;
  margin-left: auto;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.page-toolbar-collapsed {
  display: none;
}

.page-toolbar h2,
.page-toolbar .eyebrow {
  margin-top: 0;
  margin-bottom: 0;
}

.page-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  margin: 14px 0 10px;
  align-items: end;
}

.filter-actions {
  display: flex;
  align-items: end;
}

.order-item-filter-actions {
  gap: 12px;
  flex-wrap: wrap;
}

#order-item-modal .filter-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

#order-item-modal .order-item-filter-actions {
  flex-wrap: nowrap;
}

.order-item-scanner-panel {
  display: grid;
  gap: 16px;
  margin: 18px 0 0;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(240, 199, 162, 0.92);
  background:
    radial-gradient(circle at top left, rgba(233, 120, 36, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(255, 248, 242, 0.98) 0%, rgba(255, 253, 250, 0.98) 100%);
  box-shadow: var(--shadow-soft);
}

.order-item-scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  flex-wrap: wrap;
}

.order-item-scanner-copy {
  display: grid;
  gap: 4px;
  flex: 1 1 220px;
}

.order-item-scanner-copy strong,
.order-item-scanner-copy p {
  margin: 0;
}

.order-item-scanner-status {
  min-height: 0;
  margin-top: 4px;
}

.order-item-scanner-reader {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 320px;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(65, 35, 18, 0.94) 0%, rgba(48, 26, 13, 0.98) 100%);
  border: 1px solid rgba(255, 226, 199, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.order-item-scanner-reader::before,
.order-item-scanner-reader::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.order-item-scanner-reader::before {
  inset: 0;
  background:
    linear-gradient(rgba(44, 22, 10, 0.22), rgba(44, 22, 10, 0.22));
}

.order-item-scanner-reader::after {
  left: 8%;
  right: 8%;
  top: 50%;
  height: clamp(88px, 18%, 132px);
  border-radius: 22px;
  border: 3px solid rgba(255, 143, 56, 0.95);
  transform: translateY(-50%);
  box-shadow:
    0 0 0 9999px rgba(44, 22, 10, 0.18),
    0 0 24px rgba(255, 132, 45, 0.36),
    inset 0 0 0 1px rgba(255, 240, 228, 0.42);
}

.order-item-scanner-reader > div {
  position: relative;
  border: 0 !important;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.order-item-scanner-reader video,
.order-item-scanner-reader canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border-radius: 20px;
  object-fit: cover;
}

#order-item-modal-card.order-item-modal-scanning > :not(.order-item-scanner-panel) {
  display: none;
}

#order-item-modal-card.order-item-modal-scanning .order-item-scanner-panel {
  margin-top: 0;
}

.card {
  padding: clamp(18px, 2.2vw, 26px);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(213, 114, 52, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
  z-index: -1;
}

.order-cover-toggle {
  white-space: nowrap;
  margin-left: auto;
}

.order-cover-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.order-cover-summary-item {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.94) 0%, rgba(244, 235, 226, 0.88) 100%);
  box-shadow: var(--shadow-soft);
}

.order-cover-summary-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.order-cover-summary-item strong {
  font-size: 1.02rem;
  color: var(--secondary);
}

.order-cover-content {
  margin-top: 18px;
}

.order-cover-content.hidden {
  display: none;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.full-width {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--muted-strong);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  line-height: 1.2;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(247, 240, 232, 0.9);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 1px 1px rgba(35, 24, 16, 0.02);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

input::placeholder {
  color: rgba(117, 103, 91, 0.8);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
  background: rgba(255, 251, 246, 0.96);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 0 5px rgba(213, 114, 52, 0.12),
    0 12px 24px rgba(213, 114, 52, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
  min-height: 112px;
  padding-top: 16px;
}

#client-form input:not([type="hidden"]),
#client-form select {
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-align: center;
  vertical-align: middle;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn-primary {
  background: linear-gradient(180deg, #ef8d4d 0%, var(--primary) 100%);
  color: var(--primary-contrast);
  box-shadow: 0 18px 32px rgba(213, 114, 52, 0.26);
}

.btn-secondary {
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.98) 0%, rgba(239, 228, 215, 0.98) 100%);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}

.btn-danger {
  background: linear-gradient(180deg, #d9573f 0%, #bf3f29 100%);
  color: #fff8f2;
  box-shadow: 0 12px 24px rgba(191, 63, 41, 0.2);
}

.btn-ghost {
  background: rgba(255, 248, 242, 0.12);
  color: rgba(255, 248, 242, 0.92);
  border-color: rgba(255, 248, 242, 0.14);
}

.sidebar-logout {
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 242, 0.06);
}

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

.btn:active {
  transform: translateY(0);
}

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

.btn-primary:hover {
  background: linear-gradient(180deg, #f7965a 0%, var(--primary-deep) 100%);
  box-shadow: 0 18px 34px rgba(213, 114, 52, 0.3);
}

.btn-danger:hover {
  background: linear-gradient(180deg, #e6664d 0%, #a93521 100%);
  box-shadow: 0 14px 28px rgba(191, 63, 41, 0.26);
}

.btn-secondary:hover,
.btn-ghost:hover {
  box-shadow: 0 16px 26px rgba(46, 30, 17, 0.1);
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(213, 114, 52, 0.3);
  outline-offset: 2px;
}

.message {
  min-height: 0;
  margin: 10px 0 0;
  color: var(--secondary);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.45;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pagination-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

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

.inline-field {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-field input,
.inline-field select {
  flex: 1 1 260px;
}

.debug-box {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(249, 242, 235, 0.92);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.45;
  max-height: 220px;
  overflow: auto;
}

.table-wrapper {
  overflow: auto;
  margin-top: 6px;
  padding-bottom: 2px;
  scrollbar-gutter: stable both-edges;
}

.numeric-cell {
  text-align: right;
  white-space: nowrap;
}

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

.order-item-row {
  display: grid;
  grid-template-columns: minmax(72px, 96px) minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.order-item-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(46, 30, 17, 0.12);
  background: rgba(255, 253, 249, 0.98);
}

.order-item-figure {
  width: 100%;
  max-width: 96px;
}

.order-item-photo,
.order-item-photo-placeholder {
  width: 100%;
  max-width: 96px;
  height: 96px;
  border-radius: 20px;
}

.order-item-photo {
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.order-item-photo-placeholder {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 247, 239, 0.9);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.order-item-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.order-item-edit-header {
  display: grid;
  grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin: 14px 0;
}

.order-item-edit-photo-frame {
  width: 100%;
  max-width: 120px;
}

.order-item-edit-photo,
.order-item-edit-photo-placeholder {
  width: 100%;
  height: 120px;
  border-radius: 22px;
}

.order-item-edit-photo {
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.order-item-edit-photo-placeholder {
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 247, 239, 0.9);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.order-item-edit-copy {
  display: grid;
  gap: 8px;
}

.order-item-edit-copy h4 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
}

.order-item-discount-placeholder {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px dashed var(--border-strong);
  background: rgba(246, 239, 232, 0.88);
}

.order-item-discount-placeholder strong,
.order-item-discount-placeholder p {
  margin: 0;
}

.order-item-edit-actions {
  justify-content: space-between;
}

.order-item-description {
  color: var(--text);
  font-weight: 700;
  line-height: 1.45;
}

.order-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.order-item-meta span {
  text-align: right;
  white-space: nowrap;
}

.order-items-empty {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 18px;
  border-radius: 22px;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.55);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

th,
td {
  padding: 16px 14px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 0 14px 2px;
}

tbody td {
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

tbody td:first-child {
  border-left: 1px solid var(--border);
  border-radius: 22px 0 0 22px;
}

tbody td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 22px 22px 0;
}

tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.clickable-row {
  cursor: pointer;
  transition: transform 0.18s ease;
}

tbody tr:hover td {
  transform: translateY(-1px);
  background: rgba(255, 252, 249, 0.98);
}

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

.order-list-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.order-list-description {
  color: var(--text);
  font-weight: 700;
  line-height: 1.4;
}

.order-list-support {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
}

.search-result-row {
  display: grid;
  grid-template-columns: minmax(72px, 96px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.search-result-figure {
  width: 100%;
  max-width: 96px;
}

.search-result-photo,
.search-result-photo-placeholder {
  width: 100%;
  max-width: 96px;
  height: 96px;
  border-radius: 20px;
}

.search-result-photo {
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.search-result-photo-placeholder {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 247, 239, 0.9);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.search-result-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.search-result-primary {
  color: var(--text);
  font-weight: 700;
  line-height: 1.4;
}

.search-result-secondary {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.search-result-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.search-result-actions .btn {
  min-width: 112px;
}

.product-list-row {
  display: grid;
  gap: 4px;
}

.product-list-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: #8b4c20;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-list-description {
  color: var(--text);
  font-weight: 700;
  line-height: 1.4;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.product-media-panel {
  display: grid;
  gap: 14px;
}

.product-photo-frame {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(213, 114, 52, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 239, 231, 0.96) 100%);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
}

.product-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product-photo-placeholder {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.product-hero-copy {
  display: grid;
  gap: 8px;
}

.product-detail-code-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.product-detail-description {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.product-detail-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.product-detail-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 249, 243, 0.98) 0%, rgba(239, 228, 215, 0.98) 100%);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

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

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

.product-info-item {
  display: grid;
  gap: 6px;
  min-height: 88px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}

.product-info-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.product-info-item strong {
  font-size: 1rem;
  line-height: 1.4;
}

.product-sizes-section {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.product-sizes-section .section-title h4 {
  margin: 0;
}

.product-sizes-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.product-size-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.product-price-section {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.product-price-section .section-title h4 {
  margin: 0;
}

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

.item-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}

.address-builder {
  display: grid;
  gap: 16px;
}

.address-row {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 241, 235, 0.94) 100%);
  box-shadow: var(--shadow-soft);
}

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

.address-row .section-title h4,
.address-builder .section-title h3,
.address-builder .section-title p {
  margin: 0;
}

.hidden {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 13, 0.36);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1000;
  backdrop-filter: blur(16px);
}

.modal-card {
  width: min(920px, 100%);
  max-height: min(80vh, 900px);
  overflow: auto;
  padding: 22px;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  overscroll-behavior: contain;
}

.table-wrapper table {
  background: transparent;
}

.modal-overlay.hidden {
  display: none;
}

@media (max-width: 900px) {
  body {
    background:
      radial-gradient(circle at top left, rgba(213, 114, 52, 0.1), transparent 30%),
      linear-gradient(180deg, #f7f1ea 0%, #ece3d9 100%);
  }

  body::before,
  body::after {
    width: 220px;
    height: 220px;
  }

  .auth-body {
    place-items: center;
    padding:
      max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .auth-layout,
  .content {
    width: 100%;
  }

  .auth-card,
  .offline-card {
    border-radius: 28px;
  }

  .app-shell {
    display: block;
    width: 100%;
    padding: 12px;
  }

  .sidebar {
    position: fixed;
    inset: 0 0 auto 0;
    top: 0;
    height: auto;
    padding: max(12px, env(safe-area-inset-top)) 12px 0;
    gap: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    z-index: 120;
  }

  .sidebar-header {
    min-height: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.84);
    color: var(--text);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow-soft);
  }

  .sidebar-heading {
    min-width: 0;
    gap: 4px;
  }

  .sidebar-greeting {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.1;
  }

  .sidebar-brand h1 {
    font-size: 1rem;
    color: var(--text);
  }

  .sidebar-brand-copy {
    gap: 1px;
  }

  .sidebar-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(23, 18, 15, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 22px rgba(18, 12, 9, 0.16);
  }

  .sidebar-brand-logo {
    width: 32px;
    height: 32px;
  }

  .sidebar-logout {
    min-height: 42px;
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.98) 0%, rgba(239, 229, 217, 0.98) 100%);
    color: var(--text);
    border-color: var(--border);
    box-shadow: none;
  }

  .menu {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
    border-radius: 28px;
    background: rgba(23, 18, 15, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 48px rgba(18, 12, 9, 0.22);
    z-index: 130;
  }

  .menu a {
    min-height: 60px;
    padding: 10px 8px;
    display: grid;
    place-items: center;
    gap: 6px;
    text-align: center;
    font-size: 0.74rem;
    color: rgba(255, 248, 241, 0.72);
    border-radius: 18px;
  }

  .menu a::before {
    position: static;
    transform: none;
    margin: 0;
    opacity: 0.55;
  }

  .menu a.active,
  .menu a:hover {
    transform: none;
  }

  .menu a.active {
    padding-left: 8px;
    background: linear-gradient(180deg, rgba(241, 143, 79, 0.95) 0%, rgba(213, 114, 52, 0.98) 100%);
    box-shadow: 0 16px 28px rgba(213, 114, 52, 0.26);
  }

  .menu a.active::before {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08);
  }

  .content {
    gap: 14px;
    padding: calc(84px + env(safe-area-inset-top)) 0 calc(104px + env(safe-area-inset-bottom));
  }

  .page-header,
  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-toolbar {
    top: calc(12px + env(safe-area-inset-top));
  }

  .page-toolbar .page-actions {
    width: 100%;
    margin-left: 0;
    padding: 8px;
    border-radius: 24px;
  }

  .page-toolbar .page-actions > * {
    flex: 1 1 100%;
  }

  .page-toolbar-actions-only .page-actions .btn {
    border-left: 0;
  }

  .card {
    padding: 18px;
    border-radius: 28px;
  }

  .two-columns,
  .item-row,
  .address-row-grid,
  .filter-grid,
  .product-detail-layout,
  .product-info-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  #order-item-modal .order-item-filter-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-actions .btn,
  #order-item-modal .order-item-filter-actions .btn {
    width: 100%;
  }

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

  .order-cover-summary-item:last-child {
    grid-column: 1 / -1;
  }

  .order-cover-summary-label,
  #client-form-hint,
  #product-detail-subtitle,
  .section-title .muted {
    display: none;
  }

  .inline-field {
    gap: 10px;
  }

  .inline-field input,
  .inline-field select,
  .inline-field .btn {
    flex: 1 1 100%;
  }

  .table-wrapper {
    margin: 0 -4px;
    padding: 0 4px 2px;
  }

  table {
    min-width: 100%;
    border-spacing: 0 8px;
  }

  th,
  td {
    padding: 14px 12px;
  }

  th {
    padding: 0 12px 2px;
  }

  .pagination-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pagination-controls .btn {
    width: 100%;
  }

  .product-photo-frame {
    min-height: 260px;
  }

  .order-item-row,
  .search-result-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .order-item-meta,
  .search-result-actions {
    justify-content: flex-start;
  }

  .modal-overlay {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: min(92vh, 100svh - 8px);
    padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 30px 30px 0 0;
  }

  #open-order-item-modal {
    width: 100%;
    margin: 0;
  }

  #order-item-modal .filter-grid {
    grid-template-columns: 1fr;
  }

  .order-item-scanner-reader {
    min-height: 0;
  }
}

@media (display-mode: standalone) and (max-width: 900px) {
  .sidebar {
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .content {
    padding-top: calc(80px + env(safe-area-inset-top));
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }
}
