:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #62706b;
  --line: #dce4df;
  --paper: #f7f8f5;
  --green: #1f8a5b;
  --green-soft: #e6f5ee;
  --amber: #a76300;
  --amber-soft: #fff1d8;
  --red: #b73535;
  --red-soft: #ffe7e7;
  --blue: #2f5b9a;
  --charcoal: #26312d;
  --shadow: 0 20px 50px rgba(23, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    linear-gradient(135deg, rgba(31, 138, 91, 0.13), transparent 32%),
    linear-gradient(315deg, rgba(47, 91, 154, 0.14), transparent 36%),
    var(--paper);
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 18px;
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.customer-shell {
  grid-template-columns: minmax(0, 1fr);
  width: min(900px, calc(100vw - 32px));
}

.admin-shell {
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.customer-panel,
.admin-panel {
  min-width: 0;
  border: 1px solid rgba(220, 228, 223, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.customer-panel {
  padding: 24px;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
  padding: 18px;
}

.owner-page-panel {
  max-height: none;
}

.panel-header,
.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
}

.admin-header h1,
.admin-header h2 {
  font-size: 1.28rem;
}

.inventory-pill,
.ghost-action,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--charcoal);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.inventory-pill {
  padding: 0 14px;
}

.ghost-action,
.ghost-link {
  cursor: pointer;
  padding: 0 14px;
}

.phone-stage {
  display: grid;
  grid-template-columns: minmax(190px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 26px;
  margin: 26px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  overflow: hidden;
}

.product-media {
  position: relative;
  display: grid;
  place-items: center;
  width: min(300px, 100%);
  aspect-ratio: 1.25 / 1;
  justify-self: center;
  margin: 0;
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
}

.product-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

.carousel-control {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(23, 33, 29, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  transform: translateY(-50%);
}

.carousel-prev {
  left: 8px;
}

.carousel-next {
  right: 8px;
}

.image-counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-width: 50px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(23, 33, 29, 0.78);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.is-hidden {
  display: none !important;
}

.selected-copy p,
.selected-copy span,
.selected-copy a {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.selected-copy h2 {
  margin: 6px 0 12px;
  font-size: clamp(1.65rem, 4vw, 3.1rem);
  line-height: 1.05;
}

.selected-copy a {
  display: inline-block;
  margin-top: 14px;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.reserve-form,
.customer-details,
.form-grid {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

select,
input,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 91, 154, 0.16);
}

.wide {
  grid-column: 1 / -1;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.status-strip strong {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.status-strip span {
  color: var(--muted);
  text-align: right;
}

.status-in strong {
  background: var(--green-soft);
  color: var(--green);
}

.status-reserve strong {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-out strong {
  background: var(--red-soft);
  color: var(--red);
}

.primary-action {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

.compact-action {
  min-height: 38px;
  padding: 0 14px;
}

.primary-action:disabled {
  cursor: not-allowed;
  background: #a4ada8;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--green);
  font-weight: 800;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.metric-row div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.metric-row span {
  display: block;
  font-size: 1.6rem;
  font-weight: 900;
}

.metric-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.orders-toolbar {
  margin-bottom: 12px;
}

.image-manager {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.upload-box {
  min-height: 94px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.upload-box input {
  min-height: auto;
  padding: 10px;
}

.image-manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.uploaded-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.uploaded-thumb {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.uploaded-thumb img {
  width: 100%;
  aspect-ratio: 1.25 / 1;
  object-fit: contain;
  border-radius: 6px;
  background: var(--paper);
}

.uploaded-thumb span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.inventory-summary {
  display: grid;
  gap: 10px;
}

.inventory-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-counts span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.inventory-table {
  display: grid;
  gap: 8px;
}

.inventory-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) 86px 72px minmax(110px, 0.8fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.inventory-row:hover {
  border-color: var(--blue);
}

.inventory-row strong {
  color: var(--green);
}

.orders-list {
  display: grid;
  gap: 10px;
  min-height: 180px;
  overflow: visible;
  padding-right: 2px;
}

.order-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-code {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.order-card h3 {
  margin: 2px 0 0;
  font-size: 1rem;
  line-height: 1.25;
}

.order-meta {
  display: grid;
  gap: 5px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.order-status {
  min-width: 142px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .admin-panel {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 1220px);
    padding: 10px 0;
  }

  .customer-panel,
  .admin-panel,
  .phone-stage {
    padding: 14px;
  }

  .panel-header,
  .admin-header,
  .status-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .phone-stage,
  .form-grid,
  .customer-details,
  .inventory-row {
    grid-template-columns: 1fr;
  }

  .product-media {
    max-width: 280px;
  }

  .status-strip span {
    text-align: left;
  }
}
