body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(180deg, #eef2f7 0%, #f8fbff 100%);
  padding: 24px;
  margin: 0;
  color: #1f2937;
}

.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
}

button,
input,
select {
  font: inherit;
}

.box {
  max-width: 1024px;
  margin: 40px auto;
  background: #ffffff;
  padding: 32px;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.login-box {
  max-width: 480px;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button.primary-action-button,
button {
  background: #0f766e;
  color: #ffffff;
}

button.primary-action-button:hover,
button:hover {
  background: #115e59;
}

.secondary-btn {
  background-color: #1d4ed8;
  color: white;
}

.secondary-btn:hover {
  background-color: #1e40af;
}

.danger-btn {
  background-color: #dc2626;
  color: white;
}

.danger-btn:hover {
  background-color: #b91c1c;
}

.logout-btn {
  width: auto;
  margin: 0;
  padding: 10px 18px;
}

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

.flex-container select,
.flex-container input {
  flex: 1 1 240px;
}

.text-btn {
  background: transparent;
  color: #0f172a;
  border: none;
  padding: 8px 0;
  text-decoration: underline;
  cursor: pointer;
}

.table {
  width: 100%;
  margin-top: 24px;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 520px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 24px;
}

.table-wrap .table {
  margin-top: 0;
}

td,
th {
  padding: 16px 18px;
  text-align: left;
}

th {
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tr {
  border-bottom: 1px solid #e2e8f0;
}

tr:nth-child(even) {
  background: #f8fafc;
}

.total-row {
  font-weight: 700;
  background-color: #e0f2fe !important;
}

.subtotal-row {
  font-weight: 700;
  background-color: #f1f5f9 !important;
}

.row-summary-cell {
  font-weight: 600;
  color: #0f766e;
  white-space: nowrap;
}

.plastic-total-cell {
  font-weight: 600;
  color: #0f766e;
  white-space: nowrap;
}

.dashboard-section {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid #e2e8f0;
}

.panel {
  background: #ffffff;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  margin-top: 0;
}

.panel h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.panel .hint {
  margin-top: 12px;
  margin-bottom: 0;
}

.panel input[type="file"] {
  margin-top: 14px;
}

.panel button.primary-action-button {
  width: 100%;
  margin-top: 20px;
}

.top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.shared-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.nav-tab {
  flex: 1;
  border-radius: 12px;
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 14px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
}

.nav-tab.active {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  border-color: #0f766e;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22);
}

.nav-tab:hover:not(.active) {
  background: #f8fafc;
}

.weight-input {
  width: 90px;
  margin: 0;
  padding: 10px 12px;
  text-align: right;
}

.section-title {
  margin-top: 28px;
  color: #0f172a;
}

.summary-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  padding: 24px;
  margin-top: 28px;
}

.summary-box h4 {
  margin: 0 0 14px;
  color: #0f172a;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 1rem;
}

.summary-stat:last-child {
  border-bottom: none;
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid #cbd5e1;
}

.hint {
  color: #475569;
  font-size: 0.95rem;
  font-style: normal;
  margin-top: 10px;
}

.num-right {
  text-align: right;
}

.company-badge {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 6px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.role-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.role-badge--client {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.role-badge--accountant {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.sharing-panel {
  margin-top: 18px;
}

.sharing-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.sharing-all-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  cursor: pointer;
  grid-column: 1 / -1;
}

.sharing-limitation {
  font-size: 0.88rem;
  color: #64748b;
}

.share-perm-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.share-perm-badge--read {
  background: #f1f5f9;
  color: #475569;
}

.share-perm-badge--write {
  background: #dbeafe;
  color: #1d4ed8;
}

.drs-badge {
  background: #dcfce7;
  color: #166534;
}

.auth-msg {
  color: #b91c1c;
  font-size: 0.95rem;
  text-align: center;
  margin: 14px 0 0;
}

.welcome-user {
  font-style: normal;
  color: #64748b;
  margin: 0;
  font-size: 0.875rem;
}

/* —— Easy DRS brand —— */
.brand-easy {
  font-weight: 600;
}

.brand-drs {
  font-weight: 800;
}

.login-title .brand-easy,
.login-title .brand-drs {
  letter-spacing: -0.03em;
}

.login-title .brand-drs {
  color: #6ee7b7;
}

.login-title .brand-easy {
  margin-right: 0.12em;
}

.app-brand-title {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #0f172a;
}

.app-brand-title .brand-drs {
  color: #0f766e;
}

.app-brand-title .brand-easy {
  margin-right: 0.1em;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.25);
}

.brand-lockup-text {
  min-width: 0;
}

.app-header {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.auth-box-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 1.05rem;
}

.auth-box-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1rem;
  flex-shrink: 0;
}

.auth-box-brand .brand-drs {
  color: #0f766e;
}

.auth-box-brand .brand-easy {
  margin-right: 0.08em;
}

.login-footer {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.75);
  letter-spacing: 0.02em;
}

.landing-back-link {
  color: #5eead4;
  text-decoration: underline;
  background: transparent;
  box-shadow: none;
  padding: 0;
  font-weight: 600;
  border: none;
  font-size: inherit;
}

.landing-back-link:hover {
  transform: none;
  color: #99f6e4;
}

.mt-0 {
  margin-top: 0;
}

.primary-action-button {
  font-size: 16px;
  margin-top: 15px;
}

.btn-download {
  background-color: #2a9d8f;
}

.btn-save {
  background-color: #2a6f97;
}

.btn-disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

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

.result-label {
  margin-top: -5px;
}

.error-msg {
  color: red;
}

.view-btn {
  margin-right: 15px;
  color: #2a6f97;
}

.delete-btn {
  color: #8b0000;
}


.non-drs-badge {
  background: #fff3e0;
  color: #e65100;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.field-label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-weight: 600;
  color: #0f172a;
}

.btn-pdf {
  background-color: #7c3aed;
}

.label-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 20px;
}

.label-box label {
  display: block;
  margin-bottom: 8px;
  color: #0f172a;
}

.period-badge {
  background: #ede9fe;
  color: #5b21b6;
  padding: 6px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.status-draft {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.status-ready {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.status-submitted {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.status-control-panel {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0 12px;
}

.status-control-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.status-control-actions,
.history-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 120px;
}

.status-transition-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.status-transition-btn:hover {
  background: #f1f5f9;
}

.status-transition-btn--compact {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.audit-log-panel {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0 12px;
}

.audit-log-panel h4 {
  margin: 0 0 12px;
  color: #0f172a;
}

.audit-log-table {
  margin-top: 0;
}

.audit-log-table th,
.audit-log-table td {
  font-size: 0.88rem;
}

.audit-log-panel.hidden {
  display: none;
}

.add-weight-panel {
  margin-top: 24px;
}

.product-import-panel {
  margin-bottom: 20px;
}

.product-import-actions {
  margin-bottom: 12px;
}

.ean-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.ean-input-wrap .ean-input,
.ean-input-wrap input {
  flex: 1;
  min-width: 0;
}

.ean-scan-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 10px;
  background: var(--surface-muted, #f8fafc);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.ean-scan-btn:hover {
  background: var(--surface-hover, #eef2ff);
  border-color: var(--accent, #0f766e);
}

.ean-scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ean-scanner-modal.hidden {
  display: none;
}

.ean-scanner-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.ean-scanner-dialog {
  position: relative;
  width: min(100%, 420px);
  padding: 20px;
  z-index: 1;
}

.ean-scanner-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

.ean-scanner-reader {
  width: 100%;
  min-height: 260px;
  border-radius: 12px;
  overflow: hidden;
  background: #111827;
}

body.ean-scanner-open {
  overflow: hidden;
}

.szamlazz-panel {
  margin: 16px 0 20px;
}

.szamlazz-status {
  font-weight: 600;
  margin: 8px 0 12px;
}

.szamlazz-status.connected {
  color: #0f766e;
}

.szamlazz-status.disconnected {
  color: #64748b;
}

.szamlazz-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.szamlazz-textarea {
  width: 100%;
  min-height: 96px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #cbd5e1);
  font-family: inherit;
  resize: vertical;
}

.szamlazz-prefix-input {
  width: 100%;
  max-width: 320px;
  margin-bottom: 12px;
}

.szamlazz-range-hint {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.szamlazz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.szamlazz-or-divider {
  text-align: center;
  margin: 16px 0;
  opacity: 0.75;
}

html[data-theme="dark"] .szamlazz-status.connected {
  color: #2dd4bf;
}

html[data-theme="dark"] .szamlazz-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .ean-scan-btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .ean-scan-btn:hover {
  background: #334155;
  border-color: #14b8a6;
}

.add-weight-panel h4 {
  margin: 0 0 14px;
}

.add-weight-form {
  display: grid;
  grid-template-columns: 1.45fr 1.65fr 0.85fr 0.85fr 0.85fr auto;
  gap: 12px;
  align-items: center;
}

.ean-input {
  width: 100%;
  min-width: 152px;
  margin: 0;
  padding: 10px 12px;
  text-align: left;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

#weightsManagerContainer .table th:nth-child(2),
#weightsManagerContainer .table td:nth-child(2) {
  min-width: 180px;
}

#weightsManagerContainer .ean-input-wrap {
  min-width: 168px;
}

.ean-badge {
  background: #ede9fe;
  color: #5b21b6;
  padding: 4px 8px;
  border-radius: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
}

.ean-missing {
  color: #b45309;
  font-size: 0.9rem;
  font-style: italic;
}

.ean-warning {
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 12px;
  padding: 12px 14px;
}

.btn-csv-export {
  background-color: #0369a1;
}

.csv-export-panel {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 20px;
}

.csv-export-panel .field-label {
  margin-top: 0;
}

.csv-export-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.csv-export-row button {
  white-space: nowrap;
  margin-top: 0;
}

.paper-receipt-panel {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0 12px;
}

.paper-receipt-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.paper-receipt-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.paper-receipt-panel .hint {
  margin: 8px 0 0;
}

.drs-qty-input,
.q-qty-input {
  width: 88px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-align: right;
  font-size: 0.95rem;
}

.validation-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.ean-alias-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #7c3aed;
  background: #ede9fe;
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}

.primary-product-select {
  width: 100%;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
}

.invoice-qty-cell {
  color: #64748b;
  font-weight: 500;
}

.add-weight-form button {
  margin-top: 0;
  white-space: nowrap;
}

#qResultContent,
#resultTableGoesHere {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.feedback-box {
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 16px;
}

.feedback-box.info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}

.feedback-box.warning {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
}

.feedback-box.success {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.feedback-box.error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.validation-summary .validation-status {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.feedback-box ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.add-company-panel {
  margin-top: 24px;
}

.add-company-panel h4 {
  margin: 0 0 14px;
}

.add-company-form {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.5fr auto;
  gap: 12px;
  align-items: center;
}

.add-company-form button {
  margin-top: 0;
  white-space: nowrap;
}

.company-notes-input {
  width: 100%;
  margin: 0;
}

/* —— Login page —— */
body.login-screen {
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 42%, #0f766e 100%);
  min-height: 100vh;
}

body.app-screen {
  background: linear-gradient(180deg, #eef2f7 0%, #f8fbff 100%);
}

.login-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  min-height: calc(100vh - 48px);
}

.login-hero {
  color: #f8fafc;
}

.login-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}

.lang-switcher {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-select {
  padding: 8px 12px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.35);
  color: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 110px;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.app-header .lang-select {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.35) 0%, rgba(15, 118, 110, 0.2) 100%);
  border: 1px solid rgba(110, 231, 183, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
}

.login-logo-icon {
  font-size: 2rem;
  line-height: 1;
}

.login-title {
  margin: 0 0 12px;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-tagline {
  margin: 0 0 28px;
  font-size: 1.05rem;
  line-height: 1.55;
  color: #cbd5e1;
  max-width: 36ch;
}

.login-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-features li {
  position: relative;
  padding-left: 28px;
  color: #e2e8f0;
  font-size: 0.98rem;
}

.login-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #6ee7b7;
  font-weight: 700;
}

.login-box {
  margin: 0;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.login-box h2 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  color: #0f172a;
}

.login-subtitle {
  margin: 0 0 20px;
  color: #64748b;
  font-size: 0.95rem;
}

.login-box .field-label:first-of-type {
  margin-top: 0;
}

.login-primary-btn,
.login-secondary-btn {
  width: 100%;
  margin-top: 16px;
}

.login-secondary-btn {
  margin-top: 10px;
}

.auth-link-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  text-align: center;
  font-size: 0.9rem;
  color: #475569;
}

.auth-legal-field {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.auth-legal-checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.auth-legal-checkbox-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #0f766e;
  cursor: pointer;
}

.auth-legal-checkbox-label {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #334155;
  cursor: pointer;
}

.auth-legal-links {
  margin: 10px 0 0 28px;
  font-size: 0.85rem;
}

.auth-legal-links a {
  color: #0f766e;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-legal-links a:hover {
  color: #115e59;
}

.auth-legal-hint {
  margin: 8px 0 0 28px;
  font-size: 0.8rem;
  color: #64748b;
}

html[data-theme="dark"] .auth-legal-field {
  background: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] .auth-legal-checkbox-label {
  color: #cbd5e1;
}

html[data-theme="dark"] .auth-legal-links a {
  color: #5eead4;
}

html[data-theme="dark"] .auth-legal-hint {
  color: #94a3b8;
}

.auth-msg:not(:empty) {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 12px;
  padding: 12px 14px;
}

.auth-msg-success {
  background: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
  color: #065f46 !important;
}

/* —— Toast notifications —— */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.toast-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.45;
  padding-top: 2px;
}

.toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: none;
  border-radius: 8px;
}

.toast-close:hover {
  background: #f1f5f9;
  color: #475569;
  transform: none;
}

.toast-success .toast-icon {
  background: #dcfce7;
  color: #166534;
}

.toast-error .toast-icon {
  background: #fee2e2;
  color: #b91c1c;
}

.toast-warning .toast-icon {
  background: #ffedd5;
  color: #c2410c;
}

.toast-info .toast-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

/* —— Confirm modal —— */
body.modal-open {
  overflow: hidden;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.confirm-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 28px;
}

.confirm-dialog h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  color: #0f172a;
}

.confirm-message {
  margin: 0 0 24px;
  color: #475569;
  line-height: 1.55;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-actions button {
  width: auto;
  min-width: 110px;
  margin: 0;
  padding: 12px 18px;
  box-shadow: none;
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .box {
    margin: 16px auto;
    padding: 18px;
    border-radius: 18px;
  }

  .top-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .app-header {
    gap: 12px;
  }

  .app-brand-title {
    font-size: 1.2rem;
  }

  .top-toolbar h2,
  .top-toolbar h3 {
    font-size: 1.15rem;
  }

  .app-header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .app-header .lang-select,
  .logout-btn {
    width: 100%;
  }

  .login-hero-top {
    flex-direction: column;
    align-items: center;
  }

  .lang-switcher {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .lang-select {
    width: 100%;
    max-width: 200px;
  }

  .logout-btn {
    width: 100%;
  }

  .nav-tabs {
    flex-direction: column;
    gap: 8px;
  }

  .nav-tab {
    font-size: 0.9rem;
    padding: 12px 14px;
  }

  td,
  th {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .csv-export-row {
    grid-template-columns: 1fr;
  }

  .csv-export-row button {
    width: 100%;
  }

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

  .action-grid button,
  .panel button.primary-action-button {
    width: 100%;
  }

  .add-weight-form,
  .add-company-form {
    grid-template-columns: 1fr;
  }

  .weight-input {
    width: 100%;
    max-width: 120px;
  }

  .text-btn {
    display: inline-block;
    margin: 4px 8px 4px 0;
  }

  .login-page {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 8px 0 24px;
    min-height: auto;
  }

  .login-hero {
    text-align: center;
  }

  .login-logo {
    margin-left: auto;
    margin-right: auto;
  }

  .login-tagline {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  .login-features {
    align-items: center;
  }

  .login-title {
    font-size: 1.9rem;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    top: 16px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions button {
    width: 100%;
  }

  .file-drop-zone {
    min-height: 140px;
    padding: 20px 16px;
  }

  .file-drop-icon {
    font-size: 2rem;
  }

  .table-wrap {
    margin-left: -4px;
    margin-right: -4px;
    border-radius: 12px;
  }

  .theme-toggle-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* --- CSV drag & drop --- */
.file-drop-zone {
  position: relative;
  margin-top: 14px;
  padding: 28px 20px;
  border: 2px dashed #94a3b8;
  border-radius: 18px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: #0f766e;
  background: #ecfdf5;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

.file-drop-zone.has-file {
  border-color: #0f766e;
  background: #f0fdfa;
}

.file-drop-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-drop-visual {
  pointer-events: none;
}

.file-drop-icon {
  display: block;
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.file-drop-title {
  margin: 0;
  font-weight: 700;
  color: #0f172a;
}

.file-drop-hint {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.92rem;
}

.file-drop-name {
  margin: 10px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f766e;
  word-break: break-word;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}

.table-wrap .table {
  margin: 0;
  min-width: 560px;
}

.theme-toggle-btn {
  width: auto;
  min-width: 42px;
  height: 42px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: #e2e8f0;
  color: #0f172a;
  box-shadow: none;
  font-size: 1.1rem;
  line-height: 1;
}

.theme-toggle-btn:hover {
  background: #cbd5e1;
  transform: none;
}

/* --- Dark mode --- */
html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
}

html[data-theme="dark"] .box,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .confirm-dialog,
html[data-theme="dark"] .toast {
  background: #1e293b;
  color: #e2e8f0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .panel {
  border-color: #334155;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

html[data-theme="dark"] .hint,
html[data-theme="dark"] .file-drop-hint,
html[data-theme="dark"] .welcome-user {
  color: #94a3b8;
}

html[data-theme="dark"] .file-drop-zone {
  background: #0f172a;
  border-color: #475569;
}

html[data-theme="dark"] .file-drop-zone:hover,
html[data-theme="dark"] .file-drop-zone.drag-over,
html[data-theme="dark"] .file-drop-zone.has-file {
  background: #134e4a;
  border-color: #14b8a6;
}

html[data-theme="dark"] .file-drop-title {
  color: #f1f5f9;
}

html[data-theme="dark"] .file-drop-name {
  color: #5eead4;
}

html[data-theme="dark"] .result-label,
html[data-theme="dark"] #resultContainer,
html[data-theme="dark"] #qResultContainer,
html[data-theme="dark"] #resultTableGoesHere,
html[data-theme="dark"] #qResultContent {
  color: #e2e8f0;
}

html[data-theme="dark"] .feedback-box b,
html[data-theme="dark"] .feedback-box li {
  color: inherit;
}

html[data-theme="dark"] .ean-missing {
  color: #fcd34d;
}

html[data-theme="dark"] .validation-box b {
  color: inherit;
}

html[data-theme="dark"] .table-wrap {
  border-color: #334155;
}

html[data-theme="dark"] .table th {
  background: #0f172a;
  color: #cbd5e1;
}

html[data-theme="dark"] .table td {
  border-color: #334155;
}

html[data-theme="dark"] .nav-tab {
  background: #0f172a;
  color: #cbd5e1;
}

html[data-theme="dark"] .nav-tab.active {
  background: #0f766e;
  color: #fff;
}

html[data-theme="dark"] .theme-toggle-btn {
  background: #334155;
  color: #f8fafc;
}

html[data-theme="dark"] .login-hero,
html[data-theme="dark"] .login-footer {
  color: #cbd5e1;
}

html[data-theme="dark"] .auth-msg {
  color: #fecaca;
}

html[data-theme="dark"] .feedback-box.info {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #bfdbfe;
}

html[data-theme="dark"] .feedback-box.warning {
  background: #422006;
  border-color: #f97316;
  color: #fed7aa;
}

html[data-theme="dark"] .feedback-box.success {
  background: #052e16;
  border-color: #22c55e;
  color: #bbf7d0;
}

html[data-theme="dark"] .feedback-box.error {
  background: #450a0a;
  border-color: #ef4444;
  color: #fecaca;
}

html[data-theme="dark"] .section-title,
html[data-theme="dark"] .field-label,
html[data-theme="dark"] .label-box label,
html[data-theme="dark"] .summary-box h4,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] .panel h3,
html[data-theme="dark"] .add-weight-panel h4 {
  color: #e2e8f0;
}

html[data-theme="dark"] .app-brand-title {
  color: #f1f5f9;
}

html[data-theme="dark"] .app-header .lang-select {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

html[data-theme="dark"] .dashboard-section {
  border-top-color: #334155;
}

html[data-theme="dark"] tr {
  border-bottom-color: #334155;
}

html[data-theme="dark"] tr:nth-child(even) {
  background: #1e293b;
}

html[data-theme="dark"] .table td {
  color: #e2e8f0;
  border-color: #334155;
}

html[data-theme="dark"] .total-row {
  background-color: #164e63 !important;
  color: #e2e8f0;
}

html[data-theme="dark"] .subtotal-row {
  background-color: #1e3a5f !important;
  color: #e2e8f0;
}

html[data-theme="dark"] .row-summary-cell,
html[data-theme="dark"] .plastic-total-cell {
  color: #5eead4;
}

html[data-theme="dark"] .invoice-qty-cell {
  color: #94a3b8;
}

html[data-theme="dark"] .paper-receipt-panel {
  background: #422006;
  border-color: #d97706;
  color: #fde68a;
}

html[data-theme="dark"] .paper-receipt-toggle {
  color: #fde68a;
}

html[data-theme="dark"] .paper-receipt-panel .hint {
  color: #fcd34d;
}

html[data-theme="dark"] .label-box,
html[data-theme="dark"] .csv-export-panel,
html[data-theme="dark"] .summary-box {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

html[data-theme="dark"] .ean-warning {
  background: #422006;
  border-color: #f97316;
  color: #fed7aa;
}

html[data-theme="dark"] .primary-product-select {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

html[data-theme="dark"] .drs-qty-input,
html[data-theme="dark"] .q-qty-input,
html[data-theme="dark"] .weight-input,
html[data-theme="dark"] .ean-input {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

html[data-theme="dark"] .ean-badge,
html[data-theme="dark"] .period-badge,
html[data-theme="dark"] .ean-alias-badge {
  background: #4c1d95;
  color: #ddd6fe;
}

html[data-theme="dark"] .status-draft {
  background: #78350f;
  color: #fde68a;
  border-color: #92400e;
}

html[data-theme="dark"] .status-ready {
  background: #064e3b;
  color: #a7f3d0;
  border-color: #047857;
}

html[data-theme="dark"] .status-submitted {
  background: #1e3a8a;
  color: #bfdbfe;
  border-color: #2563eb;
}

html[data-theme="dark"] .status-control-panel,
html[data-theme="dark"] .audit-log-panel {
  background: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] .status-control-panel b,
html[data-theme="dark"] .audit-log-panel h4 {
  color: #e2e8f0;
}

html[data-theme="dark"] .status-transition-btn {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

html[data-theme="dark"] .status-transition-btn:hover {
  background: #334155;
}

html[data-theme="dark"] .non-drs-badge {
  background: #7c2d12;
  color: #fed7aa;
}

html[data-theme="dark"] .ean-missing {
  color: #fdba74;
}

html[data-theme="dark"] .summary-stat {
  border-bottom-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .text-btn {
  color: #94a3b8;
}

html[data-theme="dark"] .view-btn {
  color: #67e8f9;
}

html[data-theme="dark"] .role-badge--client {
  background: #064e3b;
  color: #a7f3d0;
  border-color: #047857;
}

html[data-theme="dark"] .role-badge--accountant {
  background: #1e3a8a;
  color: #bfdbfe;
  border-color: #2563eb;
}

html[data-theme="dark"] .sharing-panel,
html[data-theme="dark"] .sharing-limitation {
  color: #94a3b8;
}

html[data-theme="dark"] .share-perm-badge--read {
  background: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] .share-perm-badge--write {
  background: #1e3a8a;
  color: #bfdbfe;
}

html[data-theme="dark"] .delete-btn {
  color: #fca5a5;
}
