/* ARMCAD-2D — дашборд заказов (стиль оболочки редактора / ИИ Агенты) */

:root {
  --bg: #d8dce2;
  --bg-deep: #c5ccd4;
  --panel: #eef0f3;
  --card: #ffffff;
  --line: #c5ccd4;
  --line-strong: #b0b8c2;
  --text: #1f2430;
  --muted: #6a7380;
  --label: #3a424c;
  --accent: #3d8bfd;
  --accent-border: #2a6fd6;
  --accent-soft: #e8f0fc;
  --ok: #1f9d55;
  --warn: #c9a200;
  --shadow: 0 1px 4px rgba(20, 28, 40, 0.08);
  --radius: 10px;
  --font: "Segoe UI", Tahoma, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #e8eef6 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #dde5ee 0%, transparent 50%),
    linear-gradient(180deg, #e4e8ee 0%, var(--bg) 40%, var(--bg-deep) 100%);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

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

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ----- шапка ----- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: linear-gradient(#f7f7f7, #e8e8e8);
  border: 1px solid #9a9a9a;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.brand-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #1a1a1a;
}
.brand-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: #f3f4f6;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  filter: brightness(1.03);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent-border);
  color: #fff;
}
.btn-ghost {
  background: #fff;
}
.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
}

/* ----- сетка ----- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
  flex: 1;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e4e7eb;
}
.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1f2430;
}
.panel-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.panel-body {
  padding: 12px 14px 16px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* ----- список заказов ----- */
.order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.order-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  color: inherit;
}
.order-card:hover {
  border-color: #a8c4ef;
}
.order-card.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-border), var(--shadow);
}

.order-card-name {
  font-size: 14px;
  font-weight: 700;
  color: #1f2430;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-card-desc {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.order-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.order-card-number {
  font-weight: 600;
  color: #3a4556;
  letter-spacing: 0.02em;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
}
.badge-draft {
  background: #c5ccd4;
  color: #3a424c;
}
.badge-progress {
  background: #ffe566;
  color: #5a4700;
}
.badge-ready {
  background: var(--ok);
  color: #fff;
}

.badge-app {
  background: #3d8bfd;
  color: #fff;
}
.badge-app3 {
  background: #2a6a4a;
  color: #fff;
}
.sync-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.sync-status:empty {
  display: none;
}
.sync-status.ok {
  color: var(--ok);
  font-weight: 600;
}
.sync-status.off {
  color: #8a5a12;
}
.base-2d-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.base-2d-row input {
  min-width: 180px;
  height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}
.base-2d-row label {
  font-weight: 600;
  color: var(--label);
}

.empty {
  margin: 24px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ----- детали ----- */
.detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
  line-height: 1.5;
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-card {
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.detail-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: #8a93a0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.detail-value {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2430;
  line-height: 1.45;
  word-break: break-word;
}
.detail-value.muted {
  font-weight: 500;
  color: var(--muted);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.footer-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.footer-hint code {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}

/* ----- модальное окно «Создание нового заказа» ----- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 28, 40, 0.45);
}
.modal.open {
  display: flex;
}

.modal-card {
  width: min(480px, 96vw);
  background: #fff;
  border: 1px solid #c8c8c8;
  border-radius: 6px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
  color: #111;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #ddd;
}
.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #555;
  border-radius: 4px;
}
.modal-close:hover {
  background: #f0f0f0;
  color: #111;
}

.modal-body {
  padding: 18px 16px 8px;
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.form-row label {
  font-size: 13px;
  font-weight: 600;
  color: #222;
}

.form-row input {
  width: 100%;
  height: 34px;
  padding: 6px 10px;
  border: 1px solid #c5c5c5;
  border-radius: 4px;
  background: #fff;
  outline: none;
}
.form-row input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px rgba(61, 139, 253, 0.2);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 16px;
}

.modal-foot .btn-primary {
  min-width: 96px;
}
