:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --text: #17212e;
  --muted: #677385;
  --line: #e2e6ed;
  --brand: #0d3557;
  --brand-2: #e8821e;
  --brand-2-h: #cf7012;
  --moving: #1f9d55;
  --stopped: #2f6fdb;
  --offline: #98a2b3;
  --danger: #d0453f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 20px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
small, .muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- элементы форм ---------- */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }
input, select {
  width: 100%; font: inherit; color: var(--text); background: #fff;
  border: 1px solid #ccd3dd; border-radius: 8px; padding: 9px 11px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 53, 87, .14); }
.field { margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px;
  padding: 9px 14px; border: 1px solid transparent; background: var(--brand); color: #fff;
  transition: background .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { background: #0a2a46; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.accent { background: var(--brand-2); }
.btn.accent:hover { background: var(--brand-2-h); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; opacity: .9; }
.btn.ghost:hover { background: rgba(127, 127, 127, .12); }
.btn.light { background: #fff; color: var(--text); border-color: #ccd3dd; }
.btn.light:hover { background: #f2f4f7; }
.btn.danger { background: #fff; color: var(--danger); border-color: #f0c4c2; }
.btn.danger:hover { background: #fdf0ef; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }

.error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
.note {
  background: #fff8ec; border: 1px solid #f6dcb4; color: #6b4a12;
  padding: 10px 12px; border-radius: 8px; font-size: 13px;
}

/* ---------- логотип ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 38px; height: 38px; flex: none; border-radius: 50%; background: #fff; object-fit: cover; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.login-card .brand { flex-direction: column; text-align: center; gap: 8px; }
.login-card .brand .logo { width: 110px; height: 110px; box-shadow: 0 2px 10px rgba(13, 53, 87, .2); }
.login-card .brand b { font-size: 20px; }
.brand b { display: block; font-size: 16px; letter-spacing: .2px; }
.brand small { display: block; font-size: 11.5px; color: inherit; opacity: .75; }

/* ---------- вход ---------- */
.login-page {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #1d5a8c 0, transparent 60%), var(--brand);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--panel); border-radius: 14px;
  padding: 28px 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.login-card .brand { margin-bottom: 22px; color: var(--brand); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p.sub { margin: 0 0 18px; color: var(--muted); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #17212e; color: #fff; padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 5000; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
.toast-undo { margin-left: 10px; background: var(--brand-2); color: #fff; border: 0; border-radius: 6px; padding: 4px 10px; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- диалоги ---------- */
dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100% - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); color: var(--text);
}
dialog::backdrop { background: rgba(10, 20, 35, .45); }
dialog form { padding: 20px; }
dialog h2 { font-size: 18px; margin-bottom: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.pw-wrap { display: flex; gap: 6px; }
.pw-wrap input { flex: 1; }
