/* ============================================================
   Fulfillment Reports — clean modern SaaS theme
   ============================================================ */

* { box-sizing: border-box; }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-hover: #fafbfc;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --text: #101828;
  --sub: #667085;
  --muted: #98a2b3;

  --accent: #c0895f;
  --accent-hover: #a8714a;
  --accent-tint: #f7ece2;
  --accent-tint-line: #ecdac5;

  --ok: #059669;
  --ok-tint: #ecfdf5;
  --ok-tint-line: #a7f3d0;

  --danger: #dc2626;
  --danger-tint: #fef2f2;
  --danger-tint-line: #fecaca;

  --warn: #b45309;
  --warn-tint: #fffbeb;
  --warn-tint-line: #fde68a;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

h1, h2, h3 { margin: 0; }

/* ---------- App header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.app-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.app-brand {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.app-logo-img {
  height: 34px;
  width: auto;
  flex-shrink: 0;
}

.app-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.app-header-controls {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .app-header-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .app-brand { grid-column: 1; }
  .app-header-controls { grid-column: 1; justify-self: center; justify-content: center; }
}

.signed-in-as {
  font-size: 12.5px;
  color: var(--sub);
  white-space: nowrap;
}

.role-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ---------- Login screen ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
}

.header-input,
.header-select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: var(--surface);
  min-width: 140px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.header-input:focus,
.header-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

/* ---------- Tabs ---------- */

.tab-bar {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}

.tab-bar button {
  border: none;
  background: none;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--sub);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.tab-bar button:hover { color: var(--text); }

.tab-bar button.active { color: var(--accent); }

.tab-bar button.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.tab-bar .count {
  background: var(--bg);
  color: var(--sub);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}

.tab-bar button.active .count {
  background: var(--accent-tint);
  color: var(--accent);
}

/* ---------- Layout ---------- */

.app-main {
  padding: 28px 24px 80px;
}

.app-container {
  max-width: 760px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 32px;
}

.section-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-sub {
  color: var(--sub);
  font-size: 13.5px;
  margin: 6px 0 22px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0;
}

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

/* ---------- Fields ---------- */

.field { margin-bottom: 20px; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 7px;
}

.field-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.field-toolbar label { margin-bottom: 0; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 620px) {
  .grid2 { grid-template-columns: 1fr; }
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="color"],
input:not([type]),
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 96px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg);
  color: var(--sub);
  cursor: not-allowed;
}

input[type="color"] {
  padding: 3px;
  width: 44px;
  height: 38px;
  cursor: pointer;
}

/* ---------- Buttons ---------- */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--line-strong); }

.btn-ok {
  background: var(--ok);
  color: #fff;
}
.btn-ok:hover { background: #047857; }

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-tint-line);
}
.btn-danger:hover { background: var(--danger-tint); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; }

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.ai-btn {
  border: 1px solid var(--accent-tint-line);
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-btn:hover { background: #e2e2fc; }
.ai-btn.ghost { background: transparent; }
.ai-btn.ghost:hover { background: var(--accent-tint); }

/* ---------- Badges & status ---------- */

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.badge-draft { background: #f2f4f7; color: var(--sub); }
.badge-submitted { background: var(--warn-tint); color: var(--warn); }
.badge-sent_back { background: var(--danger-tint); color: var(--danger); }
.badge-approved { background: var(--ok-tint); color: var(--ok); }
.badge-delivered { background: var(--accent-tint); color: var(--accent); }

.brand-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* ---------- Lists ---------- */

.list-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.list-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.list-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.li-title { font-weight: 600; font-size: 14.5px; }

.li-meta {
  color: var(--sub);
  font-size: 12.5px;
  margin-top: 6px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 20px;
  font-size: 13.5px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- QC / notes / alerts ---------- */

.qc-note-box {
  background: var(--warn-tint);
  border: 1px solid var(--warn-tint-line);
  color: #7c4a03;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 20px;
  line-height: 1.55;
}

.security-warn {
  background: var(--danger-tint);
  border: 1px solid var(--danger-tint-line);
  color: #9a1c1c;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 18px;
}

/* ---------- AI suggestion panel ---------- */

.ai-panel {
  margin-top: 12px;
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.ai-panel-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--accent-hover);
  margin-bottom: 10px;
}

.ai-suggestion {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--accent-tint-line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.ai-demo-note {
  color: #5850c4;
  font-size: 11.5px;
  margin-top: 4px;
  line-height: 1.5;
}

/* ---------- Modal ---------- */

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
}

.lock-icon { margin-right: 4px; }

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-of-type { border-bottom: none; }

/* ---------- Toasts ---------- */

.toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #101828;
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PDF / print report
   ============================================================ */

.pdf-render { display: none; }

.pr-header {
  padding: 36px 40px;
  color: #fff;
  border-radius: 0;
}

.pr-brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 10px;
}

.pr-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
}

.pr-meta { font-size: 13px; line-height: 1.6; opacity: 0.92; }

.pr-body { padding: 32px 40px; }

.pr-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.pr-stat {
  background: #f9fafb;
  border-radius: 6px;
  padding: 14px 12px;
}

.pr-stat-value { font-size: 19px; font-weight: 700; }
.pr-stat-label { font-size: 11.5px; color: #667085; margin-top: 3px; }

.pr-section { margin-bottom: 22px; }

.pr-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #667085;
  margin-bottom: 8px;
}

.pr-text {
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: #101828;
}

.pr-specialist {
  border-left: 3px solid;
  background: #f9fafb;
  border-radius: 0 6px 6px 0;
  padding: 14px 16px;
  margin-bottom: 22px;
}

.pr-specialist-title {
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 8px;
}

.pr-specialist-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.6;
}

.pr-footer {
  border-top: 1px solid #e4e7ec;
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: #667085;
}

@media print {
  body * { visibility: hidden; }
  .pdf-render, .pdf-render * { visibility: visible; }
  .pdf-render {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
  }
  @page { margin: 0; }
}
