:root {
  --ink: #142027;
  --muted: #5c6b76;
  --line: rgba(20, 32, 39, 0.12);
  --surface: #f7fafb;
  --card: #fff;
  --accent: #0f7a6c;
  --accent-deep: #0a5f54;
  --danger: #b42318;
  --warn: #9a6a2e;
  --ok: #1f8a57;
  --shadow: 0 12px 36px rgba(20, 32, 39, 0.08);
  --radius: 14px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, #eef5f4 0%, var(--surface) 40%, #f3f1ea 100%);
  -webkit-font-smoothing: antialiased;
}

.brand { font-weight: 700; letter-spacing: 0.04em; }
.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.muted { color: var(--muted); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand { display: flex; gap: 12px; align-items: baseline; }
.topbar-title { color: var(--muted); font-weight: 500; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 18px 48px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 8px; font-size: 1.1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.grid-2 {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: rgba(15, 122, 108, 0.45); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.danger { background: #fff5f4; border-color: rgba(180, 35, 24, 0.35); color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 4px 8px; font-size: 0.85rem; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge.ok { background: rgba(31,138,87,0.12); color: var(--ok); }
.badge.warn { background: rgba(154,106,46,0.14); color: var(--warn); }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}
.inline-form input,
.filters input,
.filters select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
  min-width: 140px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 10px 0 0;
}
.stats div { display: grid; gap: 2px; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-weight: 600; }

.chip-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f4f8f7;
}
.chip form { display: inline; }
.chip-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 8px;
}
.chip-x:hover { color: var(--danger); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th, table.data td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.data th {
  background: #f3f7f6;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
table.data tr:last-child td { border-bottom: 0; }
.file-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.actions { white-space: nowrap; display: flex; gap: 6px; }
.empty { text-align: center; color: var(--muted); padding: 24px !important; }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.flash-list { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 8px; }
.flash {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.flash-ok { border-color: rgba(31,138,87,0.3); background: rgba(31,138,87,0.08); }
.flash-error { border-color: rgba(180,35,24,0.3); background: #fff5f4; color: var(--danger); }

/* Login (как у Monitor) */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, #f4f8f8 0%, #e8f1f0 38%, #e4eef5 100%);
}
.login-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.login-mesh {
  position: absolute;
  inset: -18%;
  background:
    radial-gradient(ellipse 48% 42% at 12% 20%, rgba(56, 168, 150, 0.28), transparent 62%),
    radial-gradient(ellipse 42% 36% at 88% 14%, rgba(110, 160, 190, 0.3), transparent 58%),
    radial-gradient(ellipse 50% 40% at 62% 88%, rgba(40, 120, 110, 0.18), transparent 60%),
    radial-gradient(ellipse 30% 28% at 30% 78%, rgba(180, 210, 220, 0.35), transparent 55%);
  animation: mesh-drift 20s ease-in-out infinite alternate;
}
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}
.login-orb-a {
  width: min(44vw, 400px);
  height: min(44vw, 400px);
  left: -10%;
  top: 10%;
  background: radial-gradient(circle at 35% 35%, rgba(56, 168, 150, 0.4), transparent 68%);
  animation: orb-float 15s ease-in-out infinite;
}
.login-orb-b {
  width: min(38vw, 340px);
  height: min(38vw, 340px);
  right: -8%;
  top: 6%;
  background: radial-gradient(circle at 40% 40%, rgba(120, 170, 200, 0.38), transparent 70%);
  animation: orb-float 17s ease-in-out infinite reverse;
  animation-delay: -4s;
}
.login-orb-c {
  width: min(50vw, 440px);
  height: min(50vw, 440px);
  left: 32%;
  bottom: -20%;
  background: radial-gradient(circle at 50% 40%, rgba(90, 150, 160, 0.28), transparent 68%);
  animation: orb-float 22s ease-in-out infinite;
  animation-delay: -8s;
}
.login-grid {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image:
    linear-gradient(var(--ink) 1px, transparent 1px),
    linear-gradient(90deg, var(--ink) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}
.login-noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
  mix-blend-mode: multiply;
}
@keyframes mesh-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2.2%, -1.8%, 0) scale(1.045); }
}
@keyframes orb-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(16px, -20px, 0); }
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes brand-in {
  from { opacity: 0; letter-spacing: 0.22em; transform: translateY(8px); }
  to { opacity: 1; letter-spacing: 0.06em; transform: none; }
}
.login-shell {
  width: min(420px, 100%);
  position: relative;
  z-index: 1;
  animation: card-rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.login-card {
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 42px 36px 36px;
}
.brand-hero {
  font-size: clamp(2.8rem, 9vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--ink);
  animation: brand-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.login-card h1 {
  margin: 8px 0 0;
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--accent-deep);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lede {
  color: var(--muted);
  margin: 12px 0 28px;
  line-height: 1.5;
  font-size: 0.98rem;
}
.login-form { display: grid; gap: 14px; }
.login-form label {
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}
.login-form input {
  width: 100%;
  border: 1px solid rgba(20, 32, 39, 0.16);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.login-form input:focus {
  outline: none;
  border-color: rgba(15, 122, 108, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 122, 108, 0.12);
}
.password-field {
  position: relative;
  display: block;
}
.password-field input { padding-right: 48px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.password-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--accent-deep);
  background: rgba(15, 122, 108, 0.12);
  outline: none;
}
.login-form button[type="submit"] {
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #14907f, var(--accent));
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(15, 122, 108, 0.28);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.login-form button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(15, 122, 108, 0.34);
}
.error {
  background: #fdecec;
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
.login-back {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.9rem;
}
.login-back a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.login-back a:hover { color: var(--accent-deep); }
