:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --brand: #1f6feb;
  --brand-dark: #174ea6;
  --good: #1f9d55;
  --warn: #c77700;
  --bad: #bf2c2c;
  --hold: #8b5cf6;
  --pink: #f4c7e9;
  --yellow: #fff45c;
  --green: #42d86b;
  --orange: #ffbf47;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

body.dark-mode {
  --bg: #202734;
  --panel: #283241;
  --ink: #edf2f7;
  --muted: #b8c3d1;
  --line: #445266;
  --brand: #8bbcff;
  --brand-dark: #6ca4f4;
  --good: #6bd48f;
  --warn: #e0b25b;
  --bad: #f08080;
  --hold: #b6a2ff;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: #222b38;
  color: var(--ink);
  border-color: #52627a;
}

body.dark-mode .topbar,
body.dark-mode .filters,
body.dark-mode .stats,
body.dark-mode .panel,
body.dark-mode .table-shell,
body.dark-mode .week-day,
body.dark-mode .order-card,
body.dark-mode .message,
body.dark-mode .dock-panel,
body.dark-mode .form-section,
body.dark-mode .chat-messages,
body.dark-mode .revision-log,
body.dark-mode .dock-messages {
  background: var(--panel);
  color: var(--ink);
}

body.dark-mode th,
body.dark-mode .week-day header,
body.dark-mode .dock-panel header {
  background: #344154;
}

body.dark-mode td,
body.dark-mode .stat,
body.dark-mode .week-cards,
body.dark-mode .new-checkin-row td,
body.dark-mode .empty-checkin-slot td {
  background: #2c3748;
  color: var(--ink);
}

body.dark-mode .cell-btn,
body.dark-mode .secondary,
body.dark-mode .icon-btn {
  background: #344154;
  color: #e9f1fb;
  border-color: #586982;
}

body.dark-mode .primary {
  background: #6ca4f4;
  color: #0f1720;
}

body.dark-mode .muted,
body.dark-mode label {
  color: var(--muted);
}

body.dark-mode .search-suggestions,
body.dark-mode .search-suggestions button,
body.dark-mode .detail-grid div,
body.dark-mode #approvalDetailBody pre,
body.dark-mode .confirm-modal,
body.dark-mode .modal-form {
  background: #283241;
  color: var(--ink);
  border-color: var(--line);
}

body.dark-mode .order-card.order-type-cpu {
  background: var(--panel);
}

body.dark-mode .order-card.order-type-freight {
  background: var(--panel);
}

body.dark-mode .order-card.order-type-delivery {
  background: var(--panel);
}

body.dark-mode .status-card-ready,
body.dark-mode .status-card-complete,
body.dark-mode .status-card-completed {
  background: #14231c;
}

body.dark-mode .status-card-in-progress,
body.dark-mode .status-card-printed,
body.dark-mode .status-card-pick-up-in-progress {
  background: #152235;
}

body.dark-mode .status-card-on-hold,
body.dark-mode .status-card-waiting-on-issue {
  background: #241f19;
}

body.dark-mode .status-card-cancelled {
  background: #291a1d;
}

body.dark-mode .order-card.special-bo-oc-card:not(.print-selected) {
  background: #2a2141;
  border-left-color: #a78bfa;
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.28);
}

body.dark-mode .busy-indicator {
  background: #1b2633;
  border-color: #314762;
  color: var(--ink);
}

body.dark-mode .assembly-status-filter summary,
body.dark-mode .status-filter-options {
  background: #222b38;
  color: var(--ink);
  border-color: #52627a;
}

body.dark-mode .status-filter-options label:hover {
  background: #344154;
}

body.dark-mode .health-chip,
body.dark-mode .health-summary div {
  background: #2c3748;
}

body.dark-mode tr.order-type-cpu td {
  background: #263f44;
}

body.dark-mode tr.order-type-freight td {
  background: #34334d;
}

body.dark-mode tr.order-type-delivery td {
  background: #432d3a;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.error {
  color: var(--bad);
  min-height: 20px;
  margin: 4px 0 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 111, 235, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(31, 157, 85, 0.12), transparent 32%),
    var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(25, 34, 44, 0.12);
  display: grid;
  gap: 16px;
}

.login-panel h1,
.topbar h1,
.modal-form h2,
.chat-modal h2,
.queue-modal h2 {
  margin: 0;
}

.login-logo {
  display: block;
  width: min(190px, 72%);
  height: auto;
  margin: 0 0 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 9px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.primary,
.secondary,
.ghost,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
}

.primary {
  background: var(--brand);
  color: white;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #eef4ff;
  color: #184a9e;
  border-color: #c8d8f3;
}

.ghost {
  background: transparent;
  color: #d9e2f1;
  border-color: rgba(255, 255, 255, 0.18);
}

.wide {
  width: 100%;
}

.plain {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: #16202c;
  color: white;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.brand {
  display: grid;
  gap: 5px;
  justify-items: center;
  text-align: center;
}

.brand strong {
  font-size: 13px;
  line-height: 1.1;
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #16202c;
  border-radius: 8px;
  font-weight: 900;
}

.logo-mark {
  width: 88px;
  height: 48px;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff url("/HCI_LOGO.png") center / contain no-repeat;
}

.logo-mark img {
  display: none;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #aab8c8;
  font-size: 11px;
}

nav {
  display: grid;
  gap: 6px;
  flex: 1;
  align-content: start;
}

nav button {
  text-align: center;
  color: #d9e2f1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 6px;
  font-weight: 750;
  font-size: 12px;
}

nav button.active,
nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.bottom-nav {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
}

.online-users-panel {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
}

.online-users-toggle {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 7px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 12px;
}

.online-users-toggle span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #31d158;
  box-shadow: 0 0 0 3px rgba(49, 209, 88, 0.18);
}

.online-users-list {
  max-height: 160px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.12);
  display: grid;
  gap: 5px;
}

.online-user {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 12px;
  min-width: 0;
}

.online-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-user .team-avatar {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.bottom-nav > button {
  width: 100%;
  text-align: center;
  color: #d9e2f1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 6px;
  font-weight: 750;
  font-size: 12px;
}

.bottom-nav > button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

#reportFeedbackBtn {
  color: #dbeafe;
  border-color: rgba(139, 188, 255, 0.28);
}

.theme-toggle {
  display: grid;
  grid-template-columns: auto 38px auto;
  align-items: center;
  gap: 6px;
  background: transparent;
  border-color: transparent;
  color: #d9e2f1;
  padding: 8px 6px;
}

.theme-icon {
  font-size: 11px;
  font-weight: 850;
}

.theme-switch {
  width: 38px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: #edf5ff;
  padding: 2px;
  display: flex;
  align-items: center;
}

.theme-switch span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
  transition: transform 160ms ease, background 160ms ease;
}

.theme-toggle.active .theme-switch {
  background: #243247;
}

.theme-toggle.active .theme-switch span {
  transform: translateX(18px);
  background: #c8d7ff;
}

.workspace {
  min-width: 0;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 12px;
}

.topbar,
.filters,
.stats,
.panel,
.table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar p {
  margin: 4px 0 0;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-mode-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.secondary.selected,
.view-mode-buttons .selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

#checkinRemoveBtn.selected {
  background: #ffe4e6;
  border-color: #fb7185;
  color: #9f1239;
}

.upload-band {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.upload-band h2,
.upload-band p {
  margin: 0;
}

.upload-band p {
  margin-top: 4px;
  color: var(--muted);
}

.filters {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(360px, auto) 140px 170px 170px 190px minmax(220px, 1fr);
  grid-template-areas:
    "date view type assembly status search"
    "switch view type assembly status search";
  gap: 4px 10px;
  align-items: end;
}

.day-switcher {
  grid-area: switch;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
}

.date-filter-label {
  grid-area: date;
  justify-self: start;
}

.view-filter-wrap {
  grid-area: view;
}

.order-type-filter-wrap {
  grid-area: type;
}

.assembly-filter-wrap {
  grid-area: assembly;
}

.assembly-status-filter {
  grid-area: status;
  position: relative;
  align-self: end;
}

.assembly-status-filter summary {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.assembly-status-filter summary::-webkit-details-marker {
  display: none;
}

.assembly-status-filter summary::after {
  content: "v";
  float: right;
  color: var(--muted);
}

.assembly-status-filter[open] summary::after {
  content: "^";
}

.status-filter-options {
  position: absolute;
  z-index: 25;
  top: calc(100% + 6px);
  right: 0;
  width: 230px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  padding: 8px;
  display: grid;
  gap: 4px;
}

.status-filter-options label {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 5px;
  font-weight: 650;
}

.status-filter-options label:hover {
  background: #eef4ff;
}

.status-filter-options input {
  width: 16px;
  height: 16px;
}

.filters > label.search {
  grid-area: search;
}

.date-filter-label {
  position: relative;
}

.date-filter-label input {
  position: absolute;
  inset: auto auto 0 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.current-date-label {
  min-width: 190px;
  font-weight: 850;
  color: var(--ink);
  text-align: center;
  border: 0;
  background: transparent;
  padding: 3px 4px;
  border-radius: 4px;
}

.current-date-label:hover,
.current-date-label:focus {
  background: #eef4ff;
  outline: 1px solid #c8d8f3;
}

.week-picker {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  color: #f8fafc;
}

.week-picker-panel {
  width: min(560px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid #2f3a48;
  border-radius: 4px;
  background: #111315;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
}

.week-picker header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.week-picker header button,
.week-picker-days button,
.week-picker-months button,
.week-picker-today {
  border: 0;
  color: #f8fafc;
  background: transparent;
  border-radius: 4px;
}

.week-picker header button {
  width: 28px;
  height: 28px;
  font-size: 17px;
}

.week-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 31px);
  gap: 3px;
}

.week-picker-days b {
  height: 24px;
  display: grid;
  place-items: center;
  color: #f1f5f9;
  font-size: 12px;
}

.week-picker-days button {
  height: 28px;
  font-weight: 700;
  font-size: 12px;
}

.week-picker-days button:hover,
.week-picker-months button:hover,
.week-picker header button:hover,
.week-picker-today:hover {
  background: #243244;
}

.week-picker-days button.outside {
  color: #8b99aa;
}

.week-picker-days button.week-selected {
  background: #0f5f9a;
  color: #fff;
}

.week-picker-days button.today {
  background: #0b75c9;
  color: #fff;
}

.week-picker-years {
  border-left: 1px solid #3a4554;
  padding-left: 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.week-picker-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 10px;
  align-content: start;
}

.week-picker-months button {
  min-height: 38px;
  font-weight: 800;
}

.week-picker-months button.selected {
  background: #0f5f9a;
}

.week-picker-today {
  justify-self: end;
  padding: 8px 10px;
  font-weight: 800;
}

.icon-btn {
  min-width: 40px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  font-size: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  overflow: hidden;
}

.stat {
  padding: 12px;
  background: #fff;
}

.stat strong {
  display: block;
  font-size: 22px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.table-shell {
  overflow: auto;
}

.work-week {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 6px;
  min-height: 360px;
}

.week-day {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  min-width: 0;
}

.week-day header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  background: #25364b;
  color: #fff;
}

.week-day header span {
  color: #d8e2ef;
  font-size: 12px;
}

.week-cards {
  display: grid;
  gap: 4px;
  padding: 5px;
}

.empty-day {
  margin: 6px 2px;
}

.order-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 4px;
  padding: 3px 5px;
  display: grid;
  gap: 3px;
  min-width: 0;
  font-size: 12px;
  cursor: pointer;
}

body.density-compact .order-card {
  padding: 2px 4px;
  gap: 2px;
  font-size: 11px;
}

body.density-large .order-card {
  padding: 7px 8px;
  gap: 5px;
  font-size: 13px;
}

.order-card:hover {
  background: #fbfdff;
  border-color: #c9d7eb;
}

.order-card.has-issue {
  background: #fff8ed;
  border-color: #fed7aa;
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.18);
}

.order-card.order-type-cpu {
  border-left-color: #0f766e;
}

.order-card.order-type-freight {
  border-left-color: #a78bfa;
}

.order-card.order-type-delivery {
  border-left-color: #9f1239;
}

.delivery-border-cpu {
  border-left-color: #0f9488;
}

.delivery-border-freight {
  border-left-color: #b799ff;
}

.delivery-border-delivery {
  border-left-color: #8a1538;
}

.status-card-ready,
.status-card-complete,
.status-card-completed {
  background: #f4fff6;
}

.status-card-in-progress,
.status-card-printed,
.status-card-pick-up-in-progress {
  background: #f5f9ff;
}

.status-card-on-hold,
.status-card-waiting-on-issue {
  background: #fff8ed;
}

.status-card-cancelled {
  background: #fff5f5;
}

.order-card.special-bo-oc-card {
  border-left-color: #7c3aed;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.22);
}

.order-card.special-bo-oc-card:not(.print-selected) {
  background: #f7f1ff;
}

.order-card.print-selected {
  box-shadow: inset 0 0 0 2px var(--brand);
  background: #edf5ff;
}

.card-top,
.card-meta-row,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.card-title {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.card-title strong {
  flex: 0 0 auto;
}

.card-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-card small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.card-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 10px;
}

.card-actions button,
.card-note {
  cursor: pointer;
}

.card-note {
  border: 0;
  border-radius: 4px;
  padding: 2px 4px;
  text-align: left;
  background: #fff4fb;
  color: #7a145f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  line-height: 1.25;
}

.card-note.has-unread {
  color: #b42318;
  background: #fff1f3;
}

.danger-link {
  color: var(--bad);
}

.parse-panel {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.parse-panel p {
  margin: 3px 0 0;
}

.inbox-file-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.inbox-group {
  display: grid;
  grid-template-columns: minmax(150px, 240px) 1fr 128px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
}

.inbox-identity {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.inbox-customer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.inbox-badge {
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 8px;
  text-transform: uppercase;
}

.inbox-badge.revision {
  background: #8e44d8;
}

.inbox-badge.warranty {
  background: #e86f11;
}

.inbox-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}

.inbox-action {
  justify-self: end;
  text-align: right;
}

.order-select {
  width: 14px;
  height: 14px;
  margin: 0 4px 0 0;
  vertical-align: middle;
}

.form-sections {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.form-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.revision-changed {
  background: #f4eaff;
  border-color: #9b5de5 !important;
  box-shadow: inset 3px 0 0 #8e44d8;
}

.revision-changed input,
.revision-changed select,
.revision-changed textarea {
  border-color: #9b5de5;
  background: #fff;
}

body.dark-mode .revision-changed {
  background: rgba(155, 93, 229, 0.18);
}

.span-4 {
  grid-column: 1 / -1;
}

.status-border-ready {
  border-left-color: var(--good);
}

.status-border-complete,
.status-border-completed {
  border-left-color: var(--bad);
}

.status-border-late,
.status-border-waiting-on-issue {
  border-left-color: var(--warn);
}

.status-border-on-hold {
  border-left-color: var(--hold);
}

.status-border-cancelled {
  border-left-color: var(--bad);
}

.status-border-pulling,
.status-border-printed,
.status-border-in-progress,
.status-border-pick-up-in-progress {
  border-left-color: var(--warn);
}

tr.order-type-cpu td {
  background: #eefcf9;
}

tr.order-type-freight td {
  background: #f5f1ff;
}

tr.order-type-delivery td {
  background: #fff1f4;
}

tr.order-type-cpu td:first-child {
  box-shadow: inset 4px 0 0 #0f766e;
}

tr.order-type-freight td:first-child {
  box-shadow: inset 4px 0 0 #a78bfa;
}

tr.order-type-delivery td:first-child {
  box-shadow: inset 4px 0 0 #9f1239;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1480px;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #eef1f5;
  padding: 5px 6px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.density-compact th,
body.density-compact td {
  padding: 3px 4px;
  font-size: 12px;
}

body.density-large th,
body.density-large td {
  padding: 8px 9px;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #25364b;
  color: #fff;
  text-align: left;
  font-weight: 800;
}

tbody tr:hover {
  background: #f8fbff;
}

.remove-mode tbody tr {
  cursor: pointer;
}

.remove-mode tbody tr:hover {
  background: #fff1f2;
}

td.note {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  color: #7a145f;
  background: #fff4fb;
}

.col-edit_control {
  width: 102px;
}

.col-eta_time {
  width: 122px;
}

.checkin-invoice-col {
  width: 92px;
}

.checkin-type-col {
  width: 92px;
}

.col-customer_name {
  width: 250px;
}

.col-date_of_entry,
.col-ready_date {
  width: 118px;
}

.col-order_type,
.col-route {
  width: 130px;
}

.col-display_invoice {
  width: 108px;
}

.assembly-action-col,
.col-edit_control {
  width: 96px;
}

.assembly-customer-col {
  width: 260px;
}

.col-piece_count,
.col-cabinet_count,
.col-mod_count {
  width: 82px;
}

.col-calendar_category {
  width: 150px;
}

.col-latest_note {
  width: 260px;
}

.col-actions {
  width: 170px;
}

.col-assembly_status,
.col-cpu_status {
  width: 136px;
}

.checkin-piece-col {
  width: 68px;
}

.checkin-time-col {
  width: 112px;
}

.col-wait_time {
  width: 82px;
}

.col-communications {
  width: 300px;
}

tr.print-selected td {
  background: #edf5ff !important;
  box-shadow: inset 0 2px 0 var(--brand), inset 0 -2px 0 var(--brand);
}

tr.print-selected td:first-child {
  box-shadow: inset 4px 0 0 var(--brand), inset 0 2px 0 var(--brand), inset 0 -2px 0 var(--brand);
}

body.dark-mode tr.print-selected td {
  background: #203a58 !important;
}

td.center,
th.center {
  text-align: center;
}

.cell-btn {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 800;
  padding: 0;
  position: relative;
  white-space: nowrap;
}

.row-edit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.fixed-action {
  width: 104px;
}

.secondary.selected,
.fixed-action.selected {
  background: #dbeafe;
  border-color: var(--brand);
  color: var(--brand-dark);
}

.badge-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 0 5px;
}

.inline-select,
.inline-time,
.new-checkin-row input,
.new-checkin-row select {
  width: 100%;
  min-height: 26px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.new-checkin-row td {
  background: #f8fbff;
}

.empty-checkin-slot td {
  background: #fff;
  color: #98a2b3;
}

.pickup-slot {
  font-weight: 850;
  color: #111827;
  text-align: center;
}

.new-checkin-row .pickup-slot {
  background: #eef6ff;
}

.cell-btn.has-unread {
  color: #b42318;
}

.note-count,
.note-badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #e11d48;
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 0 4px;
}

.note-badge {
  width: auto;
  padding: 0 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-width: 110px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 850;
}

.status-ready,
.status-complete,
.status-completed {
  background: #ffe0e0;
  color: #9a1b1b;
}

.status-ready {
  background: #dbf7df;
  color: #126132;
}

.status-pulling,
.status-printed,
.status-in-progress,
.status-pick-up-in-progress {
  background: #fff0c2;
  color: #824a00;
}

.status-late,
.status-waiting-on-issue {
  background: #fff0c2;
  color: #824a00;
}

.status-on-hold {
  background: #ffe0e0;
  color: #9a1b1b;
}

.status-cancelled {
  background: #ffe0e0;
  color: #9a1b1b;
}

tr.cpu-row-ready .status {
  background: #dbeafe;
  color: #1d4ed8;
}

tr.cpu-row-ready td {
  background: #eff6ff;
}

tr.cpu-row-in-progress .status {
  background: #ffedd5;
  color: #c2410c;
}

tr.cpu-row-in-progress td {
  background: #fff7ed;
}

tr.cpu-row-on-hold .status {
  background: #fee2e2;
  color: #b91c1c;
}

tr.cpu-row-on-hold td {
  background: #fef2f2;
}

tr.cpu-row-complete .status,
tr.cpu-row-completed .status {
  background: #dcfce7;
  color: #15803d;
}

tr.cpu-row-complete td,
tr.cpu-row-completed td {
  background: #f0fdf4;
}

tr.cpu-row-late td {
  background: #fffbeb;
}

tr.cpu-row-ready td:first-child {
  box-shadow: inset 4px 0 0 #2563eb;
}

tr.cpu-row-in-progress td:first-child {
  box-shadow: inset 4px 0 0 #f97316;
}

tr.cpu-row-on-hold td:first-child {
  box-shadow: inset 4px 0 0 #dc2626;
}

tr.cpu-row-complete td:first-child,
tr.cpu-row-completed td:first-child {
  box-shadow: inset 4px 0 0 #16a34a;
}

.busy-indicator {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid #b8cff5;
  border-radius: 999px;
  background: #ffffff;
  color: #163d76;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 3px solid #dbeafe;
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(980px, calc(100vw - 32px));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal-form,
.chat-modal,
.queue-modal,
.confirm-modal {
  padding: 18px;
}

.modal-form header,
.modal-form footer,
.chat-modal header,
.queue-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.confirm-dialog {
  width: min(380px, calc(100vw - 32px));
}

.confirm-modal {
  display: grid;
  gap: 12px;
}

.confirm-modal h2,
.confirm-modal p {
  margin: 0;
}

.confirm-modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-form footer {
  justify-content: flex-end;
  margin-top: 14px;
}

.checkin-edit-form .form-sections {
  gap: 10px;
}

.warranty-check,
.check {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 20px;
}

.warranty-check {
  color: #b91c1c;
  font-weight: 900;
}

.warranty-check input,
.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
}

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

.disabled-field input {
  background: #f3f4f6;
}

.checkin-edit-form #orderInfoSection,
.checkin-edit-form #customerInfoSection {
  padding: 10px;
}

.checkin-edit-form #orderInfoSection .form-grid,
.checkin-edit-form #customerInfoSection .form-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.checkin-edit-form textarea {
  min-height: 76px;
}

.view-only-form .form-sections {
  gap: 8px;
}

.view-only-form .form-section {
  padding: 10px;
}

.view-only-form .form-grid {
  gap: 8px;
  margin-top: 8px;
}

.view-only-form textarea {
  min-height: 70px;
}

.form-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.span-2 {
  grid-column: span 2;
}

.chat-modal {
  height: min(720px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
}

.drawer-tabs {
  display: flex;
  gap: 8px;
}

.chat-messages {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.revision-log {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.revision {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 8px;
  display: grid;
  gap: 4px;
}

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

.revision span {
  color: var(--muted);
  font-weight: 700;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sticky-notes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  max-height: 110px;
  overflow: auto;
  margin-top: 3px;
}

.sticky-note {
  background: #fff9d8;
  border: 1px solid #efd979;
  border-radius: 4px;
  padding: 4px 6px;
  min-height: 0;
  white-space: pre-wrap;
  font-size: 11px;
  line-height: 1.25;
}

.sticky-note small {
  display: inline;
  color: #7a5b00;
  font-weight: 750;
  margin-right: 6px;
  font-size: 10px;
}

.sticky-note span {
  display: inline;
}

.dock-messages .sticky-note,
.dock-messages .message {
  border: 0;
  box-shadow: none;
  max-width: 82%;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  display: grid;
  gap: 2px;
  align-self: flex-start;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

.dock-messages .sticky-note.own,
.dock-messages .message.own {
  align-self: flex-end;
}

.dock-messages .sticky-note span,
.dock-messages .team-message > div > div {
  display: block;
  border-radius: 14px;
  padding: 7px 10px;
  background: #e5e7eb;
  color: #111827;
  font-size: 12px;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  max-width: 100%;
}

.dock-messages .sticky-note.own span,
.dock-messages .team-message.own > div > div {
  background: #2563eb;
  color: #fff;
}

.dock-messages .sticky-note small,
.dock-messages .message small {
  display: block;
  margin: 0 4px;
  color: #778295;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.dock-messages .sticky-note.own small,
.dock-messages .message.own small {
  text-align: right;
}

.note-entry {
  margin-top: 4px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
}

.note-entry textarea {
  min-height: 34px;
  height: 34px;
  resize: vertical;
}

.message {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.team-message {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: start;
}

.dock-messages .team-message {
  grid-template-columns: 24px minmax(0, 1fr);
  max-width: 88%;
  min-width: 0;
}

.dock-messages .team-message.own {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}

.dock-messages .team-message.own .team-avatar {
  display: none;
}

.team-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
}

.dock-messages .team-avatar {
  width: 24px;
  height: 24px;
  font-size: 9px;
}

.team-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message small {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
}

.system-announcement {
  display: block;
  margin: 4px 0;
  padding: 2px 6px 2px 8px;
  border-left: 2px solid #aab4c2;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  flex: 0 0 auto;
  position: relative;
  z-index: 0;
}

.system-announcement span {
  color: #536173;
  font-weight: 650;
}

.system-announcement small {
  display: inline;
  color: #98a2b3;
  font-size: 10px;
  margin-left: 5px;
}

.team-system-announcement {
  margin-bottom: 6px;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.dock {
  position: fixed;
  right: 14px;
  bottom: 0;
  left: 150px;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 8px;
  overflow-x: auto;
  overflow-y: visible;
  z-index: 20;
  pointer-events: none;
}

.dock-panel {
  width: min(360px, calc(100vw - 36px));
  flex: 0 0 min(360px, calc(100vw - 36px));
  height: 440px;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  pointer-events: auto;
}

.dock-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #fff;
  background: #25364b;
  cursor: pointer;
}

.dock-panel header small {
  display: block;
  color: #d9e2f1;
  margin-top: 2px;
}

.dock-panel .plain {
  color: #fff;
  cursor: pointer;
}

.global-chat-dock.collapsed {
  height: 42px;
  width: 225px;
  flex: 0 0 225px;
}

.global-chat-dock {
  order: 9999;
}

.global-chat-dock.collapsed .dock-messages,
.global-chat-dock.collapsed .dock-input {
  display: none;
}

.dock-messages {
  overflow: auto;
  padding: 10px;
  background: #f3f6fa;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dock-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.order-notes-dock {
  width: min(340px, calc(100vw - 36px));
  flex: 0 0 min(340px, calc(100vw - 36px));
  order: 0;
}

.note-dock-tabs {
  display: contents;
  pointer-events: auto;
}

.note-dock-tabs.hidden {
  display: none;
}

.note-dock-tab {
  width: 225px;
  height: 46px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #eef4ff;
  color: #184a9e;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  padding: 7px 8px 7px 10px;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  cursor: pointer;
}

.note-dock-tab .note-tab-label {
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.note-dock-tab strong,
.note-dock-tab small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-dock-tab strong {
  color: #0b3f95;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.1;
}

.note-dock-tab small {
  color: #31527d;
  opacity: 1;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  text-align: right;
}

.note-dock-tab.active {
  background: #25364b;
  color: #fff;
}

.note-dock-tab.active strong,
.note-dock-tab.active small {
  color: #fff;
}

.note-dock-tab.has-unread {
  border-color: #60a5fa;
}

.dock-unread,
.dock-unread-count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.dock-unread {
  margin-left: 6px;
  vertical-align: middle;
}

.note-dock-close {
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-weight: 900;
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 14px;
}

.note-dock-close:hover {
  opacity: 1;
}

.queue-list {
  display: grid;
  gap: 7px;
  max-height: 520px;
  overflow: auto;
}

.admin-panel {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 12px;
}

.admin-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.approvals-card {
  grid-column: 1 / -1;
}

.audit-card {
  grid-column: 1 / -1;
}

.span-all,
.outlook-card {
  grid-column: 1 / -1;
}

.system-health-card {
  grid-column: 1 / -1;
}

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

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.health-chip {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.health-chip.ok {
  border-left-color: var(--good);
}

.health-chip.missing {
  border-left-color: var(--bad);
}

.health-chip em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

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

.health-summary div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  min-width: 0;
}

.health-summary strong,
.health-summary span,
.health-summary small {
  display: block;
  overflow-wrap: anywhere;
}

.health-summary small {
  color: var(--muted);
}

.role-presets-card {
  grid-column: 1;
  grid-row: 4;
  height: 360px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-self: start;
}

.feedback-admin-card {
  grid-column: 2;
  grid-row: 4;
  min-width: 0;
  height: 360px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-self: start;
}

.reporting-panel {
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  align-items: start;
}

.reporting-card {
  min-width: 0;
}

.report-snapshot-card {
  display: grid;
  gap: 12px;
}

.reporting-card:nth-last-child(-n + 2) {
  grid-column: span 2;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.report-stat {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}

.report-stat strong {
  display: block;
  font-size: 22px;
}

.report-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-chart {
  display: grid;
  gap: 8px;
}

.report-weekly {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.report-bar-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: center;
}

.report-bar-row strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-bar-row > div {
  display: grid;
  gap: 4px;
}

.report-bar {
  display: block;
  width: var(--bar-width);
  min-width: 34px;
  border-radius: 4px;
  padding: 3px 6px;
  background: #dbeafe;
  color: #12325f;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.report-bar-pieces {
  background: #ccfbf1;
}

.report-bar-cabinets {
  background: #ede9fe;
}

.report-bar-mods {
  background: #ffe4e6;
}

.report-bar-count {
  background: #e0f2fe;
}

.department-dashboard {
  display: grid;
  gap: 10px;
}

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

.department-kpis div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  background: #f8fafc;
}

.department-kpis strong,
.department-kpis span {
  display: block;
}

.department-kpis strong {
  font-size: 18px;
}

.department-kpis span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.mini-chart {
  display: grid;
  gap: 6px;
}

.mini-chart .report-bar-row {
  grid-template-columns: 92px 1fr;
}

.report-table-wrap,
.feedback-list {
  overflow: auto;
}

.feedback-admin-card .feedback-list {
  flex: 1;
  min-height: 0;
}

.feedback-modal {
  width: min(560px, calc(100vw - 28px));
}

.feedback-modal textarea {
  min-height: 140px;
}

.outlook-card {
  grid-column: 1 / -1;
}

.outlook-settings-disclosure summary {
  cursor: pointer;
  font-weight: 900;
}

.outlook-settings-disclosure[open] summary {
  margin-bottom: 12px;
}

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

.settings-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.settings-table th,
.settings-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  vertical-align: middle;
}

.settings-table tr:last-child th,
.settings-table tr:last-child td {
  border-bottom: 0;
}

.settings-table th {
  width: 170px;
  color: var(--ink);
  background: #f8fafc;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}

.settings-table input {
  width: 100%;
}

.site-settings-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.site-settings-section h3 {
  margin: 0 0 10px;
}

.site-settings-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr);
  gap: 10px;
  align-items: start;
}

.site-settings-grid textarea {
  width: 100%;
  resize: vertical;
}

.sync-error {
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 12px;
  margin-top: 8px;
}

.approval-list,
.audit-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.audit-filters {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 150px minmax(180px, 1fr) 150px 90px;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.dense-table {
  min-width: 0;
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.dense-table th,
.dense-table td {
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.25;
  vertical-align: middle;
}

.dense-table th {
  top: 0;
}

.dense-table input,
.dense-table select {
  min-height: 26px;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.dense-table .cell-btn {
  font-size: 12px;
}

.audit-table td,
.audit-table th {
  max-width: 240px;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f0f6ff;
}

.search {
  position: relative;
}

.search-suggestions {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  display: grid;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
}

.search-suggestions button {
  border: 0;
  border-bottom: 1px solid #eef1f5;
  background: #fff;
  text-align: left;
  padding: 8px 10px;
  font-weight: 650;
}

.search-suggestions button:hover {
  background: #f5f9ff;
}

.special-order-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.32fr) 1fr;
  gap: 12px;
}

.special-lookup-panel,
.special-detail-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.additional-invoices {
  display: grid;
  gap: 8px;
}

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

.special-main-grid label:nth-child(1),
.special-main-grid label:nth-child(2),
.special-main-grid label:nth-child(3) {
  grid-column: span 1;
}

.special-main-grid .rep-field {
  grid-column: span 1;
}

.special-main-grid .customer-field {
  grid-column: span 2;
}

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

.special-ready-date {
  max-width: 240px;
}

.approval-row,
.audit-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 5px;
}

.approval-row span,
.audit-row span {
  color: var(--muted);
}

.approval-row pre,
.queue-item pre {
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
}

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

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: #f8fafc;
}

.detail-grid strong {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}

.detail-grid span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#approvalDetailBody pre {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #f8fafc;
}

.queue-actions {
  display: grid;
  gap: 5px;
  align-content: start;
}

.row-edit-cell {
  width: 52px;
  white-space: nowrap;
}

.mini-edit {
  font-size: 12px;
}

.admin-card {
  padding: 16px;
}

.admin-card h2 {
  margin: 0 0 12px;
}

.user-form {
  display: grid;
  gap: 10px;
}

.profile-picture-setting {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 120px 90px;
  gap: 10px;
}

.settings-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.settings-fieldset legend {
  padding: 0 4px;
  font-weight: 800;
}

.settings-fieldset label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-fieldset input {
  width: auto;
}

.role-preset-list {
  display: grid;
  gap: 6px;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
  min-height: 0;
  flex: 1;
  align-content: start;
}

.role-preset-group {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  min-width: max-content;
}

.role-preset-group summary {
  cursor: pointer;
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 3px;
}

.role-preset-table {
  width: max-content;
  min-width: 360px;
  table-layout: fixed;
}

.role-preset-table th,
.role-preset-table td {
  padding: 1px 3px;
  font-size: 10px;
}

.role-preset-table th:not(:first-child),
.role-preset-table td:not(:first-child) {
  width: 54px;
  max-width: 62px;
  white-space: normal;
  text-align: center;
}

.role-preset-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.role-preset-table input {
  min-height: 0;
  width: 16px;
  height: 16px;
}

.role-preset-table input:disabled {
  opacity: 0.45;
}

body.dark-mode .report-stat,
body.dark-mode .department-kpis div,
body.dark-mode .role-preset-group,
body.dark-mode .settings-table th,
body.dark-mode .site-settings-section {
  background: #2c3748;
}

body.dark-mode .note-dock-tab {
  background: #344154;
  color: #e9f1fb;
  border-color: #586982;
}

body.dark-mode .note-dock-tab.active {
  background: #52627a;
}

body.dark-mode .system-announcement {
  border-left-color: #7b8aa0;
}

body.dark-mode .system-announcement span {
  color: #c5d0de;
}

body.dark-mode .system-announcement small {
  color: #8fa0b5;
}

body.dark-mode .dock-messages .sticky-note span,
body.dark-mode .dock-messages .team-message > div > div {
  background: #3a4658;
  color: #edf2f7;
}

body.dark-mode .dock-messages .sticky-note.own span,
body.dark-mode .dock-messages .team-message.own > div > div {
  background: #4d8fe8;
  color: #07121f;
}

body.dark-mode .dock-messages .sticky-note small,
body.dark-mode .dock-messages .message small {
  color: #93a1b4;
}

body.dark-mode .queue-item {
  background: #202b39;
  border-color: #405066;
}

body.dark-mode .queue-summary {
  color: #e9f1fb;
}

body.dark-mode .queue-summary:hover {
  background: #2c3748;
}

body.dark-mode .queue-details {
  border-top-color: #405066;
}

body.dark-mode .calendar-change {
  background: #3a3422;
  border-color: #75602a;
}

body.dark-mode .calendar-change strong,
body.dark-mode .calendar-change b {
  color: #f5d37a;
}

body.dark-mode .sync-error {
  background: #44252d;
  border-color: #8a3f50;
  color: #f6bcc7;
}

.profile-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #eef4ff;
  color: #184a9e;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 28px;
  font-weight: 900;
}

.profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.queue-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.queue-item strong {
  display: block;
  margin-bottom: 2px;
}

.queue-summary {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.queue-summary:hover {
  background: #f8fafc;
}

.queue-summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.queue-status {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.queue-status.error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.queue-details {
  border-top: 1px solid var(--line);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.calendar-change-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px;
}

.calendar-change {
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 6px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.calendar-change strong {
  margin: 0;
  color: #92400e;
}

.calendar-change span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-change b {
  color: #92400e;
}

.compact-note {
  margin: 0;
  font-size: 12px;
}

.queue-main {
  min-width: 0;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .filters,
  .form-grid,
  .stats,
  .work-week,
  .admin-panel {
    grid-template-columns: 1fr;
  }

  .role-presets-card,
  .feedback-admin-card,
  .reporting-card:nth-last-child(-n + 2) {
    grid-column: 1;
    grid-row: auto;
  }

  .span-2 {
    grid-column: span 1;
  }

  .dock {
    left: 10px;
    right: 10px;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .note-dock-tabs {
    max-width: 100%;
    overflow-x: auto;
  }

  .dock-panel,
  .order-notes-dock {
    width: 100%;
    flex: 0 0 auto;
  }
}
