* {
  box-sizing: border-box;
}

:root {
  --tensor-banner-from: #166534;
  --tensor-banner-to: #4ade80;
  --tensor-banner-shadow: rgba(22, 101, 52, 0.28);
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f0fdf4;
  color: #14532d;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(520px, 100%);
}

.auth-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

button {
  background: #047857;
  color: #ffffff;
  border: 1px solid #047857;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}

button:hover {
  background: #065f46;
}

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

button:disabled:hover {
  background: #047857;
}

button.secondary {
  background: #ffffff;
  color: #065f46;
  border-color: #a7f3d0;
}

button.secondary:hover {
  background: #ecfdf5;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.header {
  align-items: flex-start;
  background: linear-gradient(135deg, var(--tensor-banner-from), var(--tensor-banner-to));
  border: none;
  border-radius: 18px;
  box-shadow: 0 12px 28px var(--tensor-banner-shadow);
  color: #ffffff;
  margin-bottom: 16px;
  padding: 22px 26px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
}

.subtitle {
  margin: 0;
  color: #15803d;
}

.shell > .header .subtitle {
  color: rgba(255, 255, 255, 0.92);
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.main-nav a {
  text-decoration: none;
  color: #14532d;
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}

.main-nav a.active {
  background: #047857;
  border-color: #047857;
  color: #ffffff;
}

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

.card {
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  padding: 16px;
}

.kpi-label {
  display: block;
  color: #15803d;
  font-size: 13px;
}

.kpi-value {
  display: block;
  font-size: 30px;
  margin: 4px 0;
}

.kpi-note {
  margin: 0;
  color: #166534;
  font-size: 13px;
}

h2 {
  margin: 0 0 12px;
  font-size: 19px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #bbf7d0;
  padding: 10px 8px;
  font-size: 14px;
}

th {
  color: #166534;
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

body[data-density="compact"] .table-wrap th,
body[data-density="compact"] .table-wrap td {
  padding: 6px;
  font-size: 13px;
}

.footer {
  margin-top: 16px;
  color: #15803d;
  font-size: 13px;
}

.label-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.label-tools label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #166534;
}

.label-tools input[type="text"] {
  min-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #bbf7d0;
  font-size: 14px;
}

.label-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  margin-top: 16px;
}

.label-preview canvas {
  border: 1px dashed #86efac;
  border-radius: 8px;
  background: #ffffff;
}

.label-preview svg {
  max-width: 100%;
  height: auto;
}

.pref-field {
  margin-bottom: 14px;
}

.pref-field select {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #bbf7d0;
  font-size: 14px;
  min-width: 220px;
}

.muted {
  margin: 8px 0 0;
  font-size: 13px;
  color: #15803d;
}

.shell > .header.app-header--with-shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.shell > .header.app-header--with-shortcuts .app-header-brand {
  flex: 1;
  min-width: 0;
}

.shell > .header.app-header--with-shortcuts .crm-header-shortcuts {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.shell > .header.app-header--with-shortcuts .crm-prefs-shortcut,
.shell > .header.app-header--with-shortcuts .tensor-banner-logout,
.shell > .header.app-header--with-shortcuts a.tensor-erp-launcher {
  order: 1;
}

.shell > .header.app-header--with-shortcuts .crm-prefs-shortcut {
  align-items: center;
  background: rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 10px;
  box-sizing: border-box;
  color: rgba(255, 255, 255, 0.95);
  display: inline-flex;
  height: 2.35rem;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s ease;
  width: 2.35rem;
}

.shell > .header.app-header--with-shortcuts .crm-prefs-shortcut:hover {
  background: rgba(15, 23, 42, 0.38);
  color: #fff;
}

.shell > .header.app-header--with-shortcuts .crm-prefs-shortcut:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.shell > .header.app-header--with-shortcuts .tensor-banner-session {
  color: rgba(255, 255, 255, 0.92);
  flex-basis: 100%;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
  max-width: none;
  order: 2;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell > .header.app-header--with-shortcuts .tensor-banner-logout {
  background: rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
}

.shell > .header.app-header--with-shortcuts .tensor-banner-logout:hover {
  background: rgba(15, 23, 42, 0.38);
  color: #fff;
}

.shell > .header.app-header--with-shortcuts a.tensor-erp-launcher {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.96);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.42);
}

.shell > .header.app-header--with-shortcuts a.tensor-erp-launcher:hover {
  background: rgba(255, 255, 255, 0.28);
}

@media print {
  .main-nav,
  .auth-row,
  .footer,
  .label-tools button,
  #printLabelsButton {
    display: none !important;
  }

  body {
    background: #ffffff;
  }

  .shell {
    max-width: none;
    padding: 0;
  }

  .card {
    border: none;
  }
}
