:root {
  --wysh-bg: #f0f2f5;
  --wysh-card: rgba(255, 255, 255, 0.82);
  --wysh-border: rgba(15, 23, 42, 0.08);
  --wysh-text: #1e293b;
  --wysh-muted: #64748b;
  --wysh-accent: #475569;
  --wysh-accent-hover: #334155;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--wysh-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(148, 163, 184, 0.22), transparent 55%),
    radial-gradient(ellipse 90% 60% at 100% 100%, rgba(203, 213, 225, 0.35), transparent 50%);
  color: var(--wysh-text);
}

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.navbar-wysh {
  background: var(--wysh-card) !important;
  border-bottom: 1px solid var(--wysh-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-wysh .navbar-brand {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.navbar-wysh .wysh-nav-logo {
  max-height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.06));
}

.navbar-wysh .navbar-toggler {
  border-color: rgba(15, 23, 42, 0.12);
}

.navbar-wysh .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(71, 85, 105, 0.12);
}

.navbar-wysh .nav-link {
  color: var(--wysh-muted) !important;
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: 10px;
  padding: 0.5rem 0.85rem !important;
}

.navbar-wysh .nav-link:hover {
  color: var(--wysh-text) !important;
  background: rgba(15, 23, 42, 0.04);
}

.navbar-wysh .nav-link.active {
  color: var(--wysh-accent) !important;
  background: rgba(71, 85, 105, 0.1);
}

.navbar-wysh .nav-user {
  color: var(--wysh-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
}

.page-title {
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--wysh-text);
  margin-bottom: 0.35rem;
}

.text-muted,
.hint {
  color: var(--wysh-muted) !important;
}

.card {
  border: 1px solid var(--wysh-border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  background: rgba(255, 255, 255, 0.85);
}

.form-control,
.form-select {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(71, 85, 105, 0.45);
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.12);
}

.form-label {
  font-weight: 500;
  color: var(--wysh-text);
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
}

.btn {
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9375rem;
}

.btn-primary {
  background: linear-gradient(180deg, #64748b 0%, var(--wysh-accent) 100%);
  border: none;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #576275 0%, var(--wysh-accent-hover) 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.2);
  color: #fff !important;
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-outline-primary {
  border: 1px solid rgba(71, 85, 105, 0.45);
  color: var(--wysh-accent);
  background: #fff;
}

.btn-outline-primary:hover {
  background: rgba(71, 85, 105, 0.1);
  border-color: var(--wysh-accent-hover);
  color: var(--wysh-accent-hover);
}

.btn-sm {
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
}

.btn-logout {
  border: 1px solid rgba(71, 85, 105, 0.25);
  background: #fff;
  color: var(--wysh-muted) !important;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.4rem 1rem !important;
  margin-left: 0.5rem;
}

.btn-logout:hover {
  border-color: rgba(220, 38, 38, 0.4);
  color: #b91c1c !important;
  background: rgba(254, 242, 242, 0.8);
}

.alert {
  border-radius: 12px;
}

.alert-danger {
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.table-responsive.wysh-table-wrap {
  border-radius: 12px;
  border: 1px solid var(--wysh-border);
  overflow: hidden;
  background: #fff;
}

.table-responsive.wysh-table-wrap .table {
  margin-bottom: 0;
}

.table-responsive.wysh-table-wrap thead th {
  background: #f1f5f9 !important;
  color: var(--wysh-text);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-color: var(--wysh-border) !important;
}

.table-responsive.wysh-table-wrap td {
  border-color: var(--wysh-border) !important;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.table-responsive.wysh-table-wrap td .err-batch {
  max-width: 16rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(241, 245, 249, 0.6);
}

.table a {
  color: var(--wysh-accent);
  font-weight: 500;
  text-decoration: none;
}

.table a:hover {
  color: var(--wysh-accent-hover);
  text-decoration: underline;
}

.pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--wysh-border);
  color: var(--wysh-muted);
  background: #fff;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.st {
  font-weight: 600;
}

.st-done { color: #15803d; }
.st-in_progress { color: var(--wysh-accent); }
.st-closing { color: var(--wysh-accent); }
.st-error { color: #b91c1c; }
.st-empty { color: var(--wysh-muted); }

.hint {
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.meta-grid .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--wysh-muted);
}

.meta-grid .value {
  margin-top: 0.25rem;
  font-size: 1.05rem;
  font-weight: 500;
}

/* Login */
.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-form {
  padding: 2rem 2rem 1.75rem;
  border-radius: 20px;
  background: var(--wysh-card);
  border: 1px solid var(--wysh-border);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 24px 48px -12px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.login-form .login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-form .login-brand img {
  max-height: 56px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.08));
}

.login-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--wysh-muted);
}

.small { font-size: 0.85rem; }
.err { color: #b91c1c; }
.err-batch { color: #b91c1c; }

.btn-expand {
  color: var(--wysh-muted) !important;
  line-height: 1;
  text-decoration: none !important;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-expand:hover { color: var(--wysh-accent) !important; }
.btn-expand .expand-icon {
  transition: transform 0.15s ease;
  font-size: 0.95rem;
}
.btn-expand.is-open .expand-icon { transform: rotate(90deg); }

.day-orders-cell {
  background: rgba(241, 245, 249, 0.55);
  border-top: none !important;
}
.day-orders-panel {
  margin: 0 0.75rem 0.85rem 2.25rem;
  border: 1px solid var(--wysh-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.orders-inner thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--wysh-muted);
  background: #f8fafc !important;
}
.search-results .wysh-table-wrap {
  border-radius: 12px;
}

.retire-docs {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.retire-doc-item {
  line-height: 1.25;
}
.retire-doc-item .hint {
  margin-top: 0.1rem;
}

.cis-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  background: #f8fafc;
  border: 1px solid var(--wysh-border);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
  word-break: break-all;
  display: inline-block;
  max-width: 100%;
  margin: 0.1rem 0;
}
.cis-cell {
  max-width: 280px;
}
