:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f2f2f2;
  --panel-2: #e9e9e9;
  --line: #c8c8c8;
  --line-soft: #dedede;
  --text: #333333;
  --muted: #6f6f6f;
  --link: #1a5aa6;
  --accent: #ffd84d;
  --accent-line: #c9a400;
  --accent-soft: #fff4c2;
  --select: #fbe9a0;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --ok: #2e7d32;
  --ok-soft: #e8f5e9;
  --warn-soft: #fff3e0;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  --radius: 3px;
  --font: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
}

[hidden] { display: none !important; }

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

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: var(--accent-line);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.logo-text { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 12px;
  border: 1px solid #a9a9a9;
  border-radius: var(--radius);
  background: linear-gradient(#ffffff, #ececec);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: linear-gradient(#ffffff, #e2e2e2); }
.btn:active { background: #dcdcdc; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible, .cmd:focus-visible, .nav-link:focus-visible, .section:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

.btn-default {
  border-color: var(--accent-line);
  background: linear-gradient(#ffe57a, var(--accent));
  font-weight: 700;
}

.btn-default:hover { background: linear-gradient(#ffeb94, #ffd23a); }
.btn-small { min-height: 22px; padding: 1px 8px; font-size: 12px; }
.btn-wide { width: 100%; min-height: 34px; font-size: 14px; }

input[type=text], input[type=search], input[type=password], input[type=tel], input[type=date],
input:not([type]), select, textarea {
  width: 100%;
  min-height: 26px;
  padding: 3px 6px;
  border: 1px solid #b5b5b5;
  border-radius: 2px;
  background: #fff;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

input:disabled, select:disabled, textarea:disabled { background: var(--panel); color: var(--muted); }

textarea { resize: vertical; }

.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.check input { margin: 0; }

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #fafafa;
  font: 11px/18px var(--font);
  text-align: center;
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 36px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  transition: opacity 0.4s;
}

.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); background: var(--danger-soft); }
.toast-warn { border-left-color: var(--accent-line); background: var(--warn-soft); }
.toast-hide { opacity: 0; }

.win-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
}

.win {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 24px);
  border: 1px solid #9e9e9e;
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}

.win-sm { max-width: 420px; }
.win-md { max-width: 560px; }
.win-lg { max-width: 720px; }

.win-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px 7px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
  font-weight: 700;
}

.win-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.win-close:hover { background: var(--panel-2); }

.win-commands {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}

.win-body { overflow: auto; padding: 14px; }

.ask-text { margin: 0 0 16px; font-size: 14px; }
.ask-buttons { display: flex; justify-content: flex-end; gap: 8px; }

.editor { display: grid; gap: 9px; }

.editor-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: start;
  gap: 4px 12px;
}

.editor-label { padding-top: 5px; color: var(--muted); }
.editor-checkbox .editor-label { padding-top: 0; }
.editor-checkbox .editor-control { padding-top: 1px; }
.req { color: var(--danger); }
.editor-hint { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.field-error { color: var(--danger); font-size: 12px; }
.field-error:empty { display: none; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }

.editor-error {
  padding: 7px 10px;
  border: 1px solid #efb2ad;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}

.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px 12px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fcfcfc;
}

@media (max-width: 640px) {
  .editor-row { grid-template-columns: 1fr; }
  .editor-label { padding-top: 0; }
}

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

.editor-section {
  margin-top: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line-soft);
  color: #6b5300;
  font-weight: 700;
}

.editor-table > .editor-label, .editor-prices > .editor-label { display: none; }
.editor-table, .editor-prices { grid-template-columns: 1fr; }

.subtable { border: 1px solid var(--line-soft); border-radius: var(--radius); }
.subtable-commands { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px 6px; background: var(--panel); }
.subtable table { width: 100%; border-collapse: collapse; }

.subtable th {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line-soft);
  background: #f7f7f7;
  color: var(--muted);
  font-weight: 400;
  text-align: left;
}

.subtable td { padding: 3px 6px; border-bottom: 1px solid #f0f0f0; }
.subtable tr:last-child td { border-bottom: 0; }
.subtable-del { width: 34px; text-align: center; }
.subtable-currency { width: 70px; color: var(--muted); }

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #6b5300;
  font-size: 11px;
}
