:root {
  --bg: #f0f3f6;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --accent: #0b6e4f;
  --accent-soft: #e6f3ee;
  --card: #ffffff;
  --line: #d5dce4;
  --header: #e8eef3;
  --row-alt: #f4f7fa;
  --row-hover: #eaf2f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topnav-brand {
  font-weight: 700;
  color: var(--ink);
}

.topnav-link {
  color: var(--muted);
  font-size: 0.95rem;
}

.topnav-link.is-active,
.topnav-link:hover {
  color: var(--accent);
  font-weight: 600;
}

.settings-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1rem 1.15rem 1.15rem;
  margin-bottom: 1rem;
  max-width: 44rem;
}

.settings-panel-wide {
  max-width: 64rem;
}

.settings-job-log-pre {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: #0f1720;
  color: #e2e8f0;
  border-radius: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 22rem;
}

.settings-companies-table {
  margin-top: 0.5rem;
}

.settings-box {
  font-size: 0.8em;
}

.diadoc-enabled-select {
  min-width: 5rem;
}

.diadoc-enabled-select.is-yes {
  border-color: #8fc9b0;
  background: #eef8f3;
}

.diadoc-enabled-select.is-no {
  border-color: var(--line);
}

.edo-spec-dialog {
  border: none;
  border-radius: 0.6rem;
  padding: 0;
  max-width: 34rem;
  width: calc(100% - 2rem);
  box-shadow: 0 12px 40px rgba(26, 35, 50, 0.22);
}

.edo-spec-dialog::backdrop {
  background: rgba(26, 35, 50, 0.45);
}

.edo-spec-modal {
  padding: 1rem 1.15rem 1.15rem;
}

.edo-spec-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.edo-spec-modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.edo-spec-modal .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.75rem 0 0.5rem;
}

.edo-spec-results {
  max-height: 12rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.35rem;
  background: #fafbfc;
  margin-bottom: 0.75rem;
}

.edo-spec-option {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.4rem 0.45rem;
  border-radius: 0.3rem;
  cursor: pointer;
}

.edo-spec-option:hover {
  background: var(--row-hover);
}

.edo-spec-option span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.9rem;
}

.edo-spec-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.75rem;
  margin-bottom: 0.5rem;
}

.edo-spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #b7d8c8;
  font-size: 0.85rem;
}

.edo-spec-chip-x {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
  opacity: 0.7;
}

.edo-spec-chip-x:hover {
  opacity: 1;
}

.settings-list {
  margin: 0.75rem 0;
  display: grid;
  gap: 0.65rem;
}

.settings-list > div {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

.settings-list dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.settings-list dd {
  margin: 0;
  word-break: break-word;
}

.settings-ok {
  color: #0b6e4f;
}

.settings-bad {
  color: #8b2e2e;
}

@media (max-width: 640px) {
  .settings-list > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.page {
  padding: 1.25rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.table-scroll {
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 1100px;
}

.orders-table th,
.orders-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.orders-table th {
  position: sticky;
  top: 0;
  background: var(--header);
  font-weight: 600;
  color: var(--ink);
  z-index: 1;
}

.orders-table tbody tr:nth-child(even) {
  background: var(--row-alt);
}

.orders-table tbody tr:hover {
  background: var(--row-hover);
}

.orders-table tbody tr.has-edo-docs {
  background: #fff6e0;
  box-shadow: inset 3px 0 0 #d4a017;
}

.orders-table tbody tr.has-edo-docs:nth-child(even) {
  background: #ffefc7;
}

.orders-table tbody tr.has-edo-docs:hover {
  background: #ffe8a8;
}

.orders-table .empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
  white-space: normal;
}

.order-num {
  font-weight: 600;
  color: var(--accent);
}

a.order-num:hover {
  text-decoration: underline;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.45rem;
  font-size: 0.9rem;
}

.banner-body {
  flex: 1;
  min-width: 0;
}

.banner-close {
  flex: 0 0 auto;
  margin: -0.25rem -0.35rem -0.25rem 0;
  padding: 0.15rem 0.45rem;
  border: 0;
  border-radius: 0.3rem;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
}

.banner-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}

.banner-error {
  background: #fdecea;
  border: 1px solid #f5c2c0;
  color: #7a1f1a;
}

.banner-ok {
  background: #e6f3ee;
  border: 1px solid #b7d8c8;
  color: #0b6e4f;
}

.edo-mode-select {
  min-width: 10.5rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font: inherit;
  font-size: 0.85rem;
  background: var(--card);
  cursor: pointer;
}

.edo-mode-form {
  margin: 0;
}

.edo-status-cell {
  color: var(--muted);
}

.edo-docs-cell {
  text-align: center;
}

.edo-docs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.edo-docs-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.edo-docs-btn.has-docs {
  border-color: #d4a017;
  background: #fff1c2;
  color: #8a6500;
}

.edo-docs-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0;
  overflow: hidden;
}

.edo-docs-placeholder {
  margin: 0;
  color: var(--muted);
  padding: 1.5rem;
}

.edo-xml-pre {
  margin: 0;
  padding: 0.85rem 1rem;
  overflow: auto;
  max-height: min(70vh, 48rem);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
  background: #0f1419;
  color: #e6edf3;
  border-radius: 0.4rem;
}

.edo-docs-table {
  min-width: 1200px;
}

.edo-docs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.85rem;
}

.edo-docs-order-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.edo-docs-order-status strong {
  color: var(--ink);
  font-weight: 600;
}

.edo-status-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
}

.edo-status-select {
  min-width: 12rem;
  width: auto;
}

.edo-status-history {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.edo-status-history summary {
  cursor: pointer;
  color: var(--ink);
}

.edo-status-history-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.edo-status-history-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  padding: 0.25rem 0;
  border-top: 1px solid color-mix(in srgb, var(--line, #ddd) 80%, transparent);
}

.edo-status-history-change {
  color: var(--ink);
}

.edo-status-history-author {
  margin-left: auto;
}

.edo-docs-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.edo-docs-action {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  color: #c45c26;
  cursor: pointer;
  text-decoration: none;
}

.edo-docs-action:hover:not(:disabled):not(.is-disabled) {
  text-decoration: underline;
}

.edo-docs-action:disabled,
.edo-docs-action.is-disabled {
  color: #c9a190;
  cursor: not-allowed;
}

.edo-drafts-menu {
  position: relative;
}

.edo-drafts-summary {
  list-style: none;
}

.edo-drafts-summary::-webkit-details-marker {
  display: none;
}

.edo-drafts-summary::after {
  content: " ▾";
  font-size: 0.8em;
}

.edo-drafts-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 5;
  min-width: 11rem;
  padding: 0.35rem 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  box-shadow: 0 6px 18px rgba(26, 35, 50, 0.08);
}

.edo-drafts-item-form {
  margin: 0;
}

.edo-drafts-item {
  display: block;
  width: 100%;
  border: none;
  background: none;
  padding: 0.45rem 0.85rem;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.edo-drafts-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.draft-form-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
}

.form-section {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.form-note,
.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.form-grid .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-grid .field.full {
  grid-column: 1 / -1;
}

.form-grid label {
  font-size: 0.8rem;
  color: var(--muted);
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font: inherit;
  background: #fff;
}

.form-grid input.is-mirrored,
.form-grid textarea.is-mirrored {
  background: #f3f6f8;
  color: var(--muted);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.saved-drafts-panel {
  margin-bottom: 1rem;
}

.edo-docs-actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.edo-docs-send-form {
  margin: 0;
  display: inline;
}

.edo-docs-clear-hidden-form {
  margin: -0.5rem 0 1rem;
  display: inline-block;
}

.edo-docs-delete {
  color: #8b2e2e;
  border-color: #d4a0a0;
  background: #fff7f7;
}

.edo-docs-delete:hover:not(:disabled) {
  background: #fde8e8;
}

.edo-docs-send {
  font-size: 0.9rem;
}

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

.edo-drafts-hint {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.edo-docs-link {
  color: #c45c26;
  text-decoration: underline;
}

.edo-docs-bind-form {
  margin: 0;
}

.edo-docs-bind-cell {
  text-align: center;
}

.edo-docs-row.is-bound {
  background: var(--accent-soft);
}

.edo-comments-panel {
  margin-top: 1rem;
}

.edo-comment-form {
  padding: 0 1rem 0.75rem;
}

.edo-comment-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.edo-comment-body-field {
  flex: 1 1 18rem;
}

.edo-comment-body {
  min-height: 4.5rem;
  resize: vertical;
}

.edo-comment-notify {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
}

.edo-comments-list {
  list-style: none;
  margin: 0;
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.edo-comment-item {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
}

.edo-comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.edo-comment-meta strong {
  color: var(--ink);
}

.edo-comment-text {
  font-size: 0.95rem;
}

.edo-comment-text p {
  margin: 0 0 0.35rem;
}

.edo-comment-text p:last-child {
  margin-bottom: 0;
}

.edo-docs-hide {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.9rem;
  color: #c45c26;
  cursor: pointer;
}

.edo-docs-hide:hover {
  text-decoration: underline;
}

.banner-hint {
  display: block;
  margin-top: 0.35rem;
  color: #5c6b7a;
}

.banner code,
.page-sub code {
  background: #e8eef3;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.85em;
}

.edo-specialists-cell {
  max-width: 12rem;
  font-size: 0.88rem;
  white-space: normal;
}

.route-cell {
  white-space: normal;
  max-width: 16rem;
}

.pager {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.pager-link {
  font-weight: 600;
}

.pager-meta {
  color: var(--muted);
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.document-filters-bar {
  margin-top: -0.25rem;
  flex-wrap: nowrap;
  align-items: flex-end;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.document-filters-bar .filter-field {
  flex: 1 1 auto;
  min-width: 0;
}

.document-filters-bar .search-input {
  width: 100%;
  min-width: 14rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-field label {
  font-size: 0.8rem;
  color: var(--muted);
}

.search-input {
  min-width: 11rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  font: inherit;
  background: var(--card);
}

.filter-select {
  min-width: 10rem;
}

.filter-select-wide {
  min-width: 14rem;
}

.filter-field-check {
  justify-content: flex-end;
  padding-bottom: 0.35rem;
}

.filter-field-check label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
  font-size: 0.9rem;
}

.edo-docs-filters {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.date-input {
  min-width: 9.5rem;
}

.search-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.4rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.search-btn:hover {
  filter: brightness(1.05);
}

.search-reset {
  font-size: 0.9rem;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
