/* ============================================================
   Сервис-Экология · панель офиса
   Строгий деловой интерфейс: тёмная навигация, светлая рабочая
   область, крупный шрифт и высокий контраст — с панелью работает
   сотрудник старшего возраста.
   ============================================================ */

:root {
  /* поверхности */
  --canvas:      #EEF1F6;
  --surface:     #FFFFFF;
  --surface-2:   #F7F9FC;
  --rail:        #0E1622;   /* тёмная навигация */
  --rail-2:      #16202F;
  --rail-line:   #22303F;

  /* текст */
  --ink:         #0F1B2D;
  --ink-2:       #33445C;
  --muted:       #6B7C93;
  --on-rail:     #E8EEF6;
  --on-rail-dim: #8FA3BC;

  /* линии */
  --line:        #DCE3ED;
  --line-soft:   #E9EEF5;

  /* акцент */
  --accent:      #0E7F9B;
  --accent-deep: #0B6478;
  --accent-soft: #E2F3F8;
  --accent-glow: #2FD3EF;

  /* состояния */
  --ok:          #12804A;
  --ok-soft:     #E3F5EB;
  --warn:        #9A6100;
  --warn-soft:   #FDF0D9;
  --danger:      #B3251C;
  --danger-soft: #FCE7E5;

  --radius:      14px;
  --radius-sm:   10px;
  --shadow:      0 1px 2px rgba(15,27,45,.05), 0 6px 20px rgba(15,27,45,.07);
  --shadow-lg:   0 24px 60px rgba(8,15,26,.28);
  --mono:        "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------------- Кнопки ---------------- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.005em;
  background: var(--accent);
  color: #fff;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover  { background: var(--accent-deep); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 2px; }

.btn.ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line);
}
.btn.ghost:hover { background: var(--surface-2); border-color: #C9D4E2; }

.btn.ok      { background: var(--ok); }
.btn.ok:hover{ background: #0C6739; }
.btn.danger      { background: var(--danger); }
.btn.danger:hover{ background: #931B14; }

.btn.small { padding: 8px 14px; font-size: 14.5px; border-radius: 8px; }
.btn.wide  { width: 100%; }

/* ---------------- Экран входа ---------------- */
#login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  /* зимний промысел: затемняем и уводим в графит, чтобы карточка читалась */
  background:
    linear-gradient(180deg, rgba(14,22,34,.82), rgba(10,18,28,.92)),
    url("bg-login.jpg") center/cover no-repeat,
    #0E1622;
}
.login-card {
  background: var(--surface);
  width: 400px; max-width: 100%;
  padding: 40px 36px;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 27px; font-weight: 800; letter-spacing: -.02em;
  color: var(--ink);
}
.login-card p {
  margin: 0 0 28px;
  color: var(--muted); font-size: 15px;
}
.login-card input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 17px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.login-card .btn { margin-top: 6px; padding: 14px; font-size: 17px; }

/* ---------------- Верхняя панель ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; height: 62px;
  background: var(--rail);
  border-bottom: 1px solid var(--rail-line);
}
.topbar .logo {
  font-size: 18px; font-weight: 750; letter-spacing: -.01em;
  color: #fff;
  display: flex; align-items: center; gap: 10px;
}
.topbar .logo::before {                 /* акцентная метка вместо картинки */
  content: ""; width: 9px; height: 22px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-glow), var(--accent));
}
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--on-rail-dim); font-size: 14.5px; }
.topbar .btn.ghost {
  background: rgba(255,255,255,.07);
  color: var(--on-rail);
  border-color: rgba(255,255,255,.14);
}
.topbar .btn.ghost:hover { background: rgba(255,255,255,.14); }

/* ---------------- Каркас ---------------- */
#app-screen { display: flex; flex-direction: column; min-height: 100vh; }
.layout { display: flex; flex: 1; align-items: stretch; }

.sidebar {
  width: 288px; flex-shrink: 0;
  padding: 24px 18px;
  background: var(--rail-2);
  border-right: 1px solid var(--rail-line);
  position: sticky; top: 62px; align-self: flex-start;
  height: calc(100vh - 62px);
  overflow-y: auto;
}
.sidebar h3 {
  margin: 0 0 10px;
  font-size: 11.5px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--on-rail-dim);
}
.sidebar h3:not(:first-child) { margin-top: 26px; }

.filter-list { list-style: none; margin: 0 0 4px; padding: 0; }
.filter-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 13px; margin-bottom: 3px;
  border-radius: var(--radius-sm);
  color: var(--on-rail);
  font-size: 15.5px;
  cursor: pointer;
  transition: background .12s;
}
.filter-list li:hover { background: rgba(255,255,255,.07); }
.filter-list li.active {
  background: var(--accent);
  color: #fff; font-weight: 650;
  box-shadow: 0 0 0 1px rgba(47,211,239,.35), 0 6px 18px rgba(14,127,155,.35);
}
.filter-list li .count {
  min-width: 26px; text-align: center;
  background: rgba(255,255,255,.12);
  border-radius: 20px; padding: 2px 8px;
  font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.filter-list li.active .count { background: rgba(0,0,0,.22); }

.sidebar .btn { margin-top: 18px; }
.sidebar .btn.ghost {
  background: rgba(255,255,255,.06);
  color: var(--on-rail);
  border-color: rgba(255,255,255,.14);
}
.sidebar .btn.ghost:hover { background: rgba(255,255,255,.13); }

.content { flex: 1; padding: 26px 30px 60px; min-width: 0; }

/* ---------------- Показатели ---------------- */
.stats {
  display: grid; gap: 14px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
.stat {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.stat .num {
  font-size: 34px; font-weight: 800; letter-spacing: -.03em;
  line-height: 1.1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat .lbl {
  margin-top: 4px;
  font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
}
.stat.alert::before { background: var(--warn); }
.stat.alert .num { color: var(--warn); }

/* ---------------- Панель действий ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.toolbar .title {
  flex: 1; min-width: 200px;
  font-size: 23px; font-weight: 750; letter-spacing: -.02em;
}

/* ---------------- Фильтры ---------------- */
.filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.filters input, .filters select {
  padding: 10px 13px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15.5px;
}
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.filters #f-search { flex: 1; min-width: 220px; }
.fdate {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted); font-size: 14.5px;
}

/* ---------------- Карточка рейса ---------------- */
.trip-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.trip-card:hover {
  border-color: #C6D3E2;
  box-shadow: 0 1px 2px rgba(15,27,45,.05), 0 10px 28px rgba(15,27,45,.10);
}
.trip-head {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.trip-head .num {
  font-size: 20px; font-weight: 800; letter-spacing: -.02em;
}
.trip-head .folder {
  flex: 1 1 100%;
  font-family: var(--mono);
  font-size: 12.5px; color: var(--muted);
  word-break: break-all;
}
.badge {
  padding: 4px 12px; border-radius: 20px;
  font-size: 12.5px; font-weight: 750;
  letter-spacing: .01em;
}
.badge.new      { background: var(--warn-soft);   color: var(--warn); }
.badge.verified { background: var(--ok-soft);     color: var(--ok); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }

.trip-meta {
  display: flex; gap: 20px; flex-wrap: wrap;
  color: var(--muted); font-size: 15px;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.trip-meta b { color: var(--ink); font-weight: 650; }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.thumb { width: 136px; }
.thumb img {
  width: 136px; height: 104px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: zoom-in;
  transition: transform .12s, border-color .12s;
}
.thumb img:hover { transform: scale(1.03); border-color: var(--accent); }
.thumb-archived {
  width: 136px; height: 104px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; line-height: 1.3;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  background: var(--surface-2);
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.thumb .cap {
  margin-top: 5px; text-align: center;
  font-size: 12.5px; color: var(--muted);
}
.trip-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.empty {
  text-align: center; color: var(--muted);
  padding: 70px 20px; font-size: 17px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------------- Работники и месторождения ---------------- */
.mng {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.mng-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.mng-head h2 {
  flex: 1; margin: 0;
  font-size: 20px; font-weight: 750; letter-spacing: -.015em;
}
.mng-form {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 16px;
}
.mng-form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.mng-form-row label {
  flex: 1; min-width: 200px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.mng-form-row input, .mng-form-row select {
  padding: 11px 13px;
  border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 400;
  text-transform: none; letter-spacing: normal;
}
.mng-form-row input:focus, .mng-form-row select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.mng-form-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px;
}

.mng-list { display: flex; flex-direction: column; gap: 10px; }
.mng-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) auto;
  grid-template-areas: "main code" "acts acts" "note note";
  gap: 12px 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  background: var(--surface);
}
.mng-row.off { background: var(--surface-2); opacity: .72; }
.mng-main { grid-area: main; display: flex; gap: 10px; flex-wrap: wrap; }
.mng-main input, .mng-main select {
  flex: 1; min-width: 160px;
  padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font-size: 15.5px;
}
.mng-main input:focus, .mng-main select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.mng-code { grid-area: code; text-align: right; }
.code-label {
  display: block;
  font-size: 10.5px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-bottom: 3px;
}
.code-value {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 19px; font-weight: 700; letter-spacing: .02em;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border: 1px solid #C9E6EF;
  border-radius: 9px;
  padding: 7px 12px;
}
.code-copy {
  border: none; background: transparent;
  color: var(--accent); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 4px; font-family: inherit;
}
.code-copy:hover { color: var(--accent-deep); text-decoration: underline; }

.mng-acts { grid-area: acts; display: flex; gap: 8px; flex-wrap: wrap; }
.mng-note { grid-area: note; font-size: 13.5px; color: var(--muted); }
.mng-note:empty { display: none; }
.mng-empty { color: var(--muted); margin: 0; padding: 18px 0; }

/* ---------------- Модальные окна ---------------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: rgba(8,15,26,.62);
  backdrop-filter: blur(3px);
}
.modal-bg img {
  max-width: 94vw; max-height: 92vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.modal-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 28px;
  width: 460px; max-width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-card h2 {
  margin: 0 0 18px;
  font-size: 21px; font-weight: 750; letter-spacing: -.015em;
}
.modal-card label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted);
}
.modal-card input, .modal-card select, .modal-card textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--surface-2); color: var(--ink);
  font-size: 16px;
}
.modal-card input:focus, .modal-card select:focus, .modal-card textarea:focus {
  outline: none; border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.modal-card .row { display: flex; gap: 10px; margin-top: 24px; }
.modal-card .row .btn { flex: 1; }

/* ---------------- Уведомление ---------------- */
#toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--rail); color: #fff;
  padding: 13px 24px; border-radius: 24px;
  font-size: 15.5px; font-weight: 550;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; z-index: 200;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Адаптив ---------------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: auto; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--rail-line);
  }
  .content { padding: 20px 16px 50px; }
  .mng-row { grid-template-columns: 1fr; grid-template-areas: "main" "code" "acts" "note"; }
  .mng-code { text-align: left; }
}

/* ---------------- Снимки без рейса ---------------- */
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--warn); }

.modal-card.wide { width: 760px; }

.orphan-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.orphan-row:last-child { border-bottom: none; }
.orphan-row > img {
  width: 96px; height: 74px; flex: none; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: zoom-in;
}
.orphan-info { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; }
.orphan-info span { color: var(--muted); }
.orphan-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.orphan-acts select { max-width: 240px; margin: 0; }

@media (max-width: 720px) {
  .orphan-row { flex-wrap: wrap; }
  .orphan-acts { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
