:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-2: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-sm: 10px;
  --sidebar-width: 220px;
  --max-content: 1600px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

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

form {
  margin: 0;
}

::placeholder {
  color: #94a3b8;
}

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

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-badge,
.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(110, 168, 255, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 10px;
}

.title {
  margin: 0 0 8px;
  font-size: 26px;
}

.page-title {
  margin: 10px 0 8px;
  font-size: 32px;
  line-height: 1.15;
}

.section-title {
  margin: 0 0 12px;
  font-size: 20px;
}

.subsection-title {
  margin: 24px 0 12px;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.form-stack {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(110, 168, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(110, 168, 255, 0.12);
  background: rgba(15, 23, 42, 0.06);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.btn,
.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid rgba(110, 168, 255, 0.18);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.18s ease, filter 0.18s ease, border-color 0.18s ease,
    background 0.18s ease;
}

.btn:hover,
.button:hover,
button.button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
}

.btn-secondary,
.button.secondary {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
  border: 1px solid var(--panel-border);
}

.btn-success,
.button.success {
  background: linear-gradient(135deg, #1f8f5f, #29b87a);
  color: white;
  border: 1px solid rgba(126, 240, 199, 0.28);
}

.sidebar-logout {
  width: 100%;
}

.alert {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
}

.alert.error,
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert.success,
.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.app-body {
  min-height: 100vh;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  padding: 18px 14px;
  background: var(--bg-soft);
  border-right: 1px solid var(--panel-border);
  overflow-y: auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.admin-brand {
  padding: 4px 10px 18px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 18px;
}

.admin-brand h2 {
  margin: 12px 0 8px;
  font-size: 22px;
}

.admin-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.sidebar-section {
  margin-bottom: 18px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px;
  margin: 14px 0 10px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, color 0.18s ease,
    border-color 0.18s ease, transform 0.18s ease;
}

.sidebar-link:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar-link.active {
  background: rgba(110, 168, 255, 0.14);
  color: var(--text);
  border-color: rgba(110, 168, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(110, 168, 255, 0.06);
}

.sidebar-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.sidebar-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding: 0 10px 14px;
}

.admin-main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
}

.admin-content {
  width: min(100%, var(--max-content));
  min-width: 0;
  padding: 28px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.page-description {
  margin: 0;
  max-width: 920px;
  color: var(--muted);
  line-height: 1.6;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.page-actions form {
  margin: 0;
}

.page-actions .button,
.page-actions .btn {
  white-space: nowrap;
}

.content-stack {
  display: grid;
  gap: 20px;
}

.card,
.panel,
.hero-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.hero-card,
.panel {
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

.stats,
.hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.grid,
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
}

.stat .label,
.hero-title {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value,
.hero-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 8px;
  word-break: break-word;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.quick-link {
  display: block;
  text-decoration: none;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 18px;
  transition: transform 0.18s ease, border-color 0.18s ease,
    background 0.18s ease;
}

.quick-link:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 168, 255, 0.24);
  background: rgba(110, 168, 255, 0.08);
}

.quick-link-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.quick-link-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.status-row:last-child {
  border-bottom: 0;
}

.status {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.ok {
  background: #f0fdf4;
  color: #166534;
}

.status.off {
  background: #fef2f2;
  color: #b91c1c;
}

.list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.list li {
  margin-bottom: 8px;
  line-height: 1.55;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.info-card {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
}

.info-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.info-value {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-all;
}

.hint {
  margin-top: 2px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 12px;
  margin: 6px 6px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge.orange {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.badge.red {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge.gray {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

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

.error-note {
  margin-top: 8px;
  font-size: 12px;
  color: #b91c1c;
  white-space: pre-wrap;
  line-height: 1.5;
}

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

table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th {
  text-align: left;
  padding: 0 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

td {
  text-align: left;
  vertical-align: top;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 14px;
}

tbody tr:hover {
  background: rgba(15, 23, 42, 0.02);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.order-name,
.table-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.inline-link {
  color: var(--accent);
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

ul.items {
  margin: 0;
  padding-left: 18px;
}

ul.items li {
  margin-bottom: 4px;
}

.method-card {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.method-card:last-child {
  margin-bottom: 0;
}

.method-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.method-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 14px;
}

.scroll-anchor {
  scroll-margin-top: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 28px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.container {
  padding: 28px;
  display: grid;
  gap: 24px;
}

@media (max-width: 1280px) {
  .stats,
  .hero,
  .quick-grid,
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 1024px) {
  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    position: static;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
  }

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .page-header {
    flex-direction: column;
  }

  .page-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 800px) {
  .admin-content,
  .container {
    padding: 20px;
  }

  .grid,
  .grid-2,
  .grid-3,
  .stats,
  .hero,
  .quick-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    padding: 20px;
  }

  table,
  .data-table {
    min-width: 760px;
  }
}

/* Packing slip share dialog ------------------------------------------- */
.packing-share-dialog[hidden] {
  display: none !important;
}

.packing-share-dialog {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.packing-share-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.packing-share-dialog-card {
  position: relative;
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  padding: 24px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.packing-share-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.packing-share-dialog-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.packing-share-dialog-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 4px 8px;
  border-radius: 6px;
}

.packing-share-dialog-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.packing-share-dialog-description {
  margin: 0 0 16px;
}

.packing-share-dialog-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 8px;
}

.packing-share-dialog-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: #0f172a;
}

.packing-share-dialog-input:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.packing-share-dialog-feedback {
  min-height: 18px;
  font-size: 12px;
  color: #2563eb;
  margin-bottom: 12px;
}

.packing-share-dialog-feedback.error {
  color: #dc2626;
}

.packing-share-dialog-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Restricted worker hand-off page ------------------------------------ */
.worker-body {
  min-height: 100vh;
  margin: 0;
  background: #f3f6fb;
  color: #0f172a;
}

.worker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px clamp(20px, 5vw, 64px);
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.worker-header h1 {
  margin: 10px 0 4px;
}

.worker-header p {
  margin: 0;
  color: #64748b;
}

.worker-header-actions,
.worker-batch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.worker-header-actions form {
  margin: 0;
}

.worker-main {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

/* Pakavimas embedded in the admin shell (admin viewing /worker): the
   standalone page's hero paddings are oversized inside .admin-content,
   so tighten the header and let the list use the full content width.
   The restricted worker account still gets the standalone layout. */
.admin-content .worker-header {
  padding: 0 0 16px;
  background: transparent;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.admin-content .worker-main {
  width: 100%;
  padding: 20px 0 40px;
}

.worker-day + .worker-day {
  margin-top: 32px;
}

.worker-day > h2 {
  margin: 0 0 12px;
  font-size: 20px;
  text-transform: capitalize;
}

.worker-batch-list {
  display: grid;
  gap: 12px;
}

.worker-batch-card,
.worker-empty {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  padding: 20px;
}

.worker-batch-card.is-complete {
  background: #f0fdf4;
  border-color: #86efac;
}

.worker-empty {
  text-align: center;
  padding: 56px 24px;
}

.worker-empty h2 {
  margin-top: 0;
}

.worker-empty p {
  margin-bottom: 0;
  color: #64748b;
}

.worker-batch-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.worker-batch-meta strong,
.worker-batch-meta span {
  display: block;
}

.worker-batch-meta > div > span {
  margin-top: 3px;
  color: #64748b;
  font-size: 13px;
}

.worker-order-count {
  border-radius: 999px;
  background: #e8efff;
  color: #1d4ed8;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.worker-batch-badges {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-direction: column;
}

.worker-batch-state {
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.worker-batch-state.is-complete {
  background: #dcfce7;
  color: #166534;
}

.worker-action {
  display: grid;
  gap: 6px;
}

.worker-action-status {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}

.worker-action.is-done .button {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px #22c55e;
}

.worker-action.is-done .worker-action-status {
  color: #15803d;
}

.worker-primary-action {
  min-width: 190px;
}

.worker-batch-actions .button {
  justify-content: center;
}

.worker-batch-actions .button[disabled] {
  opacity: 0.55;
  cursor: wait;
}

.worker-batch-error {
  margin: 12px 0 0;
  color: #b91c1c;
  font-size: 13px;
}

@media (max-width: 640px) {
  .worker-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .worker-header-actions,
  .worker-batch-actions,
  .worker-action,
  .worker-batch-actions .button {
    width: 100%;
  }
}
