:root {
  --page: #e5e5e5;
  --panel: #f3f3f3;
  --field: #fffbd1;
  --field-2: #fff8bd;
  --line: #8b8b8b;
  --line-dark: #3f3f3f;
  --text: #111;
  --muted: #424242;
  --ok: #0f6b2d;
  --warn: #9a6500;
  --bad: #9b1b1b;
  --button: #eeeeee;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
}

button,
.btn {
  min-height: 50px;
  border: 1px solid var(--line-dark);
  background: var(--button);
  color: #000;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button.primary,
.btn.primary {
  background: #d8efdc;
}

button.danger,
.btn.danger {
  background: #f2d2d2;
  color: #5f0d0d;
}

button:disabled,
.btn.disabled {
  opacity: .55;
  cursor: not-allowed;
}

button img,
.btn img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--field);
  padding: 8px 10px;
  color: #000;
  font: inherit;
}

input[readonly] {
  background: #f7f2c4;
}

textarea {
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.app-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 12px;
}

.top-menu {
  border-bottom: 1px solid #c6c6c6;
  background: #f6f6f6;
}

.menu-row,
.tool-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 12px;
}

.tool-row {
  border-top: 1px solid #dedede;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

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

.spacer {
  flex: 1;
}

.session-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px auto auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.session-strip.empty {
  background: #ece9cf;
}

.status-pill {
  border: 1px solid var(--line);
  background: var(--field);
  padding: 9px 10px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
}

.status-pill.ok {
  color: var(--ok);
}

.status-pill.warn {
  color: var(--warn);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}

.module-tile {
  min-height: 142px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  background: #f8f8d4;
  text-decoration: none;
  color: #000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
}

.module-tile img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.module-tile span {
  display: block;
  font-size: 15px;
  color: var(--muted);
  font-weight: 400;
}

.module-tile.disabled {
  filter: grayscale(1);
  opacity: .55;
  pointer-events: none;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 10px;
  margin: 10px 0;
}

.po-header-grid {
  display: grid;
  grid-template-columns: 160px 150px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.po-call-grid {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 10px;
  align-items: end;
}

.save-bottom {
  width: 100%;
  min-height: 62px;
  font-size: 20px;
}

.compact-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-dark);
  background: #fff;
}

.qss-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #fff;
}

.qss-table th,
.qss-table td {
  border: 1px solid var(--line);
  padding: 8px 7px;
  text-align: left;
  vertical-align: middle;
  font-size: 16px;
}

.qss-table th {
  background: #eeeeee;
  font-weight: 700;
}

.qss-table tbody tr:nth-child(even) {
  background: var(--field-2);
}

.qss-table input,
.qss-table select {
  min-height: 40px;
  padding: 6px 8px;
  font-size: 16px;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.message {
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--field);
  font-weight: 700;
}

.message.ok {
  color: var(--ok);
}

.message.warn {
  color: var(--warn);
}

.message.bad {
  color: var(--bad);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.summary-box {
  border: 1px solid var(--line);
  background: #f8f8d4;
  padding: 10px;
}

.summary-box.ready strong {
  color: var(--ok);
}

.summary-box.needs-action strong {
  color: var(--warn);
}

.summary-box strong {
  display: block;
  font-size: 24px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .38);
  z-index: 1000;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(460px, 100%);
  border: 2px solid var(--line-dark);
  background: var(--panel);
  padding: 14px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.print-report {
  display: none;
}

@media (max-width: 900px) {
  html,
  body {
    font-size: 18px;
  }

  .app-shell {
    padding: 10px;
  }

  .session-strip,
  .po-header-grid,
  .po-call-grid {
    grid-template-columns: 1fr;
  }

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

  .module-tile {
    min-height: 132px;
  }

  button,
  .btn {
    min-height: 56px;
  }

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

@media print {
  body {
    background: #fff;
    font-size: 12pt;
  }

  .top-menu,
  .session-strip,
  .summary-grid,
  .message,
  .panel {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .print-report {
    display: block;
  }

  .print-report h1 {
    margin: 0 0 12px;
    font-size: 16pt;
  }

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

  .print-report th,
  .print-report td {
    border: 1px solid #000;
    padding: 6px 8px;
    text-align: left;
  }

  .print-report th {
    font-weight: 700;
  }
}

@media (max-width: 560px) {
  .dashboard-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .menu-row,
  .tool-row,
  .compact-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .btn,
  button {
    width: 100%;
  }
}
