: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;
}

.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;
}

.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%);
}

.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) 34px;
  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,
.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,
.line-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef2f7;
  vertical-align: middle;
}

.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-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;
}

.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 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;
}

.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);
}

@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) 34px;
  gap: 8px;
  margin-bottom: 10px;
}

.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 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 .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));
  }
}

/* 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;
}

.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) {
  .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: 22px;
}

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

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(17, 24, 39, 0.72), rgba(17, 24, 39, 0.76)),
    url("/assets/fugalo-logo.png") center/520px auto no-repeat,
    linear-gradient(135deg, #111827, #374151);
}

.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(396px, 100%);
  padding: 28px 22px 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.login-logo img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
}

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

.login-logo strong {
  color: #101828;
  font-size: 18px;
}

.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;
}
