:root {
  --app-header-height: 6.4rem;
  --sidebar-width: 28rem;

  --brand: #ff7a00;
  --brand-strong: #bd5200;
  --brand-soft: #fff0df;
  --brand-action: #ff7a00;
  --brand-action-hover: #f06f00;
  --on-brand: #151922;
  --on-brand-action: #ffffff;
  --accent: #00786f;
  --accent-soft: #e7f7f5;
  --accent-action: #eef7f6;
  --accent-action-hover: #d9eeeb;
  --on-accent-action: #113532;
  --surface: rgb(255, 255, 255);
  --surface-raised: rgb(255, 255, 255);
  --surface-muted: #f4f6f9;
  --surface-tinted: #fff7ed;
  --canvas: #f7f8fb;
  --text-primary: #151922;
  --text-secondary: #465162;
  --text-muted: #6c7788;
  --border-subtle: rgba(21, 25, 34, 0.1);
  --border-strong: rgba(21, 25, 34, 0.18);
  --danger: #c93d3d;
  --danger-ink: #8a2020;
  --danger-surface: #fff0f0;
  --danger-border: #f4c3c3;
  --danger-action: #fff0f0;
  --danger-action-hover: #ffe0e0;
  --on-danger-action: #7b1d1d;
  --success: #168354;
  --success-ink: #0d653e;
  --success-surface: #e9f8ef;
  --success-border: #addfbe;
  --warning: #a86600;
  --warning-surface: #fff3d8;
  --body-overlay: linear-gradient(180deg, rgba(255, 255, 255, 0.92), transparent 32rem);
  --loading-initial-background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(240, 242, 245, 0.98)), var(--canvas);

  --shadow-soft: 0 1rem 2.8rem rgba(15, 23, 42, 0.06);
  --shadow-panel: 0 2.4rem 6.4rem rgba(15, 23, 42, 0.2);
  --radius-xs: 0.6rem;
  --radius-sm: 0.8rem;
  --radius-md: 1.2rem;
  --radius-lg: 1.6rem;

  --font-size-xxs: 1.2rem;
  --line-height-xxs: 1.6rem;
  --font-size-xs: 1.4rem;
  --line-height-xs: 2rem;
  --font-size-sm: 1.6rem;
  --line-height-sm: 2.3rem;
  --font-size-md: 1.8rem;
  --line-height-md: 2.5rem;
  --font-size-lg: 2.2rem;
  --line-height-lg: 2.9rem;
  --font-size-xl: 2.8rem;
  --line-height-xl: 3.4rem;
  --font-size-xxl: 3.6rem;
  --line-height-xxl: 4rem;

  --font-weight-thin: 100;
  --font-weight-extralight: 200;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-semibold: 500;
  --font-weight-bold: 600;
  --font-weight-extrabold: 700;
  --font-weight-black: 800;
  --font-family: Akrobat, system-ui, sans-serif;

  --color-brand: var(--brand);
  --color-modal: var(--accent);
  --color-neutral-dark: var(--text-primary);
  --color-neutral-medium: var(--text-muted);
  --color-neutral-light: var(--surface-muted);
  --color-neutral-ultralight: var(--surface);
  --color-divider: var(--border-subtle);
  --color-success: var(--success);
  --color-danger: var(--danger);
  --color-text-success: var(--success-ink);
  --color-background-success: var(--success-surface);
  --color-text-danger: var(--danger-ink);
  --color-background-danger: var(--danger-surface);
  --clr-white: var(--surface);
  --clr-brand: var(--brand);
  --clr-gray-300: var(--surface-muted);
  --clr-gray-400: var(--border-strong);
}

:root[data-theme='dark'] {
  --brand: #ff7a00;
  --brand-strong: #ffb15f;
  --brand-soft: rgba(255, 122, 0, 0.18);
  --brand-action: #ff8a1f;
  --brand-action-hover: #ffa24d;
  --on-brand: #151922;
  --on-brand-action: #17120d;
  --accent: #42d2c5;
  --accent-soft: rgba(66, 210, 197, 0.16);
  --accent-action: #42d2c5;
  --accent-action-hover: #68ded4;
  --on-accent-action: #0f1218;
  --surface: #181c23;
  --surface-raised: #202631;
  --surface-muted: #28303d;
  --surface-tinted: #31251c;
  --canvas: #10141b;
  --text-primary: #f5f7fb;
  --text-secondary: #c8d0dc;
  --text-muted: #9aa5b5;
  --border-subtle: rgba(226, 232, 240, 0.11);
  --border-strong: rgba(226, 232, 240, 0.22);
  --danger: #ff7b7b;
  --danger-ink: #ffd0d0;
  --danger-surface: rgba(255, 123, 123, 0.14);
  --danger-border: rgba(255, 123, 123, 0.38);
  --danger-action: #ff7b7b;
  --danger-action-hover: #ff9494;
  --on-danger-action: #0f1218;
  --success: #54d98f;
  --success-ink: #c3f7d9;
  --success-surface: rgba(84, 217, 143, 0.14);
  --success-border: rgba(84, 217, 143, 0.38);
  --warning: #f4be66;
  --warning-surface: rgba(244, 190, 102, 0.16);
  --body-overlay: radial-gradient(circle at 20% -10%, rgba(255, 122, 0, 0.12), transparent 34rem);
  --loading-initial-background:
    linear-gradient(180deg, rgba(16, 20, 27, 0.96), rgba(16, 20, 27, 0.98)), var(--canvas);
  --shadow-soft: 0 1rem 2.8rem rgba(0, 0, 0, 0.22);
  --shadow-panel: 0 2.4rem 6.4rem rgba(0, 0, 0, 0.42);
}

html[data-theme-changing],
html[data-theme-changing] *,
html[data-theme-changing] *::before,
html[data-theme-changing] *::after {
  transition: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  font: inherit;
}

#cadesplugin_ovr * {
  all: revert;
}

html {
  height: 100%;
  font-size: 62.5%;
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  color: var(--text-primary);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  background: var(--body-overlay), var(--canvas);
}

#root {
  height: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
}

:is(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  font-size: inherit;
}

h2 {
  color: var(--text-primary);
  font-size: var(--font-size-xl);
  line-height: var(--line-height-xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: 2rem;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: calc(100dvh - var(--app-header-height));
  min-height: 0;
}

.app-main {
  min-width: 0;
  overflow: auto;
  padding: 3.2rem 0 8.8rem;
}

.wrapper {
  width: min(100%, 132rem);
  margin-inline: auto;
  padding-inline: 2.4rem;
}

.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  margin-bottom: 2rem;
}

.heading h2 {
  margin-bottom: 0;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.6rem;
  margin-bottom: 2rem;
}

.page-header__copy {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.page-header__copy p {
  max-width: 72rem;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.page-header__eyebrow {
  color: var(--brand-strong);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-black);
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
  padding: 1rem;
  background: var(--surface);
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.toolbar > :is(input, select, .select-container) {
  max-width: 42rem;
}

.table-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.table-toolbar > :is(input, select, .select-container) {
  flex: 1 1 20rem;
  min-width: min(20rem, 100%);
  max-width: 32rem;
}

.table-toolbar > .status {
  margin-left: auto;
}

.table-toolbar__refresh {
  flex: 0 0 auto;
  width: 4rem;
  min-width: 4rem;
  height: 4rem;
  min-height: 4rem;
  padding: 0;
  color: var(--brand-strong);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 0.1rem color-mix(in srgb, var(--brand) 34%, transparent);
}

.table-toolbar__refresh:hover {
  background: color-mix(in srgb, var(--brand-soft) 76%, var(--brand) 24%);
}

.table-toolbar__refresh svg {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.table-toolbar__refresh[aria-busy='true'] svg {
  animation: table-refresh-spin 0.8s linear infinite;
}

@keyframes table-refresh-spin {
  to {
    transform: rotate(1turn);
  }
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.filter-chip {
  min-height: 3.6rem;
  padding: 0.5rem 1.2rem;
  color: var(--text-secondary);
  background: var(--surface);
  border: 0.1rem solid var(--border-subtle);
  border-radius: 999rem;
  box-shadow: none;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
}

.filter-chip:hover,
.filter-chip:focus-visible {
  color: var(--text-primary);
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.filter-chip--active {
  color: var(--on-brand-action);
  background: var(--brand-action);
  border-color: transparent;
}

.filter-chip--active:hover,
.filter-chip--active:focus-visible {
  color: var(--on-brand-action);
  background: var(--brand-action-hover);
  border-color: transparent;
}

.dashboard-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr));
  gap: 1.6rem;
}

.metric-card,
.resource-card {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1.6rem;
  color: var(--text-primary);
  background: var(--surface);
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.metric-card__label,
.resource-card__meta {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
}

.metric-card__value,
.resource-card__title {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  font-weight: var(--font-weight-bold);
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.metric-card__value a {
  color: var(--brand-strong);
  text-decoration: underline;
  text-underline-offset: 0.3rem;
}

.metric-card__footer,
.resource-card__footer {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

.metric-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.external-auth-logout {
  min-height: 2.8rem;
  padding: 0.3rem 1rem;
  color: var(--danger-ink);
  background: color-mix(in oklab, var(--danger-surface) 72%, var(--surface) 28%);
  border: 0.1rem solid var(--danger-border);
  border-radius: var(--radius-sm);
  box-shadow: none;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
}

.external-auth-logout:hover {
  color: var(--on-danger-action);
  background: var(--danger-action);
  border-color: transparent;
}

.external-auth-logout:active {
  transform: translateY(0.1rem);
}

.external-auth-logout:focus-visible {
  box-shadow:
    inset 0 0 0 0.1rem var(--danger),
    0 0 0 0.3rem var(--danger-surface);
}

.resource-card {
  transition:
    border-color 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}

.resource-card:hover {
  transform: translateY(-0.2rem);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-panel);
}

.section {
  margin-bottom: 2.4rem;
  background: transparent;
}

.section > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(28rem, 1fr));
  gap: 1.6rem;
  padding-block: 0;
}

.section.column > div {
  grid-template-columns: minmax(0, 1fr);
}

.section.row > div {
  align-items: end;
}

.section.row > div > :is(div, dt, .label) {
  min-width: 0;
}

form {
  display: grid;
  gap: 1.6rem;
}

form .section {
  margin-bottom: 0;
}

:is(.label, label) {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
}

:is(.label, label) > span,
dt {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
}

label:has(input[type='checkbox']) {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 3.8rem;
}

.checkbox-field {
  margin-top: -0.2rem;
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.checkbox-field input[type='checkbox'] {
  width: 1.6rem;
  min-width: 1.6rem;
  min-height: 1.6rem;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

:is(input, select, textarea) {
  width: 100%;
  min-width: 0;
  min-height: 4rem;
  padding: 0.8rem 1.2rem;
  color: var(--text-primary);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: inset 0 0 0 0.1rem var(--border-strong);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-semibold);
  transition:
    box-shadow 0.15s,
    background-color 0.15s;
}

:is(input, select, textarea):focus {
  box-shadow:
    inset 0 0 0 0.2rem var(--brand),
    0 0 0 0.4rem var(--brand-soft);
}

:is(input, select, textarea):disabled {
  cursor: not-allowed;
  color: var(--text-muted);
  background: var(--surface-muted);
}

input[type='checkbox'] {
  width: 1.8rem;
  min-height: auto;
  aspect-ratio: 1;
  padding: 0;
  accent-color: var(--brand);
  box-shadow: none;
}

input[type='search'] {
  padding-left: 4rem;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m14.6 15.65-3.35-3.35a5.15 5.15 0 1 1 1.06-1.06l3.35 3.34a.75.75 0 1 1-1.06 1.07ZM4.75 8.25a3.65 3.65 0 1 0 7.3 0 3.65 3.65 0 0 0-7.3 0Z' fill='%23737c8b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 1.2rem center;
}

input[type='search']::-webkit-search-cancel-button {
  display: none;
}

select {
  appearance: none;
  cursor: pointer;
  padding-right: 3.8rem;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m5.5 7.5 4.5 5 4.5-5' stroke='%23737c8b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 1.1rem) center;
}

button,
.button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  min-height: 4rem;
  width: auto;
  padding: 0.8rem 1.4rem;
  color: var(--text-primary);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: inset 0 0 0 0.1rem var(--border-strong);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-bold);
  transition:
    transform 0.12s,
    background-color 0.15s,
    box-shadow 0.15s;
}

.file-input-control {
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.file-input-control input[type='file'] {
  position: absolute;
  width: 0.1rem;
  height: 0.1rem;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.file-input-control__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  padding: 0.8rem 1.4rem;
  color: var(--text-primary);
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 0.1rem var(--border-strong);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-bold);
}

.file-input-control__name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input-control:has(input[type='file']:focus-visible) .file-input-control__button {
  box-shadow:
    inset 0 0 0 0.2rem var(--brand),
    0 0 0 0.4rem var(--brand-soft);
}

.file-input-control--selected .file-input-control__name {
  color: var(--success-ink);
}

button:hover,
.button:hover {
  background: var(--surface-muted);
}

button:active,
.button:active {
  transform: translateY(0.1rem);
}

button:focus-visible,
.button:focus-visible {
  box-shadow:
    inset 0 0 0 0.2rem var(--brand),
    0 0 0 0.4rem var(--brand-soft);
}

button.accent,
.button--primary,
.accent:is(button, .button) {
  color: var(--on-brand-action);
  background: var(--brand-action);
  box-shadow: none;
}

button.accent:hover,
.button--primary:hover,
.accent:is(button, .button):hover {
  background: var(--brand-action-hover);
}

button.modal,
.button--secondary,
.modal:is(button, .button) {
  color: var(--on-accent-action);
  background: var(--accent-action);
  box-shadow: none;
}

button.modal:hover,
.button--secondary:hover,
.modal:is(button, .button):hover {
  background: var(--accent-action-hover);
}

button.danger,
.button--danger,
.danger:is(button, .button) {
  color: var(--on-danger-action);
  background: var(--danger-action);
  box-shadow: none;
}

button.danger:hover,
.button--danger:hover,
.danger:is(button, .button):hover {
  background: var(--danger-action-hover);
}

button.danger:focus-visible,
.button--danger:focus-visible,
.danger:is(button, .button):focus-visible {
  box-shadow: 0 0 0 0.4rem var(--danger-surface);
}

.settings-toggle--yes {
  color: var(--success-ink);
  background: var(--success-surface);
  box-shadow: inset 0 0 0 0.1rem var(--success-border);
}

.settings-toggle--yes:hover {
  background: color-mix(in oklab, var(--success-surface) 84%, var(--success) 16%);
}

.settings-toggle--no {
  color: var(--danger-ink);
  background: var(--danger-surface);
  box-shadow: inset 0 0 0 0.1rem var(--danger-border);
}

.settings-toggle--no:hover {
  background: color-mix(in oklab, var(--danger-surface) 84%, var(--danger) 16%);
}

.button--compact {
  min-height: 3.4rem;
  padding: 0.5rem 1rem;
  font-size: var(--font-size-xs);
}

form:invalid button[type='submit'],
button[data-disabled],
button[disabled] {
  cursor: not-allowed;
  transform: none;
  opacity: 0.55;
}

dl.section {
  padding-block: 0;
}

dd {
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.8rem 1.2rem;
  color: var(--text-primary);
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 0.1rem var(--border-subtle);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  font-weight: var(--font-weight-bold);
  text-align: center;
}

dd.success {
  color: var(--success-ink);
  background: var(--success-surface);
  box-shadow: inset 0 0 0 0.1rem var(--success-border);
}

dd.accent {
  color: var(--on-brand-action);
  background: var(--brand-action);
}

dd.modal {
  color: var(--on-accent-action);
  background: var(--accent-action);
}

dd.danger {
  color: var(--danger-ink);
  background: var(--danger-surface);
  box-shadow: inset 0 0 0 0.1rem var(--danger-border);
}

dd:has(:is(button, a)) {
  padding: 0;
}

dd :is(button, a) {
  width: 100%;
  min-height: 4rem;
  border-radius: inherit;
}

dd a {
  color: var(--brand-strong);
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.table-container {
  position: relative;
  overflow: auto;
  max-width: 100%;
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.table-container--orders table {
  min-width: 96rem;
}

.table-container--reports table {
  min-width: 88rem;
}

.table-container--print-tasks table {
  min-width: 82rem;
}

.table-container:has(> p) {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
}

.empty-state {
  min-height: 18rem;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 2.4rem;
  color: var(--text-muted);
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
  font-weight: var(--font-weight-bold);
  text-align: center;
  overflow-wrap: anywhere;
}

.table-state {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 24rem;
  padding: 2.4rem;
}

.table-state__content {
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  max-width: 42rem;
  text-align: center;
}

.table-state__content strong {
  color: var(--text-primary);
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
  font-weight: var(--font-weight-bold);
}

.table-state__content p {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  overflow-wrap: anywhere;
}

.table-state__content button {
  margin-top: 0.8rem;
}

.table-skeleton {
  display: grid;
  gap: 0.8rem;
  width: 100%;
}

.table-skeleton__row {
  display: grid;
  grid-template-columns: 7rem 11rem minmax(12rem, 1fr) 9rem 12rem;
  gap: 1.2rem;
  align-items: center;
  min-height: 4.8rem;
  padding: 0 1rem;
}

.table-skeleton__row span {
  height: 1.4rem;
  border-radius: 999rem;
  background: linear-gradient(
    90deg,
    var(--surface-muted),
    var(--surface-tinted),
    var(--surface-muted)
  );
  background-size: 200% 100%;
  animation: table-skeleton-pulse 1.2s ease-in-out infinite;
}

.table-skeleton__row span:nth-child(3) {
  width: min(100%, 24rem);
}

.table-skeleton__row span:nth-child(4),
.table-skeleton__row span:nth-child(5) {
  width: 75%;
}

@keyframes table-skeleton-pulse {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-primary);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

th,
td {
  min-height: 4.8rem;
  padding: 1.2rem 1rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 0.1rem solid var(--border-subtle);
}

th:first-child,
td:first-child {
  padding-left: 1.6rem;
}

th:last-child,
td:last-child {
  padding-right: 1.6rem;
}

th {
  color: var(--text-muted);
  background: var(--surface-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-black);
  text-transform: uppercase;
}

td {
  background: var(--surface);
  font-weight: var(--font-weight-semibold);
}

tbody tr {
  transition: background-color 0.15s;
}

tbody tr[tabindex] {
  cursor: pointer;
  outline: none;
}

tbody tr:hover td {
  background: var(--surface-tinted);
}

tbody tr[tabindex]:focus-visible td {
  background: var(--surface-tinted);
  box-shadow: inset 0 0 0 0.2rem var(--brand-soft);
}

tbody tr:last-child td {
  border-bottom: none;
}

td:has(.table-actions) {
  overflow: visible;
}

.order-code-type-cell,
.code-type-cell {
  text-align: center;
}

.order-code-type-icon,
.code-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border: 0.1rem solid color-mix(in srgb, var(--brand) 34%, transparent);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  line-height: 1;
  font-weight: var(--font-weight-black);
  vertical-align: middle;
}

.order-code-type-icon svg,
.code-type-icon svg {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.table-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 3.6rem;
  height: 3.2rem;
  border-radius: var(--radius-sm);
}

.table-actions__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  min-height: 3.2rem;
  height: 3.2rem;
  padding: 0;
  color: var(--text-secondary);
  background: var(--surface);
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.table-actions__trigger:hover,
.table-actions__trigger:focus-visible,
.table-actions__trigger--open {
  color: var(--color-brand);
  background: var(--surface-muted);
  border-color: var(--color-brand);
}

.table-actions__trigger--open {
  box-shadow: 0 0 0 0.3rem var(--brand-soft);
}

.table-item-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  z-index: 20;
  min-width: 18rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-0.4rem);
  transition:
    opacity 0.15s,
    transform 0.15s,
    visibility 0.15s;
}

.table-item-menu.table-item-menu--open {
  display: block;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
}

.table-item-menu--portal {
  position: fixed;
  right: auto;
  top: auto;
  z-index: 80;
}

.table-item-menu ul {
  overflow: hidden;
  padding: 0.4rem;
  list-style: none;
  background: var(--surface);
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
}

.table-item-menu li {
  cursor: pointer;
  padding: 0.8rem 1rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  outline: none;
}

.table-item-menu li:hover,
.table-item-menu li:focus {
  color: var(--text-primary);
  background: var(--surface-muted);
}

.side-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  justify-items: end;
}

.side-drawer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  padding: 0;
  background: rgba(15, 23, 42, 0.32);
  border-radius: 0;
  box-shadow: none;
}

.side-drawer-backdrop:hover,
.side-drawer-backdrop:focus-visible,
.side-drawer-backdrop:active {
  transform: none;
  background: rgba(15, 23, 42, 0.32);
  box-shadow: none;
}

.side-drawer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(48rem, 100vw);
  height: 100dvh;
  min-width: 0;
  background: var(--surface);
  border-left: 0.1rem solid var(--border-subtle);
  box-shadow: var(--shadow-panel);
}

.side-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.2rem;
  min-width: 0;
  padding: 1.8rem;
  border-bottom: 0.1rem solid var(--border-subtle);
}

.side-drawer__header h2 {
  min-width: 0;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  overflow-wrap: anywhere;
}

.side-drawer__header button {
  flex: 0 0 auto;
}

.side-drawer__body {
  min-width: 0;
  overflow: auto;
  padding: 1.8rem;
}

.detail-list {
  display: grid;
  gap: 1rem;
}

.detail-list div {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  padding-bottom: 1rem;
  border-bottom: 0.1rem solid var(--border-subtle);
}

.detail-list dt {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
}

.detail-list dd {
  min-width: 0;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 2.8rem;
  padding: 0.3rem 1rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 0.1rem solid var(--border-subtle);
  border-radius: 999rem;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
  font-weight: var(--font-weight-bold);
}

.status.accent {
  color: var(--on-brand-action);
  background: var(--brand-action);
  border-color: transparent;
}

.status.success {
  color: var(--success-ink);
  background: var(--success-surface);
  border-color: var(--success-border);
}

.status.danger {
  color: var(--danger-ink);
  background: var(--danger-surface);
  border-color: var(--danger-border);
}

footer {
  position: fixed;
  left: calc(var(--sidebar-width) + 2.4rem);
  right: 2.4rem;
  bottom: 2.4rem;
  z-index: 30;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

footer > div {
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  width: min(100%, 132rem);
  padding: 1rem;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(1.8rem);
  min-width: 0;
}

footer button {
  min-width: 20rem;
}

dialog {
  width: fit-content;
  min-width: min(34rem, calc(100vw - 2rem));
  max-width: calc(100vw - 3.2rem);
  max-height: calc(100dvh - 3.2rem);
  margin: auto;
  padding: 0;
  border: none;
  outline: none;
  overflow: visible;
  background: transparent;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(0.2rem);
}

dialog[open] {
  display: grid;
}

dialog[open] > div {
  width: min(100%, 46rem);
  max-height: calc(100dvh - 3.2rem);
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.6rem;
  background: var(--surface);
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
}

dialog:has(input[name='reportType']) > div {
  overflow-y: clip;
}

dialog:has(.select-container--open) {
  overflow: visible;
}

dialog:has(.select-container--open) > div {
  overflow: visible;
}

@media (height <= 520px) {
  dialog:has(input[name='reportType']) > div {
    overflow-y: auto;
  }
}

@media (width <= 640px), (pointer: coarse) and (width <= 820px) {
  dialog {
    width: calc(100vw - 1.6rem);
    min-width: 0;
    max-width: calc(100vw - 1.6rem);
    max-height: calc(100svh - 1.6rem - env(safe-area-inset-top));
    margin: max(0.8rem, env(safe-area-inset-top)) auto auto;
  }

  dialog[open] > div {
    width: 100%;
    max-height: calc(100svh - 1.6rem - env(safe-area-inset-top));
  }
}

dialog form {
  min-width: 0;
}

dialog h2 {
  margin-bottom: 1.2rem;
  overflow-wrap: anywhere;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
}

dialog .wrapper {
  width: 100%;
  max-width: 100%;
  padding-inline: 0;
}

dialog .section > div {
  grid-template-columns: minmax(0, 1fr);
}

dialog :is(.label, label, input, select, textarea, .select-container) {
  max-width: 100%;
}

dialog button {
  width: 100%;
}

.select-container {
  --max-items: 4;
  position: relative;
}

.select-container > input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.select__input {
  position: relative;
}

.select__input > input {
  min-width: 0;
  padding-right: 4rem;
  text-overflow: ellipsis;
}

.select__input > svg {
  position: absolute;
  right: 1rem;
  top: 50%;
  translate: 0 -50%;
  pointer-events: none;
}

.select__items {
  position: fixed;
  z-index: 25;
  max-height: calc(3.8rem * var(--max-items) + 0.8rem);
  margin: 0;
  padding: 0.4rem;
  overflow-y: auto;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
  list-style: none;
  background: var(--surface);
  border: 0.1rem solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  transition:
    opacity 0.15s,
    transform 0.15s,
    visibility 0.15s;
}

.select__items--portal {
  z-index: 2147483000;
}

.select__item {
  cursor: pointer;
  min-height: 3.8rem;
  padding: 0.8rem 1rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.select__item:hover {
  color: var(--text-primary);
  background: var(--surface-muted);
}

.select__item--active {
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-weight: var(--font-weight-bold);
}

.select__item--disabled {
  cursor: not-allowed;
  color: var(--text-muted);
  opacity: 0.55;
}

.select__item > span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

@media (width < 980px), (orientation: portrait) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-main {
    padding-top: 2rem;
    padding-bottom: 9rem;
  }

  footer {
    left: 1.2rem;
    right: 1.2rem;
    bottom: 1.2rem;
  }
}

@media (width >= 980px) and (orientation: landscape) {
  .table-container--orders,
  .table-container--reports,
  .table-container--print-tasks {
    max-height: max(22rem, calc(100dvh - var(--app-header-height) - 33.4rem)) !important;
  }

  tbody tr[tabindex] {
    cursor: default;
  }
}

@media (width <= 840px), (orientation: portrait) {
  .wrapper {
    padding-inline: 1.4rem;
  }

  .section > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header,
  .toolbar:not(.table-toolbar) {
    align-items: stretch;
    flex-direction: column;
  }

  .table-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(13rem, 1fr));
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem;
  }

  .table-toolbar > input {
    grid-column: 1 / -1;
  }

  .table-toolbar > :is(input, select, .select-container) {
    width: 100%;
    min-width: 0;
    min-height: 3.6rem;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
  }

  .table-toolbar > .select-container .select__input > input {
    min-height: 3.6rem;
    padding-block: 0.6rem;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-xs);
  }

  .table-toolbar > .status {
    grid-column: 1;
    justify-self: start;
    margin-left: 0;
  }

  .table-toolbar__refresh {
    grid-column: 2;
    justify-self: end;
    width: 3.6rem;
    min-width: 3.6rem;
    height: 3.6rem;
    min-height: 3.6rem;
  }

  .toolbar > :is(input, select, .select-container) {
    max-width: none;
  }

  footer > div {
    flex-direction: column-reverse;
    align-items: stretch;
    max-height: calc(100dvh - 2.4rem);
    overflow-y: auto;
  }

  footer button {
    width: 100%;
    min-width: 0;
  }
}
