/* Оформление в духе macOS: системный шрифт, полупрозрачные панели, синее выделение, тёмная тема. */
:root {
  --page: #e8e8ed; --win: #ffffff; --chrome: rgba(246, 246, 246, .86); --chrome-solid: #f6f6f6;
  --pane: #ffffff; --pane-alt: #fafafa; --sep: rgba(0, 0, 0, .1); --sep-strong: rgba(0, 0, 0, .16);
  --text: #1d1d1f; --muted: #86868b; --soft: #6e6e73;
  --accent: #007aff; --accent-soft: rgba(0, 122, 255, .12); --on-accent: #fff;
  --sel-inactive: #dcdce0; --control: #ffffff; --control-border: rgba(0, 0, 0, .14);
  --mark: #fde68a; --mark-cur: #ff9f0a; --ok: #28a745; --danger: #ff3b30;
  --shadow: 0 22px 70px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .18);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0f; --win: #1e1e1e; --chrome: rgba(44, 44, 46, .86); --chrome-solid: #2c2c2e;
    --pane: #1e1e1e; --pane-alt: #232325; --sep: rgba(255, 255, 255, .1); --sep-strong: rgba(255, 255, 255, .16);
    --text: #f5f5f7; --muted: #98989d; --soft: #aeaeb2;
    --accent: #0a84ff; --accent-soft: rgba(10, 132, 255, .2);
    --sel-inactive: #3a3a3c; --control: #3a3a3c; --control-border: rgba(255, 255, 255, .12);
    --mark: rgba(255, 214, 10, .38); --mark-cur: #ff9f0a;
    --shadow: 0 22px 70px rgba(0, 0, 0, .6), 0 0 0 .5px rgba(255, 255, 255, .12);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--text); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
mark.cur { background: var(--mark-cur); color: #1d1d1f; box-shadow: 0 0 0 2px var(--mark-cur); }
.muted { color: var(--muted); }

/* ---- окно с «светофором» */
.window { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--win); overflow: hidden; }
@media (min-width: 1200px) {
  .window { inset: 16px; border-radius: var(--radius); box-shadow: var(--shadow); }
}
.titlebar { display: flex; align-items: center; gap: 14px; height: 38px; padding: 0 14px; background: var(--chrome);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--sep); flex: none; }
.lights { display: flex; gap: 8px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2); }
.lights i:nth-child(1) { background: #ff5f57; } .lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
.titlebar .title { flex: 1; text-align: center; font-weight: 600; font-size: 13px; color: var(--text); opacity: .85; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.titlebar nav { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.titlebar nav a { color: var(--soft); }
.titlebar nav a:hover, .titlebar nav a.on { color: var(--text); text-decoration: none; }
.titlebar form { margin: 0; }

/* ---- элементы управления */
.btn, button { font: inherit; font-size: 13px; padding: 4px 12px; border-radius: 6px; border: .5px solid var(--control-border);
  background: var(--control); color: var(--text); cursor: pointer; box-shadow: 0 .5px 1px rgba(0, 0, 0, .08); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.5; }
.btn:hover, button:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary, button.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.icon, button.icon { padding: 4px 8px; }
.btn[disabled], button[disabled] { opacity: .45; cursor: default; }
.linkbtn { background: none; border: 0; box-shadow: none; padding: 0; color: var(--soft); }
.linkbtn:hover { color: var(--text); }
input[type=search], input[type=text], input[type=password], input[type=date], select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--control); border: .5px solid var(--control-border);
  border-radius: 6px; padding: 4px 8px; box-shadow: inset 0 .5px 1px rgba(0, 0, 0, .06); min-width: 0; }
input:focus, select:focus, button:focus-visible, .row:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 0;
  border-color: var(--accent); }
.search { position: relative; flex: 1; display: flex; min-width: 200px; }
.search input { width: 100%; padding: 6px 28px 6px 28px; border-radius: 8px; font-size: 14px; }
.search .glass { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--muted); color: var(--win);
  width: 16px; height: 16px; border-radius: 50%; padding: 0; font-size: 11px; line-height: 16px; justify-content: center; box-shadow: none; }
.seg { display: inline-flex; background: rgba(118, 118, 128, .12); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; box-shadow: none; padding: 2px 10px; border-radius: 5px; color: var(--text); }
.seg button.on { background: var(--control); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .06); }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { appearance: none; width: 26px; height: 15px; border-radius: 8px; background: rgba(120, 120, 128, .32); position: relative;
  transition: background .15s; margin: 0; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 1.5px; left: 1.5px; width: 12px; height: 12px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: left .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 12.5px; }

/* ---- страницы-«листы» (вход, люди, администрирование) */
.sheet { flex: 1; overflow: auto; padding: 24px; }
.sheet .inner { max-width: 1000px; margin: 0 auto; }
.sheet h2 { font-size: 20px; font-weight: 600; margin: 4px 0 14px; }
.group { background: var(--pane-alt); border: .5px solid var(--sep-strong); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.group h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 10px; border-bottom: .5px solid var(--sep); vertical-align: top; }
th { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
tr:nth-child(even) td { background: rgba(127, 127, 127, .04); }
.flash { background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.error { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: rgba(40, 40, 40, .92); color: #fff;
  padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 50; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  backdrop-filter: blur(10px); opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
