:root {
  --ink: #10211f;
  --muted: #66736f;
  --deep-emerald: #083c36;
  --emerald: #0f766e;
  --soft-emerald: #e3f5f1;
  --pearl: #f5f8f7;
  --card: #ffffff;
  --line: #dfe8e5;
  --gold: #c8a15a;
  --gold-soft: #fff6df;
  --danger: #a33a45;
  --danger-soft: #fde5e8;
  --shadow: 0 12px 30px rgba(8, 60, 54, 0.08);
  --soft-shadow: 0 6px 18px rgba(8, 60, 54, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #f3f7f6;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 60, 54, 0.94);
}

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

.login-card {
  width: min(420px, 100%);
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.login-card img {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 16px;
}

.login-card h2,
.login-card p {
  text-align: center;
}

.login-message {
  margin: 10px 0;
  color: var(--danger);
  font-weight: 800;
}

.login-secondary-button {
  width: 100%;
  margin-top: 10px;
}

.user-badge {
  margin: 12px 0;
  color: #d8e8e4;
  font-size: 0.9rem;
  font-weight: 800;
}

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

.app-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 4vw 58px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(8, 60, 54, 0.99), rgba(9, 78, 71, 0.96)),
    var(--deep-emerald);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 820px;
}

.logo-frame {
  flex: 0 0 auto;
  border: 1px solid rgba(200, 161, 90, 0.4);
  border-radius: 8px;
  padding: 7px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.header-logo {
  display: block;
  width: 86px;
  height: auto;
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.header-note {
  max-width: 570px;
  margin-bottom: 0;
  color: #d8e8e4;
  font-size: 0.92rem;
  line-height: 1.45;
}

.header-card {
  display: grid;
  align-content: center;
  min-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.header-card span {
  margin-bottom: 8px;
  color: #bddbd5;
  font-size: 0.9rem;
}

.header-card strong {
  color: #ffffff;
  font-size: 0.98rem;
  line-height: 1.35;
}

.cloud-connection-badge {
  margin: 10px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 7px 9px;
  color: #d8e8e4;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  font-weight: 900;
}

.cloud-connection-badge.success {
  border-color: rgba(143, 220, 167, 0.65);
  color: #dff7e8;
  background: rgba(19, 114, 66, 0.28);
}

.cloud-connection-badge.warning {
  border-color: rgba(246, 205, 103, 0.7);
  color: #fff4cf;
  background: rgba(133, 91, 10, 0.3);
}

.cloud-connection-badge.error {
  border-color: rgba(255, 166, 166, 0.7);
  color: #ffe0e0;
  background: rgba(143, 21, 21, 0.3);
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  width: min(1640px, 100%);
  margin: -36px auto 0;
  padding: 0 4vw 44px;
}

.dashboard-tabs {
  position: sticky;
  top: 18px;
  align-self: start;
  display: grid;
  gap: 6px;
  border: 1px solid #dfe8e5;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.sidebar-title {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 4px 4px 12px;
  margin-bottom: 4px;
}

.sidebar-title span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-title strong {
  color: var(--deep-emerald);
  font-size: 1.08rem;
}

.tab-button {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--deep-emerald);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.tab-button.active,
.tab-button:hover {
  color: #ffffff;
  background: linear-gradient(135deg, var(--deep-emerald), var(--emerald));
  transform: translateX(2px);
}

.dashboard-section {
  display: none;
}

.dashboard-section.active {
  display: block;
  min-width: 0;
}

.app-footer {
  display: flex;
  justify-content: center;
  padding: 4px 5vw 32px;
}

.app-footer a {
  display: inline-flex;
  align-items: center;
  opacity: 0.58;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-footer a:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.app-footer img {
  width: 96px;
  height: auto;
  filter: saturate(0.9);
}

.card {
  border: 1px solid #dfe8e5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(300px, 410px) 1fr;
  gap: 18px;
}

#inventoryFormHome {
  min-width: 0;
}

.form-panel,
.table-panel {
  min-width: 0;
  padding: 20px;
}

.form-panel {
  align-self: start;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-kicker {
  margin-bottom: 5px;
  color: var(--emerald);
  font-size: 0.72rem;
}

#itemCount {
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: var(--pearl);
  font-size: 0.88rem;
  font-weight: 700;
}

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

.muted-text {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8e3e0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
  background: #fbfdfc;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #9aa8a4;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--emerald);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

textarea {
  resize: vertical;
}

.image-upload-panel {
  display: grid;
  gap: 12px;
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.image-preview-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  border: 1px dashed #cbd9d5;
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  background: #ffffff;
}

.image-preview {
  display: none;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
}

.image-preview.show {
  display: block;
}

.image-preview-box p {
  margin-bottom: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.notes-label {
  margin-top: 15px;
}

.primary-button,
.secondary-button,
.action-button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button {
  width: 100%;
  margin-top: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--deep-emerald), var(--emerald));
  box-shadow: 0 14px 26px rgba(15, 118, 110, 0.24);
}

.primary-button:hover,
.secondary-button:hover,
.action-button:hover {
  transform: translateY(-1px);
}

.primary-button:hover {
  background: linear-gradient(135deg, #062f2b, #0c675f);
}

.secondary-button {
  color: var(--deep-emerald);
  background: var(--soft-emerald);
}

.secondary-button:hover {
  background: #d3eee8;
}

.small-button {
  justify-self: start;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.tools {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.advanced-search-panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #ffffff;
}

.advanced-search-panel summary {
  color: var(--deep-emerald);
  font-weight: 900;
  cursor: pointer;
}

.advanced-search-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfc;
}

.chart-card h3 {
  margin: 0 0 12px;
  color: var(--deep-emerald);
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(110px, 2fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.chart-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e5efec;
}

.chart-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--deep-emerald), var(--gold));
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.8fr) minmax(150px, 0.4fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.import-panel h3 {
  margin: 0 0 7px;
  color: var(--deep-emerald);
}

.import-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfc;
}

.file-label {
  align-self: stretch;
}

.import-summary {
  display: none;
  grid-column: 1 / -1;
  border: 1px solid #d7e8e3;
  border-radius: 8px;
  padding: 12px;
  color: var(--deep-emerald);
  background: var(--soft-emerald);
}

.import-summary.show {
  display: grid;
  gap: 5px;
}

.import-debug-box {
  display: none;
  gap: 5px;
  margin-bottom: 18px;
  border: 1px solid #ead7a3;
  border-radius: 8px;
  padding: 12px;
  color: #66501d;
  background: #fffaf0;
}

.import-debug-box.show {
  display: grid;
}

.column-guide {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.column-guide h3 {
  margin: 0 0 10px;
  color: var(--deep-emerald);
}

.column-guide p {
  margin-bottom: 7px;
  color: var(--muted);
}

.import-actions {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.import-actions.show {
  display: flex;
}

.report-button {
  margin-top: 12px;
}

.import-preview-wrap table {
  min-width: 1160px;
}

.import-error-row td {
  background: #fff2f3;
}

.import-warning-row td {
  background: #fffaf0;
}

.import-skipped-row td {
  color: #7f8d89;
  background: #f4f7f6;
}

.import-update-row td {
  background: #f0faf7;
}

.import-history-heading {
  margin-top: 24px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.inventory-sku-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #ffffff;
}

tr:hover .inventory-sku-cell {
  background: #f7fbfa;
}

.sku-edit-button {
  border: 0;
  padding: 3px 0;
  color: var(--deep-emerald);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.sku-edit-button:hover {
  color: var(--emerald);
}

.sku-edit-button:disabled {
  color: #73817e;
  cursor: not-allowed;
  text-decoration: none;
}

.inventory-edit-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: #f3f7f6;
  box-shadow: 0 24px 80px rgba(8, 60, 54, 0.3);
}

.inventory-edit-dialog::backdrop {
  background: rgba(5, 31, 28, 0.72);
}

.inventory-edit-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: #ffffff;
}

.inventory-edit-toolbar span,
.inventory-edit-toolbar strong {
  display: block;
}

.inventory-edit-toolbar span {
  margin-bottom: 3px;
  color: var(--emerald);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

#inventoryEditMount {
  padding: 16px;
}

#inventoryEditMount .form-panel {
  width: 100%;
  max-width: none;
  box-shadow: none;
}

#inventoryEditMount .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  border-bottom: 1px solid #edf2f0;
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #31504a;
  background: #edf6f3;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

td {
  color: #314642;
  font-size: 0.88rem;
  line-height: 1.45;
}

.gem-thumbnail {
  display: block;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--pearl);
}

.no-image {
  display: inline-block;
  color: #91a09c;
  font-size: 0.82rem;
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background: #f7fbfa;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-in-stock {
  color: #12603a;
  background: #dff7e8;
}

.status-on-approval {
  color: #72500d;
  background: var(--gold-soft);
}

.status-out {
  color: #72500d;
  background: var(--gold-soft);
}

.status-returned {
  color: #12603a;
  background: #dff7e8;
}

.status-sold {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-recutting {
  color: #31516f;
  background: #e3eef8;
}

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

.action-button {
  padding: 7px 10px;
  font-size: 0.8rem;
}

.edit-button {
  color: var(--deep-emerald);
  background: var(--soft-emerald);
}

.listing-button {
  color: #6f4d10;
  background: var(--gold-soft);
}

.delete-button {
  color: var(--danger);
  background: var(--danger-soft);
}

.return-button {
  color: #12603a;
  background: #dff7e8;
}

.approval-row-out td {
  background: #ffd1d1;
}

.approval-row-out .approval-report-status {
  color: #8f1515;
  font-weight: 900;
}

.approval-row-returned td {
  background: #c9f0d3;
}

.approval-row-returned .approval-report-status {
  color: #0f5a2b;
  font-weight: 900;
}

.approval-row-sold td {
  background: #f6a8b0;
}

.approval-row-sold .approval-report-status {
  color: #6e0d19;
  font-weight: 900;
}

.report-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.report-panel {
  margin-bottom: 20px;
}

.report-panel h3 {
  margin: 0 0 12px;
  color: var(--deep-emerald);
}

.history-view-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.history-view-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--deep-emerald);
  background: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.history-view-button.active,
.history-view-button:hover {
  color: #ffffff;
  border-color: var(--deep-emerald);
  background: var(--deep-emerald);
}

.history-panel-hidden {
  display: none;
}

.timeline-list {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.timeline-item {
  border-left: 4px solid var(--gold);
  padding: 8px 0 8px 12px;
}

.timeline-item strong {
  display: block;
  color: var(--deep-emerald);
}

.timeline-item span {
  display: block;
  margin: 3px 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.timeline-item p {
  margin: 0;
  color: #263b36;
}

.empty-report {
  color: var(--muted);
  font-weight: 800;
}

.seller-statement-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.seller-statement-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.seller-statement-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.seller-statement-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--deep-emerald);
  font-size: 1.25rem;
}

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

.finance-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.finance-card textarea[readonly] {
  margin-top: 12px;
  background: #ffffff;
}

.finance-card .actions {
  margin-top: 12px;
}

.compact-heading {
  margin-bottom: 8px;
}

.compact-heading h3 {
  margin-bottom: 0;
}

.sale-finalization-panel {
  border: 1px solid #b9d8cf;
  border-radius: 8px;
  padding: 18px;
  background: #f7fbfa;
}

.record-lock-badge {
  border: 1px solid #d4bd76;
  border-radius: 999px;
  padding: 7px 10px;
  color: #6f4d10;
  background: #fff8e4;
  font-size: 0.76rem;
  font-weight: 900;
}

.sale-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.input-button-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.input-button-row .secondary-button {
  white-space: nowrap;
}

.sale-stone-preview {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid #b9d8cf;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.sale-stone-preview article {
  min-width: 0;
}

.sale-stone-preview span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sale-stone-preview strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--deep-emerald);
}

.empty-sale-preview {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.sale-submit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.form-message,
.status-message {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.status-message.success,
.form-message.success {
  color: #12603a;
}

.status-message.error,
.form-message.error {
  color: #8f1515;
}

.settings-action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 12px;
  color: #263b36;
  font-weight: 800;
}

.setting-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.permission-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.permission-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.permission-group h4 {
  margin: 0 0 12px;
  color: var(--deep-emerald);
  font-size: 0.95rem;
}

.permission-group label {
  display: grid;
  min-height: 48px;
  align-items: center;
  margin: 10px 0;
  border: 1px solid #e3a4aa;
  border-radius: 8px;
  padding: 12px 14px;
  color: #7f1020;
  background: #ffe4e6;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.permission-group label:hover {
  transform: translateY(-1px);
}

.permission-group label:has(input:checked) {
  border-color: #8bc89c;
  color: #0f5a2b;
  background: #dff7e8;
}

.permission-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.permission-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.permission-badge {
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--deep-emerald);
  background: var(--soft-emerald);
  font-size: 0.76rem;
  font-weight: 900;
}

.overdue-7 td {
  background: #fff4cf;
}

.overdue-14 td {
  background: #ffd9b8;
}

.overdue-30 td {
  background: #ffb7b7;
}

.listing-panel {
  display: none;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfdfc;
}

.listing-panel.show {
  display: block;
}

.listing-description-label {
  margin-top: 14px;
}

.listing-tip {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.approval-layout {
  display: grid;
  grid-template-columns: minmax(300px, 440px) 1fr;
  gap: 24px;
}

.approval-item-entry {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

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

.auto-fill-grid p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfdfc;
}

.auto-fill-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auto-fill-grid strong {
  color: var(--deep-emerald);
  font-size: 0.95rem;
}

.sku-price-history {
  display: none;
  margin-bottom: 14px;
  border: 1px solid #d3b56d;
  border-radius: 8px;
  padding: 14px;
  background: #fff8e4;
}

.sku-price-history.show {
  display: block;
}

.sku-price-history > strong {
  display: block;
  margin-bottom: 10px;
  color: #6f4d10;
}

.sku-price-history p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

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

.price-history-item {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px 12px;
  border: 1px solid #ead7a3;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.price-history-item span,
.price-history-item strong {
  color: var(--deep-emerald);
}

.price-history-item small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 700;
}

.compact-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.approval-items-wrap {
  margin-top: 16px;
}

.approval-items-wrap table {
  min-width: 880px;
}

.inline-price-input,
.inline-status-select {
  min-width: 110px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font: inherit;
}

.approval-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--deep-emerald);
  background: var(--gold-soft);
}

.approval-total span {
  color: #72500d;
  font-weight: 800;
}

.approval-total strong {
  font-size: 1.25rem;
}

.print-area {
  display: none;
}

.print-document {
  color: #172321;
  font-family: Arial, Helvetica, sans-serif;
}

.print-header {
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 2px solid #0f766e;
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.print-header img {
  width: 110px;
  height: auto;
}

.print-header h1 {
  margin: 0 0 4px;
  color: #083c36;
  font-size: 1.8rem;
}

.print-header p {
  margin: 0;
  color: #66736f;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin-bottom: 18px;
}

.print-meta p {
  margin: 0;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}

.print-table th,
.print-table td {
  border: 1px solid #d9e2df;
  padding: 8px;
  text-align: left;
}

.print-table th {
  color: #ffffff;
  background: #083c36;
}

.print-total {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  margin: 16px 0 42px;
  font-size: 1.1rem;
}

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

.signature-grid div {
  border-top: 1px solid #172321;
  padding-top: 10px;
  text-align: center;
}

.label-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 5cm);
  align-items: start;
  gap: 0.18cm;
  color: #172321;
  font-family: Arial, Helvetica, sans-serif;
}

.label-search-tools {
  display: grid;
  grid-template-columns: minmax(220px, 420px);
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.stone-label {
  position: relative;
  display: block;
  width: 6cm;
  height: 95px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: 0 7px;
  font-size: 10px;
  font-weight: 800;
  line-height: 12px;
  page-break-inside: avoid;
  break-inside: avoid;
  background: #ffffff;
}

.label-code-row {
  display: block;
  width: 100%;
  margin-top: 4px;
  color: #000000;
  font-size: 23px;
  font-weight: 900;
  line-height: 24px;
  text-align: center;
}

.label-code-row span:last-child {
  text-align: center;
}

.label-info-panel {
  float: left;
  width: 65%;
  margin-top: 3px;
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  line-height: 11px;
}

.label-info-panel span {
  display: block;
  height: 11px;
  overflow: hidden;
  white-space: nowrap;
}

.label-size-line {
  font-size: 10px;
}

.label-qr-panel {
  float: left;
  width: 35%;
  height: 66px;
  overflow: visible;
  margin-top: 3px;
  border: 0;
}

.barcode-svg {
  width: 150px;
  height: 46px;
}

.label-qr-panel img {
  display: block;
  float: left;
  width: 66px;
  height: 66px;
  margin-left: 0;
  margin-top: 0;
  border: 0;
}

.label-photo {
  width: 1.08cm;
  height: 1.08cm;
  border: 1px solid #000000;
  border-radius: 0;
  object-fit: cover;
  background: #ffffff;
}

.label-photo-empty {
  display: grid;
  place-items: center;
  color: #000000;
  font-size: 5.8pt;
  font-weight: 900;
  text-align: center;
}

.empty-message {
  display: none;
  margin: 16px 0 0;
  border: 1px dashed #cbd9d5;
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfdfc;
  text-align: center;
}

.empty-message.show {
  display: block;
}

@media (max-width: 1180px) {
  .app-layout,
  .approval-layout {
    grid-template-columns: 1fr;
  }

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

  .seller-statement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .sale-entry-grid,
  .sale-stone-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .import-panel,
  .import-settings-grid,
  .auto-fill-grid,
  .advanced-search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-header {
    align-items: center;
    flex-direction: column;
    text-align: center;
    padding: 22px 5vw 58px;
  }

  .brand-block {
    flex-direction: column;
    gap: 16px;
  }

  .header-logo {
    width: 98px;
  }

  .header-card {
    min-width: 0;
    width: 100%;
    text-align: center;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
    margin-top: -38px;
  }

  .form-grid,
  .tools,
  .import-panel,
  .import-settings-grid,
  .auto-fill-grid,
  .advanced-search-grid,
  .chart-grid,
  .seller-statement-grid,
  .finance-grid,
  .sale-entry-grid,
  .sale-stone-preview,
  .permission-panel,
  .report-tools,
  .compact-grid,
  .approval-item-entry {
    grid-template-columns: 1fr;
  }

  #inventoryEditMount .form-grid {
    grid-template-columns: 1fr;
  }

  .inventory-edit-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .inventory-edit-toolbar {
    align-items: flex-start;
  }

  #inventoryEditMount {
    padding: 8px;
  }

  .sale-submit-row,
  .settings-action-grid {
    align-items: stretch;
    flex-direction: column;
  }

  .form-panel,
  .table-panel {
    padding: 18px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  #itemCount {
    width: 100%;
    text-align: center;
  }

  .inventory-actions {
    width: 100%;
    justify-content: stretch;
  }

  .inventory-actions .secondary-button {
    width: 100%;
  }

  .dashboard-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: static;
  }

  .sidebar-title {
    grid-column: 1 / -1;
  }

  .tab-button {
    text-align: center;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  body > :not(.print-area) {
    display: none !important;
  }

  .print-area {
    display: block !important;
    padding: 24px;
  }

  .print-area.label-print-mode {
    width: 6cm;
    height: 95px;
    overflow: hidden;
    padding: 0;
  }

  .label-print-mode .label-print-grid {
    display: block;
    width: 6cm;
  }

  .label-print-mode .stone-label {
    width: 6cm !important;
    height: 95px !important;
    margin: 0;
    border: 0;
    border-radius: 0;
    break-after: avoid;
    page-break-after: avoid;
  }
}
