:root {
  --office-bg: #f3efe7;
  --office-line: rgba(26, 27, 31, .12);
  --office-muted: #6f7278;
  --office-danger: #b74234;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--office-bg);
  color: var(--anthracite);
  font-family: var(--font-sans);
}

button,
input,
select {
  font: inherit;
}

.office-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--anthracite);
  color: var(--cream);
  padding: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  text-decoration: none;
  font-weight: 800;
  margin-bottom: 26px;
}

.brand img {
  width: 34px;
  height: 34px;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.sidebar nav a {
  color: rgba(246, 241, 231, .78);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 650;
}

.sidebar nav a:hover {
  background: rgba(246, 241, 231, .08);
  color: var(--cream);
}

.main-pane {
  min-width: 0;
  padding: 20px 24px 42px;
}

.topbar,
.page-head,
.panel-head,
.quick-actions,
.user-menu {
  display: flex;
  align-items: center;
}

.topbar {
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.global-search {
  flex: 1;
  max-width: 720px;
}

.global-search input,
.form-stack input,
.form-stack select,
.form-stack textarea,
.inline-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--office-line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 0 13px;
  color: var(--anthracite);
  outline: none;
}

.global-search input:focus,
.form-stack input:focus,
.form-stack select:focus,
.form-stack textarea:focus,
.inline-search input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(195, 150, 52, .16);
}

.user-menu {
  gap: 12px;
  color: var(--office-muted);
}

.icon-button,
.quick-actions button,
.quick-actions a,
.primary-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.icon-button {
  background: transparent;
  border: 1px solid var(--office-line);
  color: var(--anthracite);
}

.page-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.1;
}

.quick-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.quick-actions button,
.quick-actions a,
.primary-button {
  display: inline-flex;
  align-items: center;
  background: var(--anthracite);
  color: var(--cream);
  text-decoration: none;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card,
.panel,
.auth-card {
  background: var(--paper);
  border: 1px solid var(--office-line);
  border-radius: 8px;
}

.metric-card {
  padding: 16px;
}

.metric-card span {
  display: block;
  color: var(--office-muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
}

.metric-card.danger strong {
  color: var(--office-danger);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head span {
  color: var(--office-muted);
  font-size: 13px;
  font-weight: 700;
}

.production-lanes {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.lane {
  min-height: 280px;
  background: rgba(26, 27, 31, .045);
  border: 1px solid var(--office-line);
  border-radius: 8px;
  padding: 10px;
}

.lane h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--office-muted);
}

.order-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #fffdfa;
  border: 1px solid var(--office-line);
  border-radius: 8px;
  margin-bottom: 8px;
}

.order-card span,
.order-card small {
  color: var(--office-muted);
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--office-line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-top: 1px solid var(--office-line);
}

.data-table th {
  color: var(--office-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(195, 150, 52, .15);
  color: var(--gold-dark);
  font-weight: 800;
  font-size: 12px;
}

.toast {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(195, 150, 52, .14);
  border: 1px solid rgba(195, 150, 52, .3);
  font-weight: 750;
}

.toast-error {
  background: rgba(183, 66, 52, .12);
  border-color: rgba(183, 66, 52, .3);
  color: var(--office-danger);
}

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

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
}

.auth-logo {
  width: 190px;
  height: auto;
  margin-bottom: 28px;
}

.auth-copy {
  color: var(--office-muted);
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-stack label {
  display: grid;
  gap: 7px;
  font-weight: 800;
  color: var(--charcoal);
}

.form-stack textarea {
  min-height: 86px;
  padding: 12px 13px;
  resize: vertical;
}

.inline-search {
  width: min(360px, 100%);
}

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

.table-link {
  color: var(--gold-dark);
  font-weight: 800;
  text-decoration: none;
}

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

.detail-grid div,
.note-box {
  border-top: 1px solid var(--office-line);
  padding-top: 12px;
}

.detail-grid span {
  display: block;
  color: var(--office-muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.note-box {
  margin-top: 16px;
  color: var(--charcoal);
  line-height: 1.6;
}

.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.module-tabs a,
.search-result {
  background: var(--paper);
  border: 1px solid var(--office-line);
  border-radius: 8px;
  color: var(--anthracite);
  text-decoration: none;
}

.module-tabs a {
  padding: 12px 14px;
  font-weight: 800;
}

.search-results {
  display: grid;
  gap: 10px;
}

.search-result {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.search-result .badge {
  width: fit-content;
}

.search-result small {
  color: var(--office-muted);
}

.compact-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.compact-form select {
  min-height: 40px;
  border: 1px solid var(--office-line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 0 12px;
}

.compact-form input {
  min-height: 40px;
  border: 1px solid var(--office-line);
  border-radius: 8px;
  background: #fffdfa;
  padding: 0 12px;
}

.inline-action {
  display: inline-flex;
}

.inline-action button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--anthracite);
  color: var(--cream);
  cursor: pointer;
  font-weight: 800;
}

.top-gap {
  margin-top: 16px;
}

.totals-box {
  width: min(320px, 100%);
  margin: 16px 0 0 auto;
  display: grid;
  gap: 8px;
}

.totals-box div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--office-line);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.media-tile {
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  background: #fffdfa;
  border: 1px solid var(--office-line);
  border-radius: 8px;
  color: var(--anthracite);
  text-decoration: none;
}

.media-tile small {
  color: var(--office-muted);
}

.file-chip {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(26, 27, 31, .08);
  color: var(--charcoal);
  font-size: 12px;
  font-weight: 900;
}

.print-body {
  background: #ddd8cc;
}

.doc-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 24px auto;
  padding: 18mm;
  background: white;
  color: var(--anthracite);
  box-shadow: 0 24px 80px rgba(26, 27, 31, .2);
}

.doc-mini-header,
.doc-address,
.doc-mini-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.board-lane {
  min-height: 68vh;
  padding: 12px;
  background: rgba(26, 27, 31, .045);
  border: 1px solid var(--office-line);
  border-radius: 8px;
}

.board-lane h2 {
  margin: 0 0 12px;
  color: var(--office-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.board-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fffdfa;
  border: 1px solid var(--office-line);
  border-radius: 8px;
}

.board-card a {
  color: var(--gold-dark);
  font-weight: 900;
  text-decoration: none;
}

.board-card span {
  color: var(--office-muted);
  font-size: 13px;
}

.board-card form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 4px;
}

.board-card select,
.board-card button {
  min-height: 34px;
  border-radius: 7px;
  font: inherit;
}

.board-card select {
  min-width: 0;
  border: 1px solid var(--office-line);
  background: white;
}

.board-card button {
  border: 0;
  background: var(--anthracite);
  color: var(--cream);
  padding: 0 10px;
  font-weight: 800;
}

.doc-mini-header {
  align-items: flex-start;
  padding-bottom: 12mm;
  border-bottom: 1px solid var(--anthracite);
}

.doc-mini-header img {
  width: 48mm;
  height: auto;
}

.doc-mini-header div,
.doc-address div,
.doc-mini-footer {
  display: grid;
  gap: 3px;
  color: var(--charcoal);
}

.doc-address {
  margin-top: 13mm;
}

.doc-address dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 16px;
  margin: 0;
}

.doc-address dt {
  color: var(--office-muted);
}

.doc-address dd {
  margin: 0;
  font-weight: 800;
}

.doc-title-block {
  margin: 14mm 0 8mm;
}

.doc-title-block span {
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.doc-title-block h1 {
  margin-top: 4px;
  font-size: 28px;
}

.doc-note {
  color: var(--charcoal);
  line-height: 1.6;
}

.doc-lines {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8mm;
}

.doc-lines th,
.doc-lines td {
  padding: 10px;
  border-bottom: 1px solid var(--office-line);
  text-align: left;
  vertical-align: top;
}

.doc-lines th {
  background: var(--anthracite);
  color: var(--cream);
  font-size: 12px;
  text-transform: uppercase;
}

.doc-lines small {
  display: block;
  color: var(--office-muted);
  margin-top: 3px;
}

.doc-sums {
  width: 78mm;
  margin: 8mm 0 0 auto;
  display: grid;
}

.doc-sums div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--office-line);
}

.doc-sums div:last-child {
  border-bottom: 2px solid var(--anthracite);
  font-size: 18px;
}

.doc-media {
  margin-top: 10mm;
  display: grid;
  gap: 6px;
}

.doc-media h2 {
  font-size: 15px;
}

.signature-box {
  margin-top: 22mm;
  height: 34mm;
  border: 1px solid var(--anthracite);
  display: flex;
  align-items: flex-end;
  padding: 8px;
  color: var(--office-muted);
}

.doc-mini-footer {
  margin-top: 16mm;
  padding-top: 5mm;
  border-top: 1px solid var(--office-line);
  color: var(--office-muted);
  font-size: 11px;
}

@media print {
  .print-body {
    background: white;
  }

  .doc-sheet {
    margin: 0;
    box-shadow: none;
  }
}

.quiet-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--gold-dark);
  font-weight: 800;
  text-decoration: none;
}

.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

@media (max-width: 980px) {
  .office-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 12px 16px;
  }

  .sidebar nav {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .brand {
    margin-bottom: 10px;
  }

  .metric-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .page-head,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .main-pane {
    padding: 16px;
  }

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

  .quick-actions button,
  .quick-actions a {
    flex: 1 1 calc(50% - 8px);
  }

  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
