:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --line: #dde3ea;
  --text: #16202a;
  --muted: #687585;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --good: #15803d;
  --shadow: 0 12px 30px rgba(21, 31, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  letter-spacing: 0;
}

.topbar p,
.content-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: #aab5c2;
}

.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.status {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

main {
  padding: 24px 28px;
}

[hidden] {
  display: none !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 19px;
}

.workspace {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.nav {
  padding: 8px;
  position: sticky;
  top: 16px;
}

.tab {
  display: block;
  width: 100%;
  text-align: left;
  border-color: transparent;
  background: transparent;
  margin-bottom: 4px;
}

.tab.active {
  background: #e8f4f2;
  border-color: #b8d9d5;
  color: var(--accent-dark);
  font-weight: 700;
}

.content {
  min-height: 580px;
  overflow: hidden;
}

.content-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.content-head input {
  min-width: 260px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
}

.view-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

#view {
  padding: 18px;
}

body[data-view="omnichat"] #view {
  padding: 0;
}

.omnichat-embed-shell {
  min-height: calc(100vh - 150px);
  background: #f3f6fb;
}

.omnichat-embed-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 150px);
  border: 0;
  background: #f3f6fb;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f0f3f7;
  color: #3b4856;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.number {
  text-align: right;
  white-space: nowrap;
}

.product-table table {
  min-width: 1080px;
}

.product-table th {
  background: #eaf4ff;
  color: #172033;
}

.check-col {
  width: 38px;
  text-align: center;
}

.image-col {
  width: 52px;
}

.image-col img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.thumb-zoom {
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.thumb-empty {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: #eef2f7;
  border: 1px solid var(--line);
}

.totals-row th {
  background: #f8fbff;
  font-size: 14px;
  text-transform: none;
}

.product-row {
  cursor: pointer;
}

.product-row:hover td {
  background: #f8fbff;
}

.product-row.selected td {
  background: #eef6ff;
  border-top: 1px solid #1a73e8;
}

.product-name {
  min-width: 220px;
  max-width: 360px;
  line-height: 1.35;
}

.product-detail-row td {
  padding: 0;
  border: 1px solid #1a73e8;
  border-top: 0;
  background: #ffffff;
}

.detail-tabs {
  display: flex;
  gap: 28px;
  height: 36px;
  align-items: flex-end;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.detail-tabs button {
  display: inline-flex;
  align-items: center;
  height: 36px;
  font-size: 13px;
  color: #253244;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
}

.detail-tabs .active {
  color: #0b63f6;
  border-bottom: 2px solid #0b63f6;
}

.product-detail {
  padding: 14px 20px 18px;
}

.detail-main {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.detail-image {
  width: 92px;
  height: 92px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f3f6fa;
}

.detail-image-zoom {
  position: relative;
  width: 92px;
  min-height: 92px;
  padding: 0;
  border: 0;
  background: transparent;
}

.detail-image-zoom span {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(16, 24, 40, 0.72);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 120ms ease;
}

.detail-image-zoom:hover span {
  opacity: 1;
}

.detail-image.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.detail-main h3 {
  font-size: 18px;
  line-height: 1.3;
  margin: 2px 0 12px;
}

.detail-main p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag-list span {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 12px;
}

.analysis-link {
  color: #0b63f6;
  font-size: 13px;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 0 22px;
  margin-bottom: 18px;
}

.detail-field {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}

.detail-field span {
  display: block;
  color: #475569;
  font-size: 12px;
  margin-bottom: 7px;
}

.detail-field strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.employee-table table {
  min-width: 1120px;
}

.employee-list-tools {
  position: relative;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 10px;
}

.employee-list-tools button {
  min-height: 34px;
  padding: 0 12px;
  border-color: #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
}

.employee-column-menu {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px 18px;
  min-width: 390px;
  padding: 12px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.employee-column-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.employee-row td {
  height: 40px;
}

.employee-avatar {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #2f80ed 0 4px, transparent 5px),
    radial-gradient(ellipse at 50% 75%, #2f80ed 0 9px, transparent 10px),
    #dbeafe;
  vertical-align: middle;
}

.employee-avatar.large {
  width: 72px;
  height: 72px;
  background:
    radial-gradient(circle at 50% 34%, #60a5fa 0 9px, transparent 10px),
    radial-gradient(ellipse at 50% 74%, #2f80ed 0 20px, transparent 21px),
    #dbeafe;
}

.employee-warning {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid #fb923c;
  border-radius: 50%;
  color: #f97316;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.employee-detail-row .product-detail {
  padding-bottom: 16px;
}

.employee-detail-card .detail-main {
  grid-template-columns: 72px 1fr;
  align-items: center;
}

.employee-info-grid {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

.empty.compact strong,
.empty.compact span {
  display: block;
}

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

.edit-field select,
.edit-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.edit-field select {
  min-height: 36px;
  background: #fff;
}

.edit-field textarea {
  min-height: 76px;
  resize: vertical;
}

.employee-editor-modal {
  width: min(1040px, calc(100vw - 28px));
  background: #f3f4f6;
}

.employee-editor-modal .modal-head,
.employee-editor-modal .modal-foot,
.employee-editor-tabs {
  background: #fff;
}

.employee-editor-tabs {
  display: flex;
  gap: 28px;
  padding: 0 22px;
  border-bottom: 1px solid #d9e2ef;
}

.employee-editor-tabs button {
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #475569;
}

.employee-editor-tabs button.active {
  color: #0b63f6;
  border-bottom: 2px solid #0b63f6;
}

.employee-editor-body {
  display: grid;
  gap: 14px;
  padding: 16px 22px;
}

.employee-edit-section {
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.employee-edit-section-head {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 18px;
  border: 0;
  background: #fff;
  color: #2f3744;
  text-align: left;
}

.employee-edit-section-head h4 {
  font-size: 15px;
}

.employee-start-grid {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 24px;
  padding: 0 18px 18px;
}

.employee-main-fields {
  display: grid;
  gap: 12px;
}

.employee-photo-uploader {
  align-self: center;
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
  border: 1px dashed #cbd5e1;
  border-radius: 50%;
  background: #f1f3f6;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

.employee-photo-uploader button {
  min-height: 36px;
  padding: 0 18px;
  background: #fff;
  color: #2f3744;
}

.employee-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px 20px;
  padding: 0 18px 18px;
}

.employee-section-grid.personal {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.employee-section-grid .edit-field:nth-child(4),
.employee-section-grid .edit-field:nth-child(5),
.employee-section-grid.personal .edit-field:nth-child(4) {
  grid-column: 1 / -1;
}

.employee-salary-row {
  display: grid;
  grid-template-columns: 120px minmax(260px, 1fr);
  gap: 18px;
  align-items: end;
  padding: 0 18px 18px;
  max-width: 520px;
}

.employee-edit-section.slim {
  padding-top: 18px;
}

.employee-toggle-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 0 18px;
}

.employee-toggle-section h4 {
  margin-bottom: 6px;
  font-size: 15px;
}

.employee-toggle-section p {
  color: #64748b;
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #a8b2c0;
}

.switch span::after {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 2px;
  border-radius: 50%;
  background: #fff;
  transition: transform 120ms ease;
}

.switch input:checked + span {
  background: #0b63f6;
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.gender-field > div {
  display: flex;
  gap: 18px;
  min-height: 36px;
  align-items: center;
}

.supplier-box,
.description-box,
.inventory-detail {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
  background: #fbfcfe;
}

.supplier-box strong,
.description-box strong,
.inventory-detail strong {
  display: block;
  font-size: 13px;
  margin-bottom: 9px;
}

.supplier-box span,
.description-box span {
  display: block;
  color: #1f2937;
  font-size: 13px;
  white-space: pre-wrap;
}

.description-box.tall {
  min-height: 60px;
}

.inventory-detail table {
  min-width: 0;
}

.inventory-detail th,
.inventory-detail td {
  padding: 8px 10px;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.channel-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
  background: #fbfcfe;
}

.channel-box strong {
  display: block;
  margin-bottom: 10px;
}

.channel-box table {
  min-width: 0;
  margin-bottom: 12px;
}

.compact {
  padding: 22px 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.54);
}

.modal {
  width: min(980px, 100%);
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.small-modal {
  width: min(460px, 100%);
}

.receipt-modal {
  width: min(1040px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  font-size: 18px;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.modal-tabs {
  display: flex;
  gap: 18px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.modal-tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 40px;
  padding: 0;
}

.modal-tabs .active {
  color: #0b63f6;
  border-bottom: 2px solid #0b63f6;
}

.modal-body {
  padding: 16px 20px;
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 18px;
}

.edit-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.edit-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.edit-field span,
.rich-field {
  color: #334155;
  font-size: 12px;
}

.edit-field input,
.rich-field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  min-height: 34px;
  padding: 7px 9px;
}

.rich-field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 700;
}

.rich-field textarea {
  min-height: 140px;
  resize: vertical;
  font-weight: 400;
}

.edit-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

.edit-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.edit-images {
  display: grid;
  align-content: start;
  gap: 10px;
}

.edit-image-main {
  display: grid;
  place-items: center;
  width: 190px;
  min-height: 150px;
  border: 1px dashed #b8c4d4;
  border-radius: 8px;
  background: #f8fafc;
  color: #667085;
}

.edit-image-main img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
}

.edit-image-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 42px);
  gap: 6px;
}

.edit-image-thumbs button {
  width: 42px;
  height: 42px;
  padding: 2px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
}

.edit-image-thumbs button.active {
  border-color: #f15a24;
  box-shadow: 0 0 0 2px rgba(241, 90, 36, 0.14);
}

.edit-image-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.edit-image-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  width: 190px;
}

.edit-image-tools input {
  grid-column: 1 / -1;
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
}

.edit-image-tools button {
  min-height: 32px;
  padding: 0 8px;
}

.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.receipt-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  padding: 14px 20px;
  font-size: 13px;
}

.receipt-meta strong {
  color: var(--good);
}

.receipt-total {
  display: grid;
  justify-content: end;
  gap: 8px;
  padding: 16px 20px;
  font-size: 14px;
}

.inline-table-tools {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 8px;
}

.purchase-price-modal {
  width: min(1080px, calc(100vw - 28px));
}

.purchase-price-modal .inventory-detail input,
.purchase-doc-modal .inventory-detail input {
  width: 130px;
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 8px;
  text-align: right;
}

.purchase-detail .detail-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.link-button {
  border: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: #0b63f6;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef2f7;
}

.badge.good {
  color: var(--good);
  background: #e8f7ed;
}

.badge.warn {
  color: var(--warn);
  background: #fff4df;
}

.badge.danger {
  color: var(--danger);
  background: #feecec;
}

.grid-two {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
}

.form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.form h3 {
  font-size: 17px;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 8px 10px;
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
}

.quick-links button,
.check-inline {
  color: #0b63f6;
  background: transparent;
  border: 0;
  padding: 0;
  min-height: 0;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.linked-row {
  align-items: end;
  margin-bottom: 8px;
}

.label-modal {
  width: min(980px, 100%);
}

.label-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 18px;
  padding: 20px;
}

.label-options {
  display: grid;
  align-content: start;
  gap: 10px;
}

.label-options select,
.purchase-side select,
.purchase-side input,
.purchase-side textarea,
.purchase-search input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  min-height: 34px;
  padding: 7px 9px;
}

.label-templates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}

.label-template {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
}

.label-paper {
  width: 92px;
  height: 78px;
  border: 1px solid #94a3b8;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.08) 1px, transparent 1px),
    #ffffff;
  background-size: 18px 18px;
}

.print-preview-modal {
  width: min(440px, 100%);
}

.receipt-print-modal {
  width: min(760px, 100%);
}

.print-template-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.print-template-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475467;
  font-size: 13px;
}

.print-template-bar select {
  min-width: 180px;
}

.receipt-print-stage {
  display: grid;
  place-items: start center;
  max-height: min(72vh, 680px);
  overflow: auto;
  padding: 18px;
  background: #e5e7eb;
}

.receipt-print-sheet {
  width: 80mm;
  min-height: 120mm;
  padding: 8mm 6mm;
  background: #ffffff;
  color: #111827;
  border: 1px solid #cbd5e1;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.18);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  line-height: 1.35;
}

.receipt-print-sheet.sp46 {
  width: 46mm;
  min-height: 90mm;
  padding: 4mm 3mm;
  font-size: 9px;
}

.receipt-print-sheet.a5 {
  width: 148mm;
  min-height: 210mm;
  padding: 12mm;
  font-size: 12px;
}

.receipt-print-sheet header,
.receipt-print-sheet footer {
  display: grid;
  gap: 2px;
  text-align: center;
}

.receipt-print-sheet header strong {
  font-size: 1.25em;
}

.receipt-print-meta,
.receipt-print-total {
  display: grid;
  gap: 3px;
  padding: 7px 0;
  border-top: 1px dashed #6b7280;
  border-bottom: 1px dashed #6b7280;
  margin: 7px 0;
}

.receipt-print-sheet table {
  width: 100%;
  border-collapse: collapse;
}

.receipt-print-sheet th,
.receipt-print-sheet td {
  padding: 4px 2px;
  vertical-align: top;
  border-bottom: 1px dotted #d1d5db;
}

.receipt-print-sheet th {
  text-align: left;
}

.receipt-print-sheet th:nth-child(2),
.receipt-print-sheet th:nth-child(3),
.receipt-print-sheet td:nth-child(2),
.receipt-print-sheet td:nth-child(3) {
  text-align: right;
}

.receipt-print-sheet td span,
.receipt-print-sheet td small {
  display: block;
}

.receipt-print-sheet.sp46 th:first-child,
.receipt-print-sheet.sp46 td:first-child {
  width: 52%;
}

.receipt-print-total strong {
  display: block;
  padding-top: 4px;
  font-size: 1.12em;
}

.receipt-print-note {
  margin: 8px 0;
}

.zoom-modal {
  width: min(1120px, 100%);
}

.zoom-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.zoom-stage {
  min-height: min(68vh, 680px);
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background:
    linear-gradient(45deg, #eef2f6 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f6 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f6 75%),
    #ffffff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.zoom-stage img {
  max-width: min(100%, 980px);
  max-height: 64vh;
  object-fit: contain;
  transform-origin: center;
  transition: transform 140ms ease;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.2);
}

.zoom-thumbs {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.zoom-thumbs button {
  width: 72px;
  height: 58px;
  min-height: 58px;
  padding: 3px;
  border-color: #d0d5dd;
}

.zoom-thumbs button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.zoom-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.print-toolbar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: #8794a3;
}

.label-preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  background: #e5e7eb;
}

.price-label {
  width: 210px;
  min-height: 96px;
  padding: 10px;
  background: white;
  border: 1px solid #cbd5e1;
  text-align: center;
}

.barcode {
  margin: 8px auto;
  padding: 10px 4px 3px;
  color: #111827;
  background: repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 5px, #fff 5px 8px);
  font-size: 9px;
}

.purchase-entry-modal {
  width: min(1240px, 100%);
  max-height: 96vh;
  overflow: hidden;
}

.purchase-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 720px;
  background: #f8fafc;
}

.purchase-layout > section {
  padding: 14px 20px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.purchase-search {
  display: grid;
  grid-template-columns: 34px auto minmax(280px, 420px) 72px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.purchase-search strong {
  font-size: 20px;
}

.purchase-search-box,
.supplier-picker {
  position: relative;
}

.purchase-entry-modal table {
  min-width: 900px;
}

.purchase-entry-modal input[type="number"] {
  width: 92px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 7px;
  text-align: right;
}

.purchase-side {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  background: #fbfcfe;
  border-left: 1px solid #eef2f7;
}

.purchase-side-top,
.supplier-picker {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.purchase-side label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #334155;
}

.purchase-side strong {
  display: flex;
  justify-content: space-between;
}

.purchase-side textarea {
  min-height: 72px;
  resize: vertical;
}

.purchase-table-wrap {
  position: relative;
  min-height: 620px;
  overflow: auto;
  border: 1px solid #dce5f0;
  background: #fff;
}

.purchase-empty {
  position: absolute;
  inset: 42px 0 0;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  background: #fff;
}

.purchase-empty.hidden,
.purchase-suggest.hidden {
  display: none;
}

.purchase-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: min(460px, 92vw);
  max-height: 420px;
  overflow: hidden;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

.supplier-picker .purchase-suggest {
  right: 0;
  left: auto;
  width: 100%;
  max-height: 236px;
  overflow-y: auto;
}

.suggest-list {
  max-height: 340px;
  overflow-y: auto;
}

.purchase-suggest .suggest-list > button {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  color: #101828;
  text-align: left;
}

.supplier-picker .purchase-suggest > button {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  color: #101828;
  text-align: left;
}

.purchase-suggest .suggest-list > button:hover,
.purchase-suggest .suggest-list > button.active,
.supplier-picker .purchase-suggest > button:hover {
  background: #fff3eb;
}

.purchase-suggest img,
.suggest-thumb-empty,
.line-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef2f7;
  vertical-align: middle;
}

.suggest-thumb-empty {
  display: inline-block;
}

.line-thumb {
  width: 30px;
  height: 30px;
  margin-right: 8px;
}

.purchase-suggest strong,
.purchase-suggest small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchase-suggest small {
  margin-top: 3px;
  color: #475467;
  font-size: 12px;
}

.suggest-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
}

.suggest-foot button,
.purchase-side-actions .primary,
.purchase-empty .primary {
  background: #f15a24;
  color: #fff;
}

.purchase-side-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 14px;
  margin-top: auto;
  background: #fbfcfe;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
}

.info-row.payable strong {
  color: #006df0;
}

.warehouse-picker-modal .info-row {
  justify-content: flex-start;
  margin: 12px 0;
}

.stock-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stock-mode-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stock-mode-tabs button {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
}

.stock-mode-tabs button.active {
  background: var(--surface);
  border-color: #b8d9d5;
  color: var(--accent-dark);
  font-weight: 700;
}

.stock-doc-table table {
  min-width: 1040px;
}

.profile-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.profile-toolbar select {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
}

.profile-metrics {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.profile-sections {
  display: grid;
  gap: 18px;
}

.profile-sections h3 {
  margin: 6px 0 10px;
  font-size: 16px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.profile-section-head h3 {
  margin: 0;
}

.profile-section-head span,
.profile-section-pager span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.profile-section-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 0;
}

.history-panel {
  display: grid;
  gap: 14px;
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(120px, 160px) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.history-toolbar label {
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.history-toolbar select,
.history-toolbar input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

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

.history-summary article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.history-summary span,
.history-table small {
  display: block;
  color: #667085;
  font-size: 12px;
}

.history-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
}

.history-table table {
  min-width: 980px;
}

.history-table td {
  vertical-align: top;
}

.history-progress {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.history-progress > strong {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.kiot-history-panel .history-toolbar {
  grid-template-columns: minmax(100px, 140px) minmax(240px, 1fr) minmax(130px, 160px) auto;
}

.profile-section-pager div {
  display: inline-flex;
  gap: 6px;
}

.profile-section-pager button {
  width: 32px;
  min-height: 30px;
  padding: 0;
  border-radius: 7px;
  font-weight: 900;
}

.profile-section-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
}

.admin-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.admin-list button {
  text-align: left;
}

.admin-list .active {
  border-color: #0b63f6;
  background: #eef6ff;
  color: #0b63f6;
  font-weight: 700;
}

.settings-page {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr) 180px;
  gap: 14px;
  align-items: start;
}

.settings-nav,
.settings-card,
.settings-help {
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #ffffff;
}

.settings-nav {
  display: grid;
  gap: 12px;
  padding: 10px;
}

.settings-nav-group {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f6;
}

.settings-nav-group:last-child {
  border-bottom: 0;
}

.settings-nav-group > span {
  padding: 8px 8px 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.settings-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  justify-content: flex-start;
  background: transparent;
}

.settings-nav button.active,
.settings-nav button:hover {
  background: #eaf3ff;
  color: #0b63f6;
}

.settings-nav i {
  width: 22px;
  text-align: center;
  font-style: normal;
}

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

.settings-toolbar,
.settings-card-head,
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-toolbar input {
  min-width: min(360px, 100%);
}

.settings-card {
  padding: 14px;
}

.settings-card-head {
  margin-bottom: 12px;
}

.settings-card-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.settings-actions {
  margin: 10px 0;
  justify-content: flex-end;
}

.settings-help {
  padding: 16px;
  display: grid;
  gap: 10px;
  color: #475467;
}

.settings-help strong {
  color: #0b63f6;
}

.settings-help p {
  font-size: 13px;
  line-height: 1.45;
}

.role-pill,
.permission-banner {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.role-pill.admin {
  background: #dcfce7;
  color: #166534;
}

.role-pill.locked,
.permission-banner {
  background: #fff7ed;
  color: #c2410c;
}

.permission-banner {
  border-radius: 8px;
}

.compact-admin-layout {
  grid-template-columns: 190px minmax(0, 1fr);
  box-shadow: none;
}

.admin-overview {
  display: grid;
  gap: 18px;
}

.admin-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.admin-module-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.admin-module-card:hover {
  border-color: rgba(236, 91, 38, 0.35);
  box-shadow: 0 14px 30px rgba(236, 91, 38, 0.12);
  transform: translateY(-1px);
}

.admin-module-card strong {
  font-size: 14px;
}

.admin-module-card span {
  color: var(--accent);
  font-weight: 800;
}

.admin-module-card small {
  color: var(--muted);
}

.overview-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  background: #f3f6fb;
  margin: 0;
  padding: 16px;
  min-height: 680px;
}

body[data-view="overview"] main {
  padding: 16px;
}

body[data-view="overview"] .content {
  border: 0;
  background: #f3f6fb;
  box-shadow: none;
  overflow: visible;
}

body[data-view="overview"] .content-head {
  display: none;
}

.overview-main {
  display: grid;
  gap: 14px;
}

.overview-card {
  background: #fff;
  border: 1px solid #e8edf4;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  padding: 18px;
}

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

.overview-card-head h3 {
  margin: 0;
  font-size: 15px;
}

.overview-card-head h3 small {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.overview-card-head h3 span {
  margin-left: 8px;
  color: #0675ff;
  background: #eef6ff;
  border-radius: 6px;
  padding: 4px 8px;
}

.overview-card-head select,
.overview-card-head button {
  min-height: 30px;
}

.today-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.today-stat {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 0 18px;
  border-right: 1px solid #e5eaf1;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.today-stat:last-child {
  border-right: 0;
}

.today-stat:hover,
.overview-hbar:hover,
.overview-activity:hover,
.alerts-card p:hover {
  background: #f8fbff;
}

.today-stat i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  background: #0b7cff;
  font-style: normal;
  font-weight: 800;
}

.today-stat i.return {
  background: #fb7a22;
}

.today-stat i.down {
  color: #ef1f1f;
  background: transparent;
  font-size: 28px;
}

.today-stat i.trend-up,
.today-stat i.trend-down {
  background: transparent;
  font-size: 28px;
}

.today-stat i.trend-up {
  color: #16a34a;
}

.today-stat i.trend-down {
  color: #ef1f1f;
}

.today-stat span,
.today-stat small {
  display: block;
  color: #657186;
  font-size: 12px;
}

.today-stat strong {
  display: block;
  margin: 4px 0 2px;
  font-size: 18px;
  color: #111827;
}

.overview-tabs {
  display: flex;
  gap: 20px;
  margin: 4px 0 22px;
}

.overview-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #4d5b70;
  padding: 8px 0;
}

.overview-tabs button.active {
  border-color: #0675ff;
  color: #0675ff;
}

.overview-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
  gap: 10px;
  height: 310px;
  padding: 10px 8px 0;
  border-top: 1px solid #eef2f7;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 49px, #edf1f6 50px);
}

.overview-bar {
  display: grid;
  grid-template-rows: 1fr 20px;
  align-items: end;
  justify-items: center;
  color: #58657a;
  font-size: 11px;
}

.overview-bar span {
  width: 22px;
  background: #0877f2;
  border-radius: 2px 2px 0 0;
}

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

.overview-hbars {
  display: grid;
  gap: 10px;
}

.overview-hbar {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 2px 0;
}

.overview-hbar div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #42526a;
}

.overview-hbar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-hbar strong {
  flex: 0 0 auto;
  font-size: 11px;
  color: #42526a;
}

.overview-hbar i {
  display: block;
  height: 18px;
  background: linear-gradient(90deg, #edf3fb, #f9fbfd);
  border-left: 1px solid #d7dee9;
}

.overview-hbar b {
  display: block;
  height: 100%;
  background: #0877f2;
}

.overview-aside {
  display: grid;
  gap: 14px;
  align-content: start;
}

.mini-actions {
  padding: 0;
  overflow: hidden;
}

.mini-actions button {
  display: grid;
  grid-template-columns: 30px 1fr 16px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid #e8edf4;
  border-radius: 0;
  background: #fff;
  text-align: left;
}

.mini-actions button:last-child {
  border-bottom: 0;
}

.mini-actions button::after {
  content: "›";
  color: #718096;
  font-size: 22px;
}

.mini-actions span {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eef6ff;
  color: #0b63f6;
  font-size: 11px;
  font-weight: 900;
}

.mini-actions small,
.alerts-card p,
.overview-activity small {
  color: #667085;
}

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

.alerts-card p {
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8edf4;
  line-height: 1.4;
  cursor: pointer;
  border-radius: 8px;
}

.alerts-card p:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.activity-feed {
  display: grid;
  gap: 14px;
  max-height: 560px;
  overflow: auto;
}

.activity-feed h3 {
  margin: 0;
  font-size: 15px;
}

.overview-activity {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  position: relative;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}

.overview-activity i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f0f3f8;
  color: #64748b;
  font-style: normal;
}

.overview-activity p {
  margin: 0;
  line-height: 1.35;
  font-size: 13px;
}

.overview-activity strong {
  color: #006fff;
}

.overview-activity small {
  display: block;
  margin-top: 4px;
}

@media (max-width: 1180px) {
  .overview-dashboard,
  .overview-grid-2 {
    grid-template-columns: 1fr;
  }

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

  .today-stat:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .today-stats {
    grid-template-columns: 1fr;
  }

  .today-stat {
    border-right: 0;
    border-bottom: 1px solid #e5eaf1;
    padding: 10px 0;
  }

  .today-stat:last-child {
    border-bottom: 0;
  }

  .overview-chart {
    gap: 6px;
  }
}

.user-modal {
  width: min(820px, 100%);
}

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

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

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

.user-form-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
}

.user-form-section p {
  color: var(--muted);
  font-size: 13px;
}

.permission-line {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.row-actions {
  white-space: nowrap;
}

.row-actions button {
  min-width: 44px;
  margin: 2px;
  padding: 5px 8px;
}

.permission-matrix {
  display: grid;
  gap: 10px;
}

.permission-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
}

.permission-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.access-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.user-form-section textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
}

.profile-form {
  max-width: 760px;
}

.profile-detail-modal {
  width: min(1180px, 100%);
}

.invoice-table table {
  min-width: 1120px;
}

.purchase-table table {
  min-width: 1060px;
}

.invoice-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.invoice-head h3 {
  margin-bottom: 10px;
}

.invoice-head p,
.branch-note {
  color: var(--muted);
  font-size: 13px;
}

.branch-note {
  text-align: right;
}

.invoice-bottom {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  align-items: start;
}

.purchase-detail .receipt-total {
  min-width: 280px;
}

.purchase-debt-tools {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.purchase-doc-modal {
  width: min(1180px, 100%);
}

.purchase-doc-head,
.purchase-doc-meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
}

.purchase-doc-head {
  border-bottom: 1px solid var(--line);
}

.purchase-doc-meta {
  color: var(--muted);
  font-size: 13px;
}

.include-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.activity-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

.activity-fab {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 94;
  width: 56px;
  min-height: 56px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, #f97316, var(--fugalo));
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(237, 100, 38, 0.34);
  font-size: 23px;
  pointer-events: auto;
  animation: gear-spin 3.6s linear infinite;
}

.activity-fab:hover {
  transform: translateY(-2px);
  background: linear-gradient(145deg, #fb923c, var(--fugalo-dark));
  color: #ffffff;
  box-shadow: 0 20px 38px rgba(237, 100, 38, 0.42);
  border-color: transparent;
}

.activity-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
  opacity: 1;
  transition: opacity 180ms ease;
  pointer-events: auto;
  visibility: visible;
}

.activity-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(520px, calc(100vw - 56px));
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 18px;
  padding: 28px 30px;
  background: #ffffff;
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.24);
  transform: translateX(0);
  transition: transform 220ms ease;
  pointer-events: auto;
  overflow: auto;
}

.activity-panel.collapsed .activity-backdrop {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.activity-panel.collapsed .activity-drawer {
  transform: translateX(104%);
}

.activity-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.activity-drawer-head h3 {
  font-size: 18px;
}

.activity-drawer-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

#activityClose {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 24px;
}

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

.activity-stats article {
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
}

.activity-stats span,
.activity-section-title {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.activity-stats strong {
  display: block;
  margin-top: 7px;
  color: #101828;
  font-size: 16px;
}

.activity-chart {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  background: #ffffff;
}

.activity-bar {
  display: grid;
  gap: 6px;
}

.activity-bar div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.activity-bar i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2ff;
}

.activity-bar b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2448f4, var(--fugalo));
}

.activity-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.activity-item {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 12px;
}

.activity-item:last-child {
  border-bottom: 1px solid #edf2f7;
}

.activity-item time {
  color: var(--muted);
}

.activity-item.sync span {
  color: #0b63f6;
}

.activity-item.success span {
  color: var(--good);
}

.activity-item.error span {
  color: var(--danger);
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  align-items: start;
  padding: 12px 12px 12px 14px;
  border: 1px solid #dbe3ef;
  border-left-width: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.leaving {
  opacity: 0;
  transform: translateY(8px);
}

.toast strong {
  font-size: 12px;
  line-height: 1.2;
}

.toast span {
  grid-column: 1 / -1;
  font-size: 13px;
  line-height: 1.35;
  color: #334155;
}

.toast button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 999px;
  color: #64748b;
  background: #f8fafc;
}

.toast-success {
  border-left-color: #16a34a;
}

.toast-error {
  border-left-color: #dc2626;
}

.toast-info {
  border-left-color: #2563eb;
}

@keyframes gear-spin {
  from {
    rotate: 0deg;
  }
  to {
    rotate: 360deg;
  }
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-two,
  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
}

@media (max-width: 720px) {
  .topbar,
  .content-head,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  main {
    padding: 16px;
  }

  .metrics,
  .nav {
    grid-template-columns: 1fr;
  }

  .content-head input {
    min-width: 0;
    width: 100%;
  }

  .view-tools {
    justify-content: stretch;
  }

  .view-tools button,
  .view-tools input {
    width: 100%;
  }

  .detail-main,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .edit-grid,
  .edit-row,
  .receipt-meta,
  .label-layout,
  .label-templates,
  .purchase-layout,
  .admin-layout,
  .include-grid,
  .invoice-bottom {
    grid-template-columns: 1fr;
  }

  .detail-tabs {
    gap: 14px;
    overflow-x: auto;
    align-items: center;
  }
}

/* SaaS App UI Kit refresh */
:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #f1f5f9;
  --line: #d8e0ea;
  --line-strong: #b9c5d3;
  --text: #101828;
  --muted: #667085;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --teal: #0f766e;
  --warn: #b54708;
  --danger: #b42318;
  --good: #067647;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-strong: 0 18px 44px rgba(16, 24, 40, 0.14);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 64px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #102a43;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.16);
}

h1 {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 750;
}

.topbar p,
.content-head p {
  color: var(--muted);
  font-size: 12px;
}

.actions {
  gap: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: min(480px, 42vw);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #344054;
  overflow: hidden;
  text-overflow: ellipsis;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: #1d2939;
  font-weight: 600;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

button:hover {
  background: #f8fafc;
  border-color: #98a2b3;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 1px;
  border-color: var(--accent);
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.22);
}

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

main {
  padding: 18px 22px 28px;
}

.metrics {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  margin-top: 9px;
  font-size: 20px;
  line-height: 1.1;
}

.workspace {
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.nav {
  top: 82px;
  padding: 12px;
  background: #ffffff;
}

.nav-section {
  margin: 12px 8px 6px;
  color: #7a8699;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-section:first-child {
  margin-top: 2px;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0 0 3px;
  padding: 8px 10px 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #344054;
  font-weight: 650;
}

.tab::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #c6d0dd;
}

.tab.active {
  background: var(--accent-soft);
  border-color: #bfdbfe;
  color: #1849a9;
}

.tab.active::before {
  background: var(--accent);
}

.content {
  min-height: calc(100vh - 168px);
  background: #ffffff;
}

.content-head {
  align-items: flex-start;
  padding: 14px 16px;
  background: #ffffff;
}

.content-head h2 {
  font-size: 20px;
  line-height: 1.15;
  font-weight: 760;
}

.view-tools {
  gap: 7px;
}

.content-head input,
.field input,
.field select,
.field textarea,
.edit-field input,
.rich-field textarea,
.label-options select,
.purchase-side select,
.purchase-side input,
.purchase-side textarea,
.purchase-search input,
.profile-toolbar select {
  border-color: #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #101828;
}

.content-head input {
  min-width: 320px;
  min-height: 36px;
  padding-left: 12px;
}

#view {
  padding: 16px;
}

.table-wrap {
  border-color: var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

table {
  min-width: 900px;
}

th,
td {
  padding: 9px 12px;
  border-bottom-color: #e7ecf3;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475467;
  font-size: 11px;
  font-weight: 800;
}

tbody tr:nth-child(even):not(.product-detail-row) td {
  background: #fcfdff;
}

.totals-row th {
  background: #eef4ff;
  color: #1d2939;
  font-weight: 750;
}

.product-table th {
  background: #f1f5f9;
  color: #344054;
}

.product-row:hover td {
  background: #f3f8ff;
}

.product-row.selected td {
  background: #edf5ff;
  border-top: 1px solid var(--accent);
}

.product-detail-row td {
  border-color: var(--accent);
  background: #ffffff;
}

.image-col img,
.thumb-empty {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.detail-tabs {
  height: 42px;
  gap: 20px;
  padding: 0 16px;
  background: #fbfdff;
}

.detail-tabs button,
.modal-tabs button {
  height: 42px;
  color: #475467;
  font-weight: 700;
}

.detail-tabs .active,
.modal-tabs .active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.product-detail {
  padding: 16px;
}

.detail-main {
  grid-template-columns: 96px 1fr;
}

.detail-image {
  width: 96px;
  height: 96px;
  border-radius: 8px;
}

.detail-main h3 {
  font-size: 18px;
  color: #101828;
}

.tag-list span,
.badge {
  border-radius: 999px;
  font-weight: 700;
}

.tag-list span {
  background: #f8fafc;
  border-color: #e4e7ec;
  color: #344054;
}

.analysis-link,
.link-button {
  color: var(--accent);
  font-weight: 650;
}

.detail-field span,
.edit-field span,
.rich-field,
.field label,
.purchase-side label {
  color: #667085;
  font-weight: 700;
}

.detail-field strong {
  color: #101828;
  font-weight: 600;
}

.supplier-box,
.description-box,
.inventory-detail,
.channel-box,
.form,
.edit-section {
  border-color: #e4e7ec;
  border-radius: 8px;
  background: #fcfcfd;
}

.detail-actions,
.modal-foot {
  border-top-color: #e4e7ec;
}

.modal-backdrop {
  background: rgba(16, 24, 40, 0.58);
}

.modal {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #ffffff;
}

.modal-head h3 {
  color: #101828;
  font-size: 18px;
  font-weight: 760;
}

.icon-button {
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #667085;
}

.icon-button:hover {
  background: #f2f4f7;
  color: #101828;
}

.modal-foot {
  position: sticky;
  bottom: 0;
  background: #f8fafc;
}

.badge.good {
  color: #067647;
  background: #ecfdf3;
}

.badge.warn {
  color: #b54708;
  background: #fffaeb;
}

.badge.danger {
  color: #b42318;
  background: #fef3f2;
}

.empty {
  background: #fcfcfd;
  border-color: #d0d5dd;
  color: #667085;
}

.purchase-layout {
  background: #ffffff;
}

.purchase-side {
  background: #f8fafc;
}

.stock-toolbar,
.profile-toolbar {
  padding: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #f8fafc;
}

.admin-list button.active,
.admin-list .active {
  border-color: #bfdbfe;
  background: var(--accent-soft);
  color: #1849a9;
}

.activity-item {
  border-bottom-color: #eef2f6;
}

@media (max-width: 1100px) {
  .nav {
    top: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-section {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    padding: 12px 14px;
  }

  .brand {
    min-width: 0;
  }

  .status {
    max-width: 100%;
  }

  main {
    padding: 12px;
  }

  .content-head {
    gap: 12px;
  }

  .content-head input {
    min-width: 0;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 70px;
  }
}

/* Dashboard kit layer inspired by modern SaaS/Admin UI kits */
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(79, 70, 229, 0.10), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(34, 197, 94, 0.09), transparent 26%),
    linear-gradient(135deg, #f7f8fc 0%, #eef3f8 48%, #f8fafc 100%);
}

.topbar {
  margin: 14px 18px 0;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(16, 24, 40, 0.08);
}

.brand-mark {
  background: linear-gradient(150deg, #4f46e5 0%, #2563eb 55%, #22c55e 140%);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.26);
}

.actions::before {
  content: "Không gian vận hành";
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #e4e7ec;
  border-radius: 999px;
  background: #ffffff;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

main {
  padding-top: 16px;
}

.metrics {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.metric {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(228, 231, 236, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86)),
    #ffffff;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto -24px -30px auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.08);
}

.metric-4::after,
.metric-5::after {
  background: rgba(245, 158, 11, 0.10);
}

.metric-6::after {
  background: rgba(34, 197, 94, 0.10);
}

.metric small {
  display: inline-flex;
  margin-top: 9px;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.metric small.up {
  background: #ecfdf3;
  color: #067647;
}

.metric small.warn {
  background: #fffaeb;
  color: #b54708;
}

.metric-visual {
  position: relative;
  z-index: 1;
  align-self: end;
  display: flex;
  align-items: end;
  justify-content: end;
  gap: 5px;
  height: 48px;
}

.metric-visual i {
  width: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6366f1, #2563eb);
}

.metric-visual i:nth-child(1) { height: 20px; opacity: 0.62; }
.metric-visual i:nth-child(2) { height: 34px; opacity: 0.78; }
.metric-visual i:nth-child(3) { height: 26px; opacity: 0.7; }
.metric-visual i:nth-child(4) { height: 44px; }

.metric-4 .metric-visual i,
.metric-5 .metric-visual i {
  background: linear-gradient(180deg, #f97316, #f59e0b);
}

.metric-6 .metric-visual i {
  background: linear-gradient(180deg, #22c55e, #0f766e);
}

.workspace {
  align-items: stretch;
}

.nav {
  position: sticky;
  top: 96px;
  align-self: start;
  min-height: calc(100vh - 118px);
  overflow: hidden;
  border: 0;
  background:
    linear-gradient(180deg, rgba(79, 70, 229, 0.98), rgba(37, 99, 235, 0.98) 58%, rgba(15, 118, 110, 0.98)),
    #2563eb;
  box-shadow: 0 24px 54px rgba(37, 99, 235, 0.22);
}

.nav::after {
  content: "";
  display: block;
  height: 1px;
  margin: 12px 8px;
  background: rgba(255, 255, 255, 0.18);
}

.nav-section {
  color: rgba(255, 255, 255, 0.62);
}

.tab {
  color: rgba(255, 255, 255, 0.84);
  background: transparent;
  border-color: transparent;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
}

.tab::before {
  content: attr(data-icon);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.tab.active {
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.82);
  color: #1849a9;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.14);
}

.tab.active::before {
  background: #eef4ff;
  color: #2563eb;
}

.content {
  border: 0;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 24px 54px rgba(16, 24, 40, 0.10);
}

.content-head {
  border-bottom: 1px solid #edf1f6;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92)),
    #ffffff;
}

.content-head h2 {
  font-size: 22px;
}

.view-tools {
  padding: 6px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #f8fafc;
}

.view-tools button {
  border-color: transparent;
  background: #ffffff;
}

.view-tools #createButton {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1849a9;
}

.view-tools #helpButton {
  width: 36px;
  padding: 0;
  border-radius: 50%;
}

.content-head input {
  border-color: transparent;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e4e7ec;
}

.table-wrap {
  border: 0;
  box-shadow: 0 1px 0 #e4e7ec, 0 14px 34px rgba(16, 24, 40, 0.06);
}

th {
  background: #f9fafb;
}

td {
  color: #1d2939;
}

.product-detail-row td {
  border: 1px solid #bfdbfe;
  box-shadow: inset 4px 0 0 #2563eb;
}

.detail-tabs {
  background: #ffffff;
}

.product-detail {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.modal {
  border-radius: 10px;
}

@media (max-width: 1100px) {
  .topbar {
    margin: 0;
    border-radius: 0;
  }

  .nav {
    position: static;
    min-height: 0;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .actions::before {
    display: none;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    grid-template-columns: 1fr 70px;
  }
}

/* Full layout shift: left rail + dashboard canvas + right insight panel */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.app-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.app-main .topbar {
  margin: 0;
}

.rail-nav {
  position: sticky;
  top: 18px;
  z-index: 40;
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: stretch;
  padding: 16px 10px;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 26px 60px rgba(16, 24, 40, 0.14);
  overflow: visible;
}

.rail-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(150deg, #4f46e5, #2563eb);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.30);
}

.rail-stack {
  align-self: center;
  justify-self: center;
  width: 58px;
  display: grid;
  gap: 10px;
  padding: 16px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5b5cf6, #4547e8 72%, #2563eb);
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.28);
}

.rail-nav .tab {
  position: relative;
  width: 42px;
  height: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  padding: 0;
  margin: 0;
  border-radius: 14px;
  color: #ffffff;
  overflow: visible;
}

.rail-nav .tab::before {
  content: none;
}

.tab-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.tab-text {
  display: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-nav .tab:hover,
.rail-nav .tab.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.18);
  color: transparent;
}

.rail-nav .tab.active .tab-icon {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.16);
}

.rail-nav .tab::after {
  content: attr(title);
  position: absolute;
  left: 58px;
  top: 50%;
  transform: translateY(-50%);
  min-width: max-content;
  padding: 7px 10px;
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, left 120ms ease;
  z-index: 80;
  white-space: nowrap;
}

.rail-nav .tab:hover::after {
  left: 64px;
  opacity: 1;
}

.account-dock {
  position: relative;
  align-self: end;
  justify-self: center;
}

.rail-account {
  position: relative;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 14px;
  background: #f8fafc;
  color: #667085;
}

.account-avatar,
.account-menu-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: auto;
  border-radius: 999px;
  background: #eaf2ff;
  color: #006df0;
  font-weight: 900;
}

.account-dot {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #22c55e;
}

.account-menu {
  position: absolute;
  left: 54px;
  bottom: 0;
  z-index: 120;
  width: 230px;
  overflow: hidden;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.18);
}

.account-menu button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  border-radius: 0;
  text-align: left;
}

.account-menu button:last-child {
  grid-template-columns: 1fr;
  border-bottom: 0;
  min-height: 48px;
}

.account-menu strong,
.account-menu small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu small {
  margin-top: 3px;
  color: #16a34a;
  font-size: 12px;
}

.app-main main {
  padding: 0;
}

.app-main .metrics {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.workspace {
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
}

.workspace.workspace-full {
  grid-template-columns: minmax(0, 1fr);
}

.workspace .content {
  min-width: 0;
}

.dashboard-side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 96px;
}

.dashboard-side[hidden] {
  display: none;
}

.side-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(228, 231, 236, 0.9);
  box-shadow: 0 20px 44px rgba(16, 24, 40, 0.09);
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.side-head strong {
  font-size: 14px;
}

.side-head span {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.score-card {
  text-align: center;
}

.score-ring {
  width: 172px;
  height: 172px;
  display: grid;
  place-items: center;
  margin: 10px auto 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #ffffff 70%, transparent 72%),
    conic-gradient(#4f46e5 var(--score), #e4e7ec 0);
}

.score-ring div {
  display: grid;
  gap: 4px;
}

.score-ring strong {
  font-size: 40px;
  line-height: 1;
}

.score-ring span {
  color: #22c55e;
  font-size: 12px;
  font-weight: 800;
}

.score-card .primary {
  width: 100%;
  min-height: 42px;
  border-radius: 999px;
}

.side-progress {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.side-progress div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-progress span {
  color: #475467;
  font-size: 12px;
  font-weight: 750;
}

.side-progress strong {
  font-size: 12px;
}

.side-progress i {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f6;
}

.side-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #4f46e5);
}

.side-actions {
  display: grid;
  gap: 10px;
}

.side-actions button {
  justify-content: center;
  border-radius: 999px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 10px 4px 0;
  color: #344054;
  font-size: 13px;
}

.pagination-bar label,
.pager-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination-bar select,
.pagination-bar input {
  min-height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 4px 8px;
}

.pagination-bar input {
  width: 70px;
  text-align: center;
}

.pager-buttons button {
  width: 34px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
}

.pager-buttons button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.skeleton-card span,
.skeleton-card strong,
.skeleton-line {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2f6 0%, #f8fafc 45%, #eef2f6 90%);
  background-size: 220% 100%;
  animation: shimmer 1.1s linear infinite;
}

.skeleton-card span {
  width: 46%;
  height: 12px;
}

.skeleton-card strong {
  width: 72%;
  height: 24px;
  margin-top: 16px;
}

.loading-table {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.skeleton-line {
  height: 38px;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-side {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .rail-nav {
    position: sticky;
    top: 0;
    z-index: 35;
    min-height: 76px;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: 1fr;
    border-radius: 0;
  }

  .rail-stack {
    width: 100%;
    display: flex;
    overflow-x: auto;
    border-radius: 999px;
  }

  .app-main {
    padding: 12px;
  }

  .app-main .metrics,
  .dashboard-side {
    grid-template-columns: 1fr;
  }
}

/* Fugalo ERP visual system and layout modes */
:root {
  --fugalo: #ed6426;
  --fugalo-dark: #c94b16;
  --erp-ink: #182230;
  --erp-navy: #101828;
}

body {
  background:
    radial-gradient(circle at 8% 0%, rgba(237, 100, 38, 0.12), transparent 26%),
    radial-gradient(circle at 88% 6%, rgba(37, 99, 235, 0.10), transparent 28%),
    linear-gradient(135deg, #f6f7fb 0%, #eef2f6 48%, #fbfcff 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  width: 158px;
  max-height: 46px;
  object-fit: contain;
  object-position: left center;
}

.brand h1 {
  color: var(--erp-ink);
  font-size: 20px;
}

.rail-logo {
  width: 54px;
  height: 54px;
  overflow: hidden;
  display: grid;
  place-items: center;
  justify-self: center;
  padding: 7px;
  border-radius: 17px;
  background: #ffffff;
  border: 1px solid rgba(237, 100, 38, 0.18);
  box-shadow: 0 16px 34px rgba(237, 100, 38, 0.18);
}

.rail-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  object-position: center;
  transform: none;
}

.erp-menu-title {
  display: none;
  margin: 10px 0 8px;
  color: #344054;
}

.erp-menu-title strong {
  display: block;
  font-size: 13px;
}

.erp-menu-title span {
  color: #98a2b3;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.rail-stack {
  background: linear-gradient(180deg, #182230, #253bff 58%, var(--fugalo));
}

.rail-nav .tab.active .tab-icon {
  color: var(--fugalo);
}

.layout-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #e4e7ec;
  border-radius: 999px;
  background: #f8fafc;
}

.layout-switcher button {
  min-height: 28px;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.layout-switcher button.active,
.primary {
  background: var(--fugalo);
  border-color: var(--fugalo);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(237, 100, 38, 0.24);
}

.primary:hover {
  background: var(--fugalo-dark);
  border-color: var(--fugalo-dark);
}

.menu-toggle {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
}

.view-tools #createButton {
  background: #fff4ed;
  border-color: #fed7c4;
  color: var(--fugalo-dark);
}

.metric::after {
  background: rgba(237, 100, 38, 0.10);
}

.metric-visual i {
  background: linear-gradient(180deg, #f59e0b, var(--fugalo));
}

.metric-6 .metric-visual i,
.side-progress b {
  background: linear-gradient(90deg, var(--fugalo), #2563eb);
}

.score-ring {
  background:
    radial-gradient(circle closest-side, #ffffff 70%, transparent 72%),
    conic-gradient(var(--fugalo) var(--score), #e4e7ec 0);
}

.content-head {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 237, 0.50)),
    #ffffff;
}

.content-head h2::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 22px;
  margin-right: 10px;
  border-radius: 999px;
  vertical-align: -4px;
  background: var(--fugalo);
}

.product-detail-row td {
  border-color: #fed7c4;
  box-shadow: inset 4px 0 0 var(--fugalo);
}

body[data-layout="vertical"] .app-shell,
body[data-layout="hovered"] .app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

body[data-layout="vertical"] .rail-nav,
body[data-layout="hovered"] .rail-nav {
  justify-items: stretch;
  padding: 16px;
}

body[data-layout="vertical"] .rail-logo,
body[data-layout="hovered"] .rail-nav:hover .rail-logo {
  width: 54px;
  justify-self: start;
}

body[data-layout="vertical"] .rail-logo img,
body[data-layout="hovered"] .rail-nav:hover .rail-logo img {
  width: 100%;
  transform: none;
}

body[data-layout="vertical"] .erp-menu-title,
body[data-layout="hovered"] .rail-nav:hover .erp-menu-title {
  display: block;
}

body[data-layout="vertical"] .rail-stack,
body[data-layout="hovered"] .rail-nav:hover .rail-stack {
  width: 100%;
  align-self: center;
  justify-self: stretch;
  display: grid;
  gap: 7px;
  padding: 14px 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-layout="vertical"] .rail-nav .tab,
body[data-layout="hovered"] .rail-nav:hover .tab {
  width: 100%;
  height: 42px;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px;
  border-radius: 12px;
  color: #475467;
}

body[data-layout="vertical"] .rail-nav .tab .tab-icon,
body[data-layout="hovered"] .rail-nav:hover .tab .tab-icon {
  width: 32px;
  height: 32px;
  background: #fff4ed;
  color: var(--fugalo);
  flex: 0 0 auto;
  font-size: 18px;
}

body[data-layout="vertical"] .rail-nav .tab .tab-text,
body[data-layout="hovered"] .rail-nav:hover .tab .tab-text {
  display: block;
  color: inherit;
  font-size: 13px;
  font-weight: 750;
}

body[data-layout="vertical"] .rail-nav .tab::after,
body[data-layout="hovered"] .rail-nav:hover .tab::after {
  content: none;
}

body[data-layout="vertical"] .rail-nav .tab.active,
body[data-layout="vertical"] .rail-nav .tab:hover,
body[data-layout="hovered"] .rail-nav:hover .tab.active,
body[data-layout="hovered"] .rail-nav:hover .tab:hover {
  background: #fff7ed;
  color: var(--fugalo-dark);
}

body[data-layout="hovered"] .app-shell {
  grid-template-columns: 86px minmax(0, 1fr);
}

body[data-layout="hovered"] .rail-nav {
  width: 86px;
  transition: width 180ms ease;
}

body[data-layout="hovered"] .rail-nav:hover {
  width: 248px;
}

body[data-layout="compact"] .app-shell {
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

body[data-layout="compact"] .rail-nav {
  justify-items: stretch;
  padding: 12px;
}

body[data-layout="compact"] .rail-logo {
  width: 46px;
  justify-self: start;
}

body[data-layout="compact"] .erp-menu-title {
  display: block;
}

body[data-layout="compact"] .rail-stack {
  width: 100%;
  align-self: center;
  justify-self: stretch;
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-layout="compact"] .rail-nav .tab {
  width: 100%;
  height: 36px;
  min-height: 36px;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 10px;
  border-radius: 10px;
  color: #475467;
}

body[data-layout="compact"] .rail-nav .tab .tab-icon {
  width: 28px;
  height: 28px;
  background: #fff4ed;
  color: var(--fugalo);
  flex: 0 0 auto;
  font-size: 16px;
}

body[data-layout="compact"] .rail-nav .tab .tab-text {
  display: block;
  color: inherit;
  font-size: 12px;
  font-weight: 750;
}

body[data-layout="compact"] .rail-nav .tab::after {
  content: none;
}

body[data-layout="compact"] .rail-nav .tab.active,
body[data-layout="compact"] .rail-nav .tab:hover {
  background: #fff7ed;
  color: var(--fugalo-dark);
}

body[data-layout="compact"] .dashboard-side {
  display: none;
}

body[data-layout="compact"] .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body[data-layout="compact"] th,
body[data-layout="compact"] td {
  padding: 6px 8px;
  font-size: 12px;
}

body[data-layout="hidden"] .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body[data-layout="hidden"] .rail-nav {
  display: none;
}

body[data-layout="mobile"] .app-shell {
  grid-template-columns: 1fr;
  padding: 0;
}

body[data-layout="mobile"] .rail-nav {
  position: sticky;
  top: 0;
  z-index: 35;
  min-height: 76px;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: 1fr;
  border-radius: 0;
}

body[data-layout="mobile"] .rail-stack {
  width: 100%;
  display: flex;
  overflow-x: auto;
  border-radius: 999px;
}

body[data-layout="mobile"] .app-main {
  padding: 12px;
}

body[data-layout="mobile"] .topbar,
body[data-layout="mobile"] .content-head,
body[data-layout="mobile"] .actions {
  align-items: stretch;
  flex-direction: column;
}

body[data-layout="mobile"] .metrics,
body[data-layout="mobile"] .dashboard-side,
body[data-layout="mobile"] .workspace {
  grid-template-columns: 1fr;
}

.app-shell,
.rail-nav,
.rail-logo,
.rail-stack,
.rail-nav .tab,
.tab-icon,
.tab-text {
  transition:
    grid-template-columns 180ms ease,
    width 180ms ease,
    height 180ms ease,
    padding 180ms ease,
    border-radius 180ms ease,
    background 160ms ease,
    color 140ms ease,
    opacity 140ms ease,
    box-shadow 160ms ease;
}

.rail-brand {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 10px;
}

.menu-toggle {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  min-height: 54px;
  border-color: rgba(237, 100, 38, 0.18);
}

.menu-toggle:hover {
  border-color: #fed7c4;
  transform: translateY(-1px);
}

.rail-status-dot {
  position: absolute;
  right: -2px;
  top: -2px;
  width: 11px;
  height: 11px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

body.sync-running .rail-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

body.sync-error .rail-status-dot {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

.rail-chevron {
  position: absolute;
  right: -10px;
  bottom: -8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid #e4e7ec;
  border-radius: 999px;
  background: #ffffff;
  color: var(--fugalo);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.16);
  transition: transform 180ms ease, background 160ms ease, color 160ms ease;
}

body.sidebar-collapsed[data-layout="vertical"] .app-shell,
body.sidebar-collapsed[data-layout="compact"] .app-shell {
  grid-template-columns: 92px minmax(0, 1fr);
}

body.sidebar-collapsed .rail-nav {
  justify-items: center;
  align-items: stretch;
  padding: 14px 10px;
}

body.sidebar-collapsed .rail-brand {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 8px;
}

body.sidebar-collapsed .rail-logo {
  width: 52px;
  height: 52px;
  justify-self: center;
  margin-inline: auto;
}

body.sidebar-collapsed .rail-logo img {
  width: 32px;
  height: 32px;
}

body.sidebar-collapsed .erp-menu-title {
  display: none;
}

body.sidebar-collapsed .menu-toggle {
  border-radius: 16px;
}

body.sidebar-collapsed .rail-chevron {
  transform: rotate(0deg);
}

@keyframes pulse-dot {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.18);
  }
}

body.sidebar-collapsed .rail-stack {
  width: 58px;
  align-self: center;
  justify-self: center;
  gap: 9px;
  padding: 14px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #182230, #253bff 58%, var(--fugalo));
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.22);
}

body.sidebar-collapsed .rail-nav .tab {
  width: 42px;
  height: 42px;
  min-height: 42px;
  justify-content: center;
  padding: 0;
  color: #ffffff;
}

body.sidebar-collapsed .rail-nav .tab .tab-icon {
  width: 42px;
  height: 42px;
  background: transparent;
  color: rgba(255, 255, 255, 0.94);
  font-size: 18px;
}

body.sidebar-collapsed .rail-nav .tab .tab-text {
  display: none;
  opacity: 0;
  max-width: 0;
}

body.sidebar-collapsed .rail-nav .tab.active,
body.sidebar-collapsed .rail-nav .tab:hover {
  background: rgba(255, 255, 255, 0.18);
  color: transparent;
}

body.sidebar-collapsed .rail-nav .tab.active .tab-icon {
  background: #ffffff;
  color: var(--fugalo);
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.16);
}

body.sidebar-collapsed .rail-nav .tab::after {
  content: attr(title);
  position: absolute;
  left: 58px;
  top: 50%;
  transform: translateY(-50%);
  min-width: max-content;
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  z-index: 80;
}

body.sidebar-collapsed .rail-nav .tab:hover::after {
  left: 64px;
  opacity: 1;
}

body:not(.sidebar-collapsed) .rail-nav .tab::after {
  content: none;
}

@media (max-width: 980px) {
  .brand img {
    width: 132px;
  }
}

/* Overview dashboard has its own shell; keep these overrides last so older UI-kit layers do not leak in. */
body[data-view="overview"] main {
  padding: 16px;
}

body[data-view="overview"] #view {
  padding: 0;
}

body[data-view="overview"] .content {
  min-height: calc(100vh - 120px);
  overflow: visible;
  border: 0;
  background: #f3f6fb;
  box-shadow: none;
}

body[data-view="overview"] .content-head {
  display: none;
}

body[data-view="overview"] .overview-dashboard {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  background: #f3f6fb;
}

body[data-view="overview"] .overview-main,
body[data-view="overview"] .overview-aside,
body[data-view="overview"] .overview-card,
body[data-view="overview"] .overview-chart {
  min-width: 0;
}

body[data-view="overview"] .today-stats {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  overflow: hidden;
}

body[data-view="overview"] .today-stat {
  min-width: 0;
  min-height: 68px;
  border-radius: 0;
}

body[data-view="overview"] .today-stat strong,
body[data-view="overview"] .overview-card-head h3 span {
  overflow-wrap: anywhere;
}

body[data-view="overview"] .overview-chart {
  overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(18px, 1fr));
}

body[data-view="overview"] .overview-hbar,
body[data-view="overview"] .overview-activity {
  min-height: 0;
  border-color: transparent;
}

@media (max-width: 1180px) {
  body[data-view="overview"] .overview-dashboard,
  body[data-view="overview"] .overview-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body[data-view="overview"] .today-stats {
    grid-template-columns: 1fr;
  }

  body[data-view="overview"] .today-stat {
    border-right: 0;
    border-bottom: 1px solid #e5eaf1;
  }
}

body[data-view="overview"] .overview-aside {
  gap: 16px;
}

body[data-view="overview"] .mini-actions {
  padding: 0 14px;
}

body[data-view="overview"] .mini-actions button {
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  grid-template-rows: auto auto;
  column-gap: 12px;
  min-height: 70px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid #e8edf4;
  border-radius: 0;
  background: transparent;
}

body[data-view="overview"] .mini-actions button:last-child {
  border-bottom: 0;
}

body[data-view="overview"] .mini-actions button::after {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
  content: "›";
  color: #64748b;
  font-size: 22px;
}

body[data-view="overview"] .mini-actions span {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
}

body[data-view="overview"] .mini-actions strong,
body[data-view="overview"] .mini-actions small {
  grid-column: 2;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-view="overview"] .mini-actions strong {
  grid-row: 1;
  color: #101828;
  font-size: 13px;
  line-height: 1.2;
}

body[data-view="overview"] .mini-actions small {
  grid-row: 2;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  line-height: 1.3;
}

body[data-view="overview"] .alerts-card {
  padding: 0 14px;
}

body[data-view="overview"] .alerts-card p {
  position: relative;
  min-height: 58px;
  margin: 0;
  padding: 14px 4px 14px 42px;
  border-bottom: 1px solid #e8edf4;
  color: #475467;
  line-height: 1.35;
}

body[data-view="overview"] .alerts-card p::before {
  content: "!";
  position: absolute;
  left: 4px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff4ed;
  color: var(--fugalo);
  font-weight: 900;
}

body[data-view="overview"] .alerts-card p:last-child {
  border-bottom: 0;
}

body[data-view="overview"] .activity-feed {
  gap: 0;
  max-height: 680px;
  padding: 16px 14px;
  overflow-y: auto;
  overflow-x: hidden;
}

body[data-view="overview"] .activity-feed h3 {
  margin: 0 0 14px;
  color: #101828;
}

body[data-view="overview"] .overview-activity {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: auto;
  padding: 8px 2px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  align-items: start;
}

body[data-view="overview"] .overview-activity + .overview-activity {
  margin-top: 2px;
}

body[data-view="overview"] .overview-activity i {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  flex: 0 0 auto;
}

body[data-view="overview"] .overview-activity p {
  min-width: 0;
  margin: 0;
  color: #101828;
  font-size: 13px;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

body[data-view="overview"] .overview-activity small {
  display: block;
  margin-top: 4px;
  color: #98a2b3;
  font-size: 12px;
  line-height: 1.25;
}

/* Purchase entry polish */
.purchase-entry-modal {
  width: min(1320px, calc(100vw - 44px));
  border-radius: 10px;
}

.purchase-entry-modal .purchase-layout {
  grid-template-columns: minmax(720px, 1fr) 330px;
  min-height: min(720px, calc(100vh - 96px));
}

.purchase-entry-modal .purchase-workspace {
  min-width: 0;
  padding: 12px 16px 16px;
}

.purchase-entry-modal .purchase-search {
  grid-template-columns: 32px 128px minmax(320px, 1fr) 76px;
  gap: 8px;
  margin-bottom: 10px;
}

.purchase-entry-modal .purchase-search.purchase-import-search {
  grid-template-columns: 32px 128px minmax(320px, 1fr) 76px 88px;
}

.purchase-entry-modal .purchase-search > button,
.purchase-entry-modal .supplier-picker > button {
  height: 32px;
  border: 1px solid #b8c4d4;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
}

.purchase-entry-modal .purchase-search > .add-line-button {
  padding: 0 10px;
  font-weight: 700;
  white-space: nowrap;
}

.purchase-entry-modal .purchase-search > .create-line-button {
  padding: 0 10px;
  color: #0b5cab;
  font-weight: 700;
  white-space: nowrap;
}

.purchase-entry-modal .purchase-search strong {
  white-space: nowrap;
  font-size: 18px;
  line-height: 32px;
}

.purchase-entry-modal .purchase-search-box input {
  height: 34px;
  font-size: 14px;
}

.purchase-entry-modal .purchase-table-wrap {
  min-height: min(625px, calc(100vh - 180px));
  border-color: #d4deea;
}

.purchase-entry-modal th,
.purchase-entry-modal td {
  padding: 8px 10px;
  font-size: 12px;
}

.purchase-entry-modal th {
  color: #172033;
  background: #f7f8fb;
}

.purchase-entry-modal .purchase-empty {
  inset: 40px 0 0;
  gap: 10px;
}

.purchase-entry-modal .purchase-empty h3 {
  margin: 0;
  font-size: 16px;
}

.purchase-entry-modal .purchase-empty .primary {
  justify-self: center;
  min-width: 160px;
  height: 38px;
  border-radius: 6px;
}

.purchase-entry-modal .purchase-suggest {
  width: min(420px, calc(100vw - 420px));
  max-height: 382px;
  border-radius: 7px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
}

.purchase-entry-modal .suggest-list {
  max-height: 318px;
}

.purchase-entry-modal .purchase-suggest .suggest-list > button {
  grid-template-columns: 52px minmax(0, 1fr);
  min-height: 68px;
  padding: 7px 10px;
}

.purchase-entry-modal .purchase-suggest img {
  width: 44px;
  height: 44px;
}

.purchase-entry-modal .purchase-suggest strong {
  font-size: 13px;
  line-height: 1.22;
  color: #101828;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.purchase-entry-modal .purchase-suggest small {
  font-size: 11px;
  line-height: 1.25;
}

.purchase-entry-modal .suggest-foot {
  min-height: 54px;
  padding: 8px 10px;
  border-top: 1px solid #e8edf4;
}

.purchase-entry-modal .suggest-foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475467;
  font-size: 12px;
}

.purchase-entry-modal .suggest-foot strong {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef2f7;
  color: #0f172a;
  font-size: 13px;
}

.purchase-entry-modal .suggest-foot button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-width: 128px;
  min-height: 34px !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 6px;
  background: #f15a24 !important;
  color: #fff !important;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.purchase-entry-modal .purchase-side {
  gap: 10px;
  padding: 14px 12px;
  overflow-y: auto;
}

.purchase-entry-modal .purchase-side-top {
  grid-template-columns: minmax(0, 1fr) 185px;
}

.purchase-entry-modal .purchase-side input,
.purchase-entry-modal .purchase-side select,
.purchase-entry-modal .purchase-side textarea {
  min-width: 0;
  height: 34px;
  font-size: 13px;
}

.purchase-entry-modal .purchase-side textarea {
  height: 64px;
  min-height: 64px;
}

.purchase-entry-modal .info-row {
  min-height: 28px;
  color: #334155;
  font-size: 12px;
}

.purchase-entry-modal .info-row strong {
  color: #101828;
}

.purchase-entry-modal .info-row.payable strong,
.purchase-entry-modal #purchaseTotalText {
  color: #006df0;
}

.purchase-entry-modal .purchase-side-actions {
  padding-top: 12px;
}

.purchase-entry-modal .purchase-side-actions button {
  min-height: 36px;
  border-radius: 6px;
  font-weight: 800;
}

.purchase-entry-modal .supplier-picker .purchase-suggest {
  width: 100%;
  max-height: 220px;
  border-radius: 7px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.purchase-entry-modal .supplier-picker .purchase-suggest > button {
  min-height: 48px;
  font-size: 12px;
}

.purchase-entry-modal .supplier-picker .purchase-suggest strong {
  white-space: normal;
}

.purchase-entry-modal .supplier-picker .purchase-suggest .empty {
  min-height: 48px;
  margin: 0;
  padding: 14px 10px;
  border: 0;
  background: #fff;
}

.partner-editor-modal {
  width: min(860px, calc(100vw - 28px));
}

.partner-editor-modal .modal-body {
  display: grid;
  gap: 12px;
}

.partner-editor-modal .edit-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-section {
  border: 1px solid #e4e7ec;
  border-radius: 7px;
  background: #fff;
}

.editor-section summary {
  cursor: pointer;
  padding: 12px 14px;
  color: #101828;
  font-weight: 800;
}

.editor-section > label,
.editor-section > .edit-row {
  margin: 0 14px 14px;
}

.partner-editor-modal textarea {
  min-height: 58px;
}

@media (max-width: 1180px) {
  .purchase-entry-modal {
    width: calc(100vw - 20px);
  }

  .purchase-entry-modal .purchase-layout {
    grid-template-columns: 1fr;
  }

  .purchase-entry-modal .purchase-search {
    grid-template-columns: 32px 1fr 34px;
  }

  .purchase-entry-modal .purchase-search strong {
    display: none;
  }

  .purchase-entry-modal .purchase-suggest {
    width: min(420px, calc(100vw - 64px));
  }
}

/* Product editor professional layout */
.product-edit-modal {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
}

.product-edit-modal .product-edit-head {
  min-height: 66px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e4e7ec;
}

.product-edit-modal .product-edit-head > div:first-child {
  min-width: 0;
}

.product-edit-modal .product-edit-head h3 {
  margin-bottom: 4px;
  font-size: 18px;
  letter-spacing: 0;
}

.product-edit-modal .product-edit-head p {
  max-width: 720px;
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-edit-modal .badge {
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.product-edit-modal .modal-tabs {
  flex: 0 0 auto;
  padding: 0 20px;
  border-bottom: 1px solid #e4e7ec;
  background: #fff;
}

.product-edit-modal .modal-tabs button {
  min-height: 42px;
  padding: 0 2px;
  color: #475467;
  font-weight: 760;
}

.product-edit-modal .modal-tabs button.active {
  color: var(--accent);
}

.product-edit-modal .product-edit-body {
  flex: 1 1 auto;
  padding: 16px 20px 18px;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.product-edit-modal .product-edit-grid {
  grid-template-columns: minmax(0, 1fr) 226px;
  gap: 18px;
  align-items: start;
}

.product-edit-modal .product-core-section {
  margin-top: 0;
}

.product-edit-modal .edit-section {
  margin: 0 0 12px;
  padding: 14px 14px 16px;
  border: 1px solid #e4e7ec;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.product-edit-modal .edit-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.product-edit-modal details.edit-section {
  padding: 0;
  overflow: hidden;
}

.product-edit-modal details.edit-section > summary {
  margin: 0;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.product-edit-modal details.edit-section > summary::-webkit-details-marker {
  display: none;
}

.product-edit-modal details.edit-section[open] > summary {
  border-bottom: 1px solid #eef2f7;
}

.product-edit-modal .edit-section-content {
  padding: 14px 14px 16px;
}

.product-edit-modal .section-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.product-edit-modal .section-head-actions b {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #344054;
  font-size: 15px;
  transition: transform 0.16s ease;
}

.product-edit-modal details.edit-section[open] .section-head-actions b {
  transform: rotate(180deg);
}

.product-edit-modal .edit-section-head h4 {
  margin: 0 0 4px;
  color: #101828;
  font-size: 13px;
  font-weight: 850;
}

.product-edit-modal .edit-section-head p {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.product-edit-modal .edit-row {
  gap: 12px;
}

.product-edit-modal .edit-field {
  gap: 6px;
  margin-bottom: 10px;
}

.product-edit-modal .edit-field span {
  color: #344054;
  font-size: 12px;
}

.product-edit-modal .edit-field input,
.product-edit-modal .edit-field select,
.product-edit-modal .rich-field textarea {
  min-height: 36px;
  border-color: #cfd6e3;
  border-radius: 7px;
  background: #fff;
  color: #101828;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-edit-modal .edit-field input:focus,
.product-edit-modal .edit-field select:focus,
.product-edit-modal .rich-field textarea:focus,
.product-edit-modal .edit-image-tools input:focus {
  border-color: #f15a24;
  box-shadow: 0 0 0 3px rgba(241, 90, 36, 0.12);
  outline: 0;
}

.product-edit-modal .quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.product-edit-modal .quick-links button,
.product-edit-modal .link-button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--fugalo);
  font-size: 12px;
  font-weight: 800;
}

.product-edit-modal .product-edit-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.product-edit-modal .product-edit-stats span {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fff7f2;
}

.product-edit-modal .product-edit-stats small {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: 11px;
  font-weight: 760;
}

.product-edit-modal .product-edit-stats strong {
  display: block;
  color: #101828;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-edit-modal .product-image-panel {
  position: sticky;
  top: 0;
  width: 226px;
  padding: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #f8fafc;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
}

.product-edit-modal .edit-image-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #101828;
  font-size: 13px;
}

.product-edit-modal .edit-image-title span {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.product-edit-modal .edit-image-main {
  width: 100%;
  min-height: 168px;
  border-color: #c7d0dd;
  border-radius: 10px;
  background: #fff;
}

.product-edit-modal .edit-image-main img {
  height: 168px;
  border-radius: 9px;
  object-fit: contain;
}

.product-edit-modal .edit-image-thumbs {
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  width: 100%;
}

.product-edit-modal .edit-image-thumbs button {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  background: #fff;
}

.product-edit-modal .edit-image-hint {
  margin: 0;
  color: #667085;
  font-size: 11px;
  line-height: 1.35;
}

.product-edit-modal .edit-image-tools {
  width: 100%;
  grid-template-columns: 1fr 1fr;
}

.product-edit-modal .edit-image-tools input {
  min-height: 34px;
  border-color: #cfd6e3;
  border-radius: 7px;
}

.product-edit-modal .edit-image-tools button {
  min-height: 32px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.product-edit-modal .edit-image-tools button:first-of-type {
  border-color: #f15a24;
  background: #f15a24;
  color: #fff;
}

.product-edit-modal .modal-foot {
  flex: 0 0 auto;
  padding: 12px 20px;
  border-top: 1px solid #e4e7ec;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.product-edit-modal .modal-foot button {
  min-width: 72px;
  min-height: 36px;
  border-radius: 7px;
  font-weight: 800;
}

.product-edit-modal .modal-foot .primary {
  background: #f15a24;
  border-color: #f15a24;
}

.product-edit-modal .product-sale-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-weight: 760;
}

@media (max-width: 900px) {
  .product-edit-modal .product-edit-grid {
    grid-template-columns: 1fr;
  }

  .product-edit-modal .product-image-panel {
    position: static;
    width: 100%;
  }

  .product-edit-modal .product-edit-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.omnichat-shell {
  display: grid;
  grid-template-columns: 340px minmax(460px, 1fr) 380px;
  gap: 10px;
  min-height: calc(100vh - 230px);
  background: #dfeaff;
  padding: 10px;
  border-radius: 12px;
}

.omnichat-sidebar,
.omnichat-thread,
.omnichat-profile {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.omni-filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: -6px 0 10px;
  padding: 6px 0;
}

.omni-live-ribbon {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 10px;
  padding: 7px 12px;
  border: 1px solid #d7e6f7;
  border-radius: 10px;
  background: #f8fbff;
  color: #64748b;
  font-size: 12px;
}

.omni-live-ribbon span:first-child {
  color: #166534;
  font-weight: 800;
}

.omni-live-ribbon span:first-child::before {
  content: "";
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .12);
}

.omni-live-ribbon a {
  color: #0b61d8;
  font-weight: 800;
  text-decoration: none;
}

.omni-filter,
.omni-square-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  border: 1px solid #d7e0ec;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: #334155;
  font-weight: 700;
}

.omni-filter.active {
  background: #e6f0ff;
  border-color: #bfdbfe;
  color: #0b61d8;
}

.omni-filter b {
  min-width: 22px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #1677ff;
  color: #fff;
  font-size: 11px;
}

.omni-square-action {
  width: 34px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
}

.omnichat-head,
.chat-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.omnichat-head span,
.chat-thread-head p,
.chat-channel span,
.omnichat-setup span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.omnichat-head button,
.chat-thread-head button,
.chat-profile-card button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
}

.chat-list-tools {
  display: grid;
  grid-template-columns: 1fr 34px 34px;
  gap: 8px;
  padding: 10px 10px 0;
}

.chat-list-tools label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  min-height: 36px;
}

.chat-list-tools input {
  width: 100%;
  border: 0;
  outline: 0;
}

.chat-list-tools button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.omnichat-channels,
.omnichat-list {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.chat-channel,
.chat-conversation,
.chat-profile-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.chat-channel {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.chat-channel i {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #1877f2;
  color: #fff;
  font-weight: 800;
  font-style: normal;
}

.omnichat-setup {
  margin: 0 10px 10px;
  padding: 10px;
  border: 1px dashed #b6c2d2;
  border-radius: 10px;
  background: #f8fafc;
}

.omnichat-setup code {
  display: block;
  margin: 7px 0;
  white-space: normal;
  word-break: break-all;
  font-size: 12px;
}

.chat-conversation {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 11px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 8px;
  align-items: start;
}

.chat-conversation.active {
  border-color: #cfe2ff;
  background: #dcecff;
}

.chat-conversation span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.chat-conversation strong,
.chat-conversation small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation small,
.chat-conversation em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.chat-conversation p {
  grid-column: 2 / -1;
  margin: 7px 0 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation > i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-style: normal;
  font-weight: 800;
}

.chat-conversation b {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ff6a2a;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.omnichat-thread {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

.chat-messages {
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.chat-message {
  display: flex;
}

.chat-message.out {
  justify-content: flex-end;
}

.chat-message div {
  max-width: min(76%, 520px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.chat-message.out div {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.chat-message p {
  margin: 0;
  line-height: 1.45;
}

.chat-message time,
.chat-message small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.chat-message p a {
  color: #0b61d8;
  font-weight: 700;
}

.muted-message {
  color: #64748b;
  font-style: italic;
}

.chat-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  gap: 8px;
  margin-top: 8px;
}

.chat-attachment-card {
  max-width: 260px;
  border: 1px solid #d8e1ee;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  text-decoration: none;
  overflow: hidden;
}

.chat-attachment-card.image {
  display: grid;
}

.chat-attachment-card.image img,
.chat-attachment-card.video video {
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}

.chat-attachment-card.image span,
.chat-attachment-card.video a {
  padding: 7px 9px;
  color: #0b61d8;
  font-size: 12px;
  font-weight: 800;
}

.chat-attachment-card.file {
  min-width: 150px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
}

.chat-attachment-card.file b {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: #e7f0ff;
  color: #0b61d8;
  font-size: 11px;
}

.chat-attachment-card.file span,
.chat-attachment-card.file small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-reply {
  display: grid;
  grid-template-columns: 1fr 34px 34px 34px auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat-reply input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}

.chat-reply > button:not(.primary) {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.chat-thread-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-thread-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.quick-replies {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.quick-replies button {
  flex: 0 0 auto;
  min-height: 28px;
  border: 1px solid #d7e0ec;
  border-radius: 999px;
  background: #fff;
  padding: 0 10px;
  color: #64748b;
  font-weight: 700;
}

.quick-replies .quick-setup {
  width: 28px;
  padding: 0;
}

.omnichat-profile {
  padding: 0;
  display: grid;
  align-content: start;
  gap: 0;
  background: #eef5ff;
}

.chat-profile-card {
  margin: 10px;
  padding: 12px;
}

.chat-profile-card h3 {
  margin: 0 0 8px;
}

.chat-profile-card span,
.chat-profile-card p {
  color: var(--muted);
  font-size: 12px;
}

.omni-side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.omni-side-tabs button {
  min-height: 48px;
  border: 0;
  background: #fff;
  font-weight: 800;
  color: #64748b;
}

.omni-side-tabs button.active {
  color: #0b61d8;
  box-shadow: inset 0 -3px 0 #1677ff;
}

.chat-customer-head {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
}

.chat-customer-head i {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fee2e2;
  color: #b91c1c;
  font-style: normal;
  font-weight: 900;
}

.chat-customer-head button {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
}

.chat-customer-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
  color: #0b61d8;
  font-size: 12px;
}

.chat-customer-stats span {
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.chat-customer-stats span:last-child {
  border-right: 0;
}

.chat-order-card {
  display: grid;
  gap: 8px;
}

.chat-order-card .badge,
.chat-profile-card .badge {
  width: max-content;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 12px;
}

.badge.green {
  background: #dcfce7;
  color: #15803d;
}

.badge.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.chat-product-search {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 8px;
  padding: 10px;
  background: #fff;
}

.chat-product-search input,
.chat-product-search button {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 36px;
  background: #fff;
  padding: 0 10px;
}

.chat-product-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 10px;
  background: #fff;
  overflow-x: auto;
}

.chat-product-pills button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  min-height: 30px;
  padding: 0 10px;
  font-weight: 700;
}

.chat-product-pills button.active {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}

.chat-product-list {
  display: grid;
  gap: 10px;
  padding: 10px;
  max-height: calc(100vh - 410px);
  overflow: auto;
}

.chat-product-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.chat-product-card img,
.chat-product-card > i {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  object-fit: cover;
  background: #f1f5f9;
}

.chat-product-card > i {
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-style: normal;
}

.chat-product-card strong,
.chat-product-card span,
.chat-product-card small {
  display: block;
}

.chat-product-card strong {
  line-height: 1.3;
}

.chat-product-card span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.chat-product-card small {
  text-align: right;
  font-weight: 900;
  color: #111827;
  margin-top: 4px;
}

.chat-product-card div div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chat-product-card button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.chat-create-order {
  position: sticky;
  bottom: 12px;
  justify-self: end;
  margin: 4px 16px 14px;
}

.chat-order-modal {
  width: min(1120px, calc(100vw - 28px));
}

.chat-order-layout {
  display: grid;
  grid-template-columns: 1fr 330px;
  min-height: 560px;
  background: #f8fafc;
}

.chat-order-layout > section {
  border-right: 1px solid var(--line);
  background: #fff;
}

.chat-order-layout > aside {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.chat-order-layout label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-order-layout input,
.chat-order-layout textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
}

.chat-order-layout textarea {
  min-height: 78px;
  resize: vertical;
}

.omnichat-welcome {
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
}

.omnichat-illustration {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 32px;
  background: #f1f5f9;
  font-size: 46px;
}

.omnichat-welcome h3 {
  margin: 0;
  font-size: 20px;
}

.omnichat-welcome p {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
}

.channel-connect-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 6px;
  width: min(640px, 100%);
}

.channel-connect-grid button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
}

.channel-connect-grid button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.channel-connect-grid i {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  font-style: normal;
  font-weight: 800;
}

.channel-connect-grid .fb { background: #1877f2; }
.channel-connect-grid .ig { background: #e1306c; }
.channel-connect-grid .tt { background: #111827; }
.channel-connect-grid .zalo { background: #0068ff; }

.empty.small {
  padding: 12px;
  font-size: 12px;
}

.facebook-page-list {
  display: grid;
  gap: 10px;
}

.facebook-page-row {
  display: grid;
  grid-template-columns: auto 40px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.facebook-page-row img,
.facebook-page-row i {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.facebook-page-row i {
  display: grid;
  place-items: center;
  background: #1877f2;
  color: #fff;
  font-style: normal;
  font-weight: 800;
}

.facebook-page-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .omnichat-shell {
    grid-template-columns: 280px 1fr;
  }

  .omnichat-profile {
    grid-column: 1 / -1;
  }
}

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

  .omnichat-thread {
    min-height: 520px;
  }

  .channel-connect-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Settings API and hosting */
.api-hosting-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.settings-split-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
}

.settings-split-card h3 {
  margin: 0 0 4px;
  color: #101828;
  font-size: 16px;
}

.settings-split-card p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.settings-module-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 14px;
  align-items: start;
}

.settings-module-content {
  display: grid;
  gap: 12px;
}

.settings-kv-section {
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.settings-kv-section h4 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #e4e7ec;
  color: #101828;
  font-size: 15px;
}

.settings-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 56px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef2f6;
}

.settings-line:last-child {
  border-bottom: 0;
}

.settings-line strong {
  display: block;
  color: #101828;
  font-size: 13px;
}

.settings-line p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.settings-line-action {
  min-width: 84px;
  text-align: right;
}

.settings-line-action input,
.settings-line-action select {
  width: min(240px, 100%);
}

.print-settings-panel {
  display: grid;
  gap: 12px;
}

.print-template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, auto);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #eef2f6;
}

.print-template-row:last-child {
  border-bottom: 0;
}

.print-template-row strong {
  display: block;
  color: #101828;
  font-size: 13px;
}

.print-template-row p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 12px;
}

.print-template-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.print-template-controls select {
  min-width: 176px;
}

.print-template-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475467;
  font-size: 12px;
}

.print-template-controls input[type="number"] {
  width: 56px;
  text-align: right;
}

.settings-link-value {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: #101828;
  font-size: 12px;
  white-space: nowrap;
}

.settings-link-value strong {
  color: #101828;
  font-size: 12px;
}

.settings-link-value span {
  color: #475467;
}

.settings-link-value::after {
  content: "›";
  color: #667085;
  font-size: 18px;
  line-height: 1;
}

.settings-radio-group {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.settings-radio {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 8px;
  color: #101828;
  font-size: 13px;
}

.settings-radio small {
  grid-column: 2;
  color: #667085;
  font-size: 12px;
}

.settings-check-grid,
.settings-required-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef2f6;
  color: #344054;
  font-size: 12px;
}

.settings-required-grid {
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr) auto;
  align-items: center;
}

.settings-module-side {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fff;
}

.settings-module-side button {
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: #475467;
  font-size: 12px;
}

.settings-module-side button.active,
.settings-module-side button:hover {
  background: #eef6ff;
  color: #0b63f6;
}

.settings-module-data {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #f8fafc;
  color: #667085;
  font-size: 13px;
}

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

.settings-data-list {
  display: grid;
  gap: 6px;
}

.settings-data-list p {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  color: #475467;
}

.settings-data-list strong {
  color: #101828;
}

.settings-inline-loader {
  padding: 14px 16px;
  color: #667085;
  font-size: 13px;
}

.settings-mini-table {
  margin: 0;
}

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

.config-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #f8fafc;
}

.config-item span {
  display: block;
  margin-bottom: 6px;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.config-item strong {
  display: block;
  color: #101828;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.config-item.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.config-item.warn {
  border-color: #fed7aa;
  background: #fff7ed;
}

.env-sample {
  max-height: 270px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.55;
}

.deploy-steps ol {
  margin: 0;
  padding-left: 20px;
  color: #344054;
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .settings-module-panel {
    grid-template-columns: 1fr;
  }

  .settings-module-side {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-check-grid,
  .settings-required-grid {
    grid-template-columns: 1fr;
  }

  .print-template-row,
  .settings-line {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .print-template-controls {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .print-template-controls select {
    min-width: 0;
    flex: 1 1 180px;
  }

  .settings-data-list p {
    grid-template-columns: 1fr;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }
}

/* Login */
body.auth-lock .app-shell,
body.auth-lock .activity-panel {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 96px 22px 28px;
}

.login-screen[hidden] {
  display: none;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 16, 31, 0.86) 0%, rgba(8, 16, 31, 0.58) 42%, rgba(8, 16, 31, 0.82) 100%),
    linear-gradient(180deg, rgba(10, 18, 33, 0.18), rgba(10, 18, 33, 0.68)),
    url("/assets/lola-erp-login-bg.png") center/cover no-repeat,
    #0b1324;
}

.login-backdrop::before {
  content: "";
  position: absolute;
  top: 30px;
  left: 34px;
  width: 178px;
  height: 74px;
  background: url("/assets/fugalo-logo.png") left center/contain no-repeat;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.28));
}

.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 30px 24px 20px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 30px 90px rgba(4, 12, 24, 0.42);
  backdrop-filter: blur(6px);
}

.login-logo {
  display: grid;
  align-items: center;
  justify-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
  text-align: center;
}

.login-logo img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 10px 28px rgba(241, 90, 36, 0.16);
}

.login-logo strong,
.login-logo span {
  display: block;
}

.login-logo strong {
  color: #101828;
  font-size: 20px;
  line-height: 1.1;
}

.login-logo span {
  color: #667085;
  font-size: 12px;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 760;
}

.login-card input[type="text"],
.login-card input[type="password"],
.login-card input:not([type]) {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfd6e3;
  border-radius: 7px;
  padding: 8px 11px;
}

.login-card input:focus {
  border-color: #f15a24;
  box-shadow: 0 0 0 3px rgba(241, 90, 36, 0.13);
  outline: 0;
}

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

.login-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.login-row button {
  min-height: 28px;
  padding: 0;
  border: 0;
  color: #006df0;
  background: transparent;
  font-size: 12px;
}

.login-submit,
.google-login {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  font-weight: 850;
}

.login-submit {
  background: #f15a24;
  border-color: #f15a24;
}

.google-login {
  border-color: #d0d5dd;
  background: #fff;
  color: #344054;
}

#loginMessage {
  min-height: 18px;
  color: #b42318;
  text-align: center;
  font-size: 12px;
}

/* Mobile shell hardening */
@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    min-width: 0;
  }

  .app-shell {
    width: 100%;
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px;
    padding: 0;
  }

  .app-main {
    width: 100%;
    min-width: 0;
    gap: 10px;
  }

  .rail-nav,
  body.sidebar-collapsed .rail-nav,
  body[data-layout="compact"] .rail-nav,
  body[data-layout="vertical"] .rail-nav,
  body[data-layout="mobile"] .rail-nav {
    position: sticky;
    top: 0;
    z-index: 120;
    width: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 1fr;
    align-items: center;
    justify-items: stretch;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 0 0 18px 18px;
    overflow: visible;
  }

  .rail-brand {
    min-width: 0;
    justify-self: start;
  }

  .rail-logo {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 14px;
  }

  .rail-logo img {
    width: 32px;
    height: 32px;
  }

  .erp-menu-title {
    display: none;
  }

  .rail-stack {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-self: stretch;
    align-self: center;
    gap: 8px;
    padding: 6px;
    border-radius: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .rail-stack::-webkit-scrollbar {
    display: none;
  }

  .rail-nav .tab,
  body.sidebar-collapsed .rail-nav .tab {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 12px;
    scroll-snap-align: center;
  }

  .tab-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 18px;
  }

  .rail-nav .tab::after,
  body.sidebar-collapsed .rail-nav .tab::after {
    content: none !important;
    display: none !important;
  }

  .account-dock {
    align-self: center;
    justify-self: end;
  }

  .rail-account {
    width: 40px;
    min-height: 40px;
    border-radius: 12px;
  }

  .account-menu {
    right: 0;
    bottom: auto;
    left: auto;
    top: 48px;
    max-width: calc(100vw - 24px);
  }

  .app-main .topbar,
  .topbar {
    position: sticky;
    top: 64px;
    z-index: 80;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    border-radius: 0 0 14px 14px;
  }

  .brand {
    min-width: 0;
    gap: 10px;
  }

  .brand img {
    width: 118px;
    max-width: 42vw;
  }

  .brand h1 {
    font-size: 18px;
    line-height: 1.2;
  }

  .brand p {
    font-size: 12px;
    white-space: normal;
  }

  .actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .actions .status {
    flex: 1 1 100%;
    white-space: normal;
  }

  main,
  .app-main main {
    padding: 10px;
  }

  .app-main .metrics,
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
  }

  .metric {
    min-width: 0;
    padding: 12px;
  }

  .metric strong {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .workspace,
  .workspace.workspace-full {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px;
  }

  .dashboard-side {
    display: none !important;
  }

  .panel.content,
  .content {
    min-width: 0;
    min-height: calc(100dvh - 190px);
    border-radius: 14px;
    overflow: hidden;
  }

  .content-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }

  .content-head > div:first-child {
    min-width: 0;
  }

  .content-head h2 {
    font-size: 18px;
  }

  .content-head p {
    font-size: 12px;
    white-space: normal;
  }

  .view-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 8px;
  }

  .content-head input,
  .view-tools input,
  .view-tools #searchInput {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .view-tools button {
    width: 100%;
    min-width: 0;
    padding: 8px 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view {
    min-width: 0;
    padding: 12px;
  }

  .table-wrap,
  .purchase-table-wrap,
  .inventory-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .product-table table {
    min-width: 920px;
  }

  th,
  td {
    padding: 9px 10px;
    font-size: 13px;
  }

  .pagination,
  .table-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  body[data-view="overview"] main {
    padding: 10px;
  }

  body[data-view="overview"] .overview-dashboard {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 0;
  }

  body[data-view="overview"] .overview-aside {
    order: 2;
  }

  body[data-view="overview"] .today-stats,
  body[data-view="overview"] .overview-grid-2 {
    grid-template-columns: 1fr;
  }

  body[data-view="overview"] .overview-card,
  body[data-view="overview"] .overview-chart {
    overflow: hidden;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal,
  .small-modal,
  .receipt-modal,
  .label-modal,
  .print-preview-modal,
  .zoom-modal,
  .purchase-entry-modal,
  .purchase-doc-modal,
  .purchase-price-modal,
  .product-edit-modal,
  .partner-editor-modal,
  .profile-detail-modal,
  .user-modal,
  .receipt-print-modal,
  .warehouse-picker-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 96dvh !important;
    margin: 0 !important;
    border-radius: 18px 18px 0 0 !important;
  }

  .modal-body {
    max-height: calc(96dvh - 124px);
    overflow: auto;
  }

  .modal-foot {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }

  .modal-foot button {
    flex: 1 1 auto;
    min-width: 110px;
  }

  .purchase-entry-modal {
    height: 96dvh;
    display: flex;
    flex-direction: column;
  }

  .purchase-entry-modal .purchase-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    min-height: 0;
    height: 100%;
    overflow: auto;
  }

  .purchase-entry-modal .purchase-workspace {
    padding: 10px;
  }

  .purchase-entry-modal .purchase-search {
    grid-template-columns: 34px minmax(0, 1fr) 36px;
    align-items: center;
  }

  .purchase-entry-modal .purchase-search strong {
    grid-column: 1 / -1;
    font-size: 18px;
  }

  .purchase-entry-modal .purchase-search-box {
    min-width: 0;
  }

  .purchase-entry-modal .purchase-table-wrap {
    min-height: 360px;
  }

  .purchase-entry-modal table {
    min-width: 760px;
  }

  .purchase-entry-modal .purchase-suggest {
    right: 8px;
    left: 8px !important;
    width: auto !important;
    max-width: none;
    max-height: min(58dvh, 420px);
  }

  .purchase-entry-modal .suggest-list {
    max-height: min(48dvh, 340px);
  }

  .purchase-entry-modal .purchase-side {
    max-height: none;
    border-top: 1px solid #e4e7ec;
    border-left: 0;
  }

  .purchase-entry-modal .purchase-side-top {
    grid-template-columns: 1fr;
  }

  .purchase-entry-modal .purchase-side-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
  }

  .product-edit-modal {
    height: 96dvh;
  }

  .product-edit-modal .product-edit-head {
    padding: 14px 14px 10px;
  }

  .product-edit-modal .product-edit-head p {
    white-space: normal;
  }

  .product-edit-modal .modal-tabs {
    padding: 0 14px;
    overflow-x: auto;
  }

  .product-edit-modal .product-edit-body {
    padding: 12px;
  }

  .product-edit-modal .product-edit-grid,
  .product-edit-modal .product-edit-head,
  .product-edit-modal .product-edit-body,
  .product-edit-modal .edit-row {
    grid-template-columns: 1fr !important;
  }

  .product-edit-modal .product-image-panel {
    order: -1;
    width: 100%;
    position: static;
  }

  .product-edit-modal .product-edit-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-edit-modal .edit-image-main img {
    width: 100%;
  }

  .settings-page,
  .admin-layout,
  .compact-admin-layout,
  .profile-layout,
  .customer-detail-grid,
  .supplier-detail-grid,
  .config-grid {
    grid-template-columns: 1fr !important;
  }

  .activity-fab {
    right: 16px;
    bottom: 16px;
    left: auto;
    z-index: 160;
    width: 50px;
    height: 50px;
  }

  .activity-drawer {
    width: min(100vw, 420px);
    max-width: 100vw;
  }
}

@media print {
  @page {
    size: 46mm auto;
    margin: 0;
  }

  body.printing-receipt * {
    visibility: hidden !important;
  }

  body.printing-receipt .receipt-print-stage,
  body.printing-receipt .receipt-print-stage * {
    visibility: visible !important;
  }

  body.printing-receipt #modalRoot,
  body.printing-receipt .modal-backdrop,
  body.printing-receipt .receipt-print-modal {
    visibility: visible !important;
  }

  body.printing-receipt .modal-backdrop {
    position: static !important;
    display: block !important;
    padding: 0 !important;
    background: transparent !important;
  }

  body.printing-receipt .receipt-print-modal {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-receipt .modal-head,
  body.printing-receipt .print-template-bar {
    display: none !important;
  }

  body.printing-receipt .receipt-print-stage {
    position: static !important;
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    background: transparent !important;
  }

  body.printing-receipt .receipt-print-sheet {
    width: 46mm !important;
    min-height: 0 !important;
    padding: 3mm !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-receipt .receipt-print-sheet.receipt80 {
    width: 80mm !important;
  }

  body.printing-receipt .receipt-print-sheet.a5 {
    width: 148mm !important;
    min-height: 210mm !important;
    padding: 10mm !important;
  }
}

@media (max-width: 560px) {
  .app-shell {
    gap: 0;
  }

  .rail-nav,
  body.sidebar-collapsed .rail-nav {
    padding: 8px;
    border-radius: 0 0 16px 16px;
  }

  .rail-logo,
  .rail-account {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 12px;
  }

  .rail-logo img {
    width: 28px;
    height: 28px;
  }

  .rail-stack {
    gap: 6px;
    padding: 5px;
    border-radius: 16px;
  }

  .rail-nav .tab,
  body.sidebar-collapsed .rail-nav .tab,
  .tab-icon {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 11px;
    font-size: 16px;
  }

  .app-main .topbar,
  .topbar {
    top: 54px;
    padding: 10px;
  }

  .brand img {
    display: none;
  }

  .actions button {
    flex: 1 1 calc(50% - 6px);
  }

  main,
  .app-main main {
    padding: 8px;
  }

  .app-main .metrics,
  .metrics {
    grid-template-columns: 1fr;
  }

  .view-tools {
    grid-template-columns: 1fr;
  }

  .view-tools button {
    min-height: 36px;
  }

  #view {
    padding: 10px;
  }

  .modal,
  .small-modal,
  .receipt-modal,
  .label-modal,
  .print-preview-modal,
  .zoom-modal,
  .purchase-entry-modal,
  .purchase-doc-modal,
  .purchase-price-modal,
  .product-edit-modal,
  .partner-editor-modal,
  .profile-detail-modal,
  .user-modal,
  .warehouse-picker-modal {
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }

  .modal-body {
    max-height: calc(100dvh - 120px);
  }

  .product-edit-modal .product-edit-stats {
    grid-template-columns: 1fr;
  }

  .product-edit-modal .edit-image-thumbs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .purchase-entry-modal .purchase-search {
    grid-template-columns: 32px minmax(0, 1fr) 34px;
  }

  .purchase-entry-modal .purchase-suggest .suggest-list > button {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .purchase-entry-modal .purchase-suggest img {
    width: 40px;
    height: 40px;
  }

  .activity-drawer {
    width: 100vw;
  }
}

/* Final mobile overrides: keep these last to beat older layout modes. */
@media (max-width: 900px) {
  body.sidebar-collapsed .rail-stack,
  body[data-layout="compact"] .rail-stack,
  body[data-layout="vertical"] .rail-stack,
  body[data-layout="mobile"] .rail-stack {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-self: stretch;
    gap: 8px;
    padding: 6px;
    border-radius: 18px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  body.sidebar-collapsed .rail-nav .tab,
  body[data-layout="compact"] .rail-nav .tab,
  body[data-layout="vertical"] .rail-nav .tab,
  body[data-layout="mobile"] .rail-nav .tab {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 12px;
  }

  body.sidebar-collapsed .rail-nav .tab .tab-icon,
  body[data-layout="compact"] .rail-nav .tab .tab-icon,
  body[data-layout="vertical"] .rail-nav .tab .tab-icon,
  body[data-layout="mobile"] .rail-nav .tab .tab-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 18px;
  }

  body.sidebar-collapsed .rail-nav .tab .tab-text,
  body[data-layout="compact"] .rail-nav .tab .tab-text {
    display: none;
  }

  .settings-page {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .settings-nav {
    position: sticky;
    top: 116px;
    z-index: 60;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .settings-nav-group {
    flex: 0 0 auto;
    min-width: 170px;
    padding: 6px;
    border: 1px solid #eef2f6;
    border-radius: 10px;
    background: #fff;
  }

  .settings-nav-group > span {
    padding: 4px 6px 6px;
    white-space: nowrap;
  }

  .settings-nav button {
    width: 100%;
    min-height: 36px;
    white-space: nowrap;
  }

  .settings-toolbar,
  .settings-card-head,
  .settings-actions,
  .profile-toolbar,
  .stock-toolbar,
  .pagination-bar,
  .receipt-meta,
  .label-layout,
  .grid-two {
    display: grid;
    grid-template-columns: 1fr !important;
    align-items: stretch;
  }

  .settings-toolbar input,
  .profile-toolbar select,
  .settings-actions button,
  .stock-toolbar button,
  .pagination-bar label,
  .pager-buttons {
    width: 100%;
    min-width: 0;
  }

  .detail-tabs,
  .modal-tabs {
    gap: 16px;
    overflow-x: auto;
    padding-inline: 12px;
    -webkit-overflow-scrolling: touch;
  }

  .detail-tabs button,
  .modal-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .detail-main {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .detail-image,
  .detail-image-zoom {
    width: 72px;
    height: 72px;
    min-height: 72px;
  }

  .detail-grid,
  .label-templates,
  .edit-grid,
  .edit-row,
  .user-form-grid,
  .user-form-grid.inner,
  .access-row,
  .partner-editor-modal .edit-row,
  .config-grid {
    grid-template-columns: 1fr !important;
  }

  .detail-actions,
  .purchase-detail .detail-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .detail-actions button {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .profile-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-module-grid,
  .overview-grid-2,
  .today-stats {
    grid-template-columns: 1fr !important;
  }

  .activity-feed {
    max-height: none;
  }

  .user-modal .modal-body,
  .partner-editor-modal .modal-body,
  .profile-detail-modal .modal-body,
  .purchase-doc-modal .modal-body,
  .purchase-price-modal .modal-body {
    padding: 12px;
  }

  .permission-line {
    align-items: flex-start;
    line-height: 1.35;
  }

  .modal-head {
    gap: 10px;
  }

  .modal-head h3 {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .zoom-toolbar {
    justify-content: stretch;
    overflow-x: auto;
  }

  .zoom-toolbar button {
    flex: 1 0 auto;
  }
}

@media (max-width: 560px) {
  body.sidebar-collapsed .rail-stack,
  body[data-layout="compact"] .rail-stack,
  body[data-layout="vertical"] .rail-stack,
  body[data-layout="mobile"] .rail-stack {
    gap: 6px;
    padding: 5px;
  }

  body.sidebar-collapsed .rail-nav .tab,
  body[data-layout="compact"] .rail-nav .tab,
  body[data-layout="vertical"] .rail-nav .tab,
  body[data-layout="mobile"] .rail-nav .tab,
  body.sidebar-collapsed .rail-nav .tab .tab-icon,
  body[data-layout="compact"] .rail-nav .tab .tab-icon,
  body[data-layout="vertical"] .rail-nav .tab .tab-icon,
  body[data-layout="mobile"] .rail-nav .tab .tab-icon {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 11px;
  }

  .settings-nav {
    top: 104px;
  }

  .settings-nav-group {
    min-width: 152px;
  }

  .detail-main {
    grid-template-columns: 1fr;
  }

  .detail-actions button,
  .modal-foot button {
    flex-basis: 100%;
  }

  .profile-metrics {
    grid-template-columns: 1fr !important;
  }

  .login-screen {
    padding: 12px;
  }

  .login-card {
    width: min(396px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    padding: 22px 16px 16px;
  }

  .login-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Brand system hardening */
:root {
  --font-ui: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-icon: "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  --fugalo: #f15a24;
  --fugalo-dark: #c2410c;
  --fugalo-soft: #fff4ed;
  --accent: var(--fugalo);
  --accent-dark: var(--fugalo-dark);
  --accent-soft: var(--fugalo-soft);
}

html,
body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

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

.tab-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-icon svg path {
  vector-effect: non-scaling-stroke;
}

.settings-nav i {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: inherit;
  font-family: var(--font-icon);
}

.settings-nav i svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.activity-fab svg,
.quick-setup svg,
.chat-reply button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-reply button,
.quick-setup {
  display: inline-grid;
  place-items: center;
}

.tab-icon,
.icon-button,
.round-action,
.more,
.activity-fab,
.rail-chevron,
.account-menu b,
[data-page-go],
[data-purchase-page-go] {
  font-family: var(--font-icon);
}

.primary,
.login-submit,
.purchase-entry-modal .suggest-foot button,
.purchase-entry-modal .purchase-side-actions .primary,
.channel-connect-grid button,
.activity-fab {
  background: var(--fugalo);
  border-color: var(--fugalo);
  color: #ffffff;
}

.primary:hover,
.login-submit:hover,
.purchase-entry-modal .suggest-foot button:hover,
.purchase-entry-modal .purchase-side-actions .primary:hover {
  background: var(--fugalo-dark);
  border-color: var(--fugalo-dark);
}

.tab.active,
.tab:hover,
.rail-nav .tab.active,
.rail-nav .tab:hover,
body[data-layout="compact"] .rail-nav .tab.active,
body[data-layout="compact"] .rail-nav .tab:hover,
body[data-layout="vertical"] .rail-nav .tab.active,
body[data-layout="vertical"] .rail-nav .tab:hover {
  border-color: #fed7aa;
  background: var(--fugalo-soft);
  color: var(--fugalo);
}

.rail-nav .tab.active .tab-icon,
body.sidebar-collapsed .rail-nav .tab.active .tab-icon,
body[data-layout="compact"] .rail-nav .tab.active .tab-icon,
body[data-layout="vertical"] .rail-nav .tab.active .tab-icon,
body[data-layout="mobile"] .rail-nav .tab.active .tab-icon {
  background: var(--fugalo);
  color: #ffffff;
}

body.sidebar-collapsed .rail-stack {
  background: linear-gradient(180deg, #1f2937 0%, #334155 48%, var(--fugalo) 100%);
  box-shadow: 0 18px 36px rgba(241, 90, 36, 0.22);
}

.overview-card-head h3 span,
.overview-tabs button.active,
.detail-tabs button.active,
.settings-nav button.active,
.link-button,
a {
  color: var(--fugalo);
}

.overview-tabs button.active,
.detail-tabs button.active {
  border-bottom-color: var(--fugalo);
}

.content-head input:focus,
.login-card input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--fugalo);
  box-shadow: 0 0 0 3px rgba(241, 90, 36, 0.13);
  outline: 0;
}

.login-card {
  width: min(396px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
}

/* Mobile navigation redesign: bottom app bar with larger tap targets. */
@media (max-width: 900px) {
  .app-shell,
  body.sidebar-collapsed[data-layout="vertical"] .app-shell,
  body.sidebar-collapsed[data-layout="compact"] .app-shell {
    display: block;
    min-height: 100dvh;
    padding-bottom: 76px;
  }

  .rail-nav,
  body.sidebar-collapsed .rail-nav,
  body[data-layout="compact"] .rail-nav,
  body[data-layout="vertical"] .rail-nav,
  body[data-layout="mobile"] .rail-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 260;
    width: 100%;
    height: 72px;
    min-height: 72px;
    display: block;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid #e4e7ec;
    border-radius: 18px 18px 0 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -14px 34px rgba(16, 24, 40, 0.14);
    backdrop-filter: blur(16px);
  }

  .rail-brand,
  .account-dock,
  .rail-logo,
  .erp-menu-title {
    display: none !important;
  }

  .rail-stack,
  body.sidebar-collapsed .rail-stack,
  body[data-layout="compact"] .rail-stack,
  body[data-layout="vertical"] .rail-stack,
  body[data-layout="mobile"] .rail-stack {
    width: 100%;
    height: 58px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
    padding: 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .rail-stack::-webkit-scrollbar {
    display: none;
  }

  .rail-nav .tab,
  body.sidebar-collapsed .rail-nav .tab,
  body[data-layout="compact"] .rail-nav .tab,
  body[data-layout="vertical"] .rail-nav .tab,
  body[data-layout="mobile"] .rail-nav .tab {
    flex: 0 0 76px;
    width: 76px;
    height: 56px;
    min-height: 56px;
    display: grid;
    grid-template-rows: 25px 1fr;
    place-items: center;
    gap: 2px;
    padding: 5px 4px 4px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: #475467;
    background: transparent;
    scroll-snap-align: center;
  }

  .rail-nav .tab .tab-icon,
  body.sidebar-collapsed .rail-nav .tab .tab-icon,
  body[data-layout="compact"] .rail-nav .tab .tab-icon,
  body[data-layout="vertical"] .rail-nav .tab .tab-icon,
  body[data-layout="mobile"] .rail-nav .tab .tab-icon {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: transparent;
    color: currentColor;
    font-size: 17px;
    line-height: 1;
  }

  .rail-nav .tab .tab-text,
  body.sidebar-collapsed .rail-nav .tab .tab-text,
  body[data-layout="compact"] .rail-nav .tab .tab-text,
  body[data-layout="vertical"] .rail-nav .tab .tab-text,
  body[data-layout="mobile"] .rail-nav .tab .tab-text {
    display: block;
    max-width: 68px;
    opacity: 1;
    color: currentColor;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rail-nav .tab.active,
  .rail-nav .tab:hover,
  body.sidebar-collapsed .rail-nav .tab.active,
  body.sidebar-collapsed .rail-nav .tab:hover,
  body[data-layout="compact"] .rail-nav .tab.active,
  body[data-layout="compact"] .rail-nav .tab:hover {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #f15a24;
  }

  .rail-nav .tab.active .tab-icon,
  body.sidebar-collapsed .rail-nav .tab.active .tab-icon {
    background: #f15a24;
    color: #ffffff;
    box-shadow: none;
  }

  .rail-nav .tab::after,
  body.sidebar-collapsed .rail-nav .tab::after {
    content: none !important;
  }

  .app-main .topbar,
  .topbar {
    top: 0;
    border-radius: 0 0 14px 14px;
  }

  main,
  .app-main main {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .settings-nav {
    top: 92px;
  }

  .activity-fab {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .rail-nav,
  body.sidebar-collapsed .rail-nav,
  body[data-layout="compact"] .rail-nav,
  body[data-layout="vertical"] .rail-nav,
  body[data-layout="mobile"] .rail-nav {
    height: 70px;
    min-height: 70px;
    padding-inline: 6px;
  }

  .rail-nav .tab,
  body.sidebar-collapsed .rail-nav .tab,
  body[data-layout="compact"] .rail-nav .tab,
  body[data-layout="vertical"] .rail-nav .tab,
  body[data-layout="mobile"] .rail-nav .tab {
    flex-basis: 70px;
    width: 70px;
  }

  .rail-nav .tab .tab-text,
  body.sidebar-collapsed .rail-nav .tab .tab-text,
  body[data-layout="compact"] .rail-nav .tab .tab-text,
  body[data-layout="vertical"] .rail-nav .tab .tab-text,
  body[data-layout="mobile"] .rail-nav .tab .tab-text {
    max-width: 62px;
    font-size: 9.5px;
  }
}

/* Mobile typography and controls polish */
@media (max-width: 900px) {
  body {
    font-size: 13px;
  }

  .topbar,
  .app-main .topbar {
    gap: 10px;
    padding: 14px 12px 12px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
  }

  .brand {
    display: block;
  }

  .brand h1 {
    margin: 0 0 4px;
    color: #101828;
    font-size: 18px;
    font-weight: 850;
    line-height: 1.25;
  }

  .brand p {
    margin: 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.35;
  }

  .actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
  }

  .actions .status {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #f8fafc;
    color: #344054;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .actions #syncButton {
    min-width: 142px;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 10px;
    background: #f15a24;
    border-color: #f15a24;
    color: #ffffff;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.2;
    white-space: nowrap;
  }

  .content-head {
    padding: 10px;
    border-radius: 14px;
    border: 1px solid #e4e7ec;
    background: #ffffff;
  }

  .content-head h2 {
    font-size: 17px;
    font-weight: 850;
    line-height: 1.25;
  }

  .content-head p {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
  }

  .view-tools {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .content-head input,
  .view-tools input,
  .view-tools #searchInput {
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 13px;
  }

  .view-tools button {
    min-height: 40px;
    border-radius: 8px;
    background: #ffffff;
    font-size: 13px;
    font-weight: 760;
  }

  .view-tools #createButton {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #c2410c;
  }

  .view-tools #helpButton {
    width: 40px;
    max-width: 40px;
    min-height: 40px;
    justify-self: start;
    border-radius: 999px;
    background: #ffffff;
  }

  .panel.content,
  .content {
    background: #ffffff;
    border-radius: 14px;
  }

  #view {
    padding: 10px;
  }

  .empty {
    padding: 28px 14px;
    font-size: 13px;
    line-height: 1.45;
  }
}

@media (max-width: 560px) {
  .topbar,
  .app-main .topbar {
    padding: 12px 10px 10px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .brand p {
    font-size: 11.5px;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .actions .status,
  .actions #syncButton {
    min-height: 44px;
    font-size: 11.5px;
  }

  .actions .status {
    border-radius: 999px;
  }

  .actions #syncButton {
    min-width: 0;
    white-space: normal;
  }
}

/* Mobile button system */
@media (max-width: 900px) {
  button,
  .primary,
  .link-button,
  .view-tools button,
  .detail-actions button,
  .settings-actions button,
  .modal-foot button,
  .side-actions button,
  .quick-links button {
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 760;
    line-height: 1.2;
  }

  .primary,
  button.primary,
  .modal-foot .primary,
  .detail-actions .primary,
  .view-tools #createButton {
    border-color: #f15a24;
    background: #f15a24;
    color: #ffffff;
  }

  .view-tools #createButton {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
  }

  .link-button {
    min-height: auto;
    padding: 0;
    border-radius: 0;
    font-size: 12px;
    color: #0b63f6;
    background: transparent;
  }

  .detail-actions,
  .purchase-detail .detail-actions,
  .modal-foot,
  .settings-actions,
  .side-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .detail-actions button,
  .purchase-detail .detail-actions button,
  .modal-foot button,
  .settings-actions button,
  .side-actions button {
    width: 100%;
    min-width: 0;
    flex: initial;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .detail-actions button:only-child,
  .modal-foot button:only-child,
  .settings-actions button:only-child,
  .side-actions button:only-child {
    grid-column: 1 / -1;
  }

  .detail-actions button:last-child:nth-child(odd),
  .modal-foot button:last-child:nth-child(odd),
  .settings-actions button:last-child:nth-child(odd),
  .side-actions button:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .view-tools {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .view-tools button,
  .view-tools input {
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
  }

  .view-tools #helpButton {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    padding: 0;
    font-size: 13px;
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
  }

  .action-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-module-card,
  .today-stat,
  .overview-hbar,
  .overview-activity,
  .mini-actions button {
    min-height: 44px;
    border-radius: 10px;
    font-size: 12px;
  }

  .settings-nav button {
    min-height: 36px;
    padding: 8px 9px;
    border-radius: 8px;
    font-size: 12px;
  }

  .rail-nav .tab {
    min-height: 56px;
    padding: 5px 4px 4px;
  }
}

@media (max-width: 560px) {
  button,
  .primary,
  .view-tools button,
  .detail-actions button,
  .settings-actions button,
  .modal-foot button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 11.5px;
  }

  .detail-actions,
  .purchase-detail .detail-actions,
  .modal-foot,
  .settings-actions,
  .side-actions {
    grid-template-columns: 1fr;
  }

  .view-tools #helpButton {
    width: 38px;
    min-width: 38px;
    max-width: 38px;
    min-height: 38px;
  }
}

@media (max-width: 900px) {
  .toast-root {
    left: 10px;
    right: 10px;
    bottom: 78px;
    width: auto;
  }

  .toast {
    border-radius: 11px;
    padding: 11px 11px 11px 13px;
  }

  .toast span {
    font-size: 12px;
  }
}
