:root {
  --bg-main: #020813;
  --bg-panel: #050d19;
  --bg-panel-alt: #071223;
  --bg-chip: #101b2c;
  --accent-gold: #ffb66c;
  --accent-gold-soft: #b98647;
  --accent-teal: #00b6c4;
  --accent-teal-soft: #047e9f;
  --text-main: #f5f5f5;
  --text-muted: #95a2b6;
  --border-soft: #1d2938;
  --danger: #c63333;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --shadow-soft: 0 0 32px rgba(0, 0, 0, 0.65);
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --accent-green: #7ddf4e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: var(--font-ui);
  background: radial-gradient(circle at top, #091a30 0, #020813 55%, #000 100%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* základný layout */

.app_demo-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 14px 10px 18px;
}

.app {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* DEMO banner */

.demo-banner {
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    rgba(255, 182, 108, 0.1),
    rgba(198, 47, 47, 0.45)
  );
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 182, 108, 0.6);
  color: #ffe5c8;
  font-size: 13px;
  padding: 8px 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-soft);
}

.demo-active .demo-banner {
  display: flex;
}

/* HEADER */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 60px;
  width: auto;
  display: block;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* BUTTONS */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent-gold-soft);
  background: linear-gradient(
    135deg,
    rgba(255, 182, 108, 0.08),
    rgba(4, 19, 37, 0.9)
  );
  color: var(--accent-gold);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7);
  transition: background 0.15s ease, transform 0.08s ease,
    box-shadow 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    opacity 0.1s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9);
}

.btn span.icon {
  font-size: 14px;
  line-height: 1;
}

.btn-secondary {
  border-color: #253246;
  color: var(--text-main);
}

.btn-danger {
  border-color: var(--danger);
  color: #ffe4e4;
}

.btn-primary {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, #ffb66c, #c98237);
  color: #1a1309;
  font-weight: 600;
  padding-inline: 18px;
  box-shadow: 0 0 18px rgba(255, 182, 108, 0.4);
}

.btn[disabled] {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}

.btn-ghost {
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--text-main);
}

.btn-small {
  padding: 3px 9px;
  font-size: 11px;
}

/* FILTER PANEL */

.filter-panel {
  background: linear-gradient(
    135deg,
    rgba(4, 17, 32, 0.96),
    rgba(3, 10, 22, 0.98)
  );
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  width: 100%;
}

.filter-left {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 8px;
}

.filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 160px));
  gap: 8px 12px;
  flex: 1;
  min-width: 280px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}

.field-label {
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-input {
  position: relative;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 9px;
  background: #050b16;
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  font-size: 13px;
}

.field-input input {
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  width: 100%;
  font: inherit;
}

.field-input input::placeholder {
  color: #4b5a70;
}

/* WRAPPERS */

.list-wrapper,
.new-wrapper,
.issue-wrapper {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
  width: 100%;
}

/* LIST HEADER */

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.list-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.status-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-label {
  font-size: 12px;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  background: var(--bg-chip);
  white-space: nowrap;
}

.status-pill-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-pill--uncollected .status-pill-dot {
  background: var(--accent-gold);
}

.status-pill--collected .status-pill-dot {
  background: var(--accent-teal);
}

.uncollected-count {
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffb66c, #c98237);
  color: #1b130a;
  font-size: 12px;
  font-weight: 600;
  min-width: 30px;
  text-align: center;
}

/* PARCEL GRID */

.parcel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 2px;
}

.parcel-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-radius: var(--radius-md);
  padding: 10px 10px 10px 13px;
  cursor: pointer;
  background: linear-gradient(
    135deg,
    rgba(10, 22, 40, 0.96),
    rgba(5, 14, 27, 1)
  );
  border: 1px solid #182334;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  transition: transform 0.08s ease, box-shadow 0.12s ease,
    border-color 0.12s ease, background 0.12s ease;
  min-height: 68px;
}

.parcel-card:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9);
}

.parcel-card--uncollected {
  background: radial-gradient(
    circle at top left,
    #39200c 0,
    #120b04 38%,
    #050c17 100%
  );
  border-color: rgba(255, 182, 108, 0.35);
}

.parcel-card--collected {
  background: radial-gradient(
    circle at top left,
    #07373d 0,
    #041925 40%,
    #040c17 100%
  );
  border-color: rgba(0, 182, 196, 0.45);
}

.parcel-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding-right: 8px;
}

.parcel-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.parcel-card--uncollected .parcel-name {
  color: var(--accent-gold);
}

.parcel-card--collected .parcel-name {
  color: var(--accent-teal);
}

.parcel-courier {
  font-size: 12px;
  color: var(--text-muted);
}

.parcel-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding-left: 10px;
  margin-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 48px;
}

.parcel-info-chip {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
}

.parcel-qty {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-chip);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.parcel-card--uncollected .parcel-qty {
  border-color: rgba(255, 182, 108, 0.8);
  color: var(--accent-gold);
}

.parcel-card--collected .parcel-qty {
  border-color: rgba(0, 182, 196, 0.8);
  color: var(--accent-teal);
}

/* NEW PARCEL FORM */

.new-header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-green);
  margin-bottom: 2px;
}

.new-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.new-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 260px));
  gap: 10px 16px;
  max-width: 640px;
}

.new-field-label-main {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  margin-bottom: 3px;
}

.new-input {
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: #040915;
  padding: 7px 9px;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}

.new-input[readonly] {
  opacity: 0.8;
}

.new-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
  margin-top: 14px;
}

.new-actions-left,
.new-actions-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.new-required {
  color: #ff6b6b;
  font-size: 11px;
  margin-left: 4px;
}

/* ISSUE (VÝDAJ) */

.issue-header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-teal);
  margin-bottom: 2px;
}

.issue-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.issue-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 22px;
  max-width: 1000px;
}

.issue-block-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.issue-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  font-size: 11px;
}

.issue-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
}

.issue-input,
.issue-textarea {
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: #040915;
  padding: 7px 9px;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}

.issue-input[readonly] {
  opacity: 0.8;
}

.issue-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
  margin-top: 14px;
}

.issue-actions-left,
.issue-actions-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.issue-required {
  color: #ff6b6b;
  font-size: 11px;
  margin-left: 4px;
}

.condition-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.condition-label-inline {
  font-size: 12px;
  color: var(--text-muted);
}

.condition-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: #040915;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-main);
}

.condition-pill.active-undamaged {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
  background: rgba(0, 182, 196, 0.12);
}

.condition-pill.active-damaged {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: rgba(255, 182, 108, 0.12);
}

/* SIGNATURES */

.signature-field {
  margin-top: 4px;
}

.signature-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.signature-box {
  margin-top: 4px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: #020915;
  padding: 4px;
  touch-action: none;
}

.signature-canvas {
  width: 100%;
  height: 80px;
  display: block;
  background: radial-gradient(circle at top, #07111f 0, #020713 55%);
  border-radius: 6px;
  touch-action: none;
}

.signature-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* RESPONSIVE */

@media (max-width: 1024px) {
  .parcel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .parcel-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .new-grid,
  .issue-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 100%;
  }
}
