:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --soft: #f1f5f9;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --violet: #7c3aed;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  text-transform: none;
  letter-spacing: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
textarea { resize: vertical; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
th {
  background: #f8fafc;
  color: #64748b;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  padding: 12px 20px;
  white-space: nowrap;
}
td { padding: 12px 20px; border-top: 1px solid var(--line-soft); color: #334155; vertical-align: middle; }
tr { cursor: pointer; }
pre { white-space: pre-wrap; overflow: auto; background: #0b1220; color: #e2e8f0; padding: 16px; border-radius: 12px; }

.nav-toggle { position: fixed; opacity: 0; pointer-events: none; }
.nav-scrim { display: none; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
}
.brand-title { font-weight: 700; line-height: 1.1; }
.brand-subtitle { color: #64748b; font-size: 11px; line-height: 1.2; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px; }
.sidebar-section {
  padding: 16px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: #f1f5f9; color: #0f172a; }
.sidebar-link.active { background: var(--blue); color: #fff; }
.nav-icon { width: 18px; display: inline-flex; justify-content: center; font-weight: 700; }
.sidebar-footer { border-top: 1px solid var(--line-soft); padding: 12px; }
.user-chip { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; }
.user-chip:hover { background: #f8fafc; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 auto;
}
.small-avatar { width: 32px; height: 32px; font-size: 12px; }
.user-name { font-size: 14px; font-weight: 600; line-height: 1.2; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: #64748b; font-size: 11px; line-height: 1.2; }
.signout { color: #dc2626; margin-top: 4px; }
.signout:hover { background: #fef2f2; color: #b91c1c; }

.app-frame { min-height: 100vh; margin-left: 256px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 57px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.hamburger { display: none; font-size: 22px; line-height: 1; color: #334155; cursor: pointer; text-transform: none; letter-spacing: 0; }
.mobile-title { display: none; font-weight: 700; }
.top-search {
  max-width: 430px;
  flex: 1;
  position: relative;
}
.top-search span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; z-index: 1; }
.top-search input {
  min-height: 38px;
  padding-left: 36px;
  border-color: transparent;
  background: #f1f5f9;
  font-size: 14px;
}
.top-search input:focus { background: #fff; border-color: #cbd5e1; box-shadow: none; }
.top-user { display: flex; align-items: center; gap: 9px; padding-left: 12px; border-left: 1px solid var(--line); margin-left: auto; }

.shell { width: min(100%, 1280px); margin: 0 auto; padding: 24px; }
.narrow { width: min(760px, 100%); }
.panel, .login-panel, .table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.panel, .login-panel { padding: 24px; }
.button, .ghost, .hero-primary, .hero-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: 14px;
}
.button { background: var(--blue); color: #fff; }
.button:hover { background: var(--blue-dark); }
.ghost { background: #fff; border-color: #cbd5e1; color: #334155; }
.ghost:hover { background: #f8fafc; }
.danger { color: #b91c1c; border-color: #fecaca; }
.danger:hover { background: #fef2f2; color: #991b1b; }
.danger:disabled { opacity: .45; cursor: not-allowed; }
.small { min-height: 34px; padding: 0 10px; }
.large { min-height: 52px; font-size: 15px; }
.wide { width: 100%; }
.muted { color: #64748b; }
.eyebrow {
  color: var(--blue);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 30px 32px;
  color: #fff;
  margin-bottom: 24px;
  background-image:
    linear-gradient(115deg, rgba(15,23,42,.88) 0%, rgba(15,23,42,.62) 58%, rgba(37,99,235,.62) 100%),
    url("https://images.unsplash.com/photo-1581091226825-a6a2a5aee158?auto=format&fit=crop&w=1600&q=70");
  background-size: cover;
  background-position: center;
}
.hero-kicker {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,.15);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.hero h1 { margin: 10px 0 6px; font-size: clamp(25px, 3vw, 34px); line-height: 1.12; letter-spacing: 0; }
.hero p { max-width: 680px; margin: 0; color: rgba(255,255,255,.82); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-primary { background: #fff; color: #0f172a; }
.hero-primary:hover { background: #f1f5f9; }
.hero-secondary { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.25); backdrop-filter: blur(8px); }
.hero-secondary:hover { background: rgba(255,255,255,.24); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}
.stat-card.clickable {
  color: inherit;
  text-decoration: none;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.stat-card.clickable:hover {
  transform: translateY(-1px);
  border-color: #bfdbfe;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .08);
}
.stat-card.clickable.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.secondary-stats { margin-top: 0; }
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 13px;
}
.stat-icon.blue { color: #2563eb; background: #dbeafe; }
.stat-icon.green { color: #059669; background: #d1fae5; }
.stat-icon.amber { color: #d97706; background: #fef3c7; }
.stat-icon.violet { color: #7c3aed; background: #ede9fe; }
.stat-icon.red { color: #dc2626; background: #fee2e2; }
.stat-card span { display: block; color: #64748b; font-size: 12px; }
.stat-card strong { display: block; font-size: 27px; line-height: 1.1; margin-top: 3px; font-weight: 700; }
.stat-card small { display: block; color: #94a3b8; font-size: 11px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-distribution {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.distribution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.distribution-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  font-weight: 750;
}
.distribution-card span { font-size: 12px; }
.distribution-card strong { font-size: 22px; }

.toolbar.sticky { position: sticky; top: 69px; z-index: 8; background: var(--bg); padding-bottom: 12px; }
.search-form {
  display: grid;
  grid-template-columns: 1fr 130px 150px auto;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
}
.search-form input, .search-form select { font-size: 14px; }
.table-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.table-title h2 { margin: 0; font-size: 16px; }
.table-title p { margin: 3px 0 0; color: #64748b; font-size: 12px; }
.desktop-table {
  overflow: hidden;
}
.table-scroll-window {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #e2e8f0;
}
.table-scroll-window::-webkit-scrollbar {
  height: 14px;
}
.table-scroll-window::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}
.table-scroll-window::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
  border: 3px solid #e2e8f0;
}
.table-scroll-window.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.work-orders-table table {
  min-width: 1780px;
}
.work-orders-table th,
.work-orders-table td {
  white-space: nowrap;
}
.work-orders-table td:nth-child(3) {
  min-width: 260px;
  max-width: 360px;
  white-space: normal;
}
.work-orders-table td:nth-child(14) {
  min-width: 260px;
  white-space: normal;
}
.machine-list-cell {
  display: grid;
  gap: 6px;
  line-height: 1.35;
}
.machine-list-cell span {
  display: block;
}
.card-machine-list {
  margin: 8px 0;
  color: #334155;
}
.table-row:hover { background: #f8fafc; }
.mobile-cards { display: none; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .65; }
.status-verified { background: #dcfce7; color: #166534; }
.status-draft { background: #fef3c7; color: #92400e; }
.status-kickoff-pending { background: #fef3c7; color: #92400e; }
.status-wip { background: #dbeafe; color: #1d4ed8; }
.status-machine-packed { background: #ccfbf1; color: #0f766e; }
.status-rff-ready-for-fat { background: #fae8ff; color: #86198f; }
.status-production { background: #e0f2fe; color: #075985; }
.status-dispatched { background: #ede9fe; color: #5b21b6; }
.status-closed { background: #f1f5f9; color: #334155; }
.pill { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: #dbeafe; color: var(--blue); font-size: 12px; font-weight: 700; }
.notify-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.wo-card {
  display: grid;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.wo-card > div { display: flex; justify-content: space-between; gap: 10px; }
.wo-card h2 { margin: 0; font-size: 16px; }
.wo-card p { margin: 0; color: #64748b; font-size: 14px; }
.wo-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; color: #64748b; font-size: 12px; }
.wo-card dd { margin: 0; color: #0f172a; }
.machine-list { white-space: pre-line; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 14px 16px; }
.doc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}
.doc-button:hover { background: #bfdbfe; }
.doc-missing {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 9px;
  border-radius: 8px;
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #eff6ff, #fff 45%, #f1f5f9); }
.login-panel { width: min(430px, 100%); display: grid; gap: 20px; border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(148,163,184,.45), 0 10px 10px -5px rgba(148,163,184,.2); }
.login-panel h1 { margin: 0; font-size: 22px; }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 2px; }
.stack { display: grid; gap: 13px; }
.alert { background: #fff7ed; border: 1px solid #fed7aa; color: #b45309; border-radius: 12px; padding: 12px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.drop-zone {
  min-height: 150px;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  background: #fff;
  padding: 22px;
  place-items: center;
  text-align: center;
  cursor: pointer;
  color: #0f172a;
  font-size: 15px;
  text-transform: none;
  letter-spacing: 0;
}
.drop-zone:hover { border-color: var(--blue); background: #eff6ff; }
.drop-zone span { color: #64748b; font-weight: 500; font-size: 13px; }
.drop-zone input { display: none; }
.full, progress, .upload-grid button { grid-column: 1 / -1; width: 100%; }
progress { height: 12px; accent-color: var(--blue); }

.page-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-title h1 { margin: 0; font-size: 26px; }
.verify-layout { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr); gap: 16px; align-items: start; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field-grid label:has(textarea), .check { grid-column: 1 / -1; }
.span-2 { grid-column: 1 / -1; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.section-title-row h2 { margin: 0; }
.items-editor { display: grid; gap: 12px; margin-top: 10px; }
.item-edit-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #f8fafc; }
.item-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.admin-user-form { display: grid; gap: 12px; align-items: start; }
.admin-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.admin-section-head h3 { margin: 0; font-size: 16px; }
.admin-section-head p { margin: 4px 0 0; }
.inline-create-user {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #f8fafc;
}
.admin-user-create {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}
.admin-user-form label,
.admin-user-form input,
.admin-user-form select,
.admin-user-form textarea { min-width: 0; }
.admin-user-form input,
.admin-user-form select,
.admin-user-form textarea { width: 100%; }
.sales-map-field { grid-column: span 2; }
.admin-access-box {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
}
.mini-label {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.admin-create-action {
  display: flex;
  align-items: end;
  min-height: 100%;
}
.admin-create-action .button { width: 100%; }
.module-settings-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.module-settings-form h3 { margin: 0; }
.master-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.master-card { border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px; background: #f8fafc; }
.master-card h3 { margin: 0 0 10px; }
.inline-master-form, .master-list form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.master-list input { min-width: 180px; }
.smtp-form, .samples-integration-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; align-items: end; }
.redaction-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.status-email-form { display: grid; gap: 14px; }
.status-email-rule {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}
.status-email-rule legend { padding: 0 8px; color: var(--ink); font-weight: 900; }
.status-email-rule label:nth-of-type(4),
.status-email-rule label:nth-of-type(5) { grid-column: 1 / -1; }
.status-email-rule .actions { grid-column: 1 / -1; margin-top: 0; }
.admin-table { overflow-x: auto; }
.admin-table table { min-width: 1120px; table-layout: fixed; }
.admin-table th:nth-child(1) { width: 220px; }
.admin-table th:nth-child(2) { width: 150px; }
.admin-table th:nth-child(3) { width: 260px; }
.admin-table th:nth-child(4) { width: 170px; }
.admin-table th:nth-child(5) { width: 170px; }
.admin-table th:nth-child(6) { width: 110px; }
.admin-table th:nth-child(7) { width: 150px; }
.admin-table td { vertical-align: top; }
.admin-table input, .admin-table select, .admin-table textarea { width: 100%; min-width: 0; margin-bottom: 6px; }
.admin-table textarea { min-height: 76px; resize: vertical; }
.user-stack { display: grid; gap: 8px; }
.access-cell { display: grid; gap: 8px; }
.access-cell .check,
.admin-access-box .check { margin: 0; }
.admin-user-cards { display: none; }
.admin-user-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
}
.admin-user-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.admin-user-card-head strong,
.admin-user-card-head span { display: block; }
.admin-user-card-head span { color: #64748b; font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.admin-card-meta { color: #64748b; font-weight: 800; }
.audit-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}
.audit-list li {
  overflow-wrap: anywhere;
}
.audit-cards h3 {
  margin: 4px 0 0;
  font-size: 13px;
}
.row-actions { display: flex; gap: 8px; align-items: flex-start; }
.needs-review input, .needs-review textarea { border-color: #f59e0b; background: #fffaf0; }
small { color: #64748b; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.tab-head h2 { margin: 0; }
.compact-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.attachment-upload { margin-bottom: 16px; justify-content: flex-start; }
.file-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-weight: 650;
  cursor: pointer;
}
.file-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.revision-alert { margin-bottom: 16px; }
.revision-upload {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(360px, 1.4fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
}
.revision-upload h2 { margin: 0 0 4px; }
.revision-upload p { margin: 0; }
.revision-upload-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}
.compact-revision-upload { margin-bottom: 20px; }
.preview-stack { display: grid; gap: 16px; }
.pdf-panel h2 { margin-top: 0; }
.pdf-viewer { min-height: 560px; overflow: auto; background: #e9eef5; border-radius: 12px; border: 1px solid var(--line); }
.pdf-viewer.tall { min-height: 72vh; }
.pdf-native-frame { display: block; width: 100%; min-height: 72vh; border: 0; background: #fff; }
.pdf-tools { position: sticky; top: 0; display: flex; gap: 8px; align-items: center; padding: 8px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); z-index: 2; }
.pdf-tools button { min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
canvas { display: block; margin: 10px auto; max-width: 100%; height: auto; box-shadow: 0 8px 24px rgba(15, 23, 42, .14); }
.ga-preview-list { display: grid; gap: 16px; }
.ga-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px; }
.ga-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ga-card-head div { min-width: 0; display: grid; gap: 3px; }
.ga-card-head strong { overflow-wrap: anywhere; }
.ga-card-head span { color: #64748b; font-size: 12px; font-weight: 650; }
.drawing-image { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.tabs, .mobile-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.tabs button, .mobile-tabs button { border: 1px solid #cbd5e1; background: #fff; border-radius: 8px; padding: 10px 13px; white-space: nowrap; color: #334155; display: inline-flex; align-items: center; gap: 8px; }
.tabs button.active, .mobile-tabs button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tab-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.tabs button.active .tab-badge, .mobile-tabs button.active .tab-badge { background: #fff; color: var(--blue); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.message-list { display: grid; gap: 12px; margin-bottom: 16px; }
.message-card {
  max-width: 78%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #f8fafc;
}
.message-card.own-message { justify-self: end; background: #eff6ff; border-color: #bfdbfe; }
.message-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.message-meta > div { display: grid; gap: 3px; min-width: 0; }
.message-meta span { display: block; color: #64748b; font-size: 12px; font-weight: 650; }
.message-meta form, .message-attachment form { margin: 0; }
.message-card p { margin: 0; white-space: pre-line; line-height: 1.5; overflow-wrap: anywhere; }
.message-attachments { display: grid; gap: 10px; margin-top: 10px; }
.message-attachment {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}
.message-attachment > div:first-child { display: grid; gap: 3px; min-width: 0; }
.message-attachment strong { overflow-wrap: anywhere; }
.message-attachment span { color: #64748b; font-size: 12px; font-weight: 650; }
.message-attachment img, .message-attachment video {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #f8fafc;
}
.message-form { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.message-form .button { justify-self: end; }
.message-file-pill { justify-self: start; width: min(420px, 100%); }
.status-editor {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}
.status-editor > div { display: grid; gap: 6px; }
.status-editor span:first-child, .status-editor label { color: #64748b; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.status-update-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 150px auto;
  gap: 10px;
  align-items: end;
}
.status-select {
  min-width: 210px;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  color: #0f172a;
  background: #fff;
  font: inherit;
  font-weight: 700;
}
.status-date-input {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  color: #0f172a;
  background: #fff;
  font: inherit;
  font-weight: 700;
}
.status-date-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.status-date-list span {
  display: inline-flex;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #475569;
  font-size: 11px;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}
.status-date-list.compact { margin-top: 7px; max-width: 260px; }
.status-date-list.compact span { font-size: 10px; }
.idd-status-block {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 3px 0 4px;
}
.idd-status-block strong { font-size: 22px; color: #0f172a; }
.idd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 6px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.idd-day-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  margin: 4px 0 0;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.idd-days-overdue { background: #fee2e2; color: #991b1b; }
.idd-days-today { background: #ffedd5; color: #9a3412; }
.idd-days-soon { background: #dbeafe; color: #1d4ed8; }
.idd-days-upcoming { background: #dcfce7; color: #166534; }
.idd-none { background: #f1f5f9; color: #475569; }
.idd-card-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #64748b;
  font-size: 13px;
}
.idd-card-line strong { color: #0f172a; }
.sample-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.sample-badge.received { background: #dcfce7; color: #166534; }
.sample-badge.pending { background: #f1f5f9; color: #475569; }
.samples-summary { margin: 18px 0; }
.sample-remarks { white-space: pre-line; color: #334155; }
.sample-table { margin-top: 12px; overflow-x: auto; }
.integration-status {
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-weight: 750;
}
.integration-status.ok { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.integration-status.warn { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.idd-form {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}
.idd-history {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.idd-history li {
  border-left: 3px solid var(--blue);
  background: #f8fafc;
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
}
.idd-history strong { display: block; }
.idd-history span { display: block; margin-top: 4px; color: #64748b; font-size: 12px; font-weight: 650; }
.idd-history p { margin: 8px 0 0; color: #334155; white-space: pre-line; }
.idd-section { margin-bottom: 18px; }
.idd-overdue { border-color: #fecaca; }
.row-overdue { background: #fff7f7; }
.row-overdue:hover { background: #fee2e2; }
.idd-desktop {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.idd-desktop table {
  min-width: 1180px;
}
.idd-desktop th,
.idd-desktop td {
  white-space: nowrap;
}
.idd-desktop td:nth-child(4),
.idd-desktop td:nth-child(7) {
  min-width: 260px;
  white-space: normal;
}
.idd-cards { display: none; }
.idd-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line-soft);
  background: #fff;
}
.idd-card > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.idd-card h2 { margin: 0; font-size: 18px; }
.idd-card p { margin: 0; color: #334155; white-space: pre-line; }
.idd-card dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 13px; }
.idd-card dt { color: #64748b; }
.idd-card dd { margin: 0; color: #0f172a; overflow-wrap: anywhere; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.summary-grid div { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; }
.summary-grid span { color: #64748b; font-size: 13px; }
.file-list, .timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.file-list li, .timeline li { display: flex; gap: 12px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; }
.timeline li { display: grid; justify-content: stretch; }
.file-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.file-actions form { margin: 0; }
.message-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.message-actions form { margin: 0; }
.link-danger {
  border: 0;
  background: transparent;
  padding: 0;
  color: #b91c1c;
  font-weight: 700;
  min-height: 0;
}
.readiness-shell .toolbar { margin-bottom: 14px; }
.readiness-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.traffic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; padding: 14px; }
.traffic-card { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 12px; color: inherit; text-decoration: none; background: #fff; }
.traffic-card span { color: #64748b; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.traffic-card strong { display: inline-flex; align-items: center; gap: 7px; font-size: 18px; }
.dot { width: 10px; height: 10px; border-radius: 99px; display: inline-block; }
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #22c55e; }
.readiness-filters { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 10px; width: 100%; }
.readiness-filters input, .readiness-filters select,
.readiness-table input, .readiness-table select, .readiness-table textarea,
.readiness-card input, .readiness-card select, .readiness-card textarea {
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 7px 9px;
  color: #0f172a;
  background: #fff;
  font: inherit;
  font-weight: 650;
}
.readiness-table { overflow-x: auto; }
.readiness-table table { min-width: 2200px; }
.readiness-table th { white-space: nowrap; }
.readiness-table td { vertical-align: top; }
.readiness-table select { min-width: 140px; }
.readiness-table textarea { min-width: 160px; }
.machine-detail-cell { min-width: 260px; white-space: pre-line; }
.readiness-cards { display: none; }
.readiness-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.readiness-card > div:first-child { display: flex; justify-content: space-between; gap: 10px; }
.readiness-card p { margin: 0; color: #334155; white-space: pre-line; }
.readiness-card dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 13px; }
.readiness-card dd { margin: 0; color: #0f172a; }
.readiness-card-form { display: grid; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.file-delete-form { margin-top: 14px; }
.upload-meta { color: #64748b; font-size: 13px; font-weight: 650; }
.inline-progress { width: 180px; max-width: 100%; height: 8px; }
.mobile-tabs { display: none; }
.compact-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; align-items: start; }
.mini-list { display: grid; gap: 8px; padding: 12px; }
.mini-row, .mini-card { display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px; }
.mini-row { grid-template-columns: 1fr auto; align-items: center; }
.mini-row span, .mini-card span { display: block; color: #64748b; font-size: 12px; margin-top: 3px; }
.empty-state { color: #64748b; padding: 18px; text-align: center; }
.progress-line { width: 96px; max-width: 100%; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.priority-urgent, .status-revision-required { background: #fee2e2; color: #991b1b; }
.priority-high, .status-waiting-for-approval, .status-waiting { background: #fef3c7; color: #92400e; }
.priority-normal, .status-in-progress { background: #dbeafe; color: #1d4ed8; }
.priority-low, .status-not-started, .status-on-hold { background: #f1f5f9; color: #334155; }
.status-completed, .status-approved { background: #dcfce7; color: #166534; }
.status-cancelled, .status-rejected { background: #fee2e2; color: #991b1b; }
.preline { white-space: pre-line; line-height: 1.55; }
.path-list { display: grid; gap: 10px; margin-top: 18px; }
.path-list div { display: grid; gap: 4px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.path-list span { color: #64748b; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.path-list a { overflow-wrap: anywhere; color: var(--blue); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.inline-form { display: grid; grid-template-columns: minmax(190px, 1fr) 180px 140px 150px auto; gap: 10px; margin-top: 16px; align-items: end; }
.roomy { margin-top: 18px; }
.text-fit { font-size: clamp(16px, 2vw, 22px) !important; overflow-wrap: anywhere; }
.quick-entry-shell { max-width: 720px; }
.quick-entry .button { margin-top: 6px; }
.mobile-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(37,99,235,.28);
}

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; }
  .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  .nav-scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .nav-toggle:checked ~ .nav-scrim { display: block; }
  .app-frame { margin-left: 0; }
  .topbar { height: 57px; padding: 12px 16px; }
  .hamburger, .mobile-title { display: block; }
  .top-search, .top-user { display: none; }
  .shell { padding: 16px 11px 90px; }
  .hero { padding: 22px; border-radius: 16px; }
  .hero h1 { font-size: 25px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; gap: 12px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-card strong { font-size: 23px; }
  .toolbar.sticky { top: 57px; }
  .search-form { grid-template-columns: 1fr; border-radius: 16px; }
  .desktop-table { display: none; }
  .mobile-cards { display: grid; gap: 12px; }
  .tab-head { align-items: stretch; flex-direction: column; }
  .compact-upload, .compact-upload .button, .file-pill { width: 100%; }
  .revision-upload, .revision-upload-form { grid-template-columns: 1fr; }
  .upload-grid, .verify-layout, .field-grid, .summary-grid, .status-email-rule, .module-settings-form, .master-grid, .readiness-filters { grid-template-columns: 1fr; }
  .two-column, .inline-form, .card-grid { grid-template-columns: 1fr; }
  .compact-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-row { grid-template-columns: 1fr; }
  .mobile-fab { display: grid; }
  .tabs { padding-bottom: 3px; }
  .admin-user-form,
  .admin-user-create { grid-template-columns: 1fr; }
  .sales-map-field { grid-column: auto; }
  .admin-create-action { min-height: auto; }
  .admin-section-head { flex-direction: column; }
  .admin-section-head form,
  .admin-section-head .ghost { width: 100%; }
  .admin-table { display: none; }
  .admin-user-cards { display: grid; gap: 12px; }
  .admin-user-card input,
  .admin-user-card select,
  .admin-user-card textarea { width: 100%; min-width: 0; }
  .admin-user-card .button,
  .admin-user-card .ghost,
  .admin-user-card .row-actions form { width: 100%; }
  .smtp-form, .samples-integration-form { grid-template-columns: 1fr; }
  .redaction-form { grid-template-columns: 1fr; }
  .row-actions { flex-direction: column; }
  .preview-stack { display: contents; }
  .mobile-tabs { display: flex; }
  .verify-shell .tab-pane { display: none; }
  .verify-shell .tab-pane.active { display: block; }
  .pdf-viewer { min-height: 70vh; }
  .page-title { align-items: flex-start; }
  .ga-card { padding: 10px; }
  .ga-card-head { align-items: flex-start; flex-direction: column; }
  .file-list li { align-items: flex-start; flex-direction: column; }
  .file-actions { justify-content: flex-start; }
  .message-card { max-width: 100%; }
  .message-meta { display: grid; gap: 3px; }
  .message-form .button { width: 100%; }
  .status-editor { align-items: stretch; flex-direction: column; }
  .status-update-form { grid-template-columns: 1fr; }
  .status-select { width: 100%; }
  .status-date-input { width: 100%; }
  .idd-form { grid-template-columns: 1fr; }
  .idd-desktop { display: none; }
  .idd-cards { display: grid; }
  .readiness-table { display: none; }
  .readiness-cards { display: grid; gap: 12px; }
}
@media (min-width: 821px) {
  .verify-shell .mobile-tabs { display: none; }
  .verify-shell .tab-pane { display: block; }
}
