:root {
  color-scheme: light;
  --ink: #23313d;
  --black: #1c2730;
  --muted: #668093;
  --paper: #eef8ff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --line: #d5e8f6;
  --blue: #62b8eb;
  --blue-dark: #267db3;
  --blue-soft: #e8f6ff;
  --green: #1f8a62;
  --amber: #b98422;
  --red: #c14f4f;
  --shadow: 0 24px 70px rgba(32, 70, 98, 0.12);
  --action-primary: linear-gradient(135deg, #267db3, #62b8eb);
  --action-create: linear-gradient(135deg, #1f8a62, #2ed184);
  --action-save: linear-gradient(135deg, #2250a3, #62b8eb);
  --action-send: linear-gradient(135deg, #267db3, #62b8eb);
  --action-view: linear-gradient(135deg, #e8f6ff, #cbe9fb);
  --action-approve: linear-gradient(135deg, #1f8a62, #27b27b);
  --action-return: linear-gradient(135deg, #b98422, #d89a2f);
  --action-danger: linear-gradient(135deg, #9f2f3a, #e25f5f);
  --action-neutral: linear-gradient(135deg, #e8f6ff, #ffffff);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.label-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: "Manrope", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.96), transparent 34%),
    radial-gradient(circle at 78% 16%, rgba(98, 184, 235, 0.22), transparent 30%),
    linear-gradient(135deg, #f5fbff 0%, #dff2ff 48%, #f8fcff 100%),
    var(--paper);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  background:
    linear-gradient(rgba(38, 125, 179, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 125, 179, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 16% 22%, rgba(98, 184, 235, 0.2), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(31, 138, 98, 0.12), transparent 24%);
  background-size: 64px 64px, 64px 64px, 100% 100%, 100% 100%;
  opacity: 0.72;
  animation: corporateDrift 22s ease-in-out infinite;
  pointer-events: none;
}

body::after {
  position: fixed;
  top: -45%;
  left: -20%;
  width: 74vw;
  height: 150vh;
  z-index: -1;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  opacity: 0.42;
  transform: rotate(16deg);
  animation: lightSweep 12s ease-in-out infinite;
  pointer-events: none;
}

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

select[multiple] {
  min-height: 112px;
}

button {
  cursor: pointer;
}

.login-page {
  width: min(1120px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 620px) 430px;
  align-items: center;
  justify-content: center;
  gap: clamp(34px, 6vw, 78px);
  padding: 48px 0;
  animation: pageReveal 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-mark,
.app-logo {
  display: flex;
  justify-content: center;
  text-decoration: none;
}

.brand-mark {
  width: min(360px, 72vw);
  margin: 0 auto 32px;
  animation: brandFloat 5.5s ease-in-out infinite;
}

.brand-mark img,
.app-logo img {
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(0) saturate(100%) opacity(0.82);
}

.mobile-menu-toggle {
  display: none;
}

.hero-copy {
  max-width: 560px;
  color: var(--black);
  text-align: center;
}

.eyebrow,
.access-pill {
  color: var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.16em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.login-page h1 {
  max-width: 520px;
  margin: 0 auto 18px;
  font-family: "Playfair Display", Georgia, serif;
  color: var(--black);
  font-size: clamp(4.1rem, 6.1vw, 5.65rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 560px;
  margin: 0 auto;
  color: #557284;
  font-size: 1.02rem;
  line-height: 1.75;
}

.login-panel,
.panel,
.order-detail,
.filter-panel,
.modal-card {
  border: 1px solid rgba(213, 232, 246, 0.95);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: clamp(28px, 4vw, 42px);
  transform-origin: center right;
  animation: cardRise 620ms 90ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--blue-dark), var(--green), #d9b873);
}

.login-hero {
  position: relative;
  animation: cardRise 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-hero::after {
  display: block;
  width: min(420px, 82vw);
  height: 2px;
  margin: 28px auto 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(38, 125, 179, 0.42), transparent);
  animation: heroLine 3.8s ease-in-out infinite;
}

.panel-head {
  margin-bottom: 28px;
}

.access-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(98, 184, 235, 0.42);
  border-radius: 999px;
  background: rgba(98, 184, 235, 0.11);
}

.panel-head h2 {
  margin: 18px 0 8px;
  color: var(--black);
  font-size: 1.55rem;
  line-height: 1.2;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-form,
.form-grid,
.user-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: #415464;
  font-size: 0.88rem;
  font-weight: 800;
}

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

textarea {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(38, 125, 179, 0.62);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(98, 184, 235, 0.17);
}

input::placeholder {
  color: #94a6b3;
}

input[list] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: none;
  padding-right: 14px;
}

input[list]::-webkit-clear-button,
input[list]::-webkit-search-decoration,
input[list]::-webkit-search-cancel-button,
input[list]::-webkit-search-results-button,
input[list]::-webkit-search-results-decoration,
input[list]::-webkit-dropdown-button,
input[list]::-ms-clear,
input[list]::-ms-expand {
  display: none;
  width: 0;
  height: 0;
}

input[type="file"] {
  min-height: 64px;
  padding: 12px;
  border: 1px dashed rgba(38, 125, 179, 0.34);
  background:
    linear-gradient(135deg, rgba(232, 246, 255, 0.84), rgba(255, 255, 255, 0.96));
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input[type="file"]:hover {
  border-color: rgba(38, 125, 179, 0.58);
  background:
    linear-gradient(135deg, rgba(232, 246, 255, 1), rgba(255, 255, 255, 1));
}

input[type="file"]::file-selector-button {
  min-height: 38px;
  margin-right: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--action-primary);
  color: #062235;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(38, 125, 179, 0.16);
}

input[type="file"]::file-selector-button:hover {
  filter: brightness(1.05);
}

label:has(input[type="file"]) {
  position: relative;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(213, 232, 246, 0.8);
  border-radius: 8px;
  background: rgba(251, 253, 255, 0.72);
}

.login-form button,
.head-actions > button,
.modal-actions button:last-child,
.detail-actions button,
.role-card button,
.panel-title button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--action-primary);
  color: #062235;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(38, 125, 179, 0.18);
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

button.danger,
.danger {
  background: var(--action-danger) !important;
  color: #ffffff !important;
  box-shadow: 0 14px 32px rgba(193, 79, 79, 0.2) !important;
}

button.ghost,
.ghost,
.modal-actions button:first-child {
  border: 1px solid var(--line) !important;
  background: var(--action-neutral) !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}

#newOrderBtn,
#downloadCustomersBtn,
.user-form button {
  background: var(--action-create);
  color: #052717;
  box-shadow: 0 14px 32px rgba(31, 138, 98, 0.18);
}

#notificationBtn,
#enableBrowserNotificationsBtn,
.chat-form button,
.notification-actions button {
  background: var(--action-send);
  color: #062235;
}

#logoutBtn,
#dismissBrowserNotificationsBtn,
#clearNotificationsBtn,
#resetFiltersBtn {
  border: 1px solid var(--line);
  background: var(--action-neutral);
  color: var(--muted);
  box-shadow: none;
}

.modal-actions button:last-child,
.user-table button[data-save-user] {
  background: var(--action-save);
  color: #ffffff;
}

.login-form button {
  height: 54px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.otp-inline-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.otp-inline-actions button {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue-dark);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
}

.otp-inline-actions button:disabled {
  color: var(--muted);
  cursor: wait;
  text-decoration: none;
}

.login-page.is-loading .login-form button {
  cursor: wait;
  filter: saturate(1.05);
}

.login-page.is-loading .login-form button .icon {
  animation: loginIconPulse 900ms ease-in-out infinite;
}

.login-progress {
  position: relative;
  height: 5px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(213, 232, 246, 0.8);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.login-progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--blue-dark));
  box-shadow: 0 0 18px rgba(38, 125, 179, 0.36);
  transform: translateX(-110%);
}

.login-page.is-loading .login-progress {
  opacity: 1;
  transform: translateY(0);
}

.login-page.is-loading .login-progress i {
  animation: loadingSweep 1.05s ease-in-out infinite;
}

.login-form button::before,
.head-actions > button::before,
.modal-actions button:last-child::before,
.detail-actions button::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.42) 45%, transparent 72%);
  transform: translateX(-120%);
}

.login-form button:hover,
.head-actions > button:hover,
.modal-actions button:last-child:hover,
.detail-actions button:hover,
.role-card button:hover,
.panel-title button:hover {
  filter: brightness(1.04);
  box-shadow: 0 18px 38px rgba(38, 125, 179, 0.25);
  transform: translateY(-2px);
}

.login-form button:hover::before,
.head-actions > button:hover::before,
.modal-actions button:last-child:hover::before,
.detail-actions button:hover::before {
  animation: buttonShine 900ms ease;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 800;
}

.form-message .missing-field-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.form-message .missing-field-list em {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff2f0;
  color: var(--red);
  font-style: normal;
  font-size: 0.78rem;
}

.order-edit-note {
  padding: 10px 12px;
  border: 1px solid #b8d9ef;
  border-radius: 8px;
  background: #eef8ff;
  color: var(--blue-dark);
  font-size: 0.88rem;
  font-weight: 850;
}

.browser-notification-prompt {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(420px, calc(100% - 36px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(32, 70, 98, 0.18);
}

.browser-notification-prompt strong {
  display: block;
  color: var(--black);
  font-size: 0.92rem;
}

.browser-notification-prompt p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.browser-notification-prompt button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 900;
}

.browser-notification-prompt button.ghost {
  background: #ffffff;
  color: var(--muted);
}

.session-warning {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  width: min(420px, calc(100% - 36px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(185, 132, 34, 0.32);
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: 0 18px 48px rgba(32, 70, 98, 0.18);
  animation: toastIn 220ms ease;
}

.session-warning strong {
  display: block;
  color: var(--black);
  font-size: 0.92rem;
}

.session-warning p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.session-warning button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(185, 132, 34, 0.32);
  border-radius: 8px;
  background: #ffffff;
  color: var(--amber);
  font-weight: 900;
}

.notification-toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
  width: min(380px, calc(100% - 36px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.notification-toast {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  padding-right: 44px;
  border: 1px solid rgba(98, 184, 235, 0.38);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(32, 70, 98, 0.2);
  animation: toastIn 220ms ease;
  pointer-events: auto;
}

.notification-toast.exiting {
  animation: toastOut 240ms ease both;
}

.notification-toast-avatar {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #62b8eb, #267db3);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72), 0 10px 22px rgba(38, 125, 179, 0.18);
}

.notification-toast-tone-danger .notification-toast-avatar {
  background: linear-gradient(135deg, #ff7b7b, #c14f4f);
}

.notification-toast-tone-success .notification-toast-avatar {
  background: linear-gradient(135deg, #60d394, #1f8a62);
}

.notification-toast-tone-chat .notification-toast-avatar {
  background: linear-gradient(135deg, #62b8eb, #267db3);
}

.notification-toast-tone-cad .notification-toast-avatar {
  background: linear-gradient(135deg, #8ba7ff, #2250a3);
}

.notification-toast-content {
  min-width: 0;
}

.notification-toast strong {
  display: block;
  color: var(--black);
  font-size: 0.94rem;
}

.notification-toast p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.notification-toast-order {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.75rem;
  font-weight: 900;
}

.notification-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.notification-toast-close:hover {
  border-color: rgba(193, 79, 79, 0.28);
  background: #ffecec;
  color: var(--red);
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 280px 1fr;
  animation: appEnter 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

.app-logo {
  width: 190px;
  margin: 0 auto 8px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav button,
.role-card button,
.panel-title button,
.modal-actions button:first-child,
.icon-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.side-nav button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  padding: 0 14px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.side-nav button.has-alert {
  padding-right: 42px;
}

.nav-badge {
  position: absolute;
  top: 7px;
  right: 10px;
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(193, 79, 79, 0.26);
}

.side-nav button.active,
.side-nav button:hover {
  border-color: rgba(38, 125, 179, 0.24);
  background: var(--blue-soft);
  color: var(--blue-dark);
  box-shadow: 0 10px 24px rgba(38, 125, 179, 0.1);
  transform: translateX(2px);
}

.role-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
}

.role-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.role-card strong {
  color: var(--black);
}

.role-card button,
.head-actions > button,
.modal-actions button,
.panel-title button,
.detail-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.panel-title button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-controls select {
  min-width: 180px;
  min-height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.role-card button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.workspace {
  min-width: 0;
  padding: clamp(18px, 2.2vw, 30px);
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.workspace-head h1 {
  margin: 0;
  color: var(--black);
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.1;
}

.head-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  min-width: 220px;
}

.sequel-header-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 220px) auto;
  gap: 8px;
  align-items: end;
}

.sequel-header-search label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.sequel-header-search button {
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--action-view);
  color: #062437;
  font-weight: 900;
}

.sequel-header-search .form-message {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  margin: 0;
  color: var(--red);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
  animation: viewEnter 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.metric-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  content: "";
  background: var(--metric-color, var(--accent));
}

.metric-card.metric-primary { --metric-color: #267db3; }
.metric-card.metric-quote { --metric-color: #0f6b64; }
.metric-card.metric-cad { --metric-color: #2250a3; }
.metric-card.metric-make { --metric-color: #9a4b17; }
.metric-card.metric-good { --metric-color: #1f8a62; }
.metric-card.metric-risk { --metric-color: #c14f4f; }

.metric-card:hover,
.queue-item:hover,
.notification-item:hover,
.timeline-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(32, 70, 98, 0.11);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--black);
  font-size: 2rem;
}

.metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-board {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  margin-top: 14px;
}

.status-board button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(213, 232, 246, 0.95);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.status-board span {
  display: grid;
  gap: 2px;
}

.status-board small {
  color: var(--muted);
  font-size: 0.78rem;
}

.status-board i {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeaf4;
}

.status-board b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-dark), var(--green));
}

.worker-kpi-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.worker-kpi-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.worker-kpi-card strong {
  color: var(--black);
}

.worker-kpi-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.tv-screen {
  position: relative;
  min-height: calc(100vh - 150px);
  isolation: isolate;
  overflow: hidden;
  padding: clamp(14px, 1.7vw, 28px);
  border: 1px solid rgba(212, 176, 103, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(5, 16, 27, 0.98), rgba(8, 38, 45, 0.96) 48%, rgba(30, 28, 21, 0.98)),
    radial-gradient(circle at 18% 12%, rgba(37, 211, 102, 0.2), transparent 26%),
    radial-gradient(circle at 82% 8%, rgba(212, 176, 103, 0.22), transparent 34%),
    radial-gradient(circle at 72% 86%, rgba(98, 184, 235, 0.18), transparent 30%);
  color: #eef8ff;
  box-shadow: 0 28px 80px rgba(8, 26, 38, 0.3);
}

.tv-screen:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
}

.tv-screen:fullscreen .tv-head-actions button {
  display: inline-flex;
}

.tv-screen::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
}

.tv-screen::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
    linear-gradient(110deg, transparent 0 24%, rgba(98, 184, 235, 0.12) 36%, transparent 48% 100%);
  mix-blend-mode: screen;
  opacity: 0.75;
  pointer-events: none;
  animation: tvScanSweep 9s linear infinite;
}

.tv-video-effect {
  position: absolute;
  inset: -20%;
  z-index: -3;
  background:
    conic-gradient(from 120deg at 28% 42%, rgba(37, 211, 102, 0.18), transparent 16%, rgba(98, 184, 235, 0.16), transparent 42%, rgba(212, 176, 103, 0.16), transparent 70%),
    repeating-linear-gradient(90deg, rgba(98, 184, 235, 0.1) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(37, 211, 102, 0.07) 0 1px, transparent 1px 58px);
  filter: blur(1px) saturate(1.25);
  opacity: 0.72;
  transform: translate3d(0, 0, 0);
  animation: tvVideoMotion 16s linear infinite;
  pointer-events: none;
}

.tv-ambient {
  position: absolute;
  inset: -30%;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 30%, rgba(37, 211, 102, 0.18), transparent 24%),
    radial-gradient(circle at 75% 20%, rgba(212, 176, 103, 0.2), transparent 24%),
    radial-gradient(circle at 70% 78%, rgba(98, 184, 235, 0.16), transparent 26%);
  filter: blur(12px);
  animation: tvAmbientDrift 18s ease-in-out infinite;
}

.tv-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.tv-head span {
  color: #62b8eb;
  font-size: clamp(0.8rem, 1vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tv-head h2 {
  margin: 4px 0 0;
  color: #ffffff;
  font-size: clamp(2rem, 3.4vw, 4rem);
  line-height: 1;
}

.tv-head p {
  max-width: 760px;
  margin: 8px 0 0;
  color: #b8ccd8;
  font-size: clamp(0.86rem, 1vw, 1.08rem);
  font-weight: 800;
}

.tv-head-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.tv-head-actions button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(212, 176, 103, 0.34);
  border-radius: 8px;
  background: rgba(212, 176, 103, 0.12);
  color: #ffe6ad;
  font-weight: 900;
}

.tv-clock {
  min-width: 218px;
  padding: 0;
  color: #ffffff;
}

.tv-live-clock {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.tv-clock-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  color: #8fb0c2;
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tv-clock-live i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #62f0a3;
  box-shadow: 0 0 0 0 rgba(98, 240, 163, 0.48);
  animation: tvClockPulse 1.5s ease-out infinite;
}

.tv-live-clock strong {
  color: #ffffff;
  font-size: clamp(2.1rem, 3.4vw, 3.65rem);
  font-weight: 1000;
  line-height: 0.9;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(98, 184, 235, 0.28);
}

.tv-live-clock strong em {
  color: #9dffc5;
  font-size: 0.58em;
  font-style: normal;
  vertical-align: 0.08em;
}

.tv-live-clock > span:last-child {
  display: block;
  color: #a8c6d9;
  font-size: 0.8rem;
  font-weight: 900;
  text-align: right;
}

.tv-market-ticker {
  position: relative;
  min-height: 42px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(37, 211, 102, 0.24);
  border-radius: 8px;
  background: rgba(2, 12, 20, 0.66);
  box-shadow: inset 0 0 28px rgba(37, 211, 102, 0.08);
}

.tv-market-ticker::before {
  position: relative;
  z-index: 2;
  width: 92px;
  align-self: stretch;
  display: inline-grid;
  place-items: center;
  flex: 0 0 92px;
  content: "LIVE";
  background: linear-gradient(135deg, #25d366, #62b8eb);
  color: #03111b;
  font-weight: 1000;
  letter-spacing: 0.12em;
}

.tv-market-ticker-track {
  position: relative;
  z-index: 1;
  min-width: max-content;
  max-width: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 14px;
  animation: tvTickerMove 34s linear infinite;
}

.tv-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  white-space: nowrap;
  color: #d9edf7;
  font-size: clamp(0.78rem, 1vw, 1rem);
  font-weight: 900;
}

.tv-ticker-item b,
.tv-ticker-item em,
.tv-ticker-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-ticker-item b {
  color: #ffffff;
}

.tv-ticker-item em {
  color: #8fb0c2;
  font-style: normal;
}

.tv-ticker-item strong {
  color: #62b8eb;
}

.tv-ticker-item i {
  min-width: 82px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffcb66;
  font-style: normal;
  text-align: center;
}

.tv-ticker-item.good i {
  color: #62f0a3;
}

.tv-ticker-item.bad i {
  color: #ff8c8c;
}

.tv-live-rates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.tv-live-rate {
  position: relative;
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 3px 0 0 var(--rate-color, #62b8eb), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.tv-live-rate::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: translateX(-120%);
  animation: tvRateSweep 4.5s ease-in-out infinite;
}

.tv-live-rate.gold { --rate-color: #ffcb66; }
.tv-live-rate.non-gst-gold { --rate-color: #ff9f43; }
.tv-live-rate.silver { --rate-color: #c8d4df; }
.tv-live-rate.dollar { --rate-color: #62f0a3; }
.tv-live-rate.refresh { --rate-color: #62b8eb; }

.tv-live-rate span,
.tv-live-rate strong,
.tv-live-rate small {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-live-rate span {
  color: #a8c6d9;
  font-size: 0.74rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.tv-live-rate strong {
  color: #ffffff;
  font-size: clamp(1.2rem, 2vw, 1.85rem);
  font-weight: 1000;
}

.tv-live-rate strong.up {
  color: #62f0a3;
}

.tv-live-rate strong.down {
  color: #ff8c8c;
}

.tv-live-rate small {
  color: #8fb0c2;
  font-size: 0.78rem;
  font-weight: 900;
}

.tv-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.tv-strip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: inset 3px 0 0 var(--dept-color, #62b8eb);
}

.tv-strip-item span {
  color: #b8ccd8;
  font-size: 0.78rem;
  font-weight: 900;
}

.tv-strip-item strong {
  color: #ffffff;
  font-size: 1.5rem;
}

.tv-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.tv-metrics div {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tv-metrics span {
  color: #a8c6d9;
  font-size: clamp(0.68rem, 0.86vw, 0.88rem);
  font-weight: 900;
  text-transform: uppercase;
}

.tv-metrics strong {
  min-width: 0;
  color: #ffffff;
  font-size: clamp(1.65rem, 2.5vw, 3rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.tv-metrics small {
  color: #85a3b5;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tv-command-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.25fr) minmax(260px, 0.85fr) minmax(260px, 0.85fr);
  gap: 10px;
  margin-bottom: 10px;
}

.tv-detail-carousel {
  position: relative;
  min-width: 0;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(3, 18, 26, 0.24);
}

.tv-detail-carousel::before,
.tv-detail-carousel::after {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 64px;
  content: "";
  pointer-events: none;
}

.tv-detail-carousel::before {
  left: 0;
  background: linear-gradient(90deg, rgba(5, 25, 31, 0.94), transparent);
}

.tv-detail-carousel::after {
  right: 0;
  background: linear-gradient(270deg, rgba(5, 25, 31, 0.94), transparent);
}

.tv-detail-track {
  width: max-content;
  display: flex;
  gap: 10px;
  padding: 10px;
  animation: tvDetailMove 54s linear infinite;
  will-change: transform;
}

.tv-detail-carousel:hover .tv-detail-track {
  animation-play-state: paused;
}

.tv-carousel-panel {
  flex: 0 0 min(860px, calc(100vw - 70px));
  min-height: 330px;
  margin: 0;
}

.tv-carousel-panel .tv-urgent-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.tv-dispatch-card.done {
  border-color: rgba(98, 240, 163, 0.35);
  background: rgba(16, 86, 62, 0.28);
}

.tv-dispatch-card.done b {
  color: #86ffc0;
}

.tv-carousel-panel .tv-photo-rail {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.tv-urgent-panel {
  display: grid;
  gap: 10px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid rgba(255, 123, 123, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 123, 123, 0.14), rgba(255, 255, 255, 0.045));
}

.tv-carousel-panel.tv-urgent-panel,
.tv-carousel-panel.tv-command-panel {
  margin: 0;
}

.tv-urgent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  gap: 10px;
  justify-content: start;
}

.tv-urgent-card {
  min-width: 0;
  max-width: 420px;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(8, 23, 32, 0.72);
  box-shadow: inset 4px 0 0 #ffcb66;
}

.tv-urgent-card.priority-urgent,
.tv-urgent-card.priority-critical {
  box-shadow: inset 4px 0 0 #ff7b7b, 0 0 0 1px rgba(255, 123, 123, 0.14);
}

.tv-urgent-top,
.tv-urgent-meta,
.tv-urgent-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tv-urgent-top strong {
  color: #ffffff;
  font-size: clamp(0.95rem, 1vw, 1.18rem);
}

.tv-urgent-top span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 123, 123, 0.18);
  color: #ffcbcb;
  font-size: 0.72rem;
  font-weight: 900;
}

.tv-urgent-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.tv-urgent-main b,
.tv-urgent-main small,
.tv-urgent-meta span,
.tv-urgent-progress em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-urgent-main b {
  color: #eef8ff;
  font-size: 0.84rem;
}

.tv-urgent-main small,
.tv-urgent-meta span,
.tv-urgent-progress em {
  color: #a8c6d9;
  font-size: 0.68rem;
  font-weight: 800;
}

.tv-urgent-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tv-urgent-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.tv-urgent-progress i {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.tv-urgent-progress b {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7b7b, #ffcb66);
}

.tv-command-panel {
  min-width: 0;
  max-height: 238px;
  overflow: hidden;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tv-panel-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tv-panel-title span {
  color: #7fa5ba;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tv-panel-title strong {
  color: #ffffff;
  font-size: 0.92rem;
}

.tv-department-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.tv-dept-tile {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(2, 12, 20, 0.38);
  box-shadow: inset 3px 0 0 var(--dept-color, #62b8eb);
}

.tv-dept-tile span,
.tv-dept-tile small {
  min-width: 0;
  color: #a8c6d9;
  font-size: 0.72rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.tv-dept-tile strong {
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
}

.tv-dept-tile i {
  height: 6px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.tv-dept-tile b {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #25d366, #62b8eb);
}

.tv-worker-board {
  display: grid;
  gap: 8px;
}

.tv-worker-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(2, 12, 20, 0.38);
}

.tv-worker-card div {
  min-width: 0;
}

.tv-worker-card strong,
.tv-worker-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-worker-card strong {
  color: #ffffff;
  font-size: 0.88rem;
}

.tv-worker-card span,
.tv-mini-empty {
  color: #a8c6d9;
  font-size: 0.76rem;
  font-weight: 800;
}

.tv-worker-card b {
  max-width: 124px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(98, 184, 235, 0.12);
  color: #b9e4ff;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  white-space: nowrap;
}

.tv-photo-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.tv-photo-card {
  min-width: 0;
  min-height: 156px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(2, 12, 20, 0.46);
}

.tv-photo-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.tv-photo-card figcaption,
.tv-photo-card.empty {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.tv-photo-card strong {
  color: #ffffff;
  font-size: 0.86rem;
}

.tv-photo-card span,
.tv-photo-card small {
  min-width: 0;
  color: #a8c6d9;
  font-size: 0.72rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tv-photo-card.empty {
  grid-column: 1 / -1;
  min-height: 74px;
  align-content: center;
}

.tv-queue-head {
  display: grid;
  grid-template-columns: 72px minmax(220px, 1.5fr) minmax(170px, 0.9fr) minmax(140px, 0.75fr) minmax(150px, 0.7fr);
  gap: 14px;
  padding: 0 12px 6px;
  color: #7fa5ba;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tv-queue {
  display: grid;
  gap: 8px;
}

.tv-order {
  display: grid;
  grid-template-columns: 72px minmax(220px, 1.5fr) minmax(170px, 0.9fr) minmax(140px, 0.75fr) minmax(150px, 0.7fr);
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.045));
  box-shadow: inset 4px 0 0 rgba(98, 184, 235, 0.75);
  animation: tvRowPulse 5s ease-in-out infinite;
}

.tv-order.priority-urgent,
.tv-order.priority-critical {
  box-shadow: inset 4px 0 0 #ff7b7b;
}

.tv-order.priority-high,
.tv-order.priority-high-priority {
  box-shadow: inset 4px 0 0 #ffcb66;
}

.tv-order-rank {
  color: #62b8eb;
  font-size: clamp(1.1rem, 1.5vw, 1.75rem);
  font-weight: 900;
}

.tv-order-main,
.tv-order-stage,
.tv-order-progress,
.tv-order-risk {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.tv-order-main strong {
  color: #ffffff;
  font-size: clamp(0.98rem, 1.15vw, 1.28rem);
}

.tv-order-main span,
.tv-order-main small,
.tv-order-stage span,
.tv-order-risk span {
  color: #a8c6d9;
  font-size: clamp(0.72rem, 0.85vw, 0.88rem);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tv-order-main small {
  color: #d7ad57;
}

.tv-order-stage .badge {
  width: max-content;
}

.tv-order-progress b,
.tv-order-risk strong {
  color: #ffffff;
  font-size: clamp(1rem, 1.2vw, 1.35rem);
}

.tv-order-progress i {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.tv-order-progress em {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #25d366, #62b8eb);
}

.split-grid,
.orders-layout,
.users-layout,
.customers-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  align-items: start;
}

.dashboard-pipeline-panel,
.dashboard-action-panel {
  overflow: hidden;
  border-color: rgba(38, 125, 179, 0.18);
}

.users-layout {
  grid-template-columns: minmax(320px, 0.78fr) minmax(560px, 1.22fr);
}

.customers-layout {
  grid-template-columns: minmax(320px, 0.72fr) minmax(560px, 1.28fr);
}

.customer-create-panel[hidden] + .customer-list-panel {
  grid-column: 1 / -1;
}

.chat-panel {
  min-height: calc(100vh - 180px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 18px;
}

.chat-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 14px;
}

.chat-channel-sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.chat-channel-title {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--blue-soft), #ffffff);
}

.chat-channel-title span {
  display: block;
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chat-channel-title strong {
  display: block;
  margin-top: 4px;
  color: var(--black);
  font-size: 1.05rem;
}

.chat-channel-list {
  min-height: 0;
  display: grid;
  align-content: start;
  overflow: auto;
  scrollbar-width: thin;
}

.chat-channel-section {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-channel-empty {
  margin: 0;
  padding: 10px 14px 16px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chat-channel-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.chat-channel-item:hover,
.chat-channel-item.active {
  background: var(--blue-soft);
}

.chat-channel-item.active {
  box-shadow: inset 4px 0 0 var(--green);
}

.chat-channel-item:hover {
  transform: translateX(2px);
}

.chat-channel-avatar {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72), 0 10px 20px rgba(18, 140, 126, 0.14);
}

.chat-channel-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.chat-channel-copy strong,
.chat-channel-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-channel-copy strong {
  color: var(--black);
  font-size: 0.9rem;
}

.chat-channel-copy small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.chat-channel-item b {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--green);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
}

.chat-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(251, 253, 255, 0.92), rgba(232, 246, 255, 0.58)),
    linear-gradient(45deg, rgba(38, 125, 179, 0.035) 25%, transparent 25%, transparent 50%, rgba(38, 125, 179, 0.035) 50%, rgba(38, 125, 179, 0.035) 75%, transparent 75%);
  background-size: auto, 26px 26px;
  scrollbar-width: thin;
}

.chat-message {
  width: min(78%, 560px);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  animation: chatMessageIn 220ms ease both;
}

.chat-message.own {
  justify-self: end;
  grid-template-columns: minmax(0, 1fr) 38px;
  background: transparent;
}

.chat-message.own .chat-avatar {
  grid-column: 2;
  grid-row: 1;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #62b8eb, #267db3);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72), 0 10px 22px rgba(38, 125, 179, 0.18);
}

.chat-message.own .chat-avatar {
  background: linear-gradient(135deg, #25d366, #128c7e);
}

.chat-message-body {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 11px 13px;
  border: 1px solid rgba(213, 232, 246, 0.86);
  border-radius: 8px 8px 8px 2px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(32, 70, 98, 0.08);
}

.chat-message.own .chat-message-body {
  border-color: rgba(18, 140, 126, 0.2);
  border-radius: 8px 8px 2px 8px;
  background: #e7fff2;
}

.chat-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-message-head strong {
  color: var(--black);
  font-size: 0.9rem;
}

.chat-message-head span {
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-message p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-message small {
  color: var(--muted);
  font-weight: 800;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px auto;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.chat-files {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.chat-attach-label,
.chat-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 120px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #062235;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(38, 125, 179, 0.18);
}

.chat-attach-label {
  min-width: 48px;
  width: 48px;
  background: #ffffff;
  color: var(--blue-dark);
  border: 1px solid var(--line);
  box-shadow: none;
  cursor: pointer;
}

.chat-attach-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#chatView.active {
  height: calc(100vh - 180px);
  min-height: 560px;
  overflow: hidden;
}

#chatView .chat-panel {
  min-height: 0;
  height: 100%;
}

#chatView .chat-layout,
#chatView .chat-main,
#chatView .chat-channel-sidebar {
  min-height: 0;
}

#chatView .chat-list,
#chatView .chat-channel-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#ordersView.active {
  height: calc(100vh - 180px);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

#ordersView .orders-layout {
  min-height: 0;
}

#ordersView:not(.order-detail-mode) .orders-layout {
  grid-template-columns: minmax(0, 1fr);
}

#ordersView.order-detail-mode .orders-layout {
  grid-template-columns: minmax(0, 1fr);
}

#ordersView.order-detail-mode .filter-panel {
  display: none;
}

#ordersView.order-detail-mode .orders-topbar {
  display: none;
}

#ordersView.order-detail-mode .order-summary-strip {
  display: none;
}

#ordersView:not(.order-detail-mode) .order-detail {
  display: none;
}

#ordersView.order-detail-mode .order-table-wrap {
  display: none;
}

#ordersView.order-detail-mode.active {
  height: auto;
  min-height: calc(100vh - 160px);
  overflow: visible;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  color: var(--black);
  font-size: 1.1rem;
}

.panel-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.queue-list,
.notification-list,
.timeline-list {
  display: grid;
  gap: 10px;
}

.workflow-lane,
.dashboard-order-card,
.dashboard-attention,
.dashboard-action-card {
  width: 100%;
  border: 1px solid var(--dept-border, var(--line));
  border-radius: 8px;
  background: linear-gradient(120deg, var(--dept-bg, #fbfdff), #fff 74%);
  color: var(--black);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.workflow-lane:hover,
.dashboard-order-card:hover,
.dashboard-attention:hover,
.dashboard-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(32, 70, 98, 0.11);
}

.production-pipeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.workflow-lane {
  display: grid;
  min-height: 132px;
  gap: 12px;
  align-content: space-between;
  padding: 15px;
}

.pipeline-lane-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.pipeline-lane-head > span,
.dashboard-order-card span {
  min-width: 0;
}

.workflow-lane strong,
.dashboard-order-card strong {
  display: block;
  color: var(--dept-color, var(--black));
  font-size: 0.98rem;
}

.workflow-lane small,
.dashboard-order-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.pipeline-lane-head b {
  display: grid;
  min-width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--dept-color, var(--accent));
  font-size: 1.15rem;
  box-shadow: inset 0 0 0 1px var(--dept-border, var(--line));
}

.workflow-lane i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(38, 125, 179, 0.1);
}

.workflow-lane i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dept-color, var(--accent)), #58c7a2);
}

.workflow-lane em {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.dashboard-action-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 13px;
}

.dashboard-action-card span {
  min-width: 0;
}

.dashboard-action-card strong {
  display: block;
  overflow: hidden;
  color: var(--dept-color, var(--black));
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-action-card small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-action-card > b {
  display: grid;
  min-width: 44px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--dept-color, var(--accent));
  font-size: 0.9rem;
  box-shadow: inset 0 0 0 1px var(--dept-border, var(--line));
}

.dashboard-action-card em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 800;
}

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

.dashboard-order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  padding: 13px;
}

.dashboard-order-card i {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(38, 125, 179, 0.12);
}

.dashboard-order-card b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dept-color, var(--accent)), #58c7a2);
}

.dashboard-order-card em {
  justify-self: end;
  color: var(--dept-color, var(--accent));
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 900;
}

.timeline-list {
  position: relative;
  gap: 0;
  padding-left: 18px;
}

.timeline-list::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 7px;
  width: 2px;
  content: "";
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(38, 125, 179, 0.22), rgba(31, 138, 98, 0.24));
}

.queue-item,
.notification-item,
.timeline-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  padding: 0 0 14px;
  border: 0;
  background: transparent;
}

.timeline-item:hover {
  transform: none;
  box-shadow: none;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  margin-top: 18px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--blue-dark);
  box-shadow: 0 0 0 3px rgba(98, 184, 235, 0.25);
}

.timeline-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.timeline-card:hover {
  transform: translateY(-2px);
  border-color: rgba(38, 125, 179, 0.22);
  box-shadow: 0 16px 34px rgba(32, 70, 98, 0.11);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 9px;
}

.timeline-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.timeline-meta .timeline-order {
  border-color: rgba(38, 125, 179, 0.24);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.timeline-muted {
  color: #8da0ad !important;
  font-style: italic;
}

.notification-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  position: relative;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.notification-item::before {
  display: none;
}

.notification-item.unread {
  border-color: rgba(37, 211, 102, 0.28);
  background: #f7fffb;
  box-shadow: 0 12px 28px rgba(18, 140, 126, 0.08);
}

.notification-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(32, 70, 98, 0.1);
}

.notification-item.seen {
  background: #ffffff;
  opacity: 0.92;
}

.notification-item.exiting {
  animation: notificationSlideOut 220ms ease both;
}

.notification-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.notification-section-title::after {
  height: 1px;
  flex: 1;
  content: "";
  background: var(--line);
}

.notification-avatar {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72), 0 10px 22px rgba(18, 140, 126, 0.18);
}

.notification-content {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.notification-tone-danger .notification-avatar {
  background: linear-gradient(135deg, #ff7b7b, #c14f4f);
}

.notification-tone-success .notification-avatar {
  background: linear-gradient(135deg, #60d394, #1f8a62);
}

.notification-tone-chat .notification-avatar {
  background: linear-gradient(135deg, #62b8eb, #267db3);
}

.notification-tone-cad .notification-avatar {
  background: linear-gradient(135deg, #8ba7ff, #2250a3);
}

.notification-item-head,
.notification-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notification-item-head strong {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--black);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item-head time {
  flex: 0 0 auto;
  color: #128c7e;
  font-size: 0.72rem;
  font-weight: 900;
}

.notification-item-head span,
.notification-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.74rem;
  font-weight: 900;
}

.notification-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.notification-meta span {
  background: #ffffff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.notification-unread-dot {
  width: 11px;
  height: 11px;
  display: inline-block;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.14);
}

.notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.notification-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(18, 140, 126, 0.24);
  border-radius: 999px;
  background: #e7fff2;
  color: #128c7e;
  font-weight: 900;
}

.notification-actions button.danger {
  border-color: rgba(193, 79, 79, 0.28);
  background: #ffecec;
  color: var(--red);
}

.queue-item,
.order-table tr,
.dept-badge {
  --dept-color: var(--blue-dark);
  --dept-bg: var(--blue-soft);
  --dept-border: rgba(38, 125, 179, 0.24);
}

.queue-item.dept-jewellery,
.order-table tr.dept-jewellery,
.dept-badge.dept-jewellery {
  --dept-color: #8a4f00;
  --dept-bg: #fff4dc;
  --dept-border: rgba(185, 132, 34, 0.34);
}

.queue-item.dept-cad-manager,
.order-table tr.dept-cad-manager,
.dept-badge.dept-cad-manager {
  --dept-color: #2250a3;
  --dept-bg: #e9f0ff;
  --dept-border: rgba(34, 80, 163, 0.32);
}

.queue-item.dept-cad-designer,
.order-table tr.dept-cad-designer,
.dept-badge.dept-cad-designer {
  --dept-color: #7a3798;
  --dept-bg: #f6eaff;
  --dept-border: rgba(122, 55, 152, 0.3);
}

.queue-item.dept-quotation,
.order-table tr.dept-quotation,
.dept-badge.dept-quotation {
  --dept-color: #0f6b64;
  --dept-bg: #e6f8f5;
  --dept-border: rgba(15, 107, 100, 0.28);
}

.queue-item.dept-manufacturing,
.order-table tr.dept-manufacturing,
.dept-badge.dept-manufacturing {
  --dept-color: #9a4b17;
  --dept-bg: #fff0e6;
  --dept-border: rgba(154, 75, 23, 0.3);
}

.queue-item.dept-product,
.order-table tr.dept-product,
.dept-badge.dept-product {
  --dept-color: #1f7a59;
  --dept-bg: #e7f8f0;
  --dept-border: rgba(31, 122, 89, 0.28);
}

.queue-item.dept-packing-slip,
.order-table tr.dept-packing-slip,
.dept-badge.dept-packing-slip {
  --dept-color: #5c6b18;
  --dept-bg: #f4f8d8;
  --dept-border: rgba(92, 107, 24, 0.28);
}

.queue-item.dept-accounts,
.order-table tr.dept-accounts,
.dept-badge.dept-accounts {
  --dept-color: #7d5b00;
  --dept-bg: #fff8d7;
  --dept-border: rgba(125, 91, 0, 0.3);
}

.queue-item.dept-completed,
.order-table tr.dept-completed,
.dept-badge.dept-completed {
  --dept-color: #256a3d;
  --dept-bg: #e7f8e9;
  --dept-border: rgba(37, 106, 61, 0.28);
}

.queue-item.dept-jewellery-qc,
.order-table tr.dept-jewellery-qc,
.dept-badge.dept-jewellery-qc {
  --dept-color: #8c6414;
  --dept-bg: #fff8e8;
  --dept-border: rgba(185, 132, 34, 0.26);
}

.queue-item.dept-cad-qc,
.order-table tr.dept-cad-qc,
.dept-badge.dept-cad-qc {
  --dept-color: #2d6f9f;
  --dept-bg: #eef5ff;
  --dept-border: rgba(38, 125, 179, 0.24);
}

.queue-item.dept-cancelled,
.order-table tr.dept-cancelled,
.dept-badge.dept-cancelled {
  --dept-color: #a33c3c;
  --dept-bg: #fff0f0;
  --dept-border: rgba(193, 79, 79, 0.28);
}

.queue-item {
  border-color: var(--dept-border);
  background: linear-gradient(90deg, var(--dept-bg), #fbfdff 72%);
  box-shadow: inset 4px 0 0 var(--dept-color);
}

.queue-item strong,
.timeline-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--black);
}

.queue-item p,
.timeline-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.notification-item p {
  margin: 0;
  color: #53656f;
  font-size: 0.88rem;
  line-height: 1.38;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  box-shadow: none;
}

.orders-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.advanced-filter-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(199, 225, 244, 0.95);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--blue-dark);
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(32, 70, 98, 0.08);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.advanced-filter-btn:hover,
.advanced-filter-btn.active {
  background: var(--blue-soft);
  box-shadow: 0 14px 30px rgba(38, 125, 179, 0.14);
  transform: translateY(-1px);
}

.advanced-filter-btn .icon {
  width: 18px;
  height: 18px;
}

.filter-count-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f8f1;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 950;
}

.advanced-filter-panel {
  animation: filterReveal 180ms ease both;
}

.order-summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  min-width: 0;
}

.order-summary-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 86px;
  padding: 14px;
  border: 1px solid rgba(199, 225, 244, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 34px rgba(32, 70, 98, 0.08);
}

.order-summary-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.order-summary-card.diamond::before {
  background: linear-gradient(180deg, #6f8cff, #62b8eb);
}

.order-summary-icon {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef9ff, #ecfff6);
  color: var(--blue-dark);
}

.order-summary-card.diamond .order-summary-icon {
  background: linear-gradient(135deg, #f0f4ff, #eefaff);
  color: #365bb8;
}

.order-summary-icon .icon {
  width: 24px;
  height: 24px;
}

.order-summary-card small,
.order-summary-card strong,
.order-summary-card em {
  display: block;
  min-width: 0;
}

.order-summary-card small {
  color: #607789;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.order-summary-card strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 950;
  line-height: 1;
}

.order-summary-card em {
  margin-top: 5px;
  color: var(--green);
  font-size: 0.84rem;
  font-style: normal;
  font-weight: 900;
}

.product-archive {
  display: grid;
  gap: 18px;
}

.customer-groups {
  width: 100%;
}

.customer-table-wrap {
  min-height: min(58vh, 640px);
}

.customer-table {
  width: 100%;
  table-layout: fixed;
}

.customer-table,
.user-table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

.customer-table thead th,
.user-table thead th {
  padding: 0 16px 8px;
  border: 0;
  color: #5d7486;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.customer-table tbody tr,
.user-table tbody tr {
  position: relative;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(32, 70, 98, 0.07);
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.customer-table tbody tr::before,
.user-table tbody tr::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.customer-table tbody td,
.user-table tbody td {
  min-height: 64px;
  padding: 14px 16px;
  border: 0;
  border-top: 1px solid rgba(213, 232, 246, 0.76);
  border-bottom: 1px solid rgba(213, 232, 246, 0.76);
  background: transparent;
  vertical-align: middle;
}

.customer-table tbody td:first-child,
.user-table tbody td:first-child {
  border-left: 1px solid rgba(213, 232, 246, 0.76);
  border-radius: 10px 0 0 10px;
}

.customer-table tbody td:last-child,
.user-table tbody td:last-child {
  border-right: 1px solid rgba(213, 232, 246, 0.76);
  border-radius: 0 10px 10px 0;
}

.customer-table th:nth-child(1),
.customer-table td:nth-child(1) {
  width: 76px;
  text-align: center;
}

.customer-table th:nth-child(2),
.customer-table td:nth-child(2) {
  width: 28%;
}

.customer-table th:nth-child(3),
.customer-table td:nth-child(3) {
  width: 140px;
}

.customer-table th:nth-child(4),
.customer-table td:nth-child(4) {
  width: 150px;
}

.customer-table th:nth-child(5),
.customer-table td:nth-child(5) {
  width: 140px;
}

.customer-table th:nth-child(6),
.customer-table td:nth-child(6) {
  width: 150px;
}

.customer-table .numeric-cell strong,
.user-table .numeric-cell strong {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(232, 246, 255, 0.98), rgba(239, 250, 245, 0.98));
  color: var(--blue-dark);
  font-weight: 900;
}

.customer-table tbody tr {
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.customer-table tbody tr:hover,
.customer-table tbody tr:focus {
  outline: none;
  background: #f8fdff;
  box-shadow: 0 16px 34px rgba(32, 70, 98, 0.12);
  transform: translateY(-1px);
}

.customer-row-identity {
  min-width: 0;
  display: block;
}

.customer-row-identity span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.customer-row-identity strong,
.customer-row-identity small {
  display: block;
  overflow-wrap: anywhere;
}

.customer-row-identity strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 950;
}

.customer-row-identity small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.user-table-wrap {
  min-height: min(58vh, 640px);
}

.user-table {
  width: 100%;
  table-layout: fixed;
}

.user-table th:nth-child(1),
.user-table td:nth-child(1) {
  width: 76px;
  text-align: center;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2) {
  width: 26%;
}

.user-table th:nth-child(3),
.user-table td:nth-child(3) {
  width: 150px;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5) {
  width: 150px;
}

.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 160px;
}

.user-table tbody tr {
  cursor: pointer;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.user-table tbody tr:hover,
.user-table tbody tr:focus {
  outline: none;
  background: #f8fdff;
  box-shadow: 0 16px 34px rgba(32, 70, 98, 0.12);
  transform: translateY(-1px);
}

.user-row-identity {
  min-width: 0;
  display: block;
}

.user-row-identity > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-row-identity strong,
.user-row-identity small {
  display: block;
  overflow-wrap: anywhere;
}

.user-row-identity strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 950;
}

.user-row-identity small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.user-dialog-card {
  width: min(780px, calc(100vw - 32px));
}

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

.customer-dialog-card {
  width: min(760px, calc(100vw - 32px));
}

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

.customer-group-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(213, 232, 246, 0.92);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f7fcff 80%);
  box-shadow: 0 16px 38px rgba(32, 70, 98, 0.07);
}

.customer-group-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.customer-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.customer-avatar,
.user-account > span {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue-dark), var(--green));
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(32, 70, 98, 0.15);
}

.customer-identity div {
  min-width: 0;
}

.customer-group-head strong {
  display: block;
  color: var(--black);
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}

.customer-group-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.customer-group-head b,
.customer-group-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 900;
}

.customer-group-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.customer-latest {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(213, 232, 246, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.customer-latest span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.customer-latest strong {
  color: var(--black);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

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

.customer-order-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 9px 10px;
  border: 1px solid rgba(213, 232, 246, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  text-align: left;
}

.customer-order-list button:hover {
  border-color: rgba(38, 125, 179, 0.28);
  background: var(--blue-soft);
}

.customer-order-list button strong,
.customer-order-list button small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.customer-order-list button small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 800;
}

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

.customer-form label,
.customer-form-grid label,
.user-form-grid label,
.customer-edit-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.customer-form button,
.customer-form-grid button,
.user-form-grid button,
.customer-edit-grid button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--action-create);
  color: #052717;
  font-weight: 900;
}

.customer-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(213, 232, 246, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.customer-edit-grid button[data-customer-action="save"] {
  background: var(--action-save);
  color: #ffffff;
}

.customer-edit-grid button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.customer-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.product-month {
  display: grid;
  gap: 10px;
}

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

.product-archive-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.product-archive-card strong {
  color: var(--black);
}

.product-archive-card span,
.product-archive-card small {
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.gold-rate-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

#goldRateView .gold-rate-workbench {
  grid-template-columns: minmax(0, 1fr);
}

.gold-rate-panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(38, 125, 179, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 255, 0.94)),
    var(--panel-solid);
  box-shadow: 0 18px 42px rgba(32, 70, 98, 0.08);
}

.gold-rate-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--blue), var(--green), #d4b067);
}

.gold-rate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(213, 232, 246, 0.8);
  border-radius: 8px;
  background: linear-gradient(135deg, #fbfdff, #eef8ff);
}

.gold-rate-head span {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gold-rate-head h2 {
  margin: 4px 0 0;
  color: var(--black);
  font-size: clamp(1.55rem, 2.5vw, 2.55rem);
}

.gold-rate-head p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.gold-rate-head > strong {
  min-width: 122px;
  padding: 10px 12px;
  border: 1px solid rgba(38, 125, 179, 0.16);
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  text-align: center;
  font-size: 0.84rem;
}

.gold-rate-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(213, 232, 246, 0.78);
  border-radius: 8px;
  background: #ffffff;
}

.gold-rate-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.gold-rate-form input,
.gold-rate-form select {
  min-height: 50px;
  border-color: rgba(38, 125, 179, 0.28);
  background: #fbfdff;
  color: var(--black);
  font-size: 1.08rem;
  font-weight: 900;
}

.gold-rate-form button {
  min-height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #062235;
  font-weight: 900;
}

@media (max-width: 1180px) {
  #goldRateView .gold-rate-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .gold-rate-form {
    grid-template-columns: 1fr;
  }

  .gold-rate-form button {
    width: 100%;
  }

  .gold-rate-head {
    flex-direction: column;
  }

  .gold-rate-head > strong {
    width: 100%;
  }
}

.gold-rate-results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.gold-rate-summary,
.gold-rate-result-grid {
  display: grid;
  gap: 10px;
}

.gold-rate-summary {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gold-rate-result-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  padding: 12px;
  border: 1px solid rgba(213, 232, 246, 0.8);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(232, 246, 255, 0.42));
}

.gold-rate-summary div,
.gold-rate-card {
  border: 1px solid rgba(213, 232, 246, 0.9);
  border-radius: 8px;
  background: #ffffff;
}

.gold-rate-summary div,
.gold-rate-card {
  display: grid;
  gap: 5px;
  padding: 14px;
}

.gold-rate-summary div {
  min-height: 112px;
  align-content: center;
  border-color: rgba(38, 125, 179, 0.16);
  background: linear-gradient(135deg, #ffffff, #f8fcff);
  box-shadow: inset 0 4px 0 rgba(38, 125, 179, 0.18);
}

.gold-rate-card {
  min-height: 112px;
  align-content: center;
  text-align: center;
  background: linear-gradient(135deg, #ffffff, #f7fcff);
  box-shadow: inset 0 4px 0 var(--rate-color, var(--blue));
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.gold-rate-card:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 4px 0 var(--rate-color, var(--blue)), 0 14px 28px rgba(32, 70, 98, 0.1);
}

.gold-rate-card.rate-22-kt { --rate-color: #d4b067; }
.gold-rate-card.rate-18-kt { --rate-color: var(--green); }
.gold-rate-card.rate-14-kt { --rate-color: var(--blue); }
.gold-rate-card.rate-10-kt { --rate-color: #7a3798; }
.gold-rate-card.rate-9-kt { --rate-color: #9a4b17; }

.live-metal-frame {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.live-metal-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(213, 232, 246, 0.9);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f8fcff);
  box-shadow: inset 0 4px 0 var(--metal-color, var(--blue));
}

.live-metal-card.gold {
  --metal-color: #d4b067;
}

.live-metal-card.non-gst-gold {
  --metal-color: #e58e26;
}

.live-metal-card.silver {
  --metal-color: #9ab0bf;
}

.live-metal-card.dollar {
  --metal-color: #267db3;
}

.live-metal-card span,
.live-metal-card strong,
.live-metal-card small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.live-metal-card > div:first-child span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.live-metal-card > div:first-child strong {
  display: block;
  margin-top: 5px;
  color: var(--black);
  font-size: 1.16rem;
}

.live-metal-values {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.live-rate-value {
  min-width: 0;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  color: #151515;
  font-size: 1.18rem;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}

.live-rate-value.up {
  background: #1f8a62;
  color: #ffffff;
}

.live-rate-value.down {
  background: #9f2f3a;
  color: #ffffff;
}

.live-metal-card small {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.live-metal-card small span:first-child {
  color: var(--green);
}

.live-metal-card small span:last-child {
  color: var(--red);
}

.gold-rate-summary span,
.gold-rate-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.gold-rate-summary strong,
.gold-rate-card strong {
  color: var(--black);
  font-size: 1.2rem;
}

.gold-rate-summary strong {
  font-size: clamp(1.22rem, 1.8vw, 1.65rem);
  overflow-wrap: anywhere;
}

.gold-rate-card strong {
  font-size: clamp(1.32rem, 2vw, 1.8rem);
}

.gold-rate-summary small,
.gold-rate-card small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.gold-rate-empty {
  display: grid;
  gap: 5px;
  padding: 20px;
  border: 1px dashed rgba(38, 125, 179, 0.28);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
}

.gold-rate-empty strong {
  color: var(--black);
  font-size: 1.05rem;
}

.filter-panel button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--action-neutral);
  color: var(--muted);
  font-weight: 900;
}

.filter-panel button:hover {
  border-color: rgba(38, 125, 179, 0.32);
  background: var(--blue-soft);
}

.order-table-wrap {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
}

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

.user-create-panel,
.user-list-panel {
  position: relative;
  overflow: hidden;
}

.user-create-panel::before,
.user-list-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--blue), var(--green), var(--blue-dark));
}

.user-account-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(213, 232, 246, 0.92);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f8fcff);
  box-shadow: 0 14px 30px rgba(32, 70, 98, 0.06);
}

.user-account-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--role-color, var(--blue-dark));
}

.user-account-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.user-account {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-account strong,
.user-account small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-account strong {
  color: var(--black);
}

.user-account small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.user-account-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.user-account-body label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.user-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-lock-note {
  min-height: 42px;
  display: grid;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(31, 138, 98, 0.18);
  border-radius: 8px;
  background: #e8f8f1;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
}

.sessions-panel {
  min-height: calc(100vh - 180px);
}

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

.session-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(213, 232, 246, 0.92);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(32, 70, 98, 0.06);
}

.session-card.is-active {
  border-color: rgba(31, 138, 98, 0.24);
  box-shadow: inset 4px 0 0 var(--green), 0 14px 30px rgba(32, 70, 98, 0.06);
}

.session-card.is-inactive {
  background: #f8fbfd;
}

.session-card-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.session-card-head strong,
.session-card-head small,
.session-details strong,
.session-agent {
  min-width: 0;
  overflow-wrap: anywhere;
}

.session-card-head strong {
  display: block;
  color: var(--black);
}

.session-card-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.session-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue-dark), var(--green));
  color: #ffffff;
  font-weight: 900;
}

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

.session-details div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcff;
}

.session-details span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.session-details strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.86rem;
}

.session-agent {
  padding: 10px 12px;
  border: 1px dashed rgba(38, 125, 179, 0.28);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.session-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--action-danger);
  color: #ffffff;
  font-weight: 900;
}

.session-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.order-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  table-layout: fixed;
}

#ordersView .order-table {
  min-width: 0;
  width: 100%;
}

#ordersView .order-table-wrap {
  overflow-x: hidden;
  width: 100%;
}

.order-table th,
.order-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: normal;
}

.order-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.order-table th:nth-child(1),
.order-table td:nth-child(1) {
  width: 110px;
}

.order-table th:nth-child(2),
.order-table td:nth-child(2) {
  width: 160px;
}

.order-table th:nth-child(3),
.order-table td:nth-child(3),
.order-table th:nth-child(4),
.order-table td:nth-child(4) {
  width: 170px;
}

.order-table th:nth-child(5),
.order-table td:nth-child(5) {
  width: 120px;
}

.order-table th:nth-child(6),
.order-table td:nth-child(6) {
  width: 140px;
}

.order-table th:nth-child(7),
.order-table td:nth-child(7) {
  width: 160px;
}

.order-table tr {
  cursor: pointer;
}

.order-table tbody tr:focus-visible {
  outline: 3px solid rgba(98, 184, 235, 0.32);
  outline-offset: -3px;
}

.user-table tr {
  cursor: default;
}

.order-table tr:hover,
.order-table tr.selected {
  background: var(--blue-soft);
}

.order-table tbody tr {
  box-shadow: inset 4px 0 0 var(--dept-color);
}

.order-table tbody tr:hover,
.order-table tbody tr.selected {
  background: var(--dept-bg);
}

.order-table tbody tr.order-delivered {
  --dept-color: var(--green);
  --dept-bg: #f0fbf6;
  background: #fbfffd;
}

.order-table tbody tr.order-delivered:hover,
.order-table tbody tr.order-delivered.selected {
  background: #e9f8f1;
}

.order-table tbody tr.order-delivered td:first-child strong {
  color: var(--green);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  max-width: 100%;
  line-height: 1.2;
  overflow-wrap: break-word;
  white-space: normal;
  word-break: normal;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.badge.warn {
  background: #fff5dd;
  color: var(--amber);
}

.badge.draft {
  background: #eef8ff;
  color: var(--blue-dark);
}

.badge.good {
  background: #e8f8f1;
  color: var(--green);
}

.badge.bad {
  background: #ffecec;
  color: var(--red);
}

.priority-badge.priority-low {
  background: #edf6ff;
  color: #2d6f9f;
}

.priority-badge.priority-normal {
  background: #e8f8f1;
  color: var(--green);
}

.priority-badge.priority-watch {
  background: #fff9d8;
  color: #8b7612;
}

.priority-badge.priority-high,
.priority-badge.priority-high-priority {
  background: #fff5dd;
  color: var(--amber);
}

.priority-badge.priority-urgent {
  background: #ffe9e9;
  color: var(--red);
}

.priority-badge.priority-critical {
  background: #5f1717;
  color: #fff4f4;
}

.order-table tbody tr.priority-urgent {
  box-shadow: inset 4px 0 0 var(--red), 0 0 0 1px rgba(193, 79, 79, 0.16);
}

.order-table tbody tr.priority-critical {
  box-shadow: inset 4px 0 0 #5f1717, 0 0 0 1px rgba(95, 23, 23, 0.18);
}

.order-table tbody tr.priority-high,
.order-table tbody tr.priority-high-priority {
  box-shadow: inset 4px 0 0 var(--amber), 0 0 0 1px rgba(185, 132, 34, 0.12);
}

.queue-item.priority-urgent {
  border-color: rgba(193, 79, 79, 0.28);
  background: linear-gradient(90deg, #ffecec, #fbfdff 72%);
  box-shadow: inset 4px 0 0 var(--red);
}

.queue-item.priority-critical {
  border-color: rgba(95, 23, 23, 0.32);
  background: linear-gradient(90deg, #ffe1e1, #fbfdff 72%);
  box-shadow: inset 4px 0 0 #5f1717;
}

.queue-item.priority-high,
.queue-item.priority-high-priority {
  border-color: rgba(185, 132, 34, 0.3);
  background: linear-gradient(90deg, #fff5dd, #fbfdff 72%);
  box-shadow: inset 4px 0 0 var(--amber);
}

.queue-item.priority-watch {
  border-color: rgba(139, 118, 18, 0.24);
  background: linear-gradient(90deg, #fffbe2, #fbfdff 72%);
  box-shadow: inset 4px 0 0 #ccb42c;
}

.dept-badge {
  border: 1px solid var(--dept-border);
  background: var(--dept-bg);
  color: var(--dept-color);
}

.order-detail {
  min-height: 0;
  max-height: 100%;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(38, 125, 179, 0.42) transparent;
}

#ordersView.order-detail-mode .order-detail {
  max-height: none;
  overflow: visible;
}

.order-detail::-webkit-scrollbar {
  width: 10px;
}

.order-detail::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(38, 125, 179, 0.36);
  background-clip: padding-box;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.detail-head h2 {
  margin: 0 0 6px;
  color: var(--black);
}

.detail-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.detail-head-actions button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(213, 232, 246, 0.95);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue-dark);
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.detail-head-actions button:hover {
  border-color: rgba(38, 125, 179, 0.32);
  box-shadow: 0 10px 22px rgba(32, 70, 98, 0.08);
  transform: translateY(-1px);
}

.detail-head-actions button[data-action="backToOrderList"] {
  border-color: rgba(38, 125, 179, 0.34);
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(38, 125, 179, 0.24);
}

.detail-head-actions button[data-action="backToOrderList"]::before {
  content: "< ";
  font-weight: 1000;
}

.department-work-panel {
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--dept-border, rgba(213, 232, 246, 0.9));
  border-radius: 14px;
  background: linear-gradient(135deg, var(--dept-bg, #fbfdff), #ffffff 78%);
  box-shadow: 0 18px 44px rgba(32, 70, 98, 0.1);
}

.work-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(213, 232, 246, 0.82);
  background: rgba(255, 255, 255, 0.78);
}

.work-panel-head div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.work-panel-head span {
  color: var(--dept-color, var(--blue-dark));
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.work-panel-head strong {
  color: var(--black);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.work-panel-head small {
  color: var(--muted);
  font-weight: 850;
}

.work-panel-head b {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--dept-color, var(--blue-dark));
  font-size: 0.76rem;
  font-weight: 1000;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--dept-border, var(--line));
}

.department-required-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
  border-bottom: 1px solid rgba(213, 232, 246, 0.72);
  background: rgba(255, 255, 255, 0.55);
}

.department-required-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(20, 48, 66, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.department-required-list b {
  color: var(--black);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.department-required-list .done {
  border-color: rgba(31, 138, 98, 0.22);
  background: #eefbf4;
  color: #1f6f52;
}

.department-required-list .pending {
  border-color: rgba(236, 101, 48, 0.28);
  background: #fff4ee;
  color: #9b4b28;
}

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

.data-box {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.data-box span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.data-box strong {
  display: block;
  margin-top: 4px;
  color: var(--black);
  overflow-wrap: anywhere;
}

.kpi-panel {
  display: grid;
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.kpi-progress {
  display: grid;
  gap: 8px;
}

.kpi-progress div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kpi-progress span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-badge-stack {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.kpi-progress strong {
  color: var(--black);
}

.kpi-progress i {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eef5;
}

.kpi-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue-dark));
}

.kpi-progress.expected b {
  background: linear-gradient(90deg, #ccb42c, var(--amber));
}

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

.reference-preview {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.reference-preview span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reference-preview img {
  width: 100%;
  max-height: 360px;
  display: block;
  object-fit: contain;
  border: 1px solid rgba(213, 232, 246, 0.95);
  border-radius: 8px;
  background: #ffffff;
  user-select: none;
  -webkit-user-drag: none;
}

.reference-preview strong {
  display: block;
  margin-top: 9px;
  color: var(--black);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

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

.file-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.file-chip span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.file-chip strong {
  min-width: 0;
  color: var(--black);
  overflow-wrap: anywhere;
}

.file-chip a,
.file-chip button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(38, 125, 179, 0.28);
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
}

.file-chip button:disabled {
  border-color: var(--line);
  background: #ffffff;
  color: var(--muted);
  cursor: not-allowed;
}

.detail-actions {
  display: grid;
  gap: 12px;
  margin-top: 0;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.56);
}

.detail-actions button[data-action*="approve" i],
.detail-actions button[data-action="clientApproveCad"],
.detail-actions button[data-action="paymentApprove"],
.detail-actions button[data-action="dispatch"] {
  background: var(--action-approve);
  box-shadow: 0 12px 28px rgba(31, 138, 98, 0.18);
}

.detail-actions button[data-action*="return" i],
.detail-actions button[data-action*="reject" i],
.detail-actions button[data-action*="decline" i],
.detail-actions button[data-action="clientReturnCad"] {
  background: var(--action-return);
  box-shadow: 0 12px 28px rgba(185, 132, 34, 0.18);
}

.detail-actions button[data-action*="assign" i],
.detail-actions button[data-action*="send" i],
.detail-actions button[data-action="completeCad"],
.detail-actions button[data-action="completeStl"],
.detail-actions button[data-action="packingSlipUpdate"] {
  background: var(--action-send);
  box-shadow: 0 12px 28px rgba(38, 125, 179, 0.18);
}

.detail-actions button[data-action*="delete" i],
.detail-actions button[data-action*="cancel" i],
.detail-actions button[data-action="paymentDecline"] {
  background: var(--action-danger);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(193, 79, 79, 0.2);
}

.detail-actions button[data-action*="update" i],
.detail-actions button[data-action*="save" i] {
  background: var(--action-save);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(34, 80, 163, 0.18);
}

.detail-actions textarea {
  min-height: 76px;
}

.detail-actions label {
  margin: 0;
}

.workflow-note {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px solid rgba(38, 125, 179, 0.22);
  border-radius: 8px;
  background: linear-gradient(90deg, var(--blue-soft), #ffffff);
}

.workflow-note strong {
  display: block;
  color: var(--black);
}

.workflow-note span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.manufacturing-checklist {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.step-check {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.step-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.step-check span {
  color: var(--black);
  font-weight: 900;
}

.step-check small {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.step-check.completed {
  border-color: rgba(31, 138, 98, 0.28);
  background: #f2fff8;
}

.step-check.completed small {
  background: #e8f8f1;
  color: var(--green);
}

.step-check.current {
  border-color: rgba(38, 125, 179, 0.38);
  background: #f7fcff;
  box-shadow: inset 4px 0 0 var(--blue-dark);
}

.step-check.upcoming {
  opacity: 0.72;
  background: #f8fafc;
}

.qr-box {
  width: 132px;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.qr-box a {
  display: block;
  padding: 8px;
  border: 1px solid rgba(213, 232, 246, 0.95);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(32, 70, 98, 0.12);
}

.qr-box img {
  width: 104px;
  height: 104px;
  display: block;
  object-fit: contain;
}

.empty-state {
  margin: 0;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(1080px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  overflow: hidden;
}

.compact-modal {
  width: min(520px, calc(100% - 28px));
}

.compact-modal .modal-card {
  display: grid;
  gap: 14px;
}

.compact-modal .modal-head {
  margin-bottom: 0;
}

.compact-modal .modal-head p {
  margin: 6px 0 0;
  color: var(--blue-dark);
  font-weight: 900;
}

.compact-modal textarea {
  min-height: 120px;
}

.modal::backdrop {
  background: rgba(20, 39, 53, 0.38);
  backdrop-filter: blur(4px);
}

.modal-card {
  padding: 22px;
  max-height: inherit;
  overflow: hidden auto;
}

.order-form-card {
  position: relative;
  width: min(1120px, calc(100vw - 40px));
  overflow-x: hidden;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(249, 253, 255, 0.97)),
    var(--panel-solid);
  animation: orderModalIn 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.order-form-card::before {
  display: block;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, var(--blue-dark), var(--green), #d9b873);
}

.order-form-card .modal-head {
  margin: 0;
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(213, 232, 246, 0.74);
  background: linear-gradient(135deg, rgba(248, 252, 255, 0.96), rgba(255, 255, 255, 0.96));
}

.order-form-card .form-grid,
.order-form-card .order-step-tabs,
.order-form-card .form-message {
  margin-inline: 26px;
}

.order-form-card input.readonly-note {
  background: linear-gradient(180deg, #f7fbfe, #eef6fb);
  border-color: rgba(97, 174, 223, 0.45);
  color: var(--muted);
  cursor: not-allowed;
  font-weight: 800;
}

.seller-auto-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(180, 215, 237, 0.88);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(236, 248, 255, 0.92), rgba(255, 255, 255, 0.96)),
    #ffffff;
  box-shadow: 0 14px 34px rgba(30, 93, 132, 0.08);
}

.seller-auto-card > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(211, 229, 240, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
}

.seller-auto-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.seller-auto-card strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.96rem;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
}

.icon-btn {
  width: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.order-step-tabs {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid rgba(213, 232, 246, 0.95);
  border-radius: 8px;
  background: rgba(247, 252, 255, 0.92);
  overflow-x: auto;
  scrollbar-width: thin;
}

.order-step-tabs span {
  position: relative;
  min-width: 112px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #6d8494;
  font-size: 0.76rem;
  font-weight: 1000;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.order-step-tabs span::before {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(213, 232, 246, 0.76);
  color: #577184;
  content: attr(data-order-step-label);
  font-size: 0.68rem;
  font-weight: 1000;
  line-height: 1;
}

.order-step-tabs span.active {
  border-color: rgba(98, 184, 235, 0.45);
  background: linear-gradient(135deg, #e5f5ff, #ffffff);
  color: var(--blue-dark);
  box-shadow: 0 10px 24px rgba(38, 125, 179, 0.12);
  transform: translateY(-1px);
}

.order-step-tabs span.active::before {
  background: var(--action-primary);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(38, 125, 179, 0.22);
}

.order-step-tabs span.done {
  border-color: rgba(31, 138, 98, 0.28);
  background: #eefaf5;
  color: var(--green);
}

.order-step-tabs span.done::before {
  background: rgba(31, 138, 98, 0.14);
  color: var(--green);
  content: "✓";
}

.order-step[hidden] {
  display: none;
}

.order-step {
  position: relative;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 0;
  padding: 20px;
  border: 1px solid rgba(192, 222, 242, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 253, 255, 0.96)),
    linear-gradient(135deg, rgba(98, 184, 235, 0.06), rgba(31, 138, 98, 0.04));
  box-shadow: 0 14px 34px rgba(32, 70, 98, 0.07);
  animation: orderStepIn 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.order-step label,
.order-step .multi-select-field {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(213, 232, 246, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(32, 70, 98, 0.045);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}

.order-step label:focus-within,
.order-step .multi-select-field:focus-within {
  border-color: rgba(98, 184, 235, 0.65);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(98, 184, 235, 0.12), 0 12px 26px rgba(32, 70, 98, 0.08);
  transform: translateY(-1px);
}

.order-step input,
.order-step select,
.order-step textarea,
.order-step .chip-select {
  border-color: rgba(213, 232, 246, 0.95);
  background: #f8fcff;
}

.order-step input,
.order-step select {
  min-height: 46px;
}

.order-step input:focus,
.order-step select:focus,
.order-step textarea:focus {
  background: #ffffff;
}

.order-step textarea {
  min-height: 96px;
  padding-top: 12px;
  resize: vertical;
}

.order-form-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 253, 0.99)),
    var(--panel-solid);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden auto;
  border-radius: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(38, 125, 179, 0.28) transparent;
}

.order-form-card::-webkit-scrollbar {
  width: 8px;
}

.order-form-card::-webkit-scrollbar-track {
  background: transparent;
}

.order-form-card::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(38, 125, 179, 0.28);
}

.order-form-card::before {
  height: 4px;
  background: linear-gradient(90deg, #1c2730, var(--blue-dark), #d9b873);
}

.order-form-card .modal-head {
  padding: 24px 28px 16px;
  border-bottom-color: rgba(213, 226, 236, 0.82);
  background: #ffffff;
}

.order-advanced-toggle {
  min-height: 38px;
  margin-left: auto;
  padding: 0 14px;
  border: 1px solid rgba(34, 121, 173, 0.24);
  border-radius: 999px;
  background: #eef7fc;
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 950;
  white-space: nowrap;
}

.order-advanced-toggle.active {
  border-color: rgba(236, 101, 48, 0.42);
  background: #fff1ea;
  color: #b94f25;
}

.order-form-card .form-grid,
.order-form-card .order-step-tabs,
.order-form-card .form-message,
.order-review-summary {
  margin-inline: 28px;
}

.advanced-order-section .form-section-title {
  border-color: rgba(236, 101, 48, 0.24);
  background: #fff7f2;
}

.order-review-summary {
  margin-top: 16px;
}

.order-review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
}

.order-review-grid span {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(213, 232, 246, 0.92);
  border-radius: 10px;
  background: #ffffff;
  color: var(--black);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.order-review-grid b {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.order-step-tabs {
  --order-progress: 0%;
  position: relative;
  display: grid;
  grid-template-columns: repeat(17, minmax(0, 1fr));
  align-items: flex-start;
  gap: 0;
  margin-top: 0;
  padding: 18px 8px 14px;
  border: 0;
  border-bottom: 1px solid rgba(213, 226, 236, 0.82);
  background: #ffffff;
  overflow: hidden;
  scrollbar-width: none;
}

.order-step-tabs::-webkit-scrollbar {
  display: none;
}

.order-step-tabs::before,
.order-step-tabs::after {
  position: absolute;
  top: 31px;
  left: calc(8px + (100% - 16px) / 34);
  height: 2px;
  border-radius: 999px;
  content: "";
}

.order-step-tabs::before {
  right: calc(8px + (100% - 16px) / 34);
  background: #d8e4ee;
}

.order-step-tabs::after {
  width: calc((100% - 16px - ((100% - 16px) / 17)) * var(--order-progress) / 100);
  max-width: calc(100% - 16px - ((100% - 16px) / 17));
  background: linear-gradient(90deg, var(--blue-dark), var(--green));
  transition: width 260ms ease;
}

.order-step-tabs span {
  z-index: 1;
  min-width: 0;
  min-height: 44px;
  flex-direction: column;
  gap: 6px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  color: #7b8d9b;
  font-size: 0;
  font-weight: 900;
  line-height: 1.15;
  transition: color 180ms ease, transform 180ms ease;
}

.order-step-tabs span::before {
  width: 28px;
  height: 28px;
  border: 2px solid #d8e4ee;
  background: #ffffff;
  box-shadow: 0 0 0 5px #ffffff;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.order-step-tabs span.active {
  background: transparent;
  color: var(--blue-dark);
  font-size: 0.68rem;
  box-shadow: none;
  transform: translateY(-2px);
}

.order-step-tabs span.active::before {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: #ffffff;
  box-shadow: 0 0 0 5px #ffffff, 0 8px 18px rgba(38, 125, 179, 0.22);
  transform: scale(1.08);
}

.order-step-tabs span.done {
  background: transparent;
  color: var(--green);
}

.order-step-tabs span.done::before {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
  content: attr(data-order-step-label);
}

.order-step {
  width: auto;
  max-width: 100%;
  overflow: hidden;
  border-color: rgba(213, 226, 236, 0.95);
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(32, 70, 98, 0.06);
}

.order-step label,
.order-step .multi-select-field {
  border-color: rgba(213, 226, 236, 0.82);
  background: #fbfdff;
  box-shadow: none;
}

.order-step label:focus-within,
.order-step .multi-select-field:focus-within {
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(98, 184, 235, 0.12);
}

.order-step input,
.order-step select,
.order-step textarea,
.order-step .chip-select {
  background: #ffffff;
}

.size-chart-card {
  display: block;
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid rgba(212, 176, 103, 0.32);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 251, 239, 0.96), rgba(255, 255, 255, 0.96));
  color: #725c2a;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.45;
}

.diamond-color-options {
  box-shadow: inset 4px 0 0 rgba(212, 176, 103, 0.58);
}

.stone-grid-field {
  padding: 12px;
  border: 1px solid rgba(213, 232, 246, 0.72);
  border-radius: 8px;
  background: #ffffff;
  overflow-x: auto;
}

.stone-detail-grid,
.stone-detail-readonly {
  min-width: 780px;
  display: grid;
  border: 1px solid rgba(212, 176, 103, 0.28);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf7;
}

.stone-grid-head,
.stone-grid-row {
  display: grid;
  grid-template-columns: 58px 1.35fr 1fr 1fr 1.15fr 0.75fr 1.25fr;
  align-items: stretch;
}

.stone-grid-head {
  background: #fff5dc;
  color: #6b5221;
  font-size: 0.72rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.stone-grid-head span,
.stone-grid-row b,
.stone-grid-row input,
.stone-grid-row span {
  min-height: 38px;
  display: grid;
  align-items: center;
  padding: 7px 8px;
  border-right: 1px solid rgba(212, 176, 103, 0.22);
  border-bottom: 1px solid rgba(212, 176, 103, 0.18);
}

.stone-grid-row b {
  color: #6b5221;
  font-size: 0.78rem;
  text-align: center;
}

.stone-grid-row input {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.stone-grid-row input:focus {
  background: #ffffff;
  box-shadow: inset 0 0 0 2px rgba(98, 184, 235, 0.28);
}

.stone-detail-readonly {
  margin: 14px 0;
}

.multi-select-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.multi-select-field > span {
  text-transform: uppercase;
}

.chip-select {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.chip-select-scroll {
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
}

.chip-select label {
  margin: 0;
}

.chip-select input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-select span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid rgba(38, 125, 179, 0.18);
  border-radius: 999px;
  background: #f8fcff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.chip-select input:checked + span {
  border-color: rgba(31, 138, 98, 0.36);
  background: #e8f8f1;
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(31, 138, 98, 0.12);
}

.multi-select-menu {
  position: relative;
  width: 100%;
}

.multi-select-menu summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  overflow-wrap: anywhere;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.multi-select-menu summary::after {
  content: "▾";
  margin-left: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.multi-select-menu summary::-webkit-details-marker {
  display: none;
}

.multi-select-menu[open] summary {
  border-color: rgba(38, 125, 179, 0.35);
  box-shadow: inset 0 -1px 0 rgba(38, 125, 179, 0.12);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.multi-select-menu[open] {
  z-index: 25;
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 18px 34px rgba(15, 45, 80, 0.12);
}

.multi-select-menu label {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-height: 44px;
  padding: 10px 14px;
  border-top: 1px solid rgba(213, 232, 246, 0.95);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.multi-select-menu[open] label {
  display: flex;
}

.multi-select-menu label:last-child {
  border-radius: 0 0 8px 8px;
}

.multi-select-menu input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--blue-dark);
}

.multi-select-menu label:last-child {
  border-radius: 0 0 8px 8px;
}

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

.form-section-title {
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(98, 184, 235, 0.42);
  border-radius: 8px;
  background: linear-gradient(135deg, #e9f6ff, #ffffff);
  box-shadow: inset 4px 0 0 var(--blue), 0 10px 22px rgba(32, 70, 98, 0.045);
}

.form-section-title strong {
  color: var(--blue-dark);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkbox-field {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(213, 232, 246, 0.8);
  border-radius: 8px;
  background: rgba(251, 253, 255, 0.72);
  color: var(--ink);
  font-weight: 900;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.terms-box {
  padding: 14px 16px;
  border: 1px solid rgba(213, 232, 246, 0.95);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 248, 255, 0.9));
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--blue);
}

.terms-box ol {
  margin: 0;
  padding-left: 20px;
}

.terms-box li {
  margin: 0 0 9px;
  line-height: 1.5;
  font-size: 0.92rem;
  color: var(--muted);
}

.terms-box li:last-child {
  margin-bottom: 0;
}

.terms-accept {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(43, 151, 213, 0.32);
  border-radius: 8px;
  background: rgba(232, 247, 255, 0.68);
  color: var(--ink);
  font-weight: 900;
}

.terms-accept input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.order-form-card .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  box-sizing: border-box;
  margin: 22px 0 0;
  padding: 16px 26px;
  border-top: 1px solid rgba(213, 232, 246, 0.82);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.order-form-card .modal-actions button {
  position: relative;
  min-width: 130px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  border-radius: 999px;
  font-weight: 950;
  letter-spacing: 0;
  transform: translateY(0);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease, filter 180ms ease;
}

.order-form-card .modal-actions button::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.42) 44%, transparent 72%);
  opacity: 0;
  transform: translateX(-120%);
  pointer-events: none;
}

.order-form-card .modal-actions button:hover {
  transform: translateY(-2px);
}

.order-form-card .modal-actions button:hover::before {
  opacity: 1;
  animation: buttonShine 850ms ease;
}

.order-form-card .modal-actions button:active {
  transform: translateY(0) scale(0.985);
}

.order-form-card .modal-actions button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(98, 184, 235, 0.22);
}

.order-form-card .modal-actions button[value="cancel"] {
  border: 1px solid rgba(192, 211, 224, 0.92) !important;
  background: #ffffff !important;
  color: #536b7d !important;
  box-shadow: 0 8px 18px rgba(32, 70, 98, 0.06) !important;
}

.order-form-card .modal-actions button[value="cancel"]:hover {
  border-color: rgba(193, 79, 79, 0.32) !important;
  color: var(--red) !important;
  box-shadow: 0 12px 24px rgba(193, 79, 79, 0.08) !important;
}

#orderBackBtn {
  border: 1px solid rgba(38, 125, 179, 0.22);
  background: #f5fbff;
  color: var(--blue-dark);
  box-shadow: 0 8px 18px rgba(32, 70, 98, 0.06);
}

#orderDraftBtn {
  border: 1px solid rgba(236, 101, 48, 0.28) !important;
  background: #fff4ee !important;
  color: #a94d25 !important;
  box-shadow: 0 8px 18px rgba(236, 101, 48, 0.08) !important;
}

#orderNextBtn,
#orderSaveBtn {
  border: 1px solid rgba(38, 125, 179, 0.32) !important;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue)) !important;
  color: #ffffff !important;
  box-shadow: 0 14px 28px rgba(38, 125, 179, 0.24) !important;
}

#orderNextBtn:hover,
#orderSaveBtn:hover {
  filter: brightness(1.04);
  box-shadow: 0 18px 36px rgba(38, 125, 179, 0.32) !important;
}

#orderSaveBtn {
  background: linear-gradient(135deg, var(--green), #2ed184) !important;
  box-shadow: 0 14px 28px rgba(31, 138, 98, 0.24) !important;
}

.modal-actions {
  position: sticky;
  bottom: -22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px -22px -22px;
  padding: 14px 22px;
  border-top: 1px solid rgba(213, 232, 246, 0.92);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.modal-actions button {
  min-width: 130px;
  padding: 0 18px;
}

#orderNextBtn,
#orderSaveBtn {
  border-color: rgba(38, 125, 179, 0.28);
  background: var(--blue);
  color: #ffffff;
}

.user-form button,
.user-table button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 900;
}

.user-form {
  gap: 14px;
}

.user-form label {
  padding: 12px;
  border: 1px solid rgba(213, 232, 246, 0.78);
  border-radius: 8px;
  background: rgba(251, 253, 255, 0.72);
}

.user-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  background: var(--action-create);
  color: #052717;
}

.user-table button.danger {
  background: var(--action-danger);
  color: #ffffff;
}

.user-table td {
  vertical-align: middle;
}

.user-table tbody tr {
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.user-table tbody tr:hover {
  background: #f7fcff;
  box-shadow: inset 4px 0 0 var(--blue-dark);
}

.user-account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.user-account > span {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-soft), #ffffff);
  color: var(--blue-dark);
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(38, 125, 179, 0.18);
}

.user-account strong {
  display: block;
  color: var(--black);
  white-space: nowrap;
}

.user-account small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.user-table select,
.user-table input {
  min-width: 160px;
  min-height: 40px;
}

.user-table .user-role-input {
  margin-bottom: 7px;
}

.user-role-badge {
  border: 1px solid rgba(213, 232, 246, 0.95);
}

.user-role-badge.role-admin {
  background: #e8f8f1;
  color: var(--green);
}

.user-role-badge.role-jewellery-manager {
  background: #fff4dc;
  color: #8a4f00;
}

.user-role-badge.role-cad-manager {
  background: #e9f0ff;
  color: #2250a3;
}

.user-role-badge.role-cad-designer {
  background: #f6eaff;
  color: #7a3798;
}

.user-role-badge.role-manufacturing-manager {
  background: #fff0e6;
  color: #9a4b17;
}

.user-role-badge.role-product-manager {
  background: #e7f8f0;
  color: #1f7a59;
}

.user-role-badge.role-account-head {
  background: #fff8d7;
  color: #7d5b00;
}

.user-account-card.role-admin { --role-color: var(--green); }
.user-account-card.role-jewellery-manager { --role-color: #8a4f00; }
.user-account-card.role-cad-manager { --role-color: #2250a3; }
.user-account-card.role-cad-designer { --role-color: #7a3798; }
.user-account-card.role-quotation-maker { --role-color: #0f6b64; }
.user-account-card.role-manufacturing-manager { --role-color: #9a4b17; }
.user-account-card.role-product-manager { --role-color: #1f7a59; }
.user-account-card.role-packing-manager { --role-color: #5c6b18; }
.user-account-card.role-account-head { --role-color: #7d5b00; }
.user-account-card.role-seller { --role-color: #267db3; }
.user-account-card.role-tv { --role-color: #4d6575; }

.user-account-card .user-account {
  min-width: 0;
}

.user-account-card .user-account > span {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--role-color, var(--blue-dark)), var(--blue));
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(32, 70, 98, 0.15);
}

.user-account-card .user-account strong,
.user-account-card .user-account small {
  white-space: normal;
}

.user-account-card select,
.user-account-card input {
  width: 100%;
  min-height: 42px;
}

.user-account-actions button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--action-save);
  color: #ffffff;
  font-weight: 900;
}

.user-account-actions button.danger {
  background: var(--action-danger);
}

.user-table td:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-table td:last-child button {
  min-width: 86px;
}

.customer-list-panel,
.user-list-panel {
  min-height: calc(100vh - 184px);
}

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

.customer-search-field {
  position: relative;
  min-width: min(320px, 42vw);
}

.customer-search-field .icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: #6f8798;
  transform: translateY(-50%);
  pointer-events: none;
}

.customer-search-field input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px 0 42px;
  border: 1px solid rgba(199, 225, 244, 0.95);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-weight: 850;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.customer-search-field input:focus {
  border-color: rgba(38, 125, 179, 0.48);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(98, 184, 235, 0.16);
}

.customer-table-wrap,
.user-table-wrap {
  width: 100%;
  min-height: min(62vh, 680px);
  overflow-x: auto;
  border: 1px solid rgba(199, 225, 244, 0.92);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.customer-table,
.user-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}

.customer-table thead,
.user-table thead {
  background: linear-gradient(180deg, #f9fdff 0%, #edf8ff 100%);
}

.customer-table thead th,
.user-table thead th {
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid rgba(199, 225, 244, 0.92);
  color: #597187;
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.customer-table tbody tr,
.user-table tbody tr {
  position: static;
  cursor: pointer;
  background: #ffffff;
  box-shadow: none;
  transform: none;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.customer-table tbody tr::before,
.user-table tbody tr::before {
  content: none;
}

.customer-table tbody tr:nth-child(even),
.user-table tbody tr:nth-child(even) {
  background: #f8fcff;
}

.customer-table tbody tr:hover,
.customer-table tbody tr:focus,
.user-table tbody tr:hover,
.user-table tbody tr:focus {
  outline: none;
  background: #eef8ff;
  box-shadow: inset 4px 0 0 var(--blue);
  transform: none;
}

.customer-table tbody td,
.user-table tbody td {
  height: 66px;
  min-height: 0;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid rgba(213, 232, 246, 0.86);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

.customer-table tbody td:first-child,
.user-table tbody td:first-child,
.customer-table tbody td:last-child,
.user-table tbody td:last-child {
  display: table-cell;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
}

.customer-table th:nth-child(1),
.customer-table td:nth-child(1),
.user-table th:nth-child(1),
.user-table td:nth-child(1) {
  width: 72px;
  text-align: center;
}

.customer-table th:nth-child(2),
.customer-table td:nth-child(2) {
  width: 26%;
}

.customer-table th:nth-child(3),
.customer-table td:nth-child(3),
.customer-table th:nth-child(4),
.customer-table td:nth-child(4),
.customer-table th:nth-child(5),
.customer-table td:nth-child(5),
.customer-table th:nth-child(6),
.customer-table td:nth-child(6) {
  width: 132px;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2) {
  width: 30%;
}

.user-table th:nth-child(3),
.user-table td:nth-child(3) {
  width: 150px;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5),
.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 150px;
}

.customer-table .numeric-cell strong,
.user-table .numeric-cell strong {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(80, 174, 232, 0.22);
  border-radius: 999px;
  background: #edf8ff;
  color: var(--blue-dark);
  font-weight: 950;
  line-height: 1;
}

.customer-row-identity strong,
.user-row-identity strong {
  color: #233442;
  font-size: 0.98rem;
  font-weight: 950;
}

.customer-row-identity small,
.user-row-identity small {
  color: #607789;
  font-size: 0.78rem;
  font-weight: 850;
}

.customer-dialog-card,
.user-dialog-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border-radius: 16px;
  border-color: rgba(184, 215, 238, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 255, 0.98)),
    radial-gradient(circle at top right, rgba(46, 209, 132, 0.14), transparent 32%);
  box-shadow: 0 28px 70px rgba(22, 47, 68, 0.28);
}

#customerDialog,
#userDialog {
  width: min(820px, calc(100vw - 28px));
  overflow: visible;
}

.customer-dialog-card::before,
.user-dialog-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.customer-dialog-card .modal-head,
.user-dialog-card .modal-head {
  margin: 0;
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(213, 232, 246, 0.92);
  background: rgba(255, 255, 255, 0.74);
}

.customer-dialog-card .modal-head h2,
.user-dialog-card .modal-head h2 {
  margin-top: 4px;
  color: #1d2b36;
}

.customer-dialog-card .icon-btn,
.user-dialog-card .icon-btn {
  border-radius: 12px;
  background: #f3faff;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.customer-dialog-card .icon-btn:hover,
.user-dialog-card .icon-btn:hover {
  background: #e4f5ff;
  box-shadow: 0 10px 24px rgba(38, 125, 179, 0.14);
  transform: translateY(-1px);
}

.customer-form-grid,
.user-form-grid {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 22px 26px 8px;
}

.customer-form-grid label,
.user-form-grid label {
  min-width: 0;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid rgba(205, 228, 246, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(32, 70, 98, 0.04);
}

.customer-form-grid input,
.customer-form-grid select,
.customer-form-grid textarea,
.user-form-grid input,
.user-form-grid select,
.user-form-grid textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 46px;
  border-radius: 10px;
  background: #fbfdff;
}

#customerMessage,
#userMessage {
  margin: 0 26px;
}

.customer-dialog-card .modal-actions,
.user-dialog-card .modal-actions {
  position: static;
  margin: 18px 0 0;
  padding: 18px 26px 22px;
  border-top: 1px solid rgba(213, 232, 246, 0.92);
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.96), rgba(240, 248, 253, 0.96));
  backdrop-filter: none;
}

.customer-dialog-card .modal-actions button,
.user-dialog-card .modal-actions button {
  min-width: 132px;
  min-height: 46px;
  border-radius: 12px;
  font-weight: 950;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.customer-dialog-card .modal-actions button:hover,
.user-dialog-card .modal-actions button:hover {
  transform: translateY(-1px);
}

#customerSaveBtn,
#userSaveBtn {
  border-color: rgba(38, 125, 179, 0.18);
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(38, 125, 179, 0.22);
}

#userDeleteBtn {
  border-color: rgba(202, 69, 69, 0.28) !important;
  background: linear-gradient(135deg, #d84d4d, #a93232) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(202, 69, 69, 0.18);
}

@media (max-width: 980px) {
  .customer-table,
  .user-table {
    min-width: 760px;
  }

  .customer-table-wrap,
  .user-table-wrap {
    min-height: 0;
    overflow-x: auto;
  }
}

@media (max-width: 760px) {
  .customer-list-panel,
  .user-list-panel {
    min-height: auto;
  }

  .customer-head-actions,
  .customer-search-field {
    width: 100%;
  }

  .customer-dialog-card,
  .user-dialog-card {
    width: min(100vw - 18px, 820px);
    border-radius: 14px;
  }

  .customer-dialog-card .modal-head,
  .user-dialog-card .modal-head,
  .customer-form-grid,
  .user-form-grid,
  .customer-dialog-card .modal-actions,
  .user-dialog-card .modal-actions {
    padding-right: 16px;
    padding-left: 16px;
  }

  .customer-dialog-card .modal-actions,
  .user-dialog-card .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .customer-dialog-card .modal-actions button,
  .user-dialog-card .modal-actions button {
    width: 100%;
  }
}

@keyframes lightSweep {
  0%,
  100% {
    transform: translateX(-18%) rotate(16deg);
    opacity: 0.35;
  }

  50% {
    transform: translateX(34%) rotate(16deg);
    opacity: 0.64;
  }
}

@keyframes corporateDrift {
  0%,
  100% {
    background-position: 0 0, 0 0, 0 0, 0 0;
    opacity: 0.62;
  }

  50% {
    background-position: 28px 18px, -18px 28px, 0 0, 0 0;
    opacity: 0.82;
  }
}

@keyframes pageReveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes filterReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes appEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loadingSweep {
  0% {
    transform: translateX(-115%);
  }

  50% {
    transform: translateX(80%);
  }

  100% {
    transform: translateX(255%);
  }
}

@keyframes loginIconPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.88);
  }
}

@keyframes buttonShine {
  from {
    transform: translateX(-120%);
  }

  to {
    transform: translateX(120%);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(18px);
  }
}

@keyframes orderModalIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes orderStepIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes notificationSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(18px);
  }
}

@keyframes tvAmbientDrift {
  0%,
  100% {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }

  50% {
    transform: translate3d(2%, 1%, 0) scale(1.06);
  }
}

@keyframes tvVideoMotion {
  0% {
    transform: translate3d(-2%, -1%, 0) rotate(0deg) scale(1.02);
  }

  50% {
    transform: translate3d(2%, 1%, 0) rotate(2deg) scale(1.08);
  }

  100% {
    transform: translate3d(-2%, -1%, 0) rotate(0deg) scale(1.02);
  }
}

@keyframes tvScanSweep {
  from {
    background-position: 0 0, -80vw 0;
  }

  to {
    background-position: 0 24px, 80vw 0;
  }
}

@keyframes tvTickerMove {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

@keyframes tvRateSweep {
  0%,
  45% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes tvDetailMove {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(calc(-100% + 100vw - 80px));
  }
}

@keyframes tvClockPulse {
  70% {
    box-shadow: 0 0 0 8px rgba(98, 240, 163, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(98, 240, 163, 0);
  }
}

@keyframes tvRowPulse {
  0%,
  100% {
    border-color: rgba(255, 255, 255, 0.11);
  }

  50% {
    border-color: rgba(98, 184, 235, 0.26);
  }
}

@keyframes chatMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes brandFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes heroLine {
  0%,
  100% {
    opacity: 0.45;
    transform: scaleX(0.72);
  }

  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  body::before,
  body::after,
  .tv-screen::after,
  .tv-video-effect,
  .tv-market-ticker-track,
  .tv-detail-track,
  .tv-live-rate::after,
  .login-page,
  .login-hero,
  .login-hero::after,
  .login-panel,
  .brand-mark,
  .app-shell,
  .view.active,
  .notification-item,
  .chat-message,
  .login-page.is-loading .login-progress i,
  .login-page.is-loading .login-form button .icon,
  .login-form button:hover::before,
  .head-actions > button:hover::before,
  .modal-actions button:last-child:hover::before,
  .detail-actions button:hover::before {
    animation: none;
  }
}

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

  .sidebar {
    position: sticky;
    height: auto;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px 16px;
    padding: 14px 18px;
  }

  .side-nav {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .side-nav button {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .app-logo {
    width: 150px;
    margin: 0;
  }

  .role-card {
    grid-column: 2;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    margin-top: 0;
    padding: 10px;
  }

  .role-card span,
  .role-card strong {
    grid-column: 1;
  }

  .role-card button {
    grid-row: 1 / span 2;
    min-height: 38px;
  }

  .role-card button:first-of-type {
    grid-column: 2;
  }

  .role-card button:last-of-type {
    grid-column: 3;
  }

  .workspace-head,
  .head-actions,
  .orders-topbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .form-grid,
  .product-archive-grid,
  .gold-rate-form,
  .live-metal-frame,
  .gold-rate-result-grid,
  .customer-groups,
  .customer-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-grid,
  .tv-order,
  .orders-layout,
  .users-layout,
  .customers-layout {
    grid-template-columns: 1fr;
  }

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

  .user-account-grid,
  .sessions-grid {
    grid-template-columns: 1fr;
  }

  .tv-live-rates,
  .tv-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .tv-command-grid {
    grid-template-columns: 1fr;
  }

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

  .tv-strip,
  .tv-queue-head {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-panel {
    min-height: auto;
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-channel-sidebar {
    max-height: 260px;
  }

  .chat-list {
    max-height: 58vh;
  }

  #ordersView.active {
    height: auto;
    overflow: visible;
  }

  #ordersView.order-detail-mode.active {
    min-height: 0;
  }

  .order-detail {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 980px) {
  #ordersView .order-table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  #ordersView .order-table,
  #ordersView .order-table thead,
  #ordersView .order-table tbody,
  #ordersView .order-table tr,
  #ordersView .order-table td {
    display: block;
    width: 100%;
  }

  #ordersView .order-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
  }

  #ordersView .order-table thead {
    display: none;
  }

  #ordersView .order-table tbody tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-solid);
    box-shadow: inset 4px 0 0 var(--dept-color), 0 12px 30px rgba(32, 70, 98, 0.07);
    overflow: hidden;
  }

  #ordersView .order-table tbody tr:hover,
  #ordersView .order-table tbody tr.selected {
    background: var(--dept-bg);
  }

  #ordersView .order-table td {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
  }

  #ordersView .order-table td::before {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  #ordersTable td:nth-child(1)::before {
    content: "Order";
  }

  #ordersTable td:nth-child(2)::before {
    content: "Customer / Seller";
  }

  #ordersTable td:nth-child(3)::before {
    content: "Department";
  }

  #ordersTable td:nth-child(4)::before {
    content: "Status";
  }

  #ordersTable td:nth-child(5)::before {
    content: "Priority";
  }

  #ordersTable td:nth-child(6)::before {
    content: "Delivery";
  }

  #ordersTable td:nth-child(7)::before {
    content: "Owner";
  }
}

@media (max-width: 760px) {
  .customer-form-grid {
    grid-template-columns: 1fr;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .user-table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  #usersTable tbody tr {
    box-shadow: 0 12px 30px rgba(32, 70, 98, 0.07);
  }

  #usersTable tbody tr:hover {
    background: var(--panel-solid);
  }

  #usersTable td:nth-child(1)::before {
    content: "User ID";
  }

  #usersTable td:nth-child(2)::before {
    content: "Name";
  }

  #usersTable td:nth-child(3)::before {
    content: "Role";
  }

  #usersTable td:nth-child(4)::before {
    content: "Password";
  }

  #usersTable td:nth-child(5)::before {
    content: "Action";
  }

  #usersTable td:last-child {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
  }

  #usersTable td:last-child button {
    width: 100%;
  }

  .user-account {
    min-width: 0;
  }
}

@media (max-width: 980px) {
  #usersTable {
    min-width: 0;
  }

  #usersTable,
  #usersTable thead,
  #usersTable tbody,
  #usersTable tr,
  #usersTable td {
    display: block;
    width: 100%;
  }

  #usersTable thead {
    display: none;
  }

  #usersTable tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(32, 70, 98, 0.07);
    overflow: hidden;
  }

  #usersTable td {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
  }

  #usersTable td::before {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  #usersTable td:nth-child(1)::before {
    content: "User";
  }

  #usersTable td:nth-child(2)::before {
    content: "Name";
  }

  #usersTable td:nth-child(3)::before {
    content: "Power";
  }

  #usersTable td:nth-child(4)::before {
    content: "Password";
  }

  #usersTable td:nth-child(5)::before {
    content: "Action";
  }

  #usersTable select,
  #usersTable input,
  #usersTable button {
    min-width: 0;
    width: 100%;
  }

  #usersTable td:last-child {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .user-account {
    min-width: 0;
  }
}

@media (max-width: 860px) {
  .login-page {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    gap: 30px;
    padding: 32px 0;
  }

  .login-page h1 {
    font-size: clamp(3.2rem, 13vw, 5rem);
  }

  .hero-copy p {
    font-size: 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .product-archive-grid,
  .gold-rate-workbench,
  .gold-rate-form,
  .gold-rate-summary,
  .gold-rate-result-grid,
  .live-metal-frame,
  .tv-live-rates,
  .order-step-tabs,
  .customer-groups,
  .customer-edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .login-page {
    width: min(100% - 24px, 420px);
    padding: 24px 0;
  }

  .login-page h1 {
    max-width: 360px;
    font-size: 3.35rem;
  }

  .login-panel,
  .workspace {
    padding: 18px;
  }

  .workspace {
    overflow-x: hidden;
  }

  .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }

  .app-logo {
    width: 132px;
    justify-self: start;
  }

  .mobile-menu-toggle {
    width: 44px;
    min-height: 44px;
    display: inline-grid;
    place-items: center;
    gap: 4px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--blue-dark);
  }

  .mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .sidebar.menu-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .sidebar.menu-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .sidebar.menu-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .workspace-head {
    gap: 12px;
    margin-bottom: 16px;
  }

  .workspace-head h1 {
    font-size: 2.15rem;
  }

  .head-actions {
    gap: 8px;
  }

  .search-box {
    min-width: 0;
  }

  .sequel-header-search {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .side-nav,
  .metric-grid,
  .production-pipeline,
  .filter-panel,
  .detail-grid,
  .session-details,
  .stage-grid {
    grid-template-columns: 1fr;
  }

  #ordersView.active,
  #notificationsView.active {
    height: auto;
    overflow: visible;
  }

  .panel {
    padding: 14px;
  }

  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-title button {
    width: 100%;
  }

  .session-card-head {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .session-card-head .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .session-actions {
    justify-content: stretch;
  }

  .session-actions button {
    width: 100%;
  }

  .panel-controls,
  .panel-controls select {
    width: 100%;
  }

  .file-grid {
    grid-template-columns: 1fr;
  }

  .side-nav {
    grid-column: 1 / -1;
    max-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease, padding 180ms ease;
  }

  .sidebar.menu-open .side-nav {
    max-height: 620px;
    padding: 8px 0 4px;
    opacity: 1;
    transform: translateY(0);
  }

  .role-card {
    grid-column: 1 / -1;
    max-height: 0;
    grid-template-columns: 1fr;
    margin-top: 0;
    padding: 0 10px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease, padding 180ms ease, margin 180ms ease;
  }

  .sidebar.menu-open .role-card {
    max-height: 230px;
    margin-top: 4px;
    padding: 10px;
    opacity: 1;
    transform: translateY(0);
  }

  .role-card span,
  .role-card strong,
  .role-card button {
    grid-column: 1;
    grid-row: auto;
  }

  .side-nav button {
    width: 100%;
    justify-content: flex-start;
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.86rem;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-card strong {
    font-size: 1.65rem;
  }

  .live-metal-card {
    padding: 13px;
  }

  .live-metal-card > div:first-child strong,
  .gold-rate-summary strong,
  .gold-rate-card strong {
    font-size: 1.12rem;
  }

  .live-rate-value {
    width: 100%;
  }

  .live-metal-values {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filter-panel {
    padding: 10px;
  }

  .advanced-filter-btn {
    width: 100%;
  }

  .order-summary-strip {
    grid-template-columns: 1fr;
  }

  .detail-head {
    flex-direction: column;
  }

  .manufacturing-checklist {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .chat-form,
  .status-board button,
  .tv-head,
  .tv-metrics,
  .tv-urgent-grid,
  .tv-department-board,
  .tv-photo-rail,
  .worker-kpi-board {
    grid-template-columns: 1fr;
  }

  .tv-screen {
    min-height: auto;
    padding: 16px;
  }

  .tv-head-actions {
    justify-items: stretch;
  }

  .tv-clock {
    min-width: 0;
  }

  .tv-queue-head {
    display: none;
  }

  .tv-order {
    min-height: 0;
    align-items: stretch;
  }

  .step-check {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .step-check small {
    grid-column: 2;
    justify-self: start;
  }

  .qr-box {
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: start;
  }

  .modal {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .modal-card {
    padding: 16px;
  }

  .order-form-card {
    width: 100%;
  }

  .order-form-card .modal-head {
    padding: 18px 16px 14px;
  }

  .order-form-card .form-grid,
  .order-form-card .order-step-tabs,
  .order-form-card .form-message {
    margin-inline: 16px;
  }

  .order-step-tabs {
    padding: 14px 4px 8px;
  }

  .order-step-tabs span {
    min-height: 34px;
    font-size: 0;
  }

  .order-step-tabs span::before {
    width: 22px;
    height: 22px;
    box-shadow: 0 0 0 4px #ffffff;
    font-size: 0.62rem;
  }

  .order-step-tabs::before,
  .order-step-tabs::after {
    top: 24px;
    left: calc(4px + (100% - 8px) / 34);
  }

  .order-step-tabs::before {
    right: calc(4px + (100% - 8px) / 34);
  }

  .order-step-tabs::after {
    width: calc((100% - 8px - ((100% - 8px) / 17)) * var(--order-progress) / 100);
    max-width: calc(100% - 8px - ((100% - 8px) / 17));
  }

  .order-step {
    padding: 12px;
    grid-template-columns: 1fr;
  }

  .modal-head,
  .modal-actions {
    gap: 10px;
  }

  .modal-actions {
    bottom: -16px;
    display: grid;
    grid-template-columns: 1fr;
    margin: 16px -16px -16px;
    padding: 12px 16px;
  }

  .order-form-card .modal-actions {
    margin: 16px 0 0;
    padding: 12px 16px;
  }

  .chat-message {
    width: 100%;
  }

  .chat-channel-sidebar {
    max-height: 230px;
  }

  .chat-channel-item {
    min-height: 62px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-form button {
    width: 100%;
  }

  .notification-item {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 12px;
  }

  .notification-avatar {
    width: 42px;
    height: 42px;
    font-size: 0.78rem;
  }

  .notification-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .notification-item-head {
    align-items: flex-start;
    gap: 4px;
  }

  .notification-item-head strong {
    white-space: normal;
  }

  .notification-meta span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .notification-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .notification-actions button {
    width: 100%;
  }

  .modal-actions button {
    width: 100%;
    min-width: 0;
  }

  .browser-notification-prompt {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    grid-template-columns: 1fr;
  }

  .session-warning {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    grid-template-columns: 1fr;
  }

  .notification-toast-stack {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .notification-toast {
    width: 100%;
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .notification-toast-avatar {
    width: 42px;
    height: 42px;
    font-size: 0.78rem;
  }

  .timeline-list {
    padding-left: 12px;
  }

  .timeline-item {
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 10px;
  }

  .timeline-card {
    padding: 12px;
  }

  .timeline-meta span {
    max-width: 100%;
  }
}

@media (max-width: 980px) {
  #usersTable,
  #usersTable thead,
  #usersTable tbody,
  #usersTable tr,
  #usersTable td,
  #customerGroups,
  #customerGroups tr,
  #customerGroups td {
    display: revert;
    width: auto;
  }

  #usersTable thead,
  .customer-table thead {
    display: table-header-group;
  }

  #usersTable tbody,
  #customerGroups {
    display: table-row-group;
  }

  #usersTable tr,
  #customerGroups tr {
    display: table-row;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  #usersTable td,
  #customerGroups td {
    display: table-cell;
    grid-template-columns: none;
    width: auto;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid rgba(213, 232, 246, 0.86);
    white-space: normal;
  }

  #usersTable td::before,
  #customerGroups td::before {
    content: none !important;
  }

  #usersTable td:last-child {
    display: table-cell;
  }

  .user-table-wrap,
  .customer-table-wrap {
    border: 1px solid rgba(199, 225, 244, 0.92);
    border-radius: 12px;
    background: #ffffff;
    overflow-x: auto;
  }
}

/* ===== One Caret Tracking v2 premium corporate layer ===== */
:root {
  --v2-bg: #f4f8fb;
  --v2-bg-grid: rgba(34, 121, 173, 0.055);
  --v2-surface: #ffffff;
  --v2-surface-soft: #f8fbfd;
  --v2-surface-strong: #edf6fb;
  --v2-text: #172532;
  --v2-muted: #63798b;
  --v2-muted-2: #8aa0af;
  --v2-line: #dbe9f2;
  --v2-line-strong: #c5deee;
  --v2-blue: #2279ad;
  --v2-blue-2: #50a8d7;
  --v2-blue-dark: #155d86;
  --v2-emerald: #16845f;
  --v2-emerald-2: #22b684;
  --v2-gold: #c7a15a;
  --v2-red: #c34848;
  --v2-red-dark: #8e2e31;
  --v2-amber: #b87518;
  --v2-radius: 10px;
  --v2-radius-sm: 8px;
  --v2-shadow-xs: 0 4px 14px rgba(18, 48, 70, 0.05);
  --v2-shadow-sm: 0 10px 26px rgba(18, 48, 70, 0.08);
  --v2-shadow-md: 0 22px 58px rgba(18, 48, 70, 0.12);
  --v2-control: 46px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--v2-bg);
}

body {
  overflow-x: hidden;
  background:
    linear-gradient(90deg, var(--v2-bg-grid) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(0deg, var(--v2-bg-grid) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(135deg, #f8fbfd 0%, #e8f6fc 48%, #f5faf8 100%);
  color: var(--v2-text);
  letter-spacing: 0;
}

body,
button,
input,
select,
textarea {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

:focus-visible {
  outline: 3px solid rgba(80, 168, 215, 0.28);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--v2-control);
  border: 1px solid var(--v2-line-strong);
  border-radius: var(--v2-radius-sm);
  background: #fbfdff;
  color: var(--v2-text);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(34, 121, 173, 0.45);
  background: #ffffff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--v2-blue-2);
  box-shadow: 0 0 0 4px rgba(80, 168, 215, 0.16);
  background: #ffffff;
}

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

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--v2-blue);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 0;
  background: transparent;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  border-right: 1px solid var(--v2-line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 8px 0 26px rgba(18, 48, 70, 0.05);
  backdrop-filter: blur(14px);
  overflow-y: auto;
}

.app-logo {
  width: 178px;
  max-width: 100%;
  padding: 6px 8px 12px;
}

.app-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.mobile-menu-toggle {
  display: none;
}

.side-nav {
  display: grid;
  gap: 5px;
  overflow: visible;
  padding: 0;
}

.side-nav button {
  position: relative;
  min-height: 44px;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px 0 14px;
  border: 1px solid transparent;
  border-radius: var(--v2-radius-sm);
  background: transparent;
  color: var(--v2-muted);
  font-size: 0.92rem;
  font-weight: 900;
  box-shadow: none;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.side-nav button::before {
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 99px;
  background: transparent;
  content: "";
  transition: background-color 0.18s ease;
}

.side-nav button:hover {
  transform: translateX(2px);
  border-color: rgba(34, 121, 173, 0.16);
  background: var(--v2-surface-soft);
  color: var(--v2-blue-dark);
}

.side-nav button.active {
  border-color: rgba(34, 121, 173, 0.22);
  background: #ffffff;
  color: var(--v2-blue-dark);
  box-shadow: var(--v2-shadow-xs);
}

.side-nav button.active::before {
  background: linear-gradient(180deg, var(--v2-blue-2), var(--v2-emerald-2));
}

.side-nav button.has-alert::after {
  top: 11px;
  right: 12px;
  width: 8px;
  height: 8px;
  border: 2px solid #ffffff;
  background: var(--v2-red);
}

.role-card {
  margin-top: auto;
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: linear-gradient(180deg, #ffffff, #f7fbfd);
  box-shadow: var(--v2-shadow-xs);
}

.role-card span {
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.role-card strong {
  min-width: 0;
  color: var(--v2-text);
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.role-card button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--v2-line-strong);
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
  color: var(--v2-muted);
  font-weight: 900;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.role-card button:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 121, 173, 0.35);
  color: var(--v2-blue-dark);
  box-shadow: var(--v2-shadow-xs);
}

.workspace {
  min-width: 0;
  width: 100%;
  padding: 22px;
}

.workspace-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--v2-shadow-xs);
  backdrop-filter: blur(12px);
}

.workspace-head h1 {
  margin: 0;
  color: var(--v2-text);
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.head-actions {
  min-width: min(640px, 100%);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box,
.sequel-header-search label,
.customer-search-field {
  min-width: min(220px, 100%);
  display: grid;
  gap: 6px;
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 950;
}

.label-with-icon,
.customer-search-field {
  align-items: center;
}

.label-with-icon {
  display: inline-flex;
  gap: 6px;
}

.sequel-header-search {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.sequel-header-search .form-message {
  flex-basis: 100%;
}

.head-actions button,
#newOrderBtn,
#downloadCustomersBtn,
#newCustomerBtn,
#refreshSessionsBtn,
.advanced-filter-btn,
.filter-panel button,
.modal-actions button,
.detail-head-actions button,
.detail-actions button,
.chat-form button,
.tv-head-actions button {
  min-height: var(--v2-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--v2-line-strong);
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
  color: var(--v2-text);
  font-size: 0.93rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.head-actions button:hover,
#downloadCustomersBtn:hover,
#newCustomerBtn:hover,
#refreshSessionsBtn:hover,
.advanced-filter-btn:hover,
.filter-panel button:hover,
.modal-actions button:hover,
.detail-head-actions button:hover,
.detail-actions button:hover,
.chat-form button:hover,
.tv-head-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 121, 173, 0.38);
  box-shadow: var(--v2-shadow-xs);
}

#newOrderBtn,
#newCustomerBtn,
#customerSaveBtn,
#userSaveBtn,
.modal-actions button:last-child,
.chat-form button[type="submit"],
.sequel-header-search button,
.detail-actions button[data-action*="complete"],
.detail-actions button[data-action*="Completed"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(22, 132, 95, 0.18);
}

.modal-actions button.danger,
.modal-actions .danger,
#userDeleteBtn {
  border-color: transparent;
  background: linear-gradient(135deg, var(--v2-red), var(--v2-red-dark));
  color: #ffffff;
}

.panel,
.filter-panel,
.order-detail,
.customer-list-panel,
.user-list-panel,
.sessions-panel,
.chat-panel,
.gold-rate-panel,
.timeline-panel,
.notifications-panel {
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--v2-shadow-xs);
}

.panel {
  padding: 18px;
}

.panel-title {
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-title h2 {
  margin: 0;
  color: var(--v2-text);
  font-size: 1.12rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-title span {
  display: block;
  margin-top: 3px;
  color: var(--v2-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

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

.metric-card,
.dashboard-action-card,
.dashboard-order-card,
.workflow-lane,
.dashboard-attention {
  position: relative;
  min-width: 0;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #ffffff;
  box-shadow: var(--v2-shadow-xs);
  overflow: hidden;
}

.metric-card {
  padding: 17px;
}

.metric-card::before,
.dashboard-action-card::before,
.workflow-lane::before,
.dashboard-order-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--dept-color, var(--v2-blue-2));
}

.metric-card small,
.metric-card span,
.dashboard-action-card small,
.workflow-lane small {
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric-card strong {
  margin-top: 8px;
  color: var(--v2-text);
  font-size: clamp(1.55rem, 2.2vw, 2.25rem);
  line-height: 1;
}

.dashboard-grid,
.split-grid {
  gap: 14px;
}

.orders-topbar {
  min-height: 0;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.advanced-filter-btn {
  background: #ffffff;
  color: var(--v2-blue-dark);
}

.advanced-filter-btn.active {
  border-color: rgba(22, 132, 95, 0.34);
  background: #f0faf6;
  color: var(--v2-emerald);
}

.filter-count-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(34, 121, 173, 0.2);
  border-radius: 99px;
  background: #eaf6fd;
  color: var(--v2-blue-dark);
  font-size: 0.75rem;
  font-weight: 950;
}

.advanced-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
}

.advanced-filter-panel[hidden] {
  display: none !important;
}

.order-summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.order-summary-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #ffffff;
  box-shadow: var(--v2-shadow-xs);
  overflow: hidden;
}

.order-summary-card::before {
  background: var(--v2-blue-2);
}

.order-summary-card.diamond::before {
  background: var(--v2-gold);
}

.order-summary-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eaf6fd;
  color: var(--v2-blue-dark);
}

.order-summary-card.diamond .order-summary-icon {
  background: #fff6df;
  color: #9c7228;
}

.order-summary-card small {
  color: var(--v2-muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.order-summary-card strong {
  color: var(--v2-text);
  font-size: 1.75rem;
}

.order-summary-card em {
  color: var(--v2-muted);
  font-style: normal;
  font-weight: 800;
}

.orders-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

#ordersView:not(.order-detail-mode) .order-detail {
  display: none;
}

#ordersView.order-detail-mode .order-table-wrap,
#ordersView.order-detail-mode .orders-topbar,
#ordersView.order-detail-mode .order-summary-strip,
#ordersView.order-detail-mode .filter-panel {
  display: none !important;
}

#ordersView.order-detail-mode.active {
  min-height: calc(100vh - 132px);
  height: auto;
  overflow: visible;
}

.order-table-wrap,
.table-wrap,
.customer-table-wrap,
.user-table-wrap {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #ffffff;
  box-shadow: var(--v2-shadow-xs);
  overflow: auto;
}

.order-table,
.orders-table,
.customer-table,
.user-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--v2-text);
}

.order-table th,
.orders-table th,
.customer-table th,
.user-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 13px 14px;
  border-bottom: 1px solid var(--v2-line);
  background: #fbfdff;
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.order-table td,
.orders-table td,
.customer-table td,
.user-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(219, 233, 242, 0.82);
  background: #ffffff;
  color: var(--v2-text);
  font-size: 0.92rem;
  vertical-align: middle;
}

.order-table tr,
.customer-table tr,
.user-table tr {
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.order-table tbody tr:hover td,
.customer-table tbody tr:hover td,
.user-table tbody tr:hover td {
  background: #f7fbfe;
}

.order-table tbody tr.selected td,
.customer-table tbody tr.selected td,
.user-table tbody tr.selected td {
  background: #edf8ff;
}

.order-table tbody tr.order-delivered td,
.orders-table tbody tr.order-delivered td {
  background: #f3fbf7;
}

.order-table tbody tr.order-delivered td:first-child,
.orders-table tbody tr.order-delivered td:first-child {
  box-shadow: inset 4px 0 0 var(--v2-emerald);
}

.order-table tbody tr:not(.order-delivered) td:first-child,
.orders-table tbody tr:not(.order-delivered) td:first-child {
  box-shadow: inset 4px 0 0 rgba(34, 121, 173, 0.58);
}

.badge,
.status-badge,
.dept-badge,
.priority-badge,
.pill,
.order-table .badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(34, 121, 173, 0.16);
  border-radius: 99px;
  background: #eef7fc;
  color: var(--v2-blue-dark);
  font-size: 0.75rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.status-completed,
.status-delivered,
.status-dispatched,
.priority-normal,
.pill.success,
.badge.good {
  border-color: rgba(22, 132, 95, 0.18);
  background: #eaf8f2;
  color: var(--v2-emerald);
}

.priority-critical,
.status-hold,
.status-returned,
.pill.danger,
.badge.bad {
  border-color: rgba(195, 72, 72, 0.2);
  background: #fff0f0;
  color: var(--v2-red-dark);
}

.priority-urgent,
.priority-high-priority,
.status-pending,
.pill.warning,
.badge.warn {
  border-color: rgba(184, 117, 24, 0.22);
  background: #fff6e4;
  color: #94600d;
}

.order-detail {
  width: 100%;
  max-width: none;
  padding: 18px;
  overflow: visible;
}

.detail-head {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: linear-gradient(180deg, #ffffff, #f8fbfd);
}

.detail-head h2 {
  margin: 0 0 8px;
  color: var(--v2-text);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  letter-spacing: 0;
}

.detail-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-head-actions button[data-action="backToOrderList"] {
  border-color: rgba(34, 121, 173, 0.24);
  background: #eef8fe;
  color: var(--v2-blue-dark);
}

.qr-box {
  width: 94px;
  padding: 8px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
  text-align: center;
}

.qr-box img {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.qr-box span {
  color: var(--v2-muted);
  font-size: 0.66rem;
  font-weight: 900;
}

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

.data-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.data-box span {
  display: block;
  margin-bottom: 5px;
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.data-box strong {
  display: block;
  color: var(--v2-text);
  font-size: 0.93rem;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.department-work-panel,
.work-panel,
.role-action-panel,
.kpi-panel,
.stage-grid,
.file-grid,
.timeline-card,
.notification-item,
.session-card {
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #ffffff;
  box-shadow: var(--v2-shadow-xs);
}

.department-work-panel,
.role-action-panel,
.kpi-panel {
  padding: 16px;
  margin-bottom: 14px;
}

.work-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-grid,
.file-grid {
  padding: 12px;
  gap: 10px;
}

.reference-preview {
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #ffffff;
}

.reference-preview img {
  border-radius: var(--v2-radius-sm);
}

.customer-list-panel,
.user-list-panel {
  min-height: min(680px, calc(100vh - 160px));
  padding: 18px;
}

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

.customer-search-field {
  position: relative;
}

.customer-search-field svg {
  position: absolute;
  left: 12px;
  bottom: 14px;
  color: var(--v2-muted);
}

.customer-search-field input {
  padding-left: 38px;
}

.customer-table-wrap,
.user-table-wrap {
  max-height: calc(100vh - 260px);
}

.customer-table td,
.user-table td {
  min-height: 60px;
}

.customer-table strong,
.user-table strong {
  color: var(--v2-text);
}

.customer-avatar,
.user-avatar,
.avatar {
  border-radius: 10px;
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(34, 121, 173, 0.18);
}

.chat-panel {
  padding: 14px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
  min-height: min(680px, calc(100vh - 170px));
}

.chat-channel-sidebar,
.chat-main {
  min-width: 0;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #ffffff;
  box-shadow: var(--v2-shadow-xs);
}

.chat-channel-sidebar {
  overflow: auto;
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.chat-list {
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  background:
    linear-gradient(90deg, rgba(34, 121, 173, 0.035) 1px, transparent 1px) 0 0 / 44px 44px,
    #fbfdff;
}

.chat-message,
.message-bubble {
  max-width: min(720px, 86%);
  border-radius: 14px;
  border: 1px solid var(--v2-line);
  background: #ffffff;
  box-shadow: var(--v2-shadow-xs);
}

.chat-message.mine,
.message-bubble.mine {
  margin-left: auto;
  border-color: rgba(22, 132, 95, 0.18);
  background: #effaf5;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--v2-line);
  background: #ffffff;
}

.chat-form textarea {
  min-height: 46px;
  max-height: 140px;
}

.gold-rate-grid,
.rate-card-grid,
.live-rate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.rate-card,
.gold-rate-card,
.calculator-card {
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #ffffff;
  box-shadow: var(--v2-shadow-xs);
}

.rate-card strong,
.gold-rate-card strong {
  color: var(--v2-text);
}

.tv-screen {
  min-height: calc(100vh - 44px);
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(90deg, rgba(80, 168, 215, 0.09) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(0deg, rgba(80, 168, 215, 0.07) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(135deg, #061b24 0%, #092f30 45%, #20291f 100%);
  box-shadow: var(--v2-shadow-md);
}

.tv-head h2 {
  letter-spacing: 0;
}

.tv-clock {
  border-radius: var(--v2-radius);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.tv-live-rates,
.tv-metrics,
.tv-strip,
.tv-detail-carousel {
  gap: 10px;
}

.tv-rate-card,
.tv-metric-card,
.tv-command-panel,
.tv-urgent-panel,
.tv-floor-card {
  border-radius: var(--v2-radius);
  border-color: rgba(213, 232, 246, 0.22);
  background: rgba(255, 255, 255, 0.07);
}

.modal {
  padding: 18px;
}

.modal::backdrop {
  background: rgba(19, 36, 48, 0.56);
  backdrop-filter: blur(7px);
}

.modal-card {
  width: min(920px, calc(100vw - 36px));
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--v2-line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--v2-shadow-md);
  overflow: hidden;
}

.modal-card::before,
.order-form-card::before,
.customer-dialog-card::before,
.user-dialog-card::before {
  height: 4px;
  background: linear-gradient(90deg, var(--v2-blue), var(--v2-emerald), var(--v2-gold));
}

.modal-head {
  min-width: 0;
  padding: 20px 22px;
  border-bottom: 1px solid var(--v2-line);
  background: #ffffff;
}

.modal-head h2 {
  margin: 0;
  color: var(--v2-text);
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--v2-line-strong);
  border-radius: var(--v2-radius-sm);
  background: #f9fcfe;
  color: var(--v2-text);
}

.order-form-card {
  width: min(1180px, calc(100vw - 36px));
  max-height: min(88vh, 900px);
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(248, 252, 255, 0.95), #ffffff 170px),
    #ffffff;
}

.order-form-card .modal-head,
.customer-dialog-card .modal-head,
.user-dialog-card .modal-head {
  position: sticky;
  top: 0;
  z-index: 5;
}

.order-form-card .modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  background:
    linear-gradient(135deg, rgba(234, 246, 253, 0.96), rgba(255, 255, 255, 0.98) 54%, rgba(243, 249, 246, 0.96));
  box-shadow: 0 10px 26px rgba(32, 70, 98, 0.08);
}

.order-form-card .modal-head .eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--v2-blue-dark);
  box-shadow: inset 0 0 0 1px rgba(34, 121, 173, 0.16);
}

.order-step-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 16px 22px;
  border-bottom: 1px solid var(--v2-line);
  background: rgba(251, 253, 255, 0.96);
  box-shadow: inset 0 -1px 0 rgba(213, 232, 246, 0.72);
}

.order-step-tabs span {
  position: relative;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px 0 44px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
  color: var(--v2-muted);
  font-size: 0.8rem;
  font-weight: 950;
  text-align: center;
  box-shadow: 0 8px 18px rgba(32, 70, 98, 0.05);
}

.order-step-tabs span::before {
  position: absolute;
  left: 12px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  content: attr(data-order-step-label);
  background: #f2f7fb;
  color: var(--v2-muted);
  font-size: 0.74rem;
  box-shadow: inset 0 0 0 1px var(--v2-line);
}

.order-step-tabs span.active {
  border-color: rgba(34, 121, 173, 0.32);
  background: linear-gradient(135deg, #eaf6fd, #ffffff);
  color: var(--v2-blue-dark);
  box-shadow: 0 12px 24px rgba(34, 121, 173, 0.12), inset 0 0 0 1px rgba(80, 168, 215, 0.1);
}

.order-step-tabs span.active::before {
  background: var(--v2-blue);
  color: #ffffff;
  box-shadow: none;
}

.order-step-tabs span.done {
  color: var(--v2-emerald);
}

.order-step-tabs span.done::before {
  content: "";
  background: var(--v2-emerald);
  box-shadow: none;
}

.order-form-card .form-grid,
.customer-form-grid,
.user-form-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 22px;
  overflow-y: auto;
}

.order-form-card .form-grid {
  max-height: none;
  overflow: visible;
  align-items: start;
}

.customer-form-grid,
.user-form-grid {
  max-height: calc(86vh - 174px);
}

.form-grid label,
.customer-form-grid label,
.user-form-grid label {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #fbfdff;
  color: var(--v2-muted);
  font-size: 0.78rem;
  font-weight: 950;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.order-form-card .form-grid label:focus-within,
.order-form-card .multi-select-field:focus-within {
  border-color: rgba(34, 121, 173, 0.34);
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(34, 121, 173, 0.1);
}

.order-form-card input,
.order-form-card select,
.order-form-card textarea {
  min-height: 42px;
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
}

.order-form-card textarea {
  min-height: 84px;
}

.form-grid label.wide,
.customer-form-grid label.wide,
.user-form-grid label.wide,
.form-section-title.wide,
.multi-select-field.wide,
.seller-auto-card.wide {
  grid-column: 1 / -1;
}

.form-section-title {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--v2-line);
  border-left: 4px solid var(--v2-blue-2);
  border-radius: var(--v2-radius-sm);
  background: linear-gradient(135deg, #f2f9fd, #ffffff);
  color: var(--v2-blue-dark);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 10px 20px rgba(32, 70, 98, 0.05);
}

.multi-select-field,
.seller-auto-card,
.size-guide-card,
.stone-table-wrap {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #fbfdff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.68);
}

.seller-auto-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.seller-auto-card > div {
  min-width: 0;
  padding: 10px;
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--v2-line);
}

.seller-auto-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.seller-auto-card strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--v2-text);
}

.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-select label {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
}

.chip-select input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-select span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--v2-line-strong);
  border-radius: 99px;
  background: #ffffff;
  color: var(--v2-muted);
  font-size: 0.8rem;
  font-weight: 950;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.chip-select label:hover span {
  border-color: rgba(34, 121, 173, 0.28);
  transform: translateY(-1px);
}

.chip-select input:checked + span {
  border-color: rgba(34, 121, 173, 0.3);
  background: #eaf6fd;
  color: var(--v2-blue-dark);
  box-shadow: 0 4px 12px rgba(34, 121, 173, 0.1);
}

.order-review-summary,
.order-edit-note,
.order-form-card .form-message {
  margin: 0 22px 14px;
}

.order-review-summary {
  padding: 14px;
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-radius);
  background: #fbfdff;
}

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

.order-review-grid span {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: var(--v2-radius-sm);
  background: #ffffff;
  color: var(--v2-text);
  box-shadow: inset 0 0 0 1px var(--v2-line);
}

.order-review-grid b {
  color: var(--v2-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.modal-actions,
.order-form-card .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--v2-line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 24px rgba(32, 70, 98, 0.08);
}

.order-form-card .modal-actions button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--v2-radius-sm);
}

.order-form-card .modal-actions button .icon {
  width: 18px;
  height: 18px;
}

.order-form-card .modal-actions button[value="cancel"],
#orderBackBtn {
  border-color: var(--v2-line-strong);
  background: #ffffff;
  color: var(--v2-muted);
}

#orderDraftBtn {
  border-color: rgba(212, 176, 103, 0.34);
  background: #fff8e8;
  color: #8a651b;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--v2-muted);
  font-weight: 850;
  text-align: center;
}

.form-message {
  color: var(--v2-muted);
  font-weight: 800;
}

@media (max-width: 1280px) {
  .metric-grid,
  .detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .advanced-filter-panel,
  .order-form-card .form-grid,
  .order-review-grid,
  .customer-form-grid,
  .user-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    max-height: none;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--v2-line);
    overflow: visible;
  }

  .app-logo {
    width: 150px;
    padding: 0;
  }

  .mobile-menu-toggle {
    display: inline-grid;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    border: 1px solid var(--v2-line);
    border-radius: var(--v2-radius-sm);
    background: #ffffff;
  }

  .mobile-menu-toggle span {
    width: 18px;
    height: 2px;
    background: var(--v2-text);
  }

  .side-nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
    border: 1px solid var(--v2-line);
    border-radius: var(--v2-radius);
    background: #ffffff;
    box-shadow: var(--v2-shadow-md);
  }

  .sidebar.menu-open .side-nav {
    display: grid;
  }

  .role-card {
    margin: 0;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .workspace {
    padding: 16px;
  }

  .workspace-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .head-actions {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-channel-sidebar {
    max-height: 220px;
  }
}

@media (max-width: 860px) {
  .metric-grid,
  .detail-grid,
  .order-summary-strip,
  .gold-rate-grid,
  .rate-card-grid,
  .live-rate-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .advanced-filter-panel,
  .order-form-card .form-grid,
  .customer-form-grid,
  .user-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-head-actions {
    justify-content: flex-start;
  }

  .order-table,
  .orders-table,
  .customer-table,
  .user-table {
    min-width: 760px;
  }

  .modal-card,
  .order-form-card {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
  }

  .modal {
    padding: 10px;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 12px;
  }

  .workspace-head {
    padding: 14px;
  }

  .workspace-head h1 {
    font-size: 2rem;
  }

  .head-actions,
  .sequel-header-search,
  .customer-head-actions,
  .orders-topbar,
  .modal-actions,
  .order-form-card .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .head-actions > *,
  .head-actions button,
  .sequel-header-search > *,
  .sequel-header-search button,
  .customer-head-actions > *,
  .customer-head-actions button,
  .orders-topbar > *,
  .modal-actions button,
  .order-form-card .modal-actions button {
    width: 100%;
  }

  .side-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .role-card {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-head,
  .order-step-tabs,
  .order-form-card .form-grid,
  .customer-form-grid,
  .user-form-grid,
  .modal-actions,
  .order-form-card .modal-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

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

  .order-form-card .modal-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .order-form-card .modal-head .order-advanced-toggle {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .seller-auto-card,
  .order-review-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-form {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ===== OneChat composer fix + TV command board v3 ===== */
#chatView.active {
  height: calc(100vh - 154px);
  min-height: 560px;
  overflow: hidden;
}

#chatView .chat-panel {
  height: 100%;
  min-height: 0;
  padding: 14px;
}

#chatView .panel-title {
  min-height: 40px;
  margin-bottom: 12px;
}

#chatView .chat-layout {
  height: calc(100% - 54px);
  min-height: 0;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 12px;
}

#chatView .chat-channel-sidebar,
#chatView .chat-main {
  min-height: 0;
  border: 1px solid var(--v2-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--v2-shadow-xs);
}

#chatView .chat-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

#chatView .chat-list {
  min-height: 0;
  align-content: start;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(34, 121, 173, 0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(0deg, rgba(34, 121, 173, 0.025) 1px, transparent 1px) 0 0 / 48px 48px,
    #fbfdff;
  overflow-y: auto;
}

#chatView .chat-list .empty-state {
  min-height: 100%;
  border: 1px dashed rgba(34, 121, 173, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--v2-muted);
}

#chatView .chat-message {
  width: min(680px, 78%);
  max-width: 78%;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#chatView .chat-message-body {
  border-color: rgba(197, 222, 238, 0.9);
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 10px 24px rgba(18, 48, 70, 0.08);
}

#chatView .chat-message.own .chat-message-body {
  border-color: rgba(22, 132, 95, 0.18);
  border-radius: 14px 14px 4px 14px;
  background: #eaf8f2;
}

#chatView .chat-form {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px minmax(96px, auto);
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border-top: 1px solid var(--v2-line);
  background: #ffffff;
}

#chatView .chat-form input#chatMessage {
  min-height: 48px;
  border-radius: 12px;
  padding: 0 14px;
}

#chatView .chat-attach-label {
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid var(--v2-line-strong);
  border-radius: 12px;
  background: #f8fbfd;
  color: var(--v2-blue);
  box-shadow: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

#chatView .chat-attach-label:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 121, 173, 0.36);
  background: #eef8fe;
}

#chatView .chat-form button[type="submit"] {
  width: auto;
  min-width: 106px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(22, 132, 95, 0.18);
}

#chatView .chat-form button[type="submit"]:hover {
  transform: translateY(-1px);
}

#tvView.active {
  overflow: hidden;
}

#tvView .tv-screen {
  min-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(260px, 1fr);
  gap: 12px;
  padding: clamp(18px, 1.8vw, 30px);
  border: 1px solid rgba(110, 153, 178, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(89, 144, 176, 0.06) 1px, transparent 1px) 0 0 / 58px 58px,
    linear-gradient(0deg, rgba(89, 144, 176, 0.045) 1px, transparent 1px) 0 0 / 58px 58px,
    linear-gradient(145deg, #07141c 0%, #0a2631 42%, #152522 100%);
  color: #f4fbff;
  box-shadow: 0 24px 70px rgba(7, 20, 28, 0.28);
}

#tvView .tv-screen:fullscreen {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

#tvView .tv-screen::before {
  background:
    linear-gradient(115deg, rgba(34, 121, 173, 0.14), transparent 34% 64%, rgba(199, 161, 90, 0.12));
  opacity: 0.75;
  mask-image: none;
}

#tvView .tv-screen::after {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 5px),
    linear-gradient(110deg, transparent 0 28%, rgba(80, 168, 215, 0.08) 40%, transparent 54% 100%);
  opacity: 0.55;
  animation-duration: 14s;
}

#tvView .tv-video-effect,
#tvView .tv-ambient {
  display: none;
}

#tvView .tv-head {
  align-items: center;
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(213, 232, 246, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.065);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#tvView .tv-head span {
  color: #67c7f3;
  letter-spacing: 0.13em;
}

#tvView .tv-head h2 {
  margin-top: 6px;
  font-size: clamp(2.4rem, 4vw, 4.8rem);
  letter-spacing: 0;
}

#tvView .tv-head p {
  max-width: 900px;
  color: #b7cbd7;
}

#tvView .tv-head-actions {
  display: grid;
  grid-template-columns: auto;
  justify-items: end;
  gap: 10px;
}

#tvView .tv-head-actions button {
  min-height: 40px;
  border: 1px solid rgba(103, 199, 243, 0.28);
  border-radius: 10px;
  background: rgba(103, 199, 243, 0.1);
  color: #d9f3ff;
}

#tvView .tv-clock {
  min-width: 260px;
  padding: 12px 14px;
  border: 1px solid rgba(213, 232, 246, 0.13);
  border-radius: 14px;
  background: rgba(3, 18, 26, 0.48);
}

#tvView .tv-live-clock strong {
  font-size: clamp(2.4rem, 3.6vw, 4.2rem);
  text-shadow: none;
}

#tvView .tv-live-clock strong em {
  color: #7dffbd;
}

#tvView .tv-market-ticker {
  min-height: 46px;
  margin: 0;
  border-color: rgba(103, 199, 243, 0.18);
  border-radius: 12px;
  background: rgba(1, 10, 16, 0.58);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

#tvView .tv-market-ticker::before {
  width: 118px;
  flex-basis: 118px;
  content: "LIVE FEED";
  background: linear-gradient(135deg, #67c7f3, #24d28b);
  color: #07141c;
}

#tvView .tv-market-ticker-track {
  gap: 20px;
  animation-duration: 46s;
}

#tvView .tv-ticker-item {
  gap: 9px;
}

#tvView .tv-ticker-item i {
  background: rgba(255, 255, 255, 0.09);
}

#tvView .tv-live-rates {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

#tvView .tv-live-rate {
  min-height: 104px;
  gap: 7px;
  padding: 16px;
  border-color: rgba(213, 232, 246, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 4px 0 0 var(--rate-color, #67c7f3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#tvView .tv-live-rate::after {
  opacity: 0.55;
  animation-duration: 7s;
}

#tvView .tv-live-rate span {
  color: #9db9c7;
}

#tvView .tv-live-rate strong {
  font-size: clamp(1.55rem, 2.25vw, 2.35rem);
}

#tvView .tv-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

#tvView .tv-strip-item {
  min-height: 58px;
  border-color: rgba(213, 232, 246, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.065);
}

#tvView .tv-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

#tvView .tv-metrics div {
  min-height: 104px;
  border-color: rgba(213, 232, 246, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

#tvView .tv-metrics strong {
  font-size: clamp(2rem, 3vw, 3.6rem);
}

#tvView .tv-detail-carousel {
  min-height: 292px;
  margin: 0;
  border-color: rgba(213, 232, 246, 0.14);
  border-radius: 14px;
  background: rgba(1, 10, 16, 0.34);
}

#tvView .tv-detail-carousel::before {
  width: 52px;
  background: linear-gradient(90deg, rgba(7, 20, 28, 0.92), transparent);
}

#tvView .tv-detail-carousel::after {
  width: 52px;
  background: linear-gradient(270deg, rgba(7, 20, 28, 0.92), transparent);
}

#tvView .tv-detail-track {
  gap: 12px;
  padding: 12px;
  animation-duration: 72s;
}

#tvView .tv-carousel-panel {
  flex: 0 0 clamp(430px, 38vw, 720px);
  min-height: 268px;
  max-height: 320px;
  overflow: hidden;
}

#tvView .tv-command-panel,
#tvView .tv-urgent-panel {
  padding: 14px;
  border-color: rgba(213, 232, 246, 0.15);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#tvView .tv-command-panel {
  max-height: none;
}

#tvView .tv-panel-title {
  margin-bottom: 12px;
}

#tvView .tv-panel-title span {
  color: #8eb4c7;
}

#tvView .tv-panel-title strong {
  font-size: 1rem;
}

#tvView .tv-urgent-card,
#tvView .tv-worker-card,
#tvView .tv-dept-tile,
#tvView .tv-photo-card,
#tvView .tv-order {
  border-color: rgba(213, 232, 246, 0.14);
  border-radius: 12px;
  background: rgba(3, 18, 26, 0.55);
}

#tvView .tv-worker-card {
  min-height: 52px;
  padding: 9px 11px;
}

#tvView .tv-department-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

#tvView .tv-dept-tile {
  min-height: 86px;
  padding: 10px;
}

#tvView .tv-urgent-grid,
#tvView .tv-dispatch-board {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#tvView .tv-photo-rail {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#tvView .tv-queue-head,
#tvView .tv-order {
  grid-template-columns: 56px minmax(220px, 1.5fr) minmax(150px, 0.9fr) minmax(120px, 0.7fr) minmax(130px, 0.7fr);
}

#tvView .tv-queue {
  max-height: 232px;
  overflow: hidden;
}

@media (max-width: 1280px) {
  #tvView .tv-live-rates,
  #tvView .tv-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #tvView .tv-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #chatView.active {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #chatView .chat-layout {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  #chatView .chat-channel-sidebar {
    max-height: 220px;
  }

  #chatView .chat-main {
    min-height: 520px;
  }

  #tvView.active {
    overflow: visible;
  }

  #tvView .tv-screen {
    display: grid;
    min-height: auto;
    border-radius: 12px;
  }

  #tvView .tv-head {
    align-items: flex-start;
    flex-direction: column;
  }

  #tvView .tv-head-actions,
  #tvView .tv-clock {
    width: 100%;
    justify-items: start;
  }

  #tvView .tv-live-clock {
    justify-items: start;
  }

  #tvView .tv-live-rates,
  #tvView .tv-metrics,
  #tvView .tv-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  #tvView .tv-carousel-panel {
    flex-basis: min(540px, calc(100vw - 72px));
  }
}

@media (max-width: 640px) {
  #chatView .chat-form {
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  #chatView .chat-form button[type="submit"] {
    grid-column: 1 / -1;
    width: 100%;
  }

  #chatView .chat-message {
    width: 100%;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #chatView .chat-attach-label,
  #chatView .chat-form button[type="submit"],
  #tvView .tv-market-ticker-track,
  #tvView .tv-detail-track,
  #tvView .tv-screen::after,
  #tvView .tv-live-rate::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* TV contrast guard: keep priority cards readable over the dark board. */
#tvView .tv-urgent-card.priority-critical,
#tvView .tv-urgent-card.priority-urgent,
#tvView .tv-order.priority-critical,
#tvView .tv-order.priority-urgent {
  border-color: rgba(255, 128, 128, 0.34) !important;
  background:
    linear-gradient(135deg, rgba(76, 16, 22, 0.88), rgba(7, 20, 28, 0.84)) !important;
  color: #f8fdff !important;
  box-shadow: inset 4px 0 0 #ff6b6b, 0 14px 34px rgba(0, 0, 0, 0.18) !important;
}

#tvView .tv-urgent-card.priority-high,
#tvView .tv-urgent-card.priority-high-priority,
#tvView .tv-order.priority-high,
#tvView .tv-order.priority-high-priority {
  border-color: rgba(255, 203, 102, 0.34) !important;
  background:
    linear-gradient(135deg, rgba(72, 48, 12, 0.76), rgba(7, 20, 28, 0.84)) !important;
  color: #f8fdff !important;
  box-shadow: inset 4px 0 0 #ffcb66, 0 14px 34px rgba(0, 0, 0, 0.16) !important;
}

#tvView .tv-urgent-card strong,
#tvView .tv-urgent-card b,
#tvView .tv-urgent-card .tv-urgent-main b,
#tvView .tv-order strong,
#tvView .tv-order b {
  color: #ffffff !important;
}

#tvView .tv-urgent-card span,
#tvView .tv-urgent-card small,
#tvView .tv-urgent-card em,
#tvView .tv-urgent-meta span,
#tvView .tv-urgent-progress em,
#tvView .tv-order span,
#tvView .tv-order small {
  color: #c6ddea !important;
}

#tvView .tv-urgent-top span {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffe4e4 !important;
}

#tvView .tv-urgent-progress i,
#tvView .tv-order-progress i {
  background: rgba(255, 255, 255, 0.16) !important;
}

#tvView .tv-mini-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(213, 232, 246, 0.18);
  border-radius: 12px;
  background: rgba(3, 18, 26, 0.34);
  color: #bdd4e2;
  text-align: center;
}

/* TV responsive icon system and polished card composition. */
#tvView .tv-svg,
#tvView .tv-panel-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(213, 232, 246, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: #77cff8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#tvView .tv-svg .icon,
#tvView .tv-panel-icon .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

#tvView .tv-head {
  position: relative;
  overflow: hidden;
}

#tvView .tv-head::after {
  position: absolute;
  inset: auto 18px 18px auto;
  width: 180px;
  height: 2px;
  content: "";
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, rgba(103, 199, 243, 0.55), rgba(36, 210, 139, 0.65));
}

#tvView .tv-live-rates {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

#tvView .tv-live-rate {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

#tvView .tv-live-rate-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: var(--rate-color, #77cff8);
  background: rgba(255, 255, 255, 0.1);
}

#tvView .tv-live-rate div,
#tvView .tv-metric-card div,
#tvView .tv-strip-item div {
  min-width: 0;
}

#tvView .tv-live-rate span,
#tvView .tv-live-rate strong,
#tvView .tv-live-rate small {
  display: block;
}

#tvView .tv-strip {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

#tvView .tv-strip-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-content: start;
}

#tvView .tv-strip-icon {
  width: 34px;
  height: 34px;
  color: var(--dept-color, #77cff8);
}

#tvView .tv-strip-item span,
#tvView .tv-strip-item strong {
  display: block;
}

#tvView .tv-metrics {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

#tvView .tv-metrics .tv-metric-card {
  min-height: 112px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid rgba(213, 232, 246, 0.14);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#tvView .tv-metrics .tv-metric-card > div {
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#tvView .tv-metric-icon {
  width: 48px;
  height: 48px;
  color: #77cff8;
}

#tvView .tv-metric-icon.danger {
  color: #ff8c8c;
}

#tvView .tv-metric-icon.warn {
  color: #ffcb66;
}

#tvView .tv-metric-icon.success {
  color: #7dffbd;
}

#tvView .tv-panel-title {
  align-items: center;
}

#tvView .tv-panel-title > div {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#tvView .tv-panel-title > div > span:last-child {
  color: #9fbdd0;
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#tvView .tv-panel-icon {
  width: 34px;
  height: 34px;
  color: #77cff8;
}

#tvView .tv-detail-carousel {
  min-height: clamp(310px, 28vh, 430px);
}

#tvView .tv-carousel-panel {
  flex-basis: clamp(500px, 42vw, 820px);
  min-height: clamp(280px, 25vh, 390px);
  max-height: none;
}

#tvView .tv-urgent-grid,
#tvView .tv-dispatch-board {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

#tvView .tv-urgent-card {
  min-height: 164px;
  align-content: space-between;
  padding: 14px;
}

#tvView .tv-urgent-title {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#tvView .tv-urgent-icon {
  width: 34px;
  height: 34px;
  color: #ff8c8c;
}

#tvView .tv-priority-chip {
  min-height: 28px;
  padding: 0 10px;
}

#tvView .tv-urgent-main b {
  font-size: 1.05rem;
}

#tvView .tv-urgent-main small,
#tvView .tv-urgent-meta span,
#tvView .tv-urgent-progress em {
  font-size: 0.78rem;
}

#tvView .tv-worker-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
}

#tvView .tv-worker-icon {
  width: 38px;
  height: 38px;
  color: #77cff8;
}

#tvView .tv-dispatch-card.done .tv-worker-icon {
  color: #7dffbd;
}

#tvView .tv-dept-head {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#tvView .tv-dept-icon {
  width: 30px;
  height: 30px;
  color: var(--dept-color, #77cff8);
}

#tvView .tv-dept-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tvView .tv-photo-rail {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

#tvView .tv-queue-head,
#tvView .tv-order {
  grid-template-columns: 82px minmax(220px, 1.5fr) minmax(150px, 0.9fr) minmax(120px, 0.7fr) minmax(130px, 0.7fr);
}

#tvView .tv-order-rank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#tvView .tv-order-icon {
  width: 32px;
  height: 32px;
  color: #77cff8;
}

#tvView .tv-order-rank span {
  color: #77cff8;
  font-size: clamp(1.1rem, 1.5vw, 1.75rem);
  font-weight: 950;
}

@media (min-width: 1500px) {
  #tvView .tv-screen {
    grid-template-rows: auto auto auto auto auto minmax(330px, 1fr);
  }

  #tvView .tv-detail-carousel {
    min-height: 390px;
  }
}

@media (max-width: 1180px) {
  #tvView .tv-head {
    align-items: flex-start;
    flex-direction: column;
  }

  #tvView .tv-head-actions,
  #tvView .tv-clock {
    width: 100%;
    justify-items: start;
  }

  #tvView .tv-live-clock {
    justify-items: start;
  }

  #tvView .tv-carousel-panel {
    flex-basis: min(700px, calc(100vw - 84px));
  }

  #tvView .tv-queue-head,
  #tvView .tv-order {
    grid-template-columns: 70px minmax(220px, 1fr) minmax(140px, 0.8fr) minmax(110px, 0.6fr);
  }

  #tvView .tv-queue-head span:last-child,
  #tvView .tv-order-risk {
    display: none;
  }
}

@media (max-width: 760px) {
  #tvView .tv-screen {
    gap: 10px;
    padding: 12px;
  }

  #tvView .tv-head {
    padding: 14px;
  }

  #tvView .tv-head h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  #tvView .tv-market-ticker::before {
    width: 90px;
    flex-basis: 90px;
    font-size: 0.72rem;
  }

  #tvView .tv-live-rate,
  #tvView .tv-metrics .tv-metric-card {
    min-height: 92px;
  }

  #tvView .tv-detail-carousel::before,
  #tvView .tv-detail-carousel::after {
    width: 24px;
  }

  #tvView .tv-carousel-panel {
    flex-basis: calc(100vw - 48px);
  }

  #tvView .tv-urgent-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  #tvView .tv-worker-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #tvView .tv-worker-card b {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #tvView .tv-queue-head {
    display: none;
  }

  #tvView .tv-order {
    grid-template-columns: minmax(0, 1fr);
  }
}

#tvView .tv-live-rate .tv-svg,
#tvView .tv-strip-item .tv-svg,
#tvView .tv-metric-card .tv-svg,
#tvView .tv-panel-title .tv-panel-icon,
#tvView .tv-urgent-card .tv-svg,
#tvView .tv-worker-card .tv-svg,
#tvView .tv-dept-tile .tv-svg,
#tvView .tv-order .tv-svg {
  display: inline-grid;
  place-items: center;
}

/* ===== Premium typography and icon refinement v5 ===== */
:root {
  --font-ui: "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
  --font-display: "Sora", "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
}

body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
  font-feature-settings: "cv02" 1, "cv03" 1, "cv04" 1, "ss01" 1;
  text-rendering: geometricPrecision;
}

h1,
h2,
h3,
.workspace-head h1,
.tv-head h2,
.login-card h1,
.metric-card strong,
.tv-live-rate strong,
.tv-metrics strong,
.order-summary-card strong {
  font-family: var(--font-display);
  letter-spacing: 0;
}

.workspace-head h1,
.tv-head h2 {
  font-weight: 800;
}

.eyebrow,
.panel-title span,
.badge,
.status-badge,
.priority-badge,
.dept-badge,
.side-nav button,
.tv-panel-title span,
.tv-live-rate span,
.tv-metrics span,
.order-table th,
.orders-table th,
.customer-table th,
.user-table th {
  letter-spacing: 0.045em;
}

.icon {
  stroke-width: 2.28;
  vector-effect: non-scaling-stroke;
}

.side-nav button .icon,
.head-actions button .icon,
.role-card button .icon,
.advanced-filter-btn .icon,
.detail-head-actions button .icon,
.detail-actions button .icon,
.modal-actions button .icon,
.chat-form button .icon {
  width: 19px;
  height: 19px;
  stroke-width: 2.35;
}

.side-nav button .icon {
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 1px solid rgba(34, 121, 173, 0.12);
  border-radius: 10px;
  background: rgba(34, 121, 173, 0.06);
  color: var(--v2-blue-dark);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.side-nav button:hover .icon,
.side-nav button.active .icon {
  border-color: rgba(22, 132, 95, 0.2);
  background: linear-gradient(135deg, rgba(34, 121, 173, 0.12), rgba(22, 132, 95, 0.1));
  color: var(--v2-emerald);
  transform: translateY(-1px);
}

.icon-btn .icon,
.customer-search-field .icon,
.label-with-icon .icon {
  stroke-width: 2.35;
}

.order-summary-icon,
.customer-avatar,
.user-avatar,
.avatar,
#tvView .tv-svg,
#tvView .tv-panel-icon {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 10px 24px rgba(18, 48, 70, 0.08);
}

#tvView .tv-screen,
#tvView .tv-screen button {
  font-family: var(--font-ui);
}

#tvView .tv-head h2,
#tvView .tv-live-rate strong,
#tvView .tv-metrics strong,
#tvView .tv-order-rank span,
#tvView .tv-order-progress b,
#tvView .tv-order-risk strong {
  font-family: var(--font-display);
}

#tvView .tv-svg,
#tvView .tv-panel-icon {
  backdrop-filter: blur(8px);
}

#tvView .tv-svg .icon,
#tvView .tv-panel-icon .icon {
  stroke-width: 2.45;
}

#tvView .tv-live-rate-icon,
#tvView .tv-metric-icon {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055));
}

#tvView .tv-urgent-icon,
#tvView .tv-metric-icon.danger {
  background:
    linear-gradient(135deg, rgba(255, 140, 140, 0.18), rgba(255, 255, 255, 0.055));
}

#tvView .tv-metric-icon.success,
#tvView .tv-dispatch-card.done .tv-worker-icon {
  background:
    linear-gradient(135deg, rgba(125, 255, 189, 0.16), rgba(255, 255, 255, 0.055));
}

#tvView .tv-metric-icon.warn {
  background:
    linear-gradient(135deg, rgba(255, 203, 102, 0.16), rgba(255, 255, 255, 0.055));
}

/* ===== Required notification setup and account card v6 ===== */
.role-profile {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px 4px 8px;
}

.role-avatar {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(34, 121, 173, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(34, 121, 173, 0.94), rgba(22, 132, 95, 0.92));
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 24px rgba(18, 48, 70, 0.14);
}

.role-profile div {
  min-width: 0;
}

.role-card .role-profile span:not(.role-avatar) {
  display: block;
  color: var(--v2-muted);
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.role-card .role-profile strong {
  display: block;
  min-width: 0;
  margin-top: 2px;
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-card button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  text-align: left;
}

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

#notificationBtn.is-on {
  border-color: rgba(22, 132, 95, 0.22);
  background: linear-gradient(135deg, rgba(22, 132, 95, 0.12), rgba(255, 255, 255, 0.96));
  color: var(--v2-emerald);
}

#notificationBtn.is-blocked,
#notificationBtn.is-warning {
  border-color: rgba(195, 72, 72, 0.22);
  background: linear-gradient(135deg, rgba(195, 72, 72, 0.1), rgba(255, 255, 255, 0.96));
  color: var(--v2-red-dark);
}

.required-notification-setup {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(10, 33, 48, 0.12) 1px, transparent 1px) 0 0 / 58px 58px,
    linear-gradient(0deg, rgba(10, 33, 48, 0.1) 1px, transparent 1px) 0 0 / 58px 58px,
    rgba(14, 31, 42, 0.7);
  backdrop-filter: blur(10px);
}

.required-notification-card {
  width: min(560px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(213, 232, 246, 0.78);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f7fbfd);
  box-shadow: 0 30px 80px rgba(6, 20, 31, 0.32);
}

.required-notification-icon {
  width: 62px;
  height: 62px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(34, 121, 173, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(34, 121, 173, 0.12), rgba(22, 132, 95, 0.1));
  color: var(--v2-blue);
}

.required-notification-icon .icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.5;
}

.required-notification-card h2 {
  margin: 0;
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3vw, 2.05rem);
  line-height: 1.1;
}

.required-notification-card p {
  margin: 0;
  color: var(--v2-muted);
  font-weight: 750;
  line-height: 1.55;
}

.required-notification-preview {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(197, 222, 238, 0.92);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(248, 251, 253, 0.96), rgba(236, 247, 252, 0.92));
  box-shadow: inset 4px 0 0 var(--v2-blue);
}

.required-notification-preview span,
.required-notification-preview small {
  color: var(--v2-muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.required-notification-preview strong {
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.required-notification-help {
  padding: 12px 14px;
  border: 1px solid rgba(184, 117, 24, 0.18);
  border-radius: 12px;
  background: #fff8eb;
  color: #865b14 !important;
  font-size: 0.88rem;
}

.required-notification-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.required-notification-actions button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  color: #ffffff;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(22, 132, 95, 0.18);
}

.required-notification-actions button.ghost {
  border-color: var(--v2-line-strong);
  background: #ffffff;
  color: var(--v2-muted);
  box-shadow: none;
}

.required-notification-setup.tone-danger .required-notification-icon {
  border-color: rgba(195, 72, 72, 0.22);
  background: rgba(195, 72, 72, 0.1);
  color: var(--v2-red);
}

.required-notification-setup.tone-warning .required-notification-icon {
  border-color: rgba(184, 117, 24, 0.22);
  background: rgba(184, 117, 24, 0.1);
  color: var(--v2-amber);
}

@media (max-width: 1080px) {
  .role-profile {
    padding: 0;
  }
}

@media (max-width: 640px) {
  .required-notification-card {
    padding: 18px;
  }

  .required-notification-actions {
    flex-direction: column;
  }

  .required-notification-actions button {
    width: 100%;
  }
}

/* ===== Smart Launch and global header correction v7 ===== */
.workspace-head {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, auto);
  align-items: center;
  gap: 18px;
  min-height: 118px;
  margin-bottom: 18px;
  padding: 18px;
}

.workspace-head > div:first-child {
  min-width: 0;
}

.workspace-head h1 {
  font-size: clamp(2.15rem, 3.2vw, 3.55rem);
  line-height: 0.98;
}

.head-actions {
  width: min(100%, 760px);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(250px, 1fr) auto;
  align-items: end;
  justify-content: end;
  gap: 10px;
  justify-self: end;
}

.head-actions .search-box,
.head-actions .sequel-header-search {
  min-width: 0;
}

.head-actions input {
  min-width: 0;
}

.sequel-header-search {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
}

.sequel-header-search label {
  min-width: 0;
}

.sequel-header-search button {
  width: 58px;
  min-width: 58px;
  padding: 0;
  border-radius: 10px;
}

.sequel-header-search .form-message {
  grid-column: 1 / -1;
  position: static;
  min-width: 0;
  margin: 0;
  font-size: 0.72rem;
}

#newOrderBtn {
  min-width: 142px;
  white-space: nowrap;
}

.smart-launch-panel {
  min-height: min(620px, calc(100vh - 180px));
  padding: 22px;
}

.smart-launch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--v2-line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 248, 254, 0.9));
}

.smart-launch-head h2 {
  margin: 0;
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1;
}

.smart-launch-head p:not(.eyebrow) {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--v2-muted);
  font-weight: 750;
  line-height: 1.5;
}

.smart-launch-status {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(22, 132, 95, 0.2);
  border-radius: 99px;
  background: #eaf8f2;
  color: var(--v2-emerald);
  font-size: 0.8rem;
  font-weight: 950;
  white-space: nowrap;
}

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

.smart-launch-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--v2-line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--v2-shadow-sm);
  overflow: hidden;
}

.smart-launch-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--v2-blue), var(--v2-emerald));
}

.smart-launch-card.muted {
  opacity: 0.82;
}

.smart-launch-icon {
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(34, 121, 173, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(34, 121, 173, 0.12), rgba(22, 132, 95, 0.1));
  color: var(--v2-blue-dark);
}

.smart-launch-icon .icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.5;
}

.smart-launch-card small {
  color: var(--v2-muted);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.smart-launch-card h3 {
  margin: 5px 0 8px;
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.smart-launch-card p {
  margin: 0;
  color: var(--v2-muted);
  font-weight: 720;
  line-height: 1.5;
}

.smart-launch-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.smart-launch-actions button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  color: #ffffff;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(22, 132, 95, 0.16);
}

.smart-launch-actions button + button {
  border-color: var(--v2-line-strong);
  background: #ffffff;
  color: var(--v2-blue-dark);
  box-shadow: none;
}

.smart-launch-actions button:disabled {
  border-color: var(--v2-line);
  background: #f4f8fb;
  color: var(--v2-muted);
}

body.tv-launch-mode .sidebar,
body.tv-launch-mode .workspace-head {
  display: none !important;
}

body.tv-launch-mode .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.tv-launch-mode .workspace {
  padding: 0;
}

body.tv-launch-mode #tvView.active {
  display: block;
  min-height: 100vh;
}

body.tv-launch-mode #tvView .tv-screen {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

@media (max-width: 1260px) {
  .workspace-head {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .head-actions {
    width: 100%;
    justify-self: stretch;
    grid-template-columns: minmax(220px, 1fr) minmax(250px, 1fr) auto;
  }
}

@media (max-width: 900px) {
  .head-actions,
  .smart-launch-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #newOrderBtn,
  .head-actions > * {
    width: 100%;
  }

  .smart-launch-head {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .workspace-head {
    min-height: 0;
    padding: 14px;
  }

  .workspace-head h1 {
    font-size: clamp(1.9rem, 12vw, 2.7rem);
  }

  .smart-launch-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .smart-launch-actions {
    flex-direction: column;
  }

  .smart-launch-actions button {
    width: 100%;
  }
}

/* ===== OneChat stable vertical pages and scrollbar polish v8 ===== */
#chatView,
#chatView .chat-panel,
#chatView .chat-layout,
#chatView .chat-channel-sidebar,
#chatView .chat-main,
#chatView .chat-list,
#chatView .chat-channel-list {
  min-width: 0;
}

#chatView .chat-channel-sidebar {
  overflow: hidden !important;
}

#chatView .chat-channel-list {
  width: 100%;
  max-width: 100%;
  display: block;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 121, 139, 0.72) rgba(234, 246, 253, 0.84);
}

#chatView .chat-channel-list::-webkit-scrollbar,
#chatView .chat-list::-webkit-scrollbar {
  width: 8px;
  height: 0;
}

#chatView .chat-channel-list::-webkit-scrollbar:horizontal,
#chatView .chat-list::-webkit-scrollbar:horizontal {
  display: none;
  height: 0;
}

#chatView .chat-channel-list::-webkit-scrollbar-track,
#chatView .chat-list::-webkit-scrollbar-track {
  border-radius: 99px;
  background: rgba(234, 246, 253, 0.84);
}

#chatView .chat-channel-list::-webkit-scrollbar-thumb,
#chatView .chat-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(234, 246, 253, 0.84);
  border-radius: 99px;
  background: rgba(99, 121, 139, 0.72);
}

#chatView .chat-channel-list::-webkit-scrollbar-thumb:hover,
#chatView .chat-list::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 121, 173, 0.82);
}

#chatView .chat-channel-section {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

#chatView .chat-channel-item {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: 44px minmax(0, 1fr) minmax(0, auto);
  overflow: hidden;
}

#chatView .chat-channel-item:hover {
  transform: none;
}

#chatView .chat-channel-avatar {
  width: 42px;
  height: 42px;
}

#chatView .chat-channel-copy {
  min-width: 0;
  max-width: 100%;
}

#chatView .chat-channel-copy strong,
#chatView .chat-channel-copy small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chatView .chat-channel-item b {
  max-width: 42px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-channel-pages {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--v2-line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.chat-channel-pages button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--v2-line-strong);
  border-radius: 10px;
  background: #ffffff;
  color: var(--v2-blue-dark);
  font-size: 0.76rem;
  font-weight: 950;
}

.chat-channel-pages button:disabled {
  color: var(--v2-muted-2);
  background: #f4f8fb;
}

.chat-channel-pages span {
  min-width: 0;
  color: var(--v2-muted);
  font-size: 0.74rem;
  font-weight: 950;
  text-align: center;
  white-space: nowrap;
}

/* ===== Header placement and TV user launch wording v9 ===== */
.workspace-head {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  min-height: 0;
  gap: 16px;
  padding: 18px;
}

.workspace-head > div:first-child {
  display: grid;
  gap: 5px;
}

.workspace-head h1 {
  max-width: 100%;
}

.head-actions {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr) minmax(144px, auto);
  align-items: end;
  justify-content: stretch;
  justify-self: stretch;
  gap: 10px;
}

.head-actions .search-box,
.head-actions .sequel-header-search {
  width: 100%;
}

.head-actions .search-box input,
.head-actions .sequel-header-search input {
  height: 48px;
  min-height: 48px;
}

.sequel-header-search {
  width: 100%;
  grid-template-columns: minmax(0, 1fr) 58px;
}

#newOrderBtn {
  width: 100%;
  min-width: 144px;
  height: 48px;
  min-height: 48px;
  align-self: end;
}

.smart-launch-card:first-child::after {
  position: absolute;
  top: 16px;
  right: 16px;
  content: "TV USER";
  padding: 5px 9px;
  border: 1px solid rgba(34, 121, 173, 0.18);
  border-radius: 99px;
  background: #eef8fe;
  color: var(--v2-blue-dark);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.smart-launch-card:first-child .smart-launch-icon {
  color: var(--v2-emerald);
  background: linear-gradient(135deg, rgba(22, 132, 95, 0.14), rgba(34, 121, 173, 0.1));
}

@media (max-width: 1100px) {
  .head-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  #newOrderBtn {
    grid-column: 1 / -1;
    justify-self: start;
    width: min(220px, 100%);
  }
}

@media (max-width: 760px) {
  .head-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  #newOrderBtn {
    width: 100%;
  }
}

/* ===== TV 16:9 stage correction v10 ===== */
#tvView.active {
  display: grid;
  justify-items: center;
  align-items: start;
  overflow: hidden;
}

#tvView .tv-screen {
  width: min(100%, calc((100vh - 172px) * 16 / 9));
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: calc(100vh - 172px);
  overflow: hidden;
}

#tvView .tv-detail-carousel,
#tvView .tv-detail-track {
  min-height: 0;
  height: 100%;
}

#tvView .tv-carousel-panel {
  min-height: 0;
  max-height: 100%;
}

body.tv-launch-mode {
  background: #07141c;
}

body.tv-launch-mode .workspace {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
  background: #07141c;
}

body.tv-launch-mode #tvView.active {
  width: 100vw;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #07141c;
}

body.tv-launch-mode #tvView .tv-screen {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 16 / 9;
  min-height: 0;
  margin: auto;
  border: 0;
  border-radius: 0;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  gap: clamp(7px, 1vh, 12px);
  padding: clamp(12px, 1.35vw, 24px);
}

body.tv-launch-mode #tvView .tv-head {
  padding: clamp(12px, 1.15vw, 18px);
}

body.tv-launch-mode #tvView .tv-live-rate,
body.tv-launch-mode #tvView .tv-metrics .tv-metric-card {
  min-height: clamp(74px, 8.5vh, 104px);
}

body.tv-launch-mode #tvView .tv-strip-item {
  min-height: clamp(42px, 5.3vh, 58px);
}

body.tv-launch-mode #tvView .tv-detail-carousel {
  min-height: 0;
}

body.tv-launch-mode #tvView .tv-carousel-panel {
  min-height: 0;
}

#tvView .tv-screen:fullscreen {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  min-height: 0;
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 16 / 9;
  margin: auto;
  border-radius: 0;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
}

#tvView .tv-screen:fullscreen::backdrop {
  background: #07141c;
}

@media (max-width: 1180px) {
  #tvView .tv-screen {
    width: min(100%, calc((100vh - 132px) * 16 / 9));
    max-height: calc(100vh - 132px);
  }
}

@media (max-width: 760px) {
  #tvView .tv-screen {
    width: 100%;
    max-height: none;
    aspect-ratio: auto;
  }

  body.tv-launch-mode #tvView .tv-screen {
    width: min(100vw, calc(100vh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
    aspect-ratio: 16 / 9;
  }
}

/* ===== Orders command workspace v11 ===== */
.order-command-header {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--v2-line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(34, 121, 173, 0.08), transparent 34%),
    linear-gradient(180deg, #ffffff, #f8fbfd);
  box-shadow: 0 16px 42px rgba(20, 48, 66, 0.09);
  overflow: hidden;
}

.order-command-header::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: linear-gradient(180deg, var(--dept-color, var(--v2-blue)), var(--v2-emerald));
}

.order-back-command,
.order-command-tools button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid rgba(34, 121, 173, 0.18);
  border-radius: 13px;
  background: #ffffff;
  color: var(--v2-blue-dark);
  font-size: 0.88rem;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(20, 48, 66, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.order-back-command {
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  color: #ffffff;
}

.order-back-command:hover,
.order-command-tools button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(20, 48, 66, 0.12);
}

.order-ui-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: #eef8fe;
  color: var(--v2-blue-dark);
}

.order-back-command .order-ui-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.order-command-title {
  min-width: 0;
}

.order-command-title > span,
.order-section-head span,
.order-snapshot-card span {
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.order-command-title h2 {
  margin: 3px 0 4px;
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.85rem);
  letter-spacing: 0;
}

.order-command-title p {
  margin: 0;
  color: var(--v2-muted);
  font-weight: 800;
}

.order-command-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.order-command-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.order-command-tools .qr-box {
  width: 86px;
  border-radius: 14px;
}

.order-command-tools .qr-box img {
  width: 58px;
  height: 58px;
}

.order-snapshot-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.order-snapshot-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--v2-line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(20, 48, 66, 0.07);
}

.order-snapshot-card.primary {
  border-color: rgba(34, 121, 173, 0.2);
  background: linear-gradient(135deg, #eef8fe, #ffffff 72%);
}

.order-snapshot-card.success {
  border-color: rgba(22, 132, 95, 0.2);
  background: linear-gradient(135deg, #ecfaf4, #ffffff 72%);
}

.order-snapshot-card.warning {
  border-color: rgba(184, 117, 24, 0.22);
  background: linear-gradient(135deg, #fff7e8, #ffffff 72%);
}

.order-snapshot-card.danger {
  border-color: rgba(195, 72, 72, 0.22);
  background: linear-gradient(135deg, #fff1f1, #ffffff 72%);
}

.order-snapshot-card strong {
  display: block;
  margin-top: 3px;
  color: var(--v2-text);
  font-size: 1rem;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.order-snapshot-card small {
  display: block;
  margin-top: 3px;
  color: var(--v2-muted);
  font-weight: 800;
  line-height: 1.35;
}

.order-snapshot-card.progress i {
  position: relative;
  display: block;
  width: 100%;
  height: 7px;
  margin-top: 9px;
  border-radius: 99px;
  background: #e5f0f7;
  overflow: hidden;
}

.order-snapshot-card.progress i b {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--v2-blue), var(--v2-emerald));
}

.order-info-sections {
  display: grid;
  gap: 14px;
}

.order-info-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--v2-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(20, 48, 66, 0.06);
}

.order-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
}

.order-section-head .order-ui-icon {
  color: var(--v2-emerald);
  background: #ecfaf4;
}

.order-section-head h3 {
  margin: 0;
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0;
}

.order-info-section .detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.order-info-section .data-box {
  min-height: 74px;
  border-radius: 13px;
  background: #fbfdff;
}

.department-work-panel {
  border-radius: 18px;
  box-shadow: 0 16px 42px rgba(20, 48, 66, 0.09);
}

.work-panel-head {
  padding: 16px;
}

.work-panel-head span {
  color: var(--dept-color, var(--v2-blue-dark));
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.detail-actions .workflow-note,
.detail-actions textarea,
.detail-actions .manufacturing-checklist,
.detail-actions .product-checklist {
  grid-column: 1 / -1;
}

.detail-actions label {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--v2-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--v2-muted);
  font-size: 0.78rem;
  font-weight: 950;
}

.detail-actions input,
.detail-actions select,
.detail-actions textarea {
  width: 100%;
  border-radius: 11px;
}

.detail-actions textarea {
  min-height: 78px;
  resize: vertical;
}

.detail-actions button {
  min-height: 46px;
  justify-self: start;
  padding: 0 16px;
  border-radius: 13px;
}

.detail-actions button:not(.danger) {
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(22, 132, 95, 0.16);
}

@media (max-width: 1280px) {
  .order-snapshot-grid,
  .order-info-section .detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .order-command-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-back-command,
  .order-command-tools {
    justify-self: stretch;
  }

  .order-command-tools {
    justify-content: space-between;
  }

  .order-snapshot-grid,
  .order-info-section .detail-grid,
  .detail-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .order-command-header,
  .order-info-section {
    border-radius: 14px;
    padding: 12px;
  }

  .order-command-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .order-command-tools .qr-box {
    display: none;
  }

  .order-snapshot-grid,
  .order-info-section .detail-grid,
  .detail-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ===== Orders task cockpit v12 ===== */
body.order-detail-open .workspace-head {
  position: sticky;
  top: 0;
  z-index: 18;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 10px 16px;
  border-color: rgba(191, 216, 232, 0.8);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(20, 48, 66, 0.08);
}

body.order-detail-open .workspace-head .eyebrow {
  font-size: 0.68rem;
}

body.order-detail-open .workspace-head h1 {
  font-size: clamp(1.4rem, 2.2vw, 2rem);
}

body.order-detail-open .workspace-head .head-actions {
  display: none;
}

#ordersView.order-detail-mode.active {
  min-height: calc(100vh - 108px);
}

#ordersView.order-detail-mode .order-detail {
  padding: 0;
}

.order-task-layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.order-task-sidebar {
  position: sticky;
  top: 88px;
  z-index: 3;
  display: grid;
  gap: 12px;
}

.order-record-main {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.order-next-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(34, 121, 173, 0.2);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(36, 210, 139, 0.12), transparent 38%),
    linear-gradient(135deg, #ffffff, #eef8fe);
  box-shadow: 0 16px 38px rgba(20, 48, 66, 0.1);
  overflow: hidden;
}

.order-next-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: linear-gradient(180deg, var(--dept-color, var(--v2-blue)), var(--v2-emerald));
}

.order-next-card.quiet {
  border-color: var(--v2-line);
  background: linear-gradient(135deg, #ffffff, #f7fbfe);
}

.order-next-card > .order-ui-icon {
  width: 42px;
  height: 42px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--v2-blue), var(--v2-emerald));
  box-shadow: 0 10px 22px rgba(22, 132, 95, 0.16);
}

.order-next-card span {
  color: var(--v2-blue-dark);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.order-next-card strong {
  display: block;
  margin-top: 3px;
  color: var(--v2-text);
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.25;
}

.order-next-card p {
  margin: 6px 0 0;
  color: var(--v2-muted);
  font-size: 0.86rem;
  font-weight: 780;
  line-height: 1.45;
}

.order-next-card dl {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin: 2px 0 0;
}

.order-next-card dl div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(191, 216, 232, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.order-next-card dt,
.order-next-card dd {
  margin: 0;
}

.order-next-card dt {
  color: var(--v2-muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.order-next-card dd {
  min-width: 0;
  color: var(--v2-text);
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-task-sidebar .department-work-panel {
  margin: 0;
  border-radius: 18px;
}

.order-task-sidebar .work-panel-head {
  align-items: flex-start;
  padding: 14px;
}

.order-task-sidebar .detail-actions {
  grid-template-columns: minmax(0, 1fr);
  padding: 14px;
}

.order-task-sidebar .detail-actions label,
.order-task-sidebar .detail-actions textarea,
.order-task-sidebar .detail-actions button {
  grid-column: 1 / -1;
  width: 100%;
  justify-self: stretch;
}

.order-task-sidebar .detail-actions textarea {
  min-height: 86px;
}

.order-task-sidebar .detail-actions button {
  min-height: 50px;
  font-size: 0.9rem;
}

.order-task-sidebar .detail-actions button.danger,
.order-task-sidebar .detail-actions button[data-action="cancelOrder"],
.order-task-sidebar .detail-actions button[data-action="deleteOrder"] {
  margin-top: 6px;
}

.order-task-sidebar .order-snapshot-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.order-task-sidebar .order-snapshot-card {
  min-height: 76px;
  padding: 12px;
  border-radius: 15px;
  box-shadow: 0 8px 22px rgba(20, 48, 66, 0.06);
}

.order-task-sidebar .order-snapshot-card .order-ui-icon {
  width: 32px;
  height: 32px;
}

.order-task-sidebar .order-snapshot-card strong {
  font-size: 0.95rem;
}

.order-command-header {
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.order-command-title h2 {
  font-size: clamp(1.65rem, 2.6vw, 2.35rem);
}

.order-command-tools {
  align-self: stretch;
}

.order-command-tools button {
  align-self: center;
}

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

.order-info-section {
  padding: 14px;
}

.order-info-section:nth-child(4),
.order-info-section:nth-child(7),
.order-info-section:nth-child(10) {
  grid-column: 1 / -1;
}

.order-info-section .detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-info-section:nth-child(4) .detail-grid,
.order-info-section:nth-child(7) .detail-grid,
.order-info-section:nth-child(10) .detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.order-record-main > .data-box,
.order-record-main > .reference-preview,
.order-record-main > .file-grid,
.order-record-main > .stage-grid,
.order-record-main > .timeline-list,
.order-record-main > .kpi-panel {
  border-radius: 18px;
}

.order-remarks-box {
  min-height: 0;
}

@media (max-width: 1360px) {
  .order-task-layout {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  }

  .order-info-section:nth-child(4) .detail-grid,
  .order-info-section:nth-child(7) .detail-grid,
  .order-info-section:nth-child(10) .detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .order-task-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-task-sidebar {
    position: static;
  }

  .order-task-sidebar .order-snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-info-sections {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-info-section,
  .order-info-section:nth-child(4),
  .order-info-section:nth-child(7),
  .order-info-section:nth-child(10) {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  body.order-detail-open .workspace-head {
    padding: 10px 12px;
  }

  .order-command-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-command-tools {
    justify-content: stretch;
  }

  .order-command-tools button {
    width: 100%;
  }

  .order-command-tools .qr-box {
    display: none;
  }

  .order-task-sidebar .order-snapshot-grid,
  .order-info-section .detail-grid,
  .order-info-section:nth-child(4) .detail-grid,
  .order-info-section:nth-child(7) .detail-grid,
  .order-info-section:nth-child(10) .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ===== Workspace header correction v13 ===== */
body:not(.order-detail-open) .workspace-head {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 0.42fr) minmax(720px, 1.58fr);
  align-items: end;
  gap: 18px;
  padding: 18px 22px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(34, 121, 173, 0.035), transparent 42%),
    rgba(255, 255, 255, 0.97);
}

body:not(.order-detail-open) .workspace-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

body:not(.order-detail-open) .workspace-head .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.1;
}

body:not(.order-detail-open) .workspace-head h1 {
  margin: 0;
  max-width: 100%;
  color: var(--v2-text);
  font-size: clamp(2.35rem, 4vw, 3.35rem);
  line-height: 0.98;
  letter-spacing: 0;
}

body:not(.order-detail-open) .head-actions {
  width: 100%;
  min-width: 0;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(300px, 1fr) minmax(142px, auto);
  align-items: end;
  justify-self: stretch;
  justify-content: stretch;
  gap: 10px;
}

body:not(.order-detail-open) .head-actions .search-box,
body:not(.order-detail-open) .head-actions .sequel-header-search {
  width: 100%;
  min-width: 0;
  margin: 0;
}

body:not(.order-detail-open) .head-actions .search-box,
body:not(.order-detail-open) .sequel-header-search label {
  display: grid;
  gap: 6px;
}

body:not(.order-detail-open) .head-actions .label-with-icon {
  min-height: 16px;
  color: var(--v2-muted);
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 900;
}

body:not(.order-detail-open) .head-actions input,
body:not(.order-detail-open) .sequel-header-search button,
body:not(.order-detail-open) #newOrderBtn {
  height: 46px;
  min-height: 46px;
}

body:not(.order-detail-open) .head-actions input {
  padding: 0 14px;
  border-radius: 9px;
  font-size: 0.9rem;
}

body:not(.order-detail-open) .sequel-header-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: end;
  gap: 8px;
}

body:not(.order-detail-open) .sequel-header-search button {
  width: 58px;
  padding: 0;
  border-radius: 10px;
}

body:not(.order-detail-open) .sequel-header-search .form-message {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  margin: 0;
  min-height: 0;
  font-size: 0.72rem;
}

body:not(.order-detail-open) #newOrderBtn {
  width: 100%;
  min-width: 142px;
  align-self: end;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: 0 12px 24px rgba(22, 132, 95, 0.18);
}

body.order-detail-open .workspace-head {
  border-radius: 12px;
}

@media (max-width: 1280px) {
  body:not(.order-detail-open) .workspace-head {
    grid-template-columns: minmax(0, 1fr);
  }

  body:not(.order-detail-open) .head-actions {
    grid-template-columns: minmax(240px, 1fr) minmax(300px, 1fr) minmax(142px, auto);
  }
}

@media (max-width: 900px) {
  body:not(.order-detail-open) .head-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  body:not(.order-detail-open) #newOrderBtn {
    grid-column: 1 / -1;
    width: min(220px, 100%);
  }
}

@media (max-width: 640px) {
  body:not(.order-detail-open) .workspace-head {
    padding: 14px;
  }

  body:not(.order-detail-open) .workspace-head h1 {
    font-size: 2.1rem;
  }

  body:not(.order-detail-open) .head-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  body:not(.order-detail-open) #newOrderBtn {
    width: 100%;
  }
}

/* ===== TV fullscreen button restore v15 ===== */
.tv-screen:fullscreen .tv-head-actions button,
#tvView .tv-screen:fullscreen .tv-head-actions button,
body.tv-launch-mode #tvView .tv-head-actions button {
  display: inline-flex !important;
}

#tvView .tv-head-actions button,
#tvFullscreenBtn {
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

#tvFullscreenBtn .icon {
  width: 18px;
  height: 18px;
}

/* ===== TV fullscreen control visibility v16 ===== */
#tvView .tv-head {
  position: relative;
  padding-right: clamp(190px, 18vw, 320px);
}

#tvView .tv-head-actions {
  position: absolute;
  top: clamp(10px, 1vw, 16px);
  right: clamp(10px, 1vw, 16px);
  z-index: 90;
  display: grid !important;
  justify-items: end;
  align-content: start;
  gap: 8px;
  pointer-events: auto;
}

#tvFullscreenBtn {
  position: relative;
  z-index: 100;
  min-width: 136px;
  min-height: 40px;
  display: inline-flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  border: 1px solid rgba(125, 255, 189, 0.32) !important;
  background: linear-gradient(135deg, rgba(103, 199, 243, 0.22), rgba(36, 210, 139, 0.18)) !important;
  color: #f4fbff !important;
  box-shadow: 0 12px 28px rgba(3, 18, 26, 0.32);
}

#tvFullscreenBtn:hover {
  transform: translateY(-1px);
}

body.tv-launch-mode #tvFullscreenBtn,
#tvView .tv-screen:fullscreen #tvFullscreenBtn {
  position: fixed;
  top: 14px;
  right: 14px;
}

body.tv-launch-mode #tvView .tv-clock,
#tvView .tv-screen:fullscreen .tv-clock {
  margin-top: 50px;
}

@media (max-width: 760px) {
  #tvView .tv-head {
    padding-right: 0;
    padding-top: 54px;
  }

  #tvView .tv-head-actions {
    left: 12px;
    right: auto;
    justify-items: start;
  }

  #tvFullscreenBtn {
    min-width: 128px;
  }
}

/* ===== TV keyboard fullscreen v17 ===== */
#tvFullscreenBtn {
  display: none !important;
}

body.tv-launch-mode #tvView .tv-clock,
#tvView .tv-screen:fullscreen .tv-clock {
  margin-top: 0;
}

@media (max-width: 760px) {
  #tvView .tv-head {
    padding-top: 14px;
  }
}

@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  #notificationBtn,
  .side-nav button[data-view="notifications"],
  .required-notification-setup,
  .notification-toast-stack {
    display: none !important;
  }
}
