.master-body {
  background: #f4f3ed;
  font-size: 14px;
}

.master-body h1 {
  font-size: clamp(34px, 3vw, 45px);
  line-height: 1.12;
  letter-spacing: -1.8px;
  font-weight: 650;
  margin: 0 0 16px;
}

.master-body h2 {
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: -.9px;
}

.master-muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.master-small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.master-body .eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.master-login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.master-login__story {
  position: relative;
  overflow: hidden;
  background: #26372e;
  color: #f4f3ed;
  padding: clamp(35px, 6vw, 95px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.master-home {
  color: #c4cfba;
  font-size: 12px;
  position: absolute;
  top: 36px;
  left: clamp(35px, 6vw, 95px);
}

.master-login__story>img {
  margin-bottom: 40px;
}

.master-login__story h1 {
  font-size: clamp(44px, 4.7vw, 72px);
  letter-spacing: -2px;
}

.master-login__story .serif-word {
  color: #e0b28c;
}

.master-login__story>p:last-of-type {
  font-size: 15px;
  color: #c6d0be;
  margin-top: 24px;
}

.master-login__stitch {
  position: absolute;
  font-size: 400px;
  bottom: -210px;
  right: -130px;
  color: #dce5d008;
  pointer-events: none;
}

.master-login__panel {
  width: min(490px, 100%);
  padding: 60px 45px;
  margin: auto;
}

.master-login__panel h2 {
  font-size: 36px;
  margin-bottom: 14px;
}

.master-login__panel .master-muted {
  margin-bottom: 30px;
}

.master-body form label {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.master-body form input,
.master-body form textarea,
.master-body form select {
  min-width: 0;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  background: #fffdf8;
  color: var(--ink);
  border: 1px solid #c8d0be;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
}

.master-body form input:focus-visible,
.master-body form select:focus-visible,
.master-body form textarea:focus-visible {
  outline: 2px solid #71875d;
  outline-offset: 2px;
}

.master-body form textarea {
  resize: vertical;
  min-height: 95px;
  max-height: 360px;
}

.master-body form .button {
  width: 100%;
  justify-content: space-between;
}

.master-body button:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.master-error {
  border: 1px solid #e3b8a3;
  background: #f9e7dc;
  color: #893a20;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.master-error>button {
  display: block;
  margin-top: 10px;
  text-decoration: underline;
}

.master-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}

.master-sidebar {
  background: #26372e;
  color: #f4f3ed;
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 35px 20px 25px;
}

.master-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Georgia, serif;
  font-size: 23px;
  letter-spacing: -.6px;
  padding-inline: 5px;
}

.master-brand img {
  flex-shrink: 0;
}

.master-brand__caption {
  display: block;
  font-family: var(--font);
  font-size: 6px;
  letter-spacing: 1.7px;
  font-weight: 400;
  margin-top: 7px;
  color: #b9c8af;
}

.sidebar-label {
  font-size: 8px;
  letter-spacing: 1.8px;
  color: #aabb9e;
  margin: 48px 12px 15px;
}

.sidebar-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-radius: 9px;
  font-size: 13px;
}

.sidebar-item.is-active {
  background: #41503d;
}

.sidebar-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-item>span {
  margin-left: auto;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #ffffff12;
}

.sidebar-note {
  margin: auto 12px;
  padding-block: 40px;
  color: #bac8ac;
}

.sidebar-note>span {
  font-size: 50px;
  color: #d3ad86;
}

.sidebar-note p {
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 25px;
  line-height: 1.2;
  margin-top: 10px;
}

.sidebar-bottom {
  display: grid;
  gap: 18px;
  padding: 24px 12px 0;
  border-top: 1px solid #ffffff15;
  font-size: 11px;
  color: #c5d0bc;
}

.sidebar-bottom button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  text-align: left;
  padding: 0;
}

.sidebar-bottom a:hover,
.sidebar-bottom button:hover {
  color: white;
}

.master-main {
  min-width: 0;
  padding: 0 42px 30px;
}

.master-topbar {
  min-height: 85px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.master-topbar>p {
  margin: 0;
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: #737d69;
}

.master-topbar>p>span {
  color: #b5bdaa;
  margin-inline: 12px;
}

.master-session-badge {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 10px;
  color: #697b59;
}

.master-session-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7e9b66;
}

.master-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 35px 30px;
}

.master-heading h1 {
  margin-bottom: 10px;
}

.master-heading .master-muted {
  margin: 0;
  font-size: 13px;
}

#master-date {
  font-size: 11px;
  margin-bottom: 15px;
  text-transform: capitalize;
}

.master-heading>.button {
  font-size: 12px;
  gap: 26px;
  padding: 15px 18px;
  white-space: nowrap;
}

.master-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.stat-card {
  text-align: left;
  border: 1px solid #dce0d3;
  border-radius: 12px;
  padding: 19px 20px;
  background: #fdfbf6;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-card:hover {
  border-color: #a2b191;
}

.stat-card>span:first-child {
  font-size: 11px;
  color: #65725d;
}

.stat-card>strong {
  font-size: 38px;
  font-weight: 600;
  line-height: 1;
  margin-block: 19px;
  letter-spacing: -2px;
}

.stat-card--late {
  background: #f4e8dd;
  border-color: #e5d5c4;
}

.stat-card--late>strong {
  color: #a65b38;
}

.stat-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  color: #6c7862;
  line-height: 1.6;
}

.stat-caption>span {
  font-size: 17px;
}

.orders-panel {
  background: #fdfbf6;
  border: 1px solid #dce0d3;
  border-radius: 14px;
  overflow: hidden;
}

.orders-panel__heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 24px;
}

.orders-panel__heading h2 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -.6px;
}

.orders-panel__heading h2>span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  font-size: 10px;
  background: #e8eddf;
  padding: 4px 9px;
  border-radius: 6px;
  vertical-align: middle;
}

.master-text-button {
  background: transparent;
  border: 0;
  padding: 3px 0;
  font-size: 11px;
  color: #536a43;
}

.master-text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.orders-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(130px, .8fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 24px 23px;
}

.master-body .orders-filters label {
  margin: 0;
}

.master-body .orders-filters input,
.master-body .orders-filters select {
  font-size: 11px;
  min-height: 40px;
  padding: 10px;
}

.master-body .orders-filters .overdue-filter {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 400;
}

.master-body .overdue-filter input {
  width: 15px;
  min-height: 15px;
  height: 15px;
  padding: 0;
  accent-color: #627e4e;
}

.orders-loading {
  color: var(--muted);
  font-size: 11px;
  margin: 0 24px 15px;
}

.orders-panel>.master-error {
  margin: 0 24px 20px;
}

.orders-table-wrap {
  position: relative;
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  min-width: 770px;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.orders-table th {
  padding: 13px 15px;
  background: #eeeee5;
  font-size: 9px;
  color: #68775c;
  font-weight: 600;
  white-space: nowrap;
  border-block: 1px solid #e0e3d8;
}

.orders-table th:first-child,
.orders-table td:first-child {
  padding-left: 24px;
}

.orders-table td {
  padding: 20px 15px;
  border-bottom: 1px solid #e8e9df;
  vertical-align: top;
  line-height: 1.6;
}

.orders-table tbody tr:hover {
  background: #f4f5ec;
}

.order-reference {
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 650;
  padding: 0;
  color: #344d2c;
  white-space: nowrap;
}

.order-reference:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.table-secondary {
  display: block;
  font-size: 11px;
  color: #78816e;
  margin-top: 6px;
  line-height: 1.6;
}

.table-client {
  display: block;
  font-size: 14px;
  font-weight: 600;
  max-width: 150px;
  overflow-wrap: anywhere;
}

.table-service {
  display: block;
  max-width: 160px;
  font-size: 12px;
}

.stage-badge {
  display: inline-block;
  font-size: 11px;
  padding: 5px 8px;
  background: #e8eddf;
  color: #576c45;
  border-radius: 5px;
  white-space: nowrap;
}

.stage-badge--new {
  background: #f8e3d2;
  color: #99512c;
}

.stage-badge--awaiting_item,
.stage-badge--assessment {
  background: #eee9d7;
  color: #88723d;
}

.stage-badge--in_progress {
  background: #e2e9eb;
  color: #486b73;
}

.stage-badge--ready {
  background: #dfead7;
  color: #4f7137;
}

.stage-badge--completed {
  background: #e8e9e2;
  color: #727b65;
}

.stage-badge--cancelled {
  background: #f0e4df;
  color: #9a7160;
}

.table-delivery-warning {
  display: block;
  color: #a66a42;
  font-size: 8px;
  margin-top: 7px;
}

.table-overdue {
  color: #aa5435;
  font-size: 11px;
}

.table-overdue .table-secondary {
  color: #aa5435;
}

.table-price {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.table-muted {
  color: #7a826f;
  font-size: 9px;
}

.order-open {
  background: transparent;
  border: 1px solid #dce0d3;
  border-radius: 7px;
  width: 30px;
  height: 30px;
  font-size: 19px;
}

.order-open:hover {
  background: #e8eddf;
}

.orders-empty {
  text-align: center;
  padding: 55px 20px;
}

.orders-empty>span {
  color: #a2b18f;
  font-size: 45px;
}

.orders-empty h3 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.7px;
  margin: 15px 0 10px;
}

.orders-empty p {
  color: var(--muted);
  font-size: 13px;
  max-width: 410px;
  margin-inline: auto;
}

.orders-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  font-size: 10px;
  color: #77816c;
}

.orders-pagination>div {
  display: flex;
  gap: 8px;
}

.orders-pagination button {
  background: transparent;
  border: 1px solid #d9dfcf;
  border-radius: 6px;
  width: 32px;
  height: 30px;
}

.master-bottom-note {
  color: #7c8571;
  font-size: 9px;
  margin: 22px 0 0;
}

.master-body dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

.master-body dialog::backdrop {
  background: #1d2d257d;
  backdrop-filter: blur(3px);
}

.master-body:has(dialog[open]) {
  overflow: hidden;
}

.master-dialog {
  width: min(520px, calc(100% - 24px));
  border-radius: 18px;
  padding: 34px;
  max-height: calc(100dvh - 30px);
  overflow-y: auto;
}

.master-dialog>.eyebrow {
  padding-right: 20px;
}

.master-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 28px;
  width: 36px;
  height: 36px;
}

.master-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.order-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(540px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow-y: auto;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 25px 28px;
  background: #f6f4eef5;
  border-bottom: 1px solid var(--line);
}

.drawer-header .eyebrow {
  margin: 0 0 9px;
  font-size: 8px;
}

.drawer-header h2 {
  font-size: 23px;
  margin: 0;
}

.drawer-header button {
  border: 1px solid #d8dece;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  font-size: 25px;
}

.drawer-content {
  padding: 28px;
}

.order-client {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.order-client>h3 {
  font-size: 24px;
  line-height: 1.4;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.order-client .eyebrow,
.order-brief .eyebrow {
  color: #7d8a70;
  font-size: 9px;
  margin-bottom: 12px;
}

.order-phone {
  display: inline-block;
  font-size: 17px;
  color: #526d3e;
  margin-bottom: 6px;
}

.order-client .master-small {
  margin: 8px 0 0;
}

.order-brief {
  padding-block: 24px;
  border-bottom: 1px solid var(--line);
}

.order-brief h3 {
  font-size: 18px;
  margin-bottom: 13px;
}

.order-description {
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.order-handoff {
  background: #e9eddf;
  border-radius: 7px;
  padding: 10px 12px;
  color: #546948;
  font-size: 11px;
}

.delivery-state {
  font-size: 10px;
  color: #78826d;
}

.delivery-state--failed,
.delivery-state--uncertain,
.delivery-state--sending {
  color: #a36b44;
}

.order-photos {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.order-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.legacy-photos {
  background: #eee8d9;
  padding: 10px;
  border-radius: 7px;
}

.order-edit {
  padding-block: 26px;
}

.order-edit .eyebrow {
  margin-bottom: 20px;
}

.order-dirty {
  color: #9c683c;
  font-size: 11px;
}

.order-history {
  border-top: 1px solid var(--line);
  padding-top: 25px;
}

.order-history .eyebrow {
  font-size: 9px;
  color: #7d8a70;
}

.order-event {
  position: relative;
  border-left: 1px solid #cbd4bf;
  padding: 0 0 22px 17px;
  margin-left: 4px;
}

.order-event::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9caf88;
  position: absolute;
  top: 6px;
  left: -4px;
}

.order-event p {
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 1.6;
}

.order-event .master-small {
  font-size: 9px;
}

.master-toast {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: 24px;
  max-width: calc(100% - 48px);
  padding: 15px 20px;
  background: var(--ink);
  color: #faf8ee;
  font-size: 13px;
  border-radius: 10px;
  box-shadow: 0 7px 25px #26372e25;
}

.master-footer-link {
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 1200px) {
  .master-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .master-main {
    padding-inline: 25px;
  }

  .master-sidebar {
    padding-inline: 14px;
  }

  .master-brand {
    font-size: 20px;
    gap: 7px;
  }

  .master-brand img {
    width: 36px;
    height: 36px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-caption {
    font-size: 9px;
  }

  .orders-filters {
    grid-template-columns: minmax(160px, 1.5fr) minmax(120px, 1fr) minmax(145px, 1fr);
  }

  .overdue-filter {
    grid-column: 1 / -1;
  }
}

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

  .master-sidebar {
    position: static;
    height: auto;
    padding: 18px 25px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
  }

  .sidebar-label,
  .sidebar-note,
  .sidebar-item {
    display: none;
  }

  .sidebar-bottom {
    display: flex;
    gap: 18px;
    border: 0;
    padding: 0;
    font-size: 10px;
  }

  .master-topbar {
    min-height: 65px;
  }

  .master-heading h1 {
    font-size: 38px;
  }

  .master-heading>.button {
    font-size: 11px;
    gap: 15px;
  }

  .master-stats {
    gap: 12px;
  }

  .stat-card>span:first-child {
    font-size: 10px;
  }

  .stat-card>strong {
    font-size: 32px;
  }
}

@media (max-width: 640px) {
  .master-login {
    grid-template-columns: 1fr;
  }

  .master-login__story {
    min-height: 290px;
    padding: 65px 25px 30px;
  }

  .master-home {
    top: 22px;
    left: 25px;
  }

  .master-login__story>img {
    width: 45px;
    height: 45px;
    margin-bottom: 20px;
  }

  .master-login__story h1 {
    font-size: 41px;
  }

  .master-login__story .eyebrow {
    font-size: 8px;
    margin-bottom: 15px;
  }

  .master-login__story>p:last-of-type {
    font-size: 12px;
    margin: 8px 0 0;
  }

  .master-login__panel {
    padding: 35px 25px;
  }

  .master-login__panel h2 {
    font-size: 30px;
  }

  .master-main {
    padding: 0 16px 25px;
  }

  .master-sidebar {
    padding: 16px;
    gap: 18px;
  }

  .sidebar-bottom {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    font-size: 10px;
  }

  .master-topbar {
    min-height: 55px;
  }

  .master-topbar>p {
    font-size: 7px;
    letter-spacing: .7px;
  }

  .master-topbar>p>span {
    margin-inline: 5px;
  }

  .master-session-badge {
    font-size: 8px;
    gap: 5px;
  }

  .master-heading {
    display: block;
    padding-block: 27px;
  }

  .master-heading h1 {
    font-size: 34px;
  }

  .master-heading>.button {
    margin-top: 20px;
    width: 100%;
    justify-content: space-between;
    font-size: 13px;
  }

  .master-heading .master-muted {
    font-size: 12px;
  }

  .master-stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-card>strong {
    margin-block: 15px;
    font-size: 32px;
  }

  .stat-card>span:first-child {
    font-size: 10px;
  }

  .stat-caption {
    font-size: 9px;
  }

  .orders-panel__heading {
    padding: 20px 16px;
  }

  .orders-panel__heading h2 {
    font-size: 18px;
  }

  .orders-filters {
    grid-template-columns: 1fr;
    padding: 0 16px 20px;
  }

  .master-body .orders-filters input,
  .master-body .orders-filters select {
    font-size: 13px;
  }

  .orders-search,
  .overdue-filter {
    grid-column: auto;
  }

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

  .orders-pagination {
    padding: 16px;
    font-size: 9px;
  }

  .orders-empty {
    padding: 35px 18px;
  }

  .orders-empty h3 {
    font-size: 22px;
  }

  .master-bottom-note {
    font-size: 9px;
  }

  .drawer-header {
    padding: 20px;
  }

  .drawer-content {
    padding: 22px 20px;
  }

  .master-fields-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .master-dialog {
    padding: 28px 22px;
  }

  .master-body form input,
  .master-body form select,
  .master-body form textarea {
    font-size: 16px;
  }
}

.orders-scroll-hint,
.mobile-order-stage {
  display: none;
}

@media (max-width: 640px) {
  .orders-scroll-hint {
    display: block;
    margin: 0 16px 14px;
    font-size: 11px;
    color: var(--muted);
  }

  .mobile-order-stage {
    display: inline-block;
    margin-top: 9px;
    font-size: 9px;
  }
}
