:root {
  color-scheme: light;
  --bg: #eef3ef;
  --surface: #ffffff;
  --surface-soft: #f5f8f5;
  --ink: #18302a;
  --muted: #6d7d77;
  --line: #dce6df;
  --green-950: #0c3b2b;
  --green-800: #126449;
  --green-700: #177c59;
  --green-100: #dcefe6;
  --lime: #c8dc54;
  --danger: #bb3d45;
  --danger-soft: #fdebed;
  --shadow: 0 18px 55px rgba(24, 57, 45, .10);
  --radius: 16px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-width: 1120px; min-height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  background:
    radial-gradient(circle at 10% 92%, rgba(200, 220, 84, .14), transparent 28%),
    var(--green-950);
  color: white;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--lime); color: var(--green-950); }
.brand-mark svg { width: 28px; }
.brand strong { display: block; font-size: 18px; letter-spacing: .01em; }
.brand span { display: block; margin-top: 3px; color: rgba(255,255,255,.58); font-size: 12px; }

.main-nav { display: grid; gap: 7px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: rgba(255,255,255,.72);
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: rgba(200, 220, 84, .15); border-color: rgba(200, 220, 84, .24); color: var(--lime); }
.nav-icon { width: 22px; font-size: 18px; text-align: center; }

.main-content { min-width: 0; padding: 28px 30px 36px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.eyebrow, .section-label { margin: 0 0 6px; color: var(--green-700); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
h3 { margin-bottom: 0; font-size: 17px; }
.topbar-actions, .inline-actions, .empty-actions { display: flex; align-items: center; gap: 9px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 650;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--green-800); color: white; box-shadow: 0 7px 18px rgba(18,100,73,.18); }
.btn-primary:hover { background: var(--green-700); }
.btn-secondary { border-color: #bdd2c6; background: var(--green-100); color: var(--green-950); }
.btn-secondary:hover { background: #d1e9dd; }
.btn-quiet { border-color: var(--line); background: var(--surface); color: #3e514a; }
.btn-quiet:hover { border-color: #b9cbc1; }
.btn-danger-quiet { border-color: #f0ced1; background: var(--danger-soft); color: var(--danger); }
.btn-small { min-height: 34px; padding: 6px 11px; font-size: 12px; }

.summary-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 24px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.76);
  box-shadow: 0 9px 30px rgba(24,57,45,.04);
}
.summary-item { min-width: 140px; padding: 7px 18px; border-right: 1px solid var(--line); }
.summary-item:first-child { padding-left: 8px; }
.summary-item span, .summary-item strong { display: block; }
.summary-item span { color: var(--muted); font-size: 11px; }
.summary-item strong { margin-top: 4px; font-size: 17px; }
.summary-item.grow { flex: 1; display: flex; align-items: center; justify-content: flex-end; border-right: 0; padding-right: 0; }
.search-box { width: min(330px, 100%); display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.search-box span { font-size: 20px; color: var(--green-700); }
.search-box input { width: 100%; padding: 9px 0; border: 0; outline: 0; background: transparent; }

.workspace { min-height: calc(100vh - 197px); display: grid; grid-template-columns: 310px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.card-list-panel { min-width: 0; padding: 22px 14px 18px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 7px 15px; }
.panel-heading h2 { font-size: 17px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; font-size: 17px; }
.card-list { display: grid; gap: 8px; max-height: calc(100vh - 285px); padding: 2px; overflow-y: auto; }
.tech-card-item { width: 100%; padding: 13px; border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.tech-card-item:hover { background: white; border-color: var(--line); }
.tech-card-item.active { background: white; border-color: #b7d3c4; box-shadow: 0 7px 18px rgba(24,57,45,.07); }
.tech-card-item .item-top { display: flex; justify-content: space-between; gap: 8px; }
.tech-card-item strong { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-card-item .organization {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--green-700);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tech-card-item .crop { display: block; margin: 3px 0 10px; color: var(--muted); font-size: 12px; }
.tech-card-item .item-meta { display: flex; justify-content: space-between; color: #5d6f68; font-size: 11px; }
.area-pill { padding: 3px 7px; border-radius: 99px; background: var(--green-100); color: var(--green-800); font-size: 10px; font-weight: 700; white-space: nowrap; }
.completion-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.completion-track { flex: 1; height: 4px; border-radius: 99px; background: #e2e9e4; overflow: hidden; }
.completion-track > span { display: block; height: 100%; border-radius: inherit; background: var(--green-700); }
.completion-line > small { min-width: 31px; color: var(--muted); font-size: 9px; text-align: right; }
.list-empty { padding: 32px 16px; color: var(--muted); text-align: center; line-height: 1.5; }

.editor-panel { min-width: 0; background: white; }
.empty-state { min-height: 590px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; text-align: center; }
.empty-state p { max-width: 460px; margin: 12px 0 22px; color: var(--muted); line-height: 1.6; }
.empty-illustration { width: 70px; height: 70px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 22px; background: var(--green-100); color: var(--green-800); font-size: 34px; }
.hidden { display: none !important; }
.editor-content { padding: 24px 26px 28px; }
.editor-titlebar, .operations-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.editor-titlebar { padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.card-form { padding: 20px 0 23px; border-bottom: 1px solid var(--line); }
.form-grid { display: grid; gap: 15px; }
.card-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { display: grid; gap: 6px; }
.field > span { color: #53665f; font-size: 11px; font-weight: 650; }
.field input, .field select, .field textarea, .catalog-add input, .catalog-row input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #ccd9d1;
  border-radius: 9px;
  outline: 0;
  background: white;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus, .catalog-add input:focus, .catalog-row input:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(23,124,89,.10); }
.field textarea { height: auto; min-height: 170px; resize: vertical; line-height: 1.5; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 17px; }
.form-hint { color: var(--muted); font-size: 11px; }
.save-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.save-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #94a39c; }
.save-status.saving .save-status-dot { background: #d59a28; animation: save-pulse 1s ease infinite; }
.save-status.saved { color: var(--green-700); }
.save-status.saved .save-status-dot { background: var(--green-700); }
.save-status.dirty .save-status-dot { background: #d59a28; }
.save-status.error { color: var(--danger); }
.save-status.error .save-status-dot { background: var(--danger); }
@keyframes save-pulse { 50% { opacity: .35; } }

.operations-section { padding-top: 22px; }
.operations-heading { margin-bottom: 14px; }
.operation-table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
.operation-table { width: 100%; min-width: 1050px; border-collapse: collapse; font-size: 12px; }
.operation-table th { padding: 10px 9px; background: #f2f6f3; color: #61736c; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.operation-table td { padding: 11px 9px; border-top: 1px solid var(--line); vertical-align: middle; }
.operation-table tbody tr:hover { background: #f8faf8; }
.operation-table th:last-child, .operation-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 108px;
  min-width: 108px;
  background: var(--surface);
  box-shadow: -7px 0 10px rgba(18, 52, 40, .04);
}
.operation-table th:last-child { z-index: 3; background: #f2f6f3; }
.operation-table tbody tr:hover td:last-child { background: #f8faf8; }
.operation-name { min-width: 145px; font-weight: 650; }
.subtext { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.table-actions { display: flex; justify-content: flex-end; gap: 5px; }
.table-action { min-width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: white; cursor: pointer; }
.table-action.delete { color: var(--danger); }
.table-action.copy { color: var(--green-700); }
.table-empty { padding: 34px !important; color: var(--muted); text-align: center; }
.operation-edit-row { background: #f4f8f5; box-shadow: inset 3px 0 0 var(--green-700); }
.operation-edit-row td { padding: 7px 5px; }
.operation-edit-row td:last-child { background: #f4f8f5; }
.operation-transport-row { background: #eef6f1; box-shadow: inset 3px 0 0 var(--green-700); }
.operation-transport-row td { padding: 9px 8px 11px; border-top: 0; }
.operation-transport-row td:last-child {
  position: static;
  width: auto;
  min-width: 0;
  background: #eef6f1;
  box-shadow: none;
}
.transport-calculation-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(105px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid #c8dbd0;
  border-radius: 10px;
  background: white;
}
.transport-field { display: grid; gap: 4px; }
.transport-field:first-child { grid-column: span 2; }
.transport-field > span { color: #52675f; font-size: 9px; font-weight: 700; }
.transport-field > small { color: var(--muted); font-size: 8px; }
.transport-manual-check {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #52675f;
  font-size: 10px;
  cursor: pointer;
}
.transport-manual-check input { width: 16px; height: 16px; accent-color: var(--green-700); }
.transport-preview {
  grid-column: span 4;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 12px;
  padding: 8px 11px;
  border-radius: 8px;
  background: #eff5dc;
}
.transport-preview > span { color: #5e6d44; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.transport-preview strong { color: var(--green-950); font-size: 11px; text-align: right; }
.transport-preview small { grid-column: 1 / -1; color: #69745c; font-size: 8px; }
.transport-preview small.transport-warning { color: #a5510f; font-weight: 700; }
.table-action[aria-busy="true"] { cursor: wait; opacity: .7; }
.calculation-type-select { color: var(--green-800); font-weight: 700; }
.calculation-badge { display: inline-block; margin-left: 6px; padding: 2px 5px; border-radius: 99px; background: #e8f1cc; color: #50642a; font-size: 8px; font-weight: 700; vertical-align: 1px; }
.transport-subtext { color: var(--green-700); }
.table-input, .table-select {
  width: 100%;
  min-width: 64px;
  height: 34px;
  padding: 5px 7px;
  border: 1px solid #bdcec4;
  border-radius: 7px;
  background: white;
  outline: none;
  font-size: 11px;
}
.table-input:focus, .table-select:focus { border-color: var(--green-700); box-shadow: 0 0 0 2px rgba(23,124,89,.1); }
.table-select.operation-select { min-width: 150px; }
.table-select.machine-select { min-width: 128px; }
.inline-stack { display: grid; gap: 4px; min-width: 90px; }
.inline-stack.compact { grid-template-columns: minmax(66px, 1fr) minmax(66px, .8fr); }
.inline-calc { color: var(--green-700); font-size: 9px; white-space: nowrap; }
.edit-row-actions { display: flex; gap: 4px; }
.edit-row-label { display: block; color: var(--green-700); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.totals-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.total-card { padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.total-card span, .total-card strong, .total-card small { display: block; }
.total-card span { color: var(--muted); font-size: 10px; }
.total-card strong { margin-top: 5px; font-size: 16px; }
.total-card small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.total-card.accent { border-color: #c8d79a; background: #f4f7df; }

.modal {
  width: min(640px, calc(100vw - 40px));
  max-height: calc(100vh - 50px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 30px 90px rgba(6,39,27,.25);
  color: var(--ink);
}
.modal::backdrop { background: rgba(8, 32, 24, .52); backdrop-filter: blur(2px); }
.modal-wide { width: min(920px, calc(100vw - 40px)); }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 23px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); background: var(--surface-soft); }
.modal-body { padding: 22px 23px; overflow-y: auto; }
.modal-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; }
.callout { margin: 18px 0 0; padding: 11px 13px; border-radius: 9px; background: #f1f5ee; color: #5d6f68; font-size: 11px; }
.calculation-preview { grid-column: span 2; display: flex; flex-direction: column; justify-content: center; padding: 8px 13px; border: 1px solid #cbd9b0; border-radius: 9px; background: #f5f8e7; }
.calculation-preview span { color: var(--muted); font-size: 10px; }
.calculation-preview strong { margin-top: 4px; font-size: 13px; }

.catalog-layout { min-height: 520px; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.catalog-tabs { padding: 15px 10px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.catalog-tab { width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: #53665f; text-align: left; cursor: pointer; }
.catalog-tab:hover { background: white; }
.catalog-tab.active { background: var(--green-100); color: var(--green-800); font-weight: 700; }
.catalog-content { min-width: 0; padding: 22px; }
.catalog-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.count-badge { min-width: 30px; padding: 5px 8px; border-radius: 99px; background: var(--green-100); color: var(--green-800); text-align: center; font-weight: 700; }
.catalog-entry-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-bottom: 13px; }
.catalog-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.catalog-list { max-height: 370px; display: grid; gap: 7px; overflow-y: auto; }
.catalog-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; align-items: center; gap: 7px; }
.catalog-index { color: var(--muted); font-size: 11px; text-align: center; }
.formula-card { display: grid; gap: 6px; margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: #5d6f68; font-size: 12px; }
.formula-card strong { margin-bottom: 3px; color: var(--ink); }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); cursor: pointer; }
.check-row input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--green-700); }
.check-row strong, .check-row small { display: block; }
.check-row small { margin-top: 4px; color: var(--muted); line-height: 1.4; }
.bulk-help { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.file-picker { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; padding: 11px 13px; border: 1px dashed #b8cac0; border-radius: 10px; background: var(--surface-soft); color: #50655d; font-size: 11px; }
.file-picker input { max-width: 245px; font-size: 10px; }
.bulk-preview { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 13px; border-radius: 10px; background: #eef5f1; color: #53665f; font-size: 11px; }
.bulk-preview strong { color: var(--green-800); }
.bulk-preview-list { max-height: 125px; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; overflow-y: auto; }
.bulk-preview-item { padding: 5px 8px; border: 1px solid #d3e0d8; border-radius: 99px; background: white; color: #3e514a; font-size: 10px; }

.batch-print-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.batch-print-toolbar > span { color: var(--muted); font-size: 12px; }
.batch-print-toolbar strong { color: var(--green-800); font-size: 15px; }
.batch-print-list { max-height: 360px; display: grid; gap: 8px; overflow-y: auto; }
.batch-print-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
}
.batch-print-option:hover { border-color: #b9cbc1; background: white; }
.batch-print-option:has(input:checked) { border-color: #a9c8b7; background: #eef7f2; }
.batch-print-option input { width: 17px; height: 17px; accent-color: var(--green-700); }
.batch-print-option strong, .batch-print-option small { display: block; }
.batch-print-option strong { font-size: 12px; }
.batch-print-option small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.toast-stack { position: fixed; z-index: 1000; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { min-width: 270px; max-width: 390px; padding: 12px 14px; border: 1px solid #c7d8cf; border-radius: 10px; background: #153f31; color: white; box-shadow: 0 15px 35px rgba(10,46,34,.23); animation: toast-in .2s ease both; }
.toast.error { border-color: #e8a7ac; background: #852f36; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.sidebar-account {
  margin-top: auto;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255,255,255,.12);
}

.portable-mode .sidebar-account {
  display: none;
}
.account-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(200,220,84,.16);
  color: var(--lime);
  font-size: 14px;
  font-weight: 800;
}
.account-copy { min-width: 0; }
.account-copy strong, .account-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 12px; }
.account-copy span { margin-top: 3px; color: rgba(255,255,255,.55); font-size: 10px; }
.account-menu-btn {
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7);
  cursor: pointer;
}
.account-menu-btn:hover { background: rgba(255,255,255,.13); color: white; }
.account-logout {
  grid-column: 1 / -1;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.66);
  cursor: pointer;
  font-size: 11px;
}
.account-logout:hover { border-color: rgba(255,255,255,.25); color: white; }

.users-modal { max-height: min(790px, calc(100vh - 36px)); }
.users-modal-body { display: grid; gap: 22px; }
.user-create-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.user-create-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.user-create-heading strong { font-size: 14px; }
.user-create-heading span, .user-create-actions span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.user-create-heading span { max-width: 440px; text-align: right; }
.user-create-grid { grid-template-columns: .9fr 1.1fr .75fr .9fr 1.05fr; }
.user-create-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; }
.user-create-actions span { max-width: 450px; }
.users-list-heading { display: flex; align-items: center; justify-content: space-between; }
.users-list-heading > span { color: var(--muted); font-size: 11px; }
.users-table-wrap { max-height: 330px; border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
.users-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.users-table th, .users-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.users-table th { position: sticky; top: 0; z-index: 1; background: #eef4f0; color: #53665f; font-size: 9px; letter-spacing: .07em; text-transform: uppercase; }
.users-table tbody tr:last-child td { border-bottom: 0; }
.user-identity strong, .user-identity span { display: block; }
.user-identity span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.role-badge, .status-badge { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 99px; font-size: 9px; font-weight: 700; }
.role-badge { background: var(--green-100); color: var(--green-800); }
.role-badge.user { background: #eef1ef; color: #5c6c66; }
.status-badge { background: #e4f3eb; color: #176847; }
.status-badge.inactive { background: var(--danger-soft); color: var(--danger); }
.status-badge.online { background: #dff5e8; color: #0d7246; }
.status-badge.offline { background: #eef1ef; color: #687871; }
.user-status-stack { display: grid; justify-items: start; gap: 4px; }
.user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.user-action {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: #50635b;
  cursor: pointer;
  font-size: 9px;
  white-space: nowrap;
}
.user-action:hover { border-color: #b8cac0; }
.user-action.danger { border-color: #efd0d3; color: var(--danger); }
.user-action:disabled { opacity: .42; cursor: not-allowed; }
.user-edit-modal { width: min(650px, calc(100vw - 40px)); }
.user-edit-grid { grid-template-columns: 1fr 1.35fr; }
.user-unlimited-check { margin-top: 15px; }
.password-required-note { margin-bottom: 18px; padding: 12px 13px; border: 1px solid #e1c978; border-radius: 10px; background: #fff9df; color: #66561c; font-size: 11px; line-height: 1.5; }
.form-hint { margin: 14px 0 0; color: var(--muted); font-size: 10px; }
.settings-personal-note { margin: 0 0 16px; }
.access-expired-banner { display: flex; align-items: center; gap: 16px; margin-top: 20px; padding: 13px 15px; border: 1px solid #dfc467; border-radius: 12px; background: #fff8d9; color: #5d4d16; }
.access-expired-banner strong { flex: none; font-size: 12px; }
.access-expired-banner span { font-size: 11px; line-height: 1.45; }
.access-expired .write-control { opacity: .52; pointer-events: none; }
.access-expired [data-edit-operation],
.access-expired [data-duplicate-operation],
.access-expired [data-delete-operation],
.access-expired [data-save-inline] { display: none !important; }

html.login-root, html.login-root body { min-width: 320px; }
.login-page {
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 88%, rgba(200,220,84,.2), transparent 27%),
    var(--green-950);
}
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1fr) minmax(420px, .82fr); }
.login-intro { min-height: 100vh; display: flex; flex-direction: column; padding: 48px clamp(44px, 7vw, 110px); color: white; }
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-brand-mark { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; margin: 0; border-radius: 14px; background: var(--lime); color: var(--green-950); font-size: 15px; font-weight: 900; line-height: 1; }
.login-brand-copy strong, .login-brand-copy span { display: block; }
.login-brand-copy strong { font-size: 19px; }
.login-brand-copy span { margin-top: 3px; color: rgba(255,255,255,.55); font-size: 11px; }
.login-intro-copy { max-width: 640px; margin: auto 0; }
.login-intro-copy > span { color: var(--lime); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.login-intro-copy h1 { max-width: 620px; margin: 16px 0 20px; font-size: clamp(38px, 4.5vw, 65px); line-height: .98; letter-spacing: -.055em; }
.login-intro-copy p { max-width: 575px; margin: 0; color: rgba(255,255,255,.64); font-size: 15px; line-height: 1.65; }
.login-security-note { max-width: 480px; display: grid; gap: 5px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 11px; background: rgba(255,255,255,.05); }
.login-security-note strong { color: var(--lime); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.login-security-note span { color: rgba(255,255,255,.58); font-size: 10px; line-height: 1.5; }
.login-panel { min-height: 100vh; display: grid; align-content: center; gap: 15px; padding: 42px clamp(34px, 7vw, 100px); background: #f5f8f5; }
.login-card { width: min(430px, 100%); display: grid; gap: 17px; margin: 0 auto; padding: 35px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 8px; font-size: 27px; }
.login-card p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.login-submit { width: 100%; min-height: 46px; margin-top: 2px; }
.login-submit:disabled { opacity: .58; cursor: wait; }
.login-error { padding: 10px 11px; border: 1px solid #f0c4c7; border-radius: 9px; background: var(--danger-soft); color: var(--danger) !important; font-size: 11px !important; }
.setup-required { width: min(430px, 100%); display: grid; gap: 5px; margin: 0 auto; padding: 13px 15px; border: 1px solid #e0c56a; border-radius: 11px; background: #fff9df; color: #604f16; }
.setup-required strong { font-size: 11px; }
.setup-required span { font-size: 10px; line-height: 1.45; }
.setup-required code { padding: 2px 4px; border-radius: 4px; background: rgba(96,79,22,.09); }
.setup-blocked { opacity: .7; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: auto; padding: 28px; }
  .login-intro-copy { margin: 54px 0 38px; }
  .login-intro-copy h1 { font-size: 38px; }
  .login-security-note { display: none; }
  .login-panel { min-height: auto; padding: 40px 22px 60px; }
}

.print-sheet { display: none; }

@page {
  size: A4 landscape;
  margin: 8mm;
}

@media print {
  html, body {
    min-width: 0;
    width: auto;
    min-height: 0;
    background: white;
    color: #000;
    font-family: Arial, sans-serif;
  }

  .app-shell, dialog, .toast-stack {
    display: none !important;
  }

  .print-sheet {
    display: block;
    width: 100%;
    color: #000;
    font-size: 7.2pt;
  }

  .print-heading {
    margin-bottom: 4mm;
    text-align: center;
  }

  .print-heading h1 {
    margin: 0;
    color: #000;
    font-size: 15pt;
    letter-spacing: 0;
  }

  .print-heading p {
    margin: 1.2mm 0 0;
    font-size: 9pt;
  }

  .print-card-counter {
    display: block;
    margin-bottom: 1.5mm;
    font-size: 7pt;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

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

  .print-sheet th, .print-sheet td {
    border: .35mm solid #111;
    padding: 1.4mm 1mm;
    color: #000;
    text-align: center;
    vertical-align: middle;
    overflow-wrap: anywhere;
  }

  .print-sheet th {
    background: #f0f0f0 !important;
    font-weight: 700;
  }

  .print-info-table th, .print-info-table td {
    font-size: 8pt;
  }

  .print-info-table th:nth-child(1) { width: 16%; }
  .print-info-table th:nth-child(2) { width: 12%; }
  .print-info-table th:nth-child(3) { width: 14%; }

  .print-section-title {
    margin: 4mm 0 1.5mm;
    color: #000;
    font-size: 11pt;
    text-align: center;
    letter-spacing: 0;
  }

  .print-operations-table {
    font-size: 6.8pt;
  }

  .print-operations-table thead {
    display: table-header-group;
  }

  .print-operations-table tr {
    break-inside: avoid;
  }

  .print-operations-table th:nth-child(1) { width: 3%; }
  .print-operations-table th:nth-child(2) { width: 14%; }
  .print-operation-name { text-align: left !important; }
  .print-operation-detail { display: block; margin-top: .7mm; color: #333; font-size: 5.8pt; font-weight: 400; line-height: 1.25; }
  .print-empty-row { padding: 5mm !important; }

  .print-operations-table tfoot th {
    text-align: left;
  }

  .print-grand-total {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: .8mm 5mm;
    margin: 3mm 0 0 auto;
    width: 72mm;
    padding: 2.5mm 3mm;
    border: .35mm solid #111;
  }

  .print-grand-total span {
    font-size: 7pt;
  }

  .print-grand-total strong {
    grid-row: span 2;
    font-size: 12pt;
  }

  .print-grand-total small {
    font-size: 6.5pt;
  }

  .print-batch-heading {
    margin: 4mm 0 6mm;
  }

  .print-batch-heading h1 {
    font-size: 17pt;
  }

  .print-batch-table {
    font-size: 7pt;
  }

  .print-batch-table th:nth-child(1) { width: 3%; }
  .print-batch-table th:nth-child(2) { width: 13%; }
  .print-batch-table th:nth-child(3) { width: 11%; }
  .print-batch-table th:nth-child(4) { width: 11%; }
  .print-batch-table th:nth-child(5) { width: 8%; }
  .print-batch-table th:nth-child(6) { width: 7%; }

  .print-batch-table tfoot th {
    text-align: left;
  }

  .print-batch-grand-total {
    width: 86mm;
    margin-top: 5mm;
  }

  .print-batch-note {
    margin: 7mm 0 0;
    color: #444;
    font-size: 7pt;
    text-align: center;
  }

  .print-batch-card {
    break-before: page;
    page-break-before: always;
  }
}

@media (max-width: 1320px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .main-content { padding-left: 22px; padding-right: 22px; }
  .workspace { grid-template-columns: 275px minmax(0, 1fr); }
  .summary-item { min-width: 120px; }
  .card-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
