﻿:root {
  --blue-900: #1e3a8a;
  --blue-800: #1e40af;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --red-700: #b91c1c;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --red-50: #fef2f2;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow-x: hidden; }
body {
  font-family: var(--font);
  color: var(--slate-900);
  background: var(--slate-100);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue-600); }

.app-shell { min-height: 100%; }

/* Landing / auth */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-visual {
  position: relative;
  background: linear-gradient(180deg, var(--blue-900) 0%, var(--slate-900) 100%);
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-visual::after {
  content: "";
  position: absolute;
  inset: auto -10% -20% 30%;
  height: 60%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Ccircle cx='200' cy='200' r='160' fill='none' stroke='rgba(255,255,255,0.08)' stroke-width='2'/%3E%3Ccircle cx='200' cy='200' r='110' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  animation: fadeUp 0.6s ease both;
}
.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
  transform-origin: center;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.15;
}
.brand-title { font-size: 1.1rem; }
.brand-sub {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(147, 197, 253, 0.9);
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.03); }
}
@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28)) drop-shadow(0 0 0 rgba(56, 189, 248, 0)); }
  50% { filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.22)) drop-shadow(0 0 12px rgba(56, 189, 248, 0.45)); }
}
@keyframes logoIn {
  from { opacity: 0; transform: scale(0.82) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}
.aside-logo,
.brand-logo {
  animation: logoIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both, logoFloat 3.6s ease-in-out 0.7s infinite, logoGlow 4.8s ease-in-out 0.7s infinite;
}
.auth-hero {
  position: relative;
  z-index: 1;
  animation: fadeUp 0.7s ease 0.08s both;
}
.auth-eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(147, 197, 253, 0.95);
}
.auth-hero h1 {
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 1.15rem;
  max-width: 14ch;
  letter-spacing: -0.02em;
}
.auth-tips {
  position: relative;
  min-height: 4.8rem;
  max-width: 38ch;
  margin-bottom: 1.35rem;
}
.auth-tip {
  position: absolute;
  inset: 0;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(10px);
  animation: tipCycle 16s ease-in-out infinite;
}
.auth-tip.tip-1 { animation-delay: 0s; }
.auth-tip.tip-2 { animation-delay: 4s; }
.auth-tip.tip-3 { animation-delay: 8s; }
.auth-tip.tip-4 { animation-delay: 12s; }
.auth-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 34ch;
}
.auth-points li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.72);
  opacity: 0;
  animation: fadeUp 0.55s ease both;
}
.auth-points li:nth-child(1) { animation-delay: 0.25s; }
.auth-points li:nth-child(2) { animation-delay: 0.4s; }
.auth-points li:nth-child(3) { animation-delay: 0.55s; }
.point-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
  flex-shrink: 0;
  animation: pulseDot 2.2s ease-in-out infinite;
}
.auth-foot-note {
  font-size: 0.8rem;
  opacity: 0.7;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.6s ease 0.35s both;
}
@keyframes tipCycle {
  0%, 4% { opacity: 0; transform: translateY(10px); }
  8%, 22% { opacity: 1; transform: translateY(0); }
  28%, 100% { opacity: 0; transform: translateY(-8px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15); }
  50% { box-shadow: 0 0 0 7px rgba(96, 165, 250, 0.28); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-tip,
  .auth-hero,
  .brand-mark,
  .brand-logo,
  .aside-logo,
  .auth-points li,
  .auth-foot-note,
  .point-dot {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .auth-tips { min-height: 0; }
  .auth-tip {
    position: static;
    margin-bottom: 0.65rem;
  }
  .auth-tip + .auth-tip { display: none; }
}
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--slate-100);
}
.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
}
.auth-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--slate-900);
}
.auth-sub { margin: 0 0 1.35rem; color: var(--slate-500); font-size: 0.92rem; }
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  background: var(--slate-100);
  padding: 0.25rem;
  border-radius: 8px;
  margin-bottom: 1.15rem;
  border: 1px solid var(--slate-200);
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  color: var(--slate-500);
  font-weight: 600;
}
.tabs button.active {
  background: #fff;
  color: var(--blue-700);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.field { margin-bottom: 0.9rem; }
.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  background: #fff;
  color: var(--slate-900);
  font: inherit;
}
.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 2.75rem;
}
.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--slate-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.password-toggle:hover {
  color: var(--slate-800);
  background: var(--slate-50);
}
.password-toggle:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
}
.password-toggle .eye-closed { display: none; }
.password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }
.field input:focus,
.field select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--blue-500);
}
.field-hint {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: var(--slate-500);
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.settings-stack {
  display: grid;
  gap: 1rem;
  max-width: 520px;
}
.settings-stack-wide {
  max-width: 920px;
}
.settings-card {
  padding: 1.15rem 1.25rem;
}
.settings-card-wide {
  max-width: 100%;
}
.settings-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  color: var(--slate-900);
}
.settings-sub {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: var(--slate-500);
  line-height: 1.4;
}
.api-block {
  margin-top: 1.15rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--slate-200);
}
.api-block:first-of-type {
  margin-top: 0.35rem;
}
.api-block-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  color: var(--slate-800);
}
.api-token-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.api-token-row input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}
.api-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.api-doc-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: var(--slate-600);
  font-size: 0.86rem;
  line-height: 1.5;
}
.api-doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.api-doc-table th,
.api-doc-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: top;
}
.api-doc-table th {
  color: var(--slate-500);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.api-doc-table code {
  font-size: 0.78rem;
  word-break: break-word;
}
.api-pre {
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--slate-800);
}
.table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}
.supplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.supplier-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.supplier-card:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.supplier-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--slate-900);
  overflow-wrap: anywhere;
}
.supplier-card-meta {
  font-size: 0.8rem;
  color: var(--slate-500);
}
.supplier-card-go {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue-600);
}
.supplier-add-row {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.supplier-add-row input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  background: #fff;
  color: var(--slate-900);
  font: inherit;
}
.supplier-add-row .btn {
  width: auto;
  white-space: nowrap;
}
.btn {
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:active { transform: none; }
.btn-primary {
  background: var(--blue-600);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--blue-700); }
.btn-secondary {
  background: #fff;
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}
.btn-secondary:hover { background: var(--slate-50); border-color: var(--slate-500); }
.btn-ghost {
  background: transparent;
  color: var(--blue-600);
  border: 0;
  padding: 0.35rem 0.5rem;
  font-weight: 600;
}
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.82rem; border-radius: 8px; }
.auth-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--blue-800);
  line-height: 1.45;
  background: var(--blue-50);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
}
.auth-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.95rem;
}
.remember-me {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--slate-700);
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.remember-me input {
  width: auto;
  margin: 0;
  accent-color: var(--blue-600);
}
.auth-forgot-link,
.auth-back-link {
  font-size: 0.86rem;
  padding: 0;
  color: var(--blue-600);
}
.auth-back-link {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  text-align: center;
}
.auth-notice {
  background: var(--blue-50);
  color: var(--blue-800);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}
.auth-error {
  background: var(--red-50);
  color: var(--red-700);
  border: 1px solid var(--red-100);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  margin-bottom: 0.85rem;
}
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--slate-900);
  color: #e2e8f0;
  font-size: 0.72rem;
  text-align: center;
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.app-toast {
  position: fixed;
  top: 2.6rem;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  max-width: min(440px, calc(100vw - 2rem));
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  z-index: 220;
  font-size: 0.9rem;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28);
  overflow-wrap: anywhere;
  text-align: center;
  animation: toastIn 0.22s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* App layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  padding-top: 28px;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
.aside {
  background: linear-gradient(180deg, var(--blue-900) 0%, var(--slate-900) 100%);
  color: #fff;
  padding: 0.85rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  min-width: 0;
}
.aside-top { min-width: 0; }
.aside-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.aside-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.aside-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.aside-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  line-height: 1.15;
}
.aside-brand-title {
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aside-brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(147, 197, 253, 0.75);
}
.aside-user {
  margin: 0 0.35rem 0.85rem;
  padding: 0.75rem 0.8rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.aside-user .name { font-weight: 700; font-size: 0.92rem; overflow-wrap: anywhere; }
.aside-user .role { font-size: 0.72rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.15rem; }
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-group-toggle {
  justify-content: space-between;
}
.nav-caret {
  font-size: 0.75rem;
  opacity: 0.75;
}
.nav-sub {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.15rem 0 0.35rem 0.55rem;
}
.nav-group.open .nav-sub { display: flex; }
.nav-sub-btn {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}
.nav-sub-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-sub-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-steps {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.2rem 0 0.35rem 0.45rem;
}
.nav-step-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}
.nav-step-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.nav-step-btn.active {
  background: rgba(37, 99, 235, 0.65);
  color: #fff;
}
.nav-step-btn.locked,
.nav-step-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.nav-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.nav-step-btn.active .nav-step-num {
  background: rgba(255, 255, 255, 0.22);
}
.nav-step-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.nav-step-text strong {
  font-size: 0.8rem;
  font-weight: 700;
}
.nav-step-text small {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.5);
}
.nav-step-btn.active .nav-step-text small {
  color: rgba(255, 255, 255, 0.8);
}
.req-workspace.embedded.single {
  grid-template-columns: 1fr;
}
.hist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}
.hist-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.hist-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.hist-card h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--slate-900);
  overflow-wrap: anywhere;
}
.hist-meta {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--slate-500);
}
.hist-card-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: var(--slate-500);
}
.hist-card-row strong {
  color: var(--slate-800);
  text-align: right;
  overflow-wrap: anywhere;
}
.hist-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.25rem;
}
.dash-hint-body {
  padding: 1rem 1.15rem 1.15rem;
}
.dash-hint-body p { margin: 0 0 0.45rem; color: var(--slate-700); }
.dash-hint-body .muted { color: var(--slate-500); font-size: 0.88rem; margin: 0; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-btn.active {
  background: var(--blue-600);
  color: #fff;
}
.nav-section {
  margin: 0.75rem 0.7rem 0.3rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 700;
}
.aside-foot {
  margin-top: auto;
  padding: 0.75rem 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.aside-foot .btn-secondary {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.aside-foot .btn-secondary:hover { background: rgba(255, 255, 255, 0.14); }
.main {
  padding: 1.35rem 1.5rem 2.25rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  min-width: 0;
}
.greeting { min-width: 0; flex: 1; }
.greeting h1 {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.85rem);
  letter-spacing: -0.02em;
  color: var(--slate-900);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.greeting .sub {
  margin: 0.3rem 0 0;
  color: var(--slate-500);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.clock {
  text-align: right;
  color: var(--slate-500);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.clock .time {
  font-weight: 700;
  font-size: 1rem;
  color: var(--slate-800);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}
.stat {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--blue-600);
}
.stat .lbl {
  font-size: 0.7rem;
  color: var(--slate-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat .val {
  font-size: 1.65rem;
  font-weight: 700;
  margin-top: 0.2rem;
  color: var(--blue-700);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.panel {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 100%;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.05rem;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
  flex-wrap: wrap;
}
.panel-head h3 { margin: 0; font-size: 0.95rem; color: var(--slate-800); }
.panel-note {
  font-size: 0.8rem;
  color: var(--slate-500);
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
  overflow-wrap: anywhere;
  word-break: break-word;
}
th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  font-weight: 700;
  background: var(--slate-50);
}
tr:last-child td { border-bottom: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-muted { background: var(--slate-100); color: var(--slate-500); }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.quick-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.15rem 1.15rem;
}
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  text-align: left;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.quick-card:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.quick-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--slate-900);
}
.quick-card-sub {
  font-size: 0.8rem;
  color: var(--slate-500);
  line-height: 1.35;
}
.quick-card-go {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue-600);
}
.draft-strip {
  margin: 0 0 1.15rem;
}
.draft-strip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.draft-strip-head h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  color: var(--slate-900);
}
.draft-strip-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--slate-500);
  line-height: 1.35;
}
.draft-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.draft-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  text-align: left;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.9rem 1rem;
  color: inherit;
  font: inherit;
  min-height: 120px;
}
.draft-card.is-active {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2), var(--shadow);
  background: var(--blue-50);
}
.draft-card-body h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  color: var(--slate-900);
  overflow-wrap: anywhere;
}
.draft-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--slate-500);
  line-height: 1.35;
}
.draft-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.draft-card-new {
  align-items: flex-start;
  cursor: pointer;
  border-style: dashed;
  background: var(--slate-50);
}
.draft-card-new:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.draft-card-plus {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--blue-600);
  line-height: 1;
}
.draft-card-new strong {
  font-size: 0.9rem;
  color: var(--slate-900);
}
.cleanup-card {
  background: linear-gradient(180deg, var(--blue-900) 0%, var(--slate-900) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  border: 0;
  box-shadow: var(--shadow);
  max-width: 100%;
}
.cleanup-card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.cleanup-card p { margin: 0 0 0.9rem; color: rgba(255, 255, 255, 0.72); font-size: 0.88rem; }
.cleanup-card .btn-secondary {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.cleanup-card .btn-secondary:hover { background: rgba(255, 255, 255, 0.16); }

.cleanup-embed {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 2.2rem);
  min-height: 480px;
  margin-top: 2.2rem;
  background: var(--slate-100);
}
.cleanup-embed-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.85rem;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
}
.cleanup-embed-label {
  flex: 1;
  min-width: 140px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-500);
}
.cleanup-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
  min-height: 0;
}

/* Modal — full-screen requisition */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  animation: fadeIn 0.18s ease;
}
.modal-back.fullscreen {
  padding: 0;
  padding-top: 28px;
  background: #fff;
  backdrop-filter: none;
  align-items: stretch;
  justify-content: stretch;
  animation: none;
  box-sizing: border-box;
}
.modal {
  width: min(640px, 100%);
  max-height: min(92vh, 860px);
  background: #fff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  animation: rise 0.2s ease;
  border: none;
}
.modal.fullscreen,
.req-modal.fullscreen {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-height: 100%;
  border-radius: 0 !important;
  box-shadow: none !important;
  animation: none !important;
  overflow: hidden;
  margin: 0;
}
.page-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1rem;
  padding: 0.2rem;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.page-tab {
  border: 0;
  background: transparent;
  color: var(--slate-500);
  font-weight: 650;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.page-tab:hover { color: var(--slate-800); background: var(--slate-50); }
.page-tab.active {
  background: var(--blue-600);
  color: #fff;
}
.page-tab-body { min-width: 0; }
.req-workspace.embedded {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: min(70vh, 720px);
  height: auto;
  max-height: none;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  overflow: hidden;
  background: var(--slate-100);
  box-shadow: var(--shadow);
}
.req-workspace.embedded .req-side {
  border-radius: 0;
}
.req-workspace.embedded .req-top {
  padding: 1.1rem 1.35rem 0.85rem;
}
.req-workspace.embedded .req-tabs {
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}
.req-workspace.embedded .req-content {
  padding: 1rem 1.35rem;
}
.req-workspace.embedded .req-foot {
  padding: 0.85rem 1.35rem;
}

@media (max-width: 960px) {
  .req-workspace.embedded {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}
.req-side {
  background: linear-gradient(180deg, var(--blue-900) 0%, var(--slate-900) 100%);
  color: #fff;
  padding: 1rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  overflow: auto;
}
.req-side-brand {
  font-weight: 700;
  font-size: 1rem;
  padding: 0.35rem 0.55rem 0.15rem;
  letter-spacing: -0.02em;
}
.req-side-tag {
  margin: 0 0.55rem 0.85rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}
.req-side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.req-side-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}
.req-side-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); color: #fff; }
.req-side-btn.active {
  background: var(--blue-600);
  color: #fff;
}
.req-side-btn.locked,
.req-side-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.req-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.req-side-btn.active .req-step-num { background: rgba(255, 255, 255, 0.22); }
.req-side-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.req-side-text strong {
  font-size: 0.84rem;
  font-weight: 700;
}
.req-side-text small {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
}
.req-side-btn.active .req-side-text small { color: rgba(255, 255, 255, 0.8); }
.req-side-summary {
  margin-top: auto;
  margin-bottom: 0.65rem;
  padding: 0.7rem 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.req-sum-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}
.req-sum-row strong {
  color: #fff;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}
.req-side-close {
  width: 100%;
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
}
.req-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--slate-100);
}
.req-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem 1.75rem 1.1rem;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  flex-shrink: 0;
}
.req-top-text { min-width: 0; flex: 1; }
.req-back-link {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--blue-600);
  font-weight: 650;
  font-size: 0.84rem;
  padding: 0;
  margin: 0 0 0.65rem;
  cursor: pointer;
}
.req-back-link:hover { color: var(--blue-800); text-decoration: underline; }
.req-top h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  color: var(--slate-900);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.req-top p {
  margin: 0.4rem 0 0;
  color: var(--slate-500);
  font-size: 0.9rem;
  line-height: 1.4;
}
.req-top-x {
  width: 40px;
  height: 40px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #fff;
  color: var(--slate-700);
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.req-top-x:hover { background: var(--slate-50); }
.req-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.65rem 1.75rem 0;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.req-tab {
  border: 0;
  background: transparent;
  color: var(--slate-500);
  font-weight: 650;
  font-size: 0.86rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}
.req-tab:hover { color: var(--slate-800); }
.req-tab.active {
  color: var(--blue-700);
  border-bottom-color: var(--blue-600);
}
.req-tab.locked,
.req-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.req-content {
  flex: 1;
  overflow: auto;
  padding: 1.25rem 1.75rem;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.req-panel {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  max-width: 960px;
  min-width: 0;
}
.req-content.has-catalog .req-panel {
  max-width: none;
}
.req-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  gap: 1rem;
  align-items: start;
}
.catalog-browser {
  width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(70vh, 640px);
  overflow: hidden;
  position: sticky;
  top: 0.5rem;
}
.catalog-browser-head {
  padding: 0 0 0.65rem;
  border-bottom: 0;
  background: transparent;
  flex-shrink: 0;
}
.catalog-browser-head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  color: var(--slate-900);
}
.catalog-browser-head p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--slate-500);
  line-height: 1.35;
}
.catalog-browser-body {
  overflow: auto;
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  -webkit-overflow-scrolling: touch;
}
.cat-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
}
.cat-card.open {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15), var(--shadow);
}
.cat-card-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 0;
  background: #fff;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
  text-align: left;
  color: var(--slate-800);
}
.cat-card.open .cat-card-btn {
  background: var(--blue-50);
  border-bottom: 1px solid var(--slate-200);
}
.cat-card-btn:hover {
  background: var(--slate-50);
}
.cat-card.open .cat-card-btn:hover {
  background: var(--blue-50);
}
.cat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}
.cat-name {
  flex: 1;
  font-size: 0.86rem;
  font-weight: 700;
  min-width: 0;
  letter-spacing: 0.02em;
}
.cat-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--slate-500);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  padding: 0.12rem 0.4rem;
  flex-shrink: 0;
}
.cat-card.open .cat-count {
  color: var(--blue-600);
  border-color: rgba(37, 99, 235, 0.25);
  background: #fff;
}
.cat-card-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate-500);
}
.cat-card.open .cat-card-hint {
  color: var(--blue-600);
}
.cat-dropdown {
  background: var(--slate-50);
  border-top: 1px solid var(--slate-200);
}
.cat-dropdown-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem 0.15rem;
}
.cat-sel-count {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--slate-500);
}
.cat-items {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.45rem 0.35rem;
  max-height: 200px;
  overflow: auto;
}
.cat-item-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  margin-bottom: 0.3rem;
  cursor: pointer;
}
.cat-item-row:last-child { margin-bottom: 0; }
.cat-item-row:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.cat-item-row.is-checked {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.cat-item-check {
  margin-top: 0.15rem;
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--blue-600);
  cursor: pointer;
}
.cat-item-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.cat-item-name {
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--slate-900);
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.cat-item-meta {
  font-size: 0.68rem;
  color: var(--slate-500);
}
.cat-dropdown-foot {
  padding: 0.45rem;
  border-top: 1px solid var(--slate-200);
  background: #fff;
}
.cat-dropdown-foot .btn {
  width: 100%;
}
.cat-dropdown-foot .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 960px) {
  .req-split {
    grid-template-columns: 1fr;
  }
  .catalog-browser {
    width: 100%;
    max-width: none;
    position: static;
    max-height: none;
  }
  .cat-items {
    max-height: 180px;
  }
}
.req-panel-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: var(--slate-900);
}
.req-panel-sub {
  margin: 0 0 1rem;
  color: var(--slate-500);
  font-size: 0.88rem;
}
.req-workspace .req-foot {
  background: #fff;
  border-top: 1px solid var(--slate-200);
  margin: 0;
  padding: 0.95rem 1.75rem;
  flex-shrink: 0;
}
.req-workspace .req-list-box { margin-top: 0.75rem; }

/* legacy red header kept unused but harmless */
.modal-head {
  padding: 1rem 1.25rem 0.95rem;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--slate-50);
  flex-shrink: 0;
  min-width: 0;
}
.req-head > div:first-child {
  min-width: 0;
  flex: 1;
}
.req-head {
  background: var(--red-600);
  color: #fff;
}
.req-head h2 {
  margin: 0;
  font-size: clamp(1rem, 3.5vw, 1.15rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  word-wrap: break-word;
}
.req-head p {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  line-height: 1.4;
  max-width: 56ch;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.modal-x {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  border-radius: 6px;
  padding: 0;
  display: grid;
  place-items: center;
}
.modal-x:hover { background: rgba(255, 255, 255, 0.15); }
.modal-body {
  padding: 1rem 1.25rem;
  overflow: auto;
  flex: 1;
  min-width: 0;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.req-body {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}
.req-body .field { min-width: 0; }
.req-body .field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--slate-900);
  margin-bottom: 0.4rem;
}
.meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  min-width: 0;
}
.meta-row input,
.meta-row select {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  box-sizing: border-box;
  font: inherit;
  color: var(--slate-900);
}
.search-row {
  display: grid;
  grid-template-columns: 1fr 64px auto;
  gap: 0.45rem;
  align-items: stretch;
  min-width: 0;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.search-ico {
  position: absolute;
  left: 0.7rem;
  color: var(--slate-500);
  display: flex;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.65rem 0.75rem 0.65rem 2.25rem;
  background: #fff;
  color: var(--slate-900);
  box-sizing: border-box;
}
.search-wrap input:focus,
.qty-input:focus,
.meta-row input:focus,
.meta-row select:focus,
.new-item-form input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  border-color: var(--blue-500);
}
.qty-input {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.65rem 0.4rem;
  text-align: center;
  background: #fff;
  box-sizing: border-box;
}
.search-results {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  max-height: 220px;
  overflow-y: auto;
}
.search-hit {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.65rem;
  align-items: center;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--slate-100);
  background: #fff;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  min-width: 0;
}
.search-hit:last-child { border-bottom: none; }
.search-hit:hover { background: var(--blue-50); }
.hit-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--slate-900);
  min-width: 0;
  overflow-wrap: anywhere;
}
.hit-meta { font-size: 0.78rem; color: var(--slate-500); white-space: nowrap; }
.hit-add { font-size: 0.78rem; font-weight: 700; color: var(--blue-600); }
.search-empty {
  margin-top: 0.4rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  color: var(--slate-500);
  border: 1px dashed var(--slate-200);
  border-radius: 8px;
}
.req-list-box {
  margin: 0.85rem 0 1rem;
  border-radius: 8px;
  min-height: 160px;
  min-width: 0;
  max-width: 100%;
}
.req-list-box.empty-state {
  border: 1px solid #fecaca;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem;
}
.empty-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--slate-900);
}
.empty-sub {
  margin: 0;
  max-width: 34ch;
  font-size: 0.84rem;
  color: var(--slate-500);
  line-height: 1.45;
}
.req-list-box.has-items {
  border: 1px solid var(--slate-200);
  overflow: hidden;
}
.req-list-box .table-wrap {
  margin: 0;
  border: none;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.req-list-box table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: auto;
}
.req-list-box th,
.req-list-box td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--slate-100);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.req-list-box th {
  background: var(--slate-50);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-500);
  white-space: nowrap;
}
.qty-edit {
  width: 64px;
  max-width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  padding: 0.3rem 0.35rem;
  text-align: center;
  box-sizing: border-box;
}
.btn-icon-danger {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--red-600);
  font-size: 1.2rem;
  line-height: 1;
}
.btn-icon-danger:hover { background: var(--red-50); }
.new-item-panel { margin-bottom: 0.5rem; min-width: 0; }
.new-item-toggle-row { margin-bottom: 0.65rem; }
.new-item-toggle-row .btn-outline {
  max-width: 100%;
  white-space: normal;
  text-align: left;
  height: auto;
}
.new-item-form {
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  background: var(--slate-50);
  min-width: 0;
}
.new-item-title {
  margin: 0 0 0.75rem;
  font-weight: 700;
  font-size: 0.92rem;
}
.new-item-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 0.8fr 0.45fr;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}
.new-item-form input {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: #fff;
  box-sizing: border-box;
}
.modal-foot {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--slate-200);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  flex-shrink: 0;
  min-width: 0;
}
.req-foot {
  width: 100%;
  box-sizing: border-box;
}
.req-foot .foot-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--red-600);
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
}
.foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
}
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-800);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  font-size: 0.88rem;
  box-sizing: border-box;
}
.btn-outline:hover { background: var(--slate-50); }
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: none;
  background: var(--red-600);
  color: #fff;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
}
.btn-accent:hover { background: var(--red-700); }
.req-foot .btn-ghost {
  border: none;
  background: transparent;
  color: var(--slate-700);
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
}
.req-foot .btn-ghost:hover { background: var(--slate-100); }
.line-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.55fr auto;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.line-row input, .modal-body input, .modal-body select {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  color: var(--slate-900);
  box-sizing: border-box;
}
.line-row input:focus, .modal-body input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--blue-500);
}
.saved-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--ok);
  font-weight: 600;
}
.saved-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--slate-500);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


@media (max-width: 960px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { min-height: 180px; padding: 1.35rem 1.25rem; }
  .auth-hero h1 { max-width: none; font-size: clamp(1.5rem, 6vw, 1.9rem); }
  .auth-panel { padding: 1.25rem 1rem 2rem; }
  .auth-card { padding: 1.35rem 1.1rem; }

  .layout {
    grid-template-columns: 1fr;
    padding-top: 28px;
  }
  .aside {
    position: sticky;
    top: 28px;
    z-index: 30;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  }
  .aside-top {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    min-width: 0;
  }
  .aside-brand {
    border: none;
    margin: 0;
    padding: 0.25rem 0.35rem;
    font-size: 0.95rem;
    flex-shrink: 0;
    gap: 0.45rem;
  }
  .aside-logo {
    width: 30px;
    height: 30px;
  }
  .aside-brand-sub { display: none; }
  .aside-brand-title { font-size: 0.88rem; }
  .aside-user {
    margin: 0;
    padding: 0.35rem 0.55rem;
    flex: 1;
    min-width: 0;
  }
  .aside-user .name { font-size: 0.82rem; }
  .aside-user .role { display: none; }
  .aside-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.3rem;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
    align-items: flex-start;
  }
  .nav-group {
    flex: 0 0 auto;
  }
  .nav-group.open .nav-sub {
    display: flex;
    flex-direction: row;
    padding: 0.15rem 0 0;
    gap: 0.25rem;
  }
  .nav-sub-btn {
    white-space: nowrap;
    padding: 0.4rem 0.65rem;
    background: rgba(255, 255, 255, 0.08);
  }
  .nav-section { display: none; }
  .nav-btn {
    width: auto;
    flex: 0 0 auto;
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }
  .aside-foot {
    margin: 0;
    padding: 0;
    border: none;
    margin-left: auto;
  }
  .aside-foot .btn-secondary {
    width: auto;
    white-space: nowrap;
  }

  .main { padding: 1rem 0.9rem 1.75rem; }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .clock {
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: baseline;
  }
  .stats { grid-template-columns: 1fr 1fr; }
  .split-2 { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: 1fr 1fr; }
  .search-row { grid-template-columns: 1fr; }
  .meta-row { grid-template-columns: 1fr; }
  .new-item-grid { grid-template-columns: 1fr 1fr; }
  .req-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .foot-actions {
    margin-left: 0;
    width: 100%;
  }
  .foot-actions .btn-outline,
  .foot-actions .btn-accent,
  .foot-actions .btn-ghost {
    flex: 1 1 auto;
    min-width: 0;
  }
  .action-row .btn-primary,
  .action-row .btn-secondary {
    flex: 1 1 auto;
  }

  .req-workspace {
    grid-template-columns: 1fr !important;
  }
  .req-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem;
    max-height: none;
  }
  .req-side-brand {
    padding: 0.2rem 0.35rem;
  }
  .req-side-tag { display: none; }
  .req-side-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    gap: 0.3rem;
  }
  .req-side-btn {
    flex: 0 0 auto;
    width: auto;
    align-items: center;
    padding: 0.4rem 0.55rem;
  }
  .req-side-text small { display: none; }
  .req-side-summary { display: none; }
  .req-side-close {
    width: auto;
    margin-left: auto;
  }
  .req-top,
  .req-tabs,
  .req-content,
  .req-workspace .req-foot {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .req-top {
    padding-top: 1.1rem;
    padding-bottom: 0.95rem;
  }
}

@media (max-width: 640px) {
  .demo-banner { font-size: 0.68rem; padding: 0.35rem 0.55rem; }
  .stats { grid-template-columns: 1fr; }
  .stat .val { font-size: 1.4rem; }
  .main { padding: 0.85rem 0.7rem 1.5rem; }
  .panel-head { padding: 0.75rem 0.85rem; }
  .panel-note { width: 100%; }
  .action-row { flex-direction: column; }
  .action-row .btn-primary,
  .action-row .btn-secondary { width: 100%; }
  .app-toast {
    left: 0.75rem;
    right: 0.75rem;
    top: 2.4rem;
    bottom: auto;
    transform: none;
    max-width: none;
    width: auto;
  }

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table th,
  .responsive-table td,
  .responsive-table tr {
    display: block;
    width: 100%;
  }
  .responsive-table thead { display: none; }
  .responsive-table tr.data-row {
    border-bottom: 1px solid var(--slate-200);
    padding: 0.75rem 0.9rem;
  }
  .responsive-table tr.data-row:last-child { border-bottom: 0; }
  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: none;
    text-align: right;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--slate-500);
    text-align: left;
    flex-shrink: 0;
  }
  .responsive-table td.cell-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .req-head p { max-width: none; font-size: 0.78rem; }
  .search-row { grid-template-columns: 1fr 72px; }
  .search-row .btn-primary {
    grid-column: 1 / -1;
    width: 100%;
  }
  .search-hit {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .hit-name { grid-column: 1 / -1; }
  .new-item-grid { grid-template-columns: 1fr; }
  .foot-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .foot-actions .btn-outline,
  .foot-actions .btn-accent,
  .foot-actions .btn-ghost { width: 100%; }

  .req-list-box.has-items {
    border: none;
    background: transparent;
    overflow: visible;
  }
  .req-list-box .table-wrap { overflow: visible; }
  .req-list-box table,
  .req-list-box thead,
  .req-list-box tbody,
  .req-list-box th,
  .req-list-box td,
  .req-list-box tr {
    display: block;
    width: 100%;
  }
  .req-list-box thead { display: none; }
  .req-list-box tr.req-line {
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.7rem 0.35rem;
    box-sizing: border-box;
  }
  .req-list-box td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--slate-100);
    text-align: right;
  }
  .req-list-box td:last-child { border-bottom: none; }
  .req-list-box td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--slate-500);
    text-align: left;
    flex-shrink: 0;
  }
  .req-list-box td.line-actions { justify-content: flex-end; }
  .req-list-box td.line-actions::before { content: none; }
  .qty-edit { width: 72px; }
}

/* Price gaps (POS missing wholesale / special / super) */
.pg-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0 0 1rem;
}
.pg-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.pg-filter strong { font-size: 0.92rem; }
.pg-filter span {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-800);
}
.pg-filter.active {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.pg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.pg-search {
  flex: 1 1 180px;
  min-width: 140px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font: inherit;
}
.pg-count {
  margin: 0 0 0.75rem;
  color: var(--slate-600);
  font-size: 0.88rem;
}
.pg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.pg-table th {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 2px solid var(--slate-200);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-500);
}
.pg-table td {
  padding: 0.45rem;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
.pg-name { font-weight: 600; color: var(--slate-900); }
.pg-meta { font-size: 0.78rem; color: var(--slate-500); margin-top: 0.15rem; }
.pg-retail { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-input {
  width: 100%;
  min-width: 72px;
  max-width: 110px;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.pg-input.pg-miss {
  background: #fff8e6;
  border-color: #e6c35c;
}
.pg-badge {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  margin-right: 0.15rem;
  border-radius: 4px;
  background: #fff3cd;
  color: #7a5b00;
  font-size: 0.68rem;
  font-weight: 700;
}
.pg-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}
.pg-empty {
  padding: 1.25rem 1.35rem;
}
.pg-empty .sub { color: var(--slate-500); margin-top: 0.5rem; }
button.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--blue-600);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
@media (max-width: 900px) {
  .pg-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 400px) {
  .aside-user { display: none; }
  .auth-visual { min-height: 140px; }
}
