:root {
  --bg: #f4f6f1;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --text: #142218;
  --muted: #66736b;
  --line: rgba(20, 34, 24, 0.09);
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --warn: #d97706;
  --danger: #b91c1c;
  --shadow: 0 20px 60px rgba(20, 34, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.10), transparent 28%),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.08), transparent 22%),
    linear-gradient(180deg, #f7faf8 0%, #eef2ec 100%);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 0.94rem;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  background: linear-gradient(180deg, #11261d 0%, #0d1f18 100%);
  color: #f8fffb;
  padding: 20px 16px;
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  text-align: center;
}

.brand strong {
  display: block;
  width: 100%;
  font-size: 1.1rem;
  line-height: 1.2;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 12px;
  color: rgba(248, 255, 251, 0.8);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease;
}

.nav-link.active,
.nav-link:hover {
  color: #fff;
  background: rgba(15, 118, 110, 0.22);
  border-color: rgba(86, 204, 194, 0.2);
}

/* ── User panel (sidebar bottom) ─────────────────────────── */

.user-panel {
  margin-top: 16px;
}

.user-panel-inner {
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 8px;
  text-align: center;
  transform: translateZ(0);
}

.user-panel strong {
  color: #f8fffb;
  font-size: 0.88rem;
}

.user-panel .muted {
  color: rgba(248, 255, 251, 0.5);
  font-size: 0.77rem;
}

.user-panel .btn-secondary {
  color: rgba(248, 255, 251, 0.88);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.11);
  padding: 7px 12px;
  font-size: 0.82rem;
  border-radius: 10px;
  width: 100%;
  text-align: center;
}

.user-panel .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Main ────────────────────────────────────────────────── */

.main {
  padding: 18px 20px;
  min-width: 0;
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.hero.hero-compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0 0 5px;
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  line-height: 1.05;
}

.hero.hero-compact h1 {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  margin-bottom: 3px;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── Grid ────────────────────────────────────────────────── */

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── Panel ───────────────────────────────────────────────── */

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.panel-compact {
  padding: 10px 14px;
  border-radius: 16px;
}

/* ── Stat cards ──────────────────────────────────────────── */

.stat {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
}

.stat .value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

/* ── Table ───────────────────────────────────────────────── */

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 6px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  line-height: 1.2;
}

th {
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding-top: 4px;
  padding-bottom: 4px;
}

/* ── Badge ───────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.71rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: 0.02em;
}

.badge.warn {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warn);
}

.badge.gray {
  background: rgba(102, 115, 107, 0.12);
  color: #4c5b53;
}

/* ── Actions ─────────────────────────────────────────────── */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-actions {
  justify-content: flex-end;
  align-items: center;
  margin-left: auto;
}

.hero-actions-single-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 6px;
}

/* ── Password toggle ─────────────────────────────────────── */

.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input {
  width: 100%;
  padding-right: 38px !important;
}

.pw-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  border-radius: 6px;
  transition: color 120ms ease;
  display: flex;
  align-items: center;
}

.pw-toggle:hover {
  color: var(--text);
}

.pw-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 8px 15px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  transition: transform 100ms ease, opacity 100ms ease, background 100ms ease;
  white-space: nowrap;
  line-height: 1.2;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #0f766e 0%, #155e75 100%);
}

.btn-secondary {
  color: var(--text);
  background: rgba(20, 34, 24, 0.06);
}

.btn-secondary:hover {
  background: rgba(20, 34, 24, 0.1);
}

.btn-danger {
  color: #fff;
  background: var(--danger);
}

/* ── Stack / Form ────────────────────────────────────────── */

.stack {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #2a3d30;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(20, 34, 24, 0.13);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 120ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.help,
.error {
  font-size: 0.8rem;
}

.error {
  color: var(--danger);
}

/* ── Item card ───────────────────────────────────────────── */

.list {
  display: grid;
  gap: 8px;
}

.item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(20, 34, 24, 0.033);
  font-size: 0.88rem;
}

.shipment-id-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.shipment-id-card > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ── Detail / document stacks ────────────────────────────── */

.detail-stack {
  max-width: 100%;
  gap: 8px;
}

.document-detail-stack {
  width: 100%;
}

.compact-panel {
  padding: 10px 13px;
  border-radius: 16px;
  gap: 8px;
}

.compact-panel h3 {
  font-size: 0.95rem;
  margin: 0 0 6px;
}

.document-goods-table th:first-child,
.document-goods-table td:first-child {
  width: 230px;
  min-width: 230px;
  white-space: nowrap;
}

.document-goods-table th:nth-child(3),
.document-goods-table td:nth-child(3),
.document-goods-table th:nth-child(4),
.document-goods-table td:nth-child(4) {
  width: 110px;
  white-space: nowrap;
}

.compact-form-grid {
  gap: 8px;
}

.freight-main-grid {
  grid-template-columns: minmax(220px, 1fr) minmax(110px, 0.35fr);
}

.freight-dimension-grid {
  grid-template-columns:
    minmax(140px, 1fr)
    repeat(3, minmax(92px, 0.7fr));
  align-items: start;
}

.freight-dimension-grid input[readonly] {
  background: rgba(20, 34, 24, 0.04);
  color: var(--muted);
  cursor: default;
}

.document-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.demosada-address-grid {
  grid-template-columns:
    minmax(180px, 1.4fr)
    minmax(110px, 0.7fr)
    minmax(150px, 1fr)
    minmax(95px, 0.55fr);
}

.compact-panel .field {
  gap: 3px;
}

.compact-panel .field label {
  font-size: 0.77rem;
}

.compact-panel .field input,
.compact-panel .field select,
.compact-panel .field textarea {
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 0.87rem;
}

.compact-panel .item-card {
  padding: 8px 10px;
  border-radius: 11px;
  gap: 8px;
}

.shipment-submit-row {
  margin-bottom: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.shipment-submit-row .btn {
  padding: 8px 13px;
}

.shipping-recommendation {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 2px;
  color: var(--muted);
  cursor: help;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

.shipping-recommendation.is-ai {
  color: #b91c1c;
}

.shipping-recommendation.is-local {
  color: #1d4ed8;
}

.field-span-half {
  grid-column: span 2;
}

.geis-filter-panel {
  margin-bottom: 12px;
}

.geis-filter-form {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(140px, 180px) max-content max-content;
  gap: 10px;
  align-items: end;
}

.geis-pickup-toggle {
  align-self: center;
  min-height: 44px;
}

.geis-summary-grid {
  margin-bottom: 12px;
}

.geis-section-panel + .geis-section-panel {
  margin-top: 14px;
}

.geis-table td {
  vertical-align: top;
}

/* ── Loading overlay ─────────────────────────────────────── */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(5px);
}

.loading-card {
  min-width: min(320px, calc(100vw - 32px));
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 20px 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  text-align: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid rgba(15, 118, 110, 0.15);
  border-top-color: var(--accent);
  animation: spin 800ms linear infinite;
}

.field-span {
  grid-column: 1 / -1;
}

/* ── Toolbar ─────────────────────────────────────────────── */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar input,
.toolbar select {
  border: 1px solid rgba(20, 34, 24, 0.12);
  border-radius: 12px;
  padding: 8px 11px;
  font: inherit;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.9);
}

.toolbar input {
  flex: 1 1 240px;
  min-width: 0;
}

.toolbar select {
  flex: 0 1 200px;
}

/* ── Toast ───────────────────────────────────────────────── */

.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 95;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.toast {
  min-width: 240px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 14px;
  color: #fff;
  box-shadow: var(--shadow);
  animation: slide-in 160ms ease;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  line-height: 1.3;
  font-size: 0.88rem;
  font-weight: 600;
}

.toast.success { background: #0f766e; }
.toast.error   { background: #b91c1c; }
.toast.info    { background: rgba(51, 65, 85, 0.96); }
.toast.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.97) 0%, rgba(51, 65, 85, 0.97) 100%);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.24);
  border-color: rgba(148, 163, 184, 0.22);
  font-weight: 700;
}

.toast-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: spin 800ms linear infinite;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Doc title row (FlexiBee links) ─────────────────────── */

.doc-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.doc-title-row h1 {
  margin: 0;
}

.doc-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 3px 9px;
  white-space: nowrap;
  transition: background 120ms ease;
}

.doc-ext-link:hover {
  background: rgba(15, 118, 110, 0.2);
}

/* ── Settings ────────────────────────────────────────────── */

.alert {
  padding: 9px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.alert-ok {
  background: rgba(240, 253, 250, 0.95);
  border: 1px solid rgba(13, 148, 136, 0.2);
  color: #0f766e;
}

.alert-err {
  background: rgba(254, 242, 242, 0.95);
  border: 1px solid rgba(220, 38, 38, 0.15);
  color: #b91c1c;
}

.sett-panel {
  padding: 12px 14px;
  border-radius: 16px;
}

.sett-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.sett-head-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.sett-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
}

.sett-head span {
  font-size: 0.82rem;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flexibee-settings-grid {
  grid-template-columns:
    minmax(220px, 1.45fr)
    minmax(130px, 0.8fr)
    minmax(110px, 0.7fr)
    minmax(130px, 0.8fr)
    minmax(100px, 0.55fr)
    minmax(100px, 0.55fr);
}

.zasilkovna-settings-grid .field {
  align-content: start;
  align-self: start;
}

.zasilkovna-settings-grid .field input,
.zasilkovna-settings-grid .field select {
  min-height: 44px;
}

.zasilkovna-detail-grid {
  grid-template-columns:
    minmax(150px, 1.1fr)
    minmax(170px, 1.15fr)
    minmax(120px, 0.75fr)
    minmax(110px, 0.7fr)
    minmax(110px, 0.7fr);
}

.zasilkovna-options-grid {
  grid-template-columns: minmax(260px, 1.5fr) repeat(2, minmax(120px, 0.7fr));
  align-items: start;
}

.account-create-grid {
  grid-template-columns: minmax(170px, 1fr) minmax(210px, 1fr) minmax(170px, 0.8fr);
}

.account-permissions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.account-permissions-compact {
  grid-template-columns: repeat(3, minmax(110px, 1fr));
}

.account-permission {
  min-height: 42px;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 10px;
  background: rgba(240, 253, 250, 0.62);
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 10px;
}

.account-admin-toggle {
  background: rgba(255, 251, 235, 0.88);
  border-color: rgba(217, 119, 6, 0.18);
}

.account-table td {
  vertical-align: top;
}

.invoice-value-row {
  margin: 0;
  min-height: 44px;
}

.settings-field-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.28;
  margin-top: 2px;
}

.geis-sender-grid {
  grid-template-columns:
    minmax(170px, 1.25fr)
    minmax(150px, 1.1fr)
    minmax(120px, 0.9fr)
    minmax(82px, 0.55fr)
    minmax(70px, 0.45fr)
    minmax(150px, 1fr)
    minmax(110px, 0.75fr);
  gap: 8px;
}

.sender-inline-grid {
  grid-template-columns:
    minmax(145px, 1.2fr)
    minmax(145px, 1.15fr)
    minmax(130px, 0.95fr)
    minmax(74px, 0.5fr)
    minmax(62px, 0.42fr)
    minmax(150px, 1.05fr)
    minmax(110px, 0.7fr);
  gap: 8px;
}

.geis-sender-grid .field,
.sender-inline-grid .field {
  gap: 4px;
}

.geis-sender-grid .field input,
.sender-inline-grid .field input {
  padding: 8px 9px;
}

.toggle-field {
  align-self: center;
  min-height: 44px;
}

.mock-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  margin: 0;
  min-height: 44px;
}

.header-toggle {
  flex: 0 0 auto;
  justify-self: end;
  min-height: 32px;
  padding-left: 12px;
}

.header-toggle span {
  white-space: nowrap;
  color: #2a3d30;
  font-weight: 700;
}

.mock-row input[type="checkbox"] {
  appearance: none;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 34, 24, 0.18);
  box-shadow: inset 0 0 0 1px rgba(20, 34, 24, 0.08);
  padding: 2px;
  position: relative;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.mock-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 34, 24, 0.25);
  transition: transform 140ms ease;
}

.mock-row input[type="checkbox"]:checked {
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.2);
}

.mock-row input[type="checkbox"]:checked::before {
  transform: translateX(18px);
}

.mock-row input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
}

/* ── Login ───────────────────────────────────────────────── */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(480px, 100%);
}

.login-remember-row {
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
}

/* ── Pre ─────────────────────────────────────────────────── */

.pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  font-size: 0.77rem;
  line-height: 1.5;
}

.event-payload {
  margin: 8px 0 0;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  max-width: 760px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Shipment table ──────────────────────────────────────── */

.shipment-table td,
.shipment-table th {
  padding-top: 5px;
  padding-bottom: 5px;
}

.shipment-table td {
  font-size: 0.88rem;
}

.shipment-table th:last-child,
.shipment-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.actions-cell {
  white-space: nowrap;
}

.account-update-form + .account-delete-form,
.account-update-form + .btn {
  margin-top: 6px;
}

/* ── Discord šablona ────────────────────────────────────── */

.discord-msg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 720px) {
  .discord-msg-grid { grid-template-columns: 1fr; }
}

.discord-msg-grid textarea {
  width: 100%;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 0.82rem;
  resize: vertical;
  min-height: 180px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--text);
  line-height: 1.5;
}

.discord-msg-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.discord-vars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.discord-var-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.discord-var-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.discord-var-code {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 0.78rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  transition: background 100ms ease, color 100ms ease;
}

.discord-var-code:hover {
  background: var(--accent);
  color: #fff;
}

.discord-var-code.inserted {
  background: #16a34a;
  color: #fff;
}

.discord-preview {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: rgba(0,0,0,.04);
  border-radius: 6px;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Barevné označení typů dokladů ──────────────────────── */

tr.doc-vf1 td:first-child,
tr.doc-vf2 td:first-child,
tr.doc-larx td:first-child {
  position: relative;
}

tr.doc-vf1 td:first-child::before,
tr.doc-vf2 td:first-child::before,
tr.doc-larx td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
}

tr.doc-vf1 td:first-child::before  { background: #16a34a; }
tr.doc-vf2 td:first-child::before  { background: #7c3aed; }
tr.doc-larx td:first-child::before { background: #d97706; }

tr.doc-vf1  { background: rgba(22, 163, 74, 0.05); }
tr.doc-vf2  { background: rgba(124, 58, 237, 0.05); }
tr.doc-larx { background: rgba(217, 119, 6, 0.06); }

/* ── Stav dopravy v přehledu dokladů ─────────────────────── */

tr.doc-unshipped {
  background: rgba(220, 38, 38, 0.08) !important;
}

tr.doc-unshipped td:first-child {
  position: relative;
}

tr.doc-unshipped td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #dc2626;
  border-radius: 0 2px 2px 0;
}

/* ── Odeslaná zásilka (doc-shipped) ─────────────────────── */

tr.doc-shipped {
  background: rgba(71, 136, 0, 0.18) !important;
}

tr.doc-shipped td:first-child {
  position: relative;
}

tr.doc-shipped td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #478800;
  border-radius: 0 2px 2px 0;
}

.badge-shipped {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 5px 0 0;
  padding: 2px 8px;
  background: rgba(71, 136, 0, 0.16);
  color: #3f7a00;
  border: 1px solid rgba(71, 136, 0, 0.32);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  width: fit-content;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.shipment-confirmation {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 4px;
  color: #315f00;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

a.badge-shipped {
  text-decoration: none;
}

a.badge-shipped:hover {
  background: rgba(71, 136, 0, 0.22);
  border-color: rgba(71, 136, 0, 0.45);
  color: #2f6500;
}

.status-shipped {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(71, 136, 0, 0.14);
  color: #3f7a00;
  border: 1px solid rgba(71, 136, 0, 0.28);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Mobilní přizpůsobení badge-shipped */
@media (max-width: 640px) {
  .badge-shipped {
    display: block;
    margin: 4px 0 0 0;
    width: fit-content;
    font-size: 0.70rem;
  }
}

.actions-inline {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.actions-inline form {
  display: inline-flex;
  margin: 0;
}

.actions-inline .btn,
.actions-inline a.btn,
.actions-inline button.btn {
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 0.79rem;
  line-height: 1;
  min-width: 0;
}

/* ── Freight sekce — odlišné pozadí ────────────────────────── */

[data-pickup-section] {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.11) 0%, rgba(245, 158, 11, 0.06) 100%);
  border: 2px solid rgba(217, 119, 6, 0.28);
}

[data-pickup-section] strong[data-freight-carrier-label] {
  color: #92400e;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1100px) {
  .shell,
  .grid.cols-3,
  .grid.cols-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 14px 12px;
  }

  .brand {
    margin: 0;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .brand strong {
    font-size: 1.05rem;
  }

  .sidebar nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    overflow-x: auto;
    padding: 0 2px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: nowrap;
  }

  .user-panel {
    display: none;
  }

  /* Formuláře zůstávají 2 sloupce do 1100px */
  .document-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

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

  .account-create-grid,
  .account-permissions-grid,
  .account-permissions-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sett-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .sett-head-main {
    flex-direction: column;
    gap: 2px;
  }

  .header-toggle {
    justify-content: space-between;
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  /* ── Sidebar → kompaktní horizontální lišta ── */
  .sidebar {
    padding: 8px 10px 10px;
    gap: 7px;
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar nav {
    justify-content: flex-start;
    gap: 4px;
    margin-inline: -2px;
    padding-inline: 2px;
  }

  .nav-link {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.8rem;
    border-radius: 9px;
  }

  /* ── Main ── */
  .main {
    padding: 12px 12px;
  }

  /* ── Panely ── */
  .panel {
    padding: 12px;
    border-radius: 14px;
  }

  .panel-compact {
    padding: 8px 10px;
    border-radius: 12px;
  }

  .compact-panel {
    padding: 8px 10px;
    border-radius: 12px;
  }

  /* ── Gridy formulářů ── */
  .form-grid,
  .document-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .freight-dimension-grid {
    grid-template-columns: 1fr;
  }

  .freight-dimension-grid .field,
  [data-pickup-section] input[type="date"] {
    min-width: 0;
    max-width: 100%;
  }

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

  .field-span-half {
    grid-column: 1 / -1;
  }

  .compact-panel .item-card {
    padding: 8px 9px;
  }

  /* ── Hero ── */
  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }

  .hero.hero-compact {
    display: flex;
    flex-direction: column;
  }

  .hero h1 {
    font-size: clamp(1.3rem, 6vw, 1.8rem);
    line-height: 1.05;
  }

  .hero-actions-single-row {
    display: flex;
    flex-wrap: wrap;
  }

  /* Tlačítka v hero full-width na mobilu */
  .hero-actions .btn,
  .hero-actions a.btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }

  /* ── Toolbar ── */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input,
  .toolbar select {
    width: 100%;
    flex: 1 1 auto;
  }

  /* ── Item cards ── */
  .item-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .item-card > div:last-child {
    width: 100%;
  }

  .shipment-id-card {
    grid-template-columns: 1fr;
  }

  .document-goods-table td:first-child,
  .document-goods-table td:nth-child(3),
  .document-goods-table td:nth-child(4) {
    width: auto;
    white-space: normal;
  }

  /* ── Tabulky → card layout ── */
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  .table-wrap {
    overflow: visible;
  }

  tbody {
    display: grid;
    gap: 8px;
  }

  tr {
    background: rgba(20, 34, 24, 0.033);
    border-radius: 12px;
    padding: 8px 10px;
  }

  tr.doc-vf1,
  tr.doc-vf2,
  tr.doc-larx,
  tr.doc-unshipped,
  tr.doc-shipped {
    position: relative;
    padding-left: 16px;
    overflow: hidden;
  }

  tr.doc-vf1 td:first-child::before,
  tr.doc-vf2 td:first-child::before,
  tr.doc-larx td:first-child::before,
  tr.doc-unshipped td:first-child::before,
  tr.doc-shipped td:first-child::before {
    display: none;
  }

  tr.doc-vf1::before,
  tr.doc-vf2::before,
  tr.doc-larx::before,
  tr.doc-unshipped::before,
  tr.doc-shipped::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 0 3px 3px 0;
  }

  tr.doc-vf1::before { background: #16a34a; }
  tr.doc-vf2::before { background: #7c3aed; }
  tr.doc-larx::before { background: #d97706; }
  tr.doc-unshipped::before { background: #dc2626; }
  tr.doc-shipped::before { background: #478800; }

  td {
    border-bottom: 1px solid var(--line);
    padding: 5px 0;
  }

  td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }

  td.actions,
  td[data-label="Akce"],
  td.actions-cell {
    padding-top: 8px;
  }

  td.actions::before,
  td[data-label="Akce"]::before,
  td.actions-cell::before {
    width: 100%;
  }

  .actions-inline {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 5px;
  }

  .actions-inline .btn,
  .actions-inline a.btn,
  .actions-inline button.btn {
    flex: 1 1 100px;
    text-align: center;
    justify-content: center;
    padding: 7px 8px;
  }

  .actions-inline form {
    display: flex;
    flex: 1 1 100px;
  }

  .actions-inline {
    white-space: normal;
  }

  /* ── Toast ── */
  .toast-wrap {
    left: 10px;
    right: 10px;
    top: 10px;
    justify-items: stretch;
  }

  .toast {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  /* ── Pre ── */
  .pre {
    font-size: 0.73rem;
    padding: 9px;
  }

  /* ── Detail stack ── */
  .detail-stack {
    gap: 10px;
  }
}

/* Velmi malé obrazovky — 1 sloupec pro formuláře */
@media (max-width: 480px) {
  .form-grid,
  .document-form-grid,
  .geis-filter-form,
  .flexibee-settings-grid,
  .zasilkovna-detail-grid,
  .demosada-address-grid,
  .account-create-grid,
  .account-permissions-grid,
  .account-permissions-compact {
    grid-template-columns: 1fr;
  }
}
