:root {
  --bg: #eef3f9;
  --ink: #0d1526;
  --muted: #74839a;
  --line: #dce5f1;
  --panel: rgba(255, 255, 255, 0.86);
  --nav: #08111f;
  --nav2: #111d31;
  --blue: #2079ff;
  --cyan: #00b8ff;
  --green: #18a058;
  --red: #e5484d;
  --amber: #f4a62a;
  --shadow: 0 20px 50px rgba(19, 34, 58, 0.12);
  --r: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(32, 121, 255, 0.14), transparent 32%),
    radial-gradient(circle at 90% 5%, rgba(0, 184, 255, 0.12), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border-radius: 12px;
  min-height: 46px;
  padding: 0 13px;
  outline: none;
}

textarea {
  min-height: 96px;
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(32, 121, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(32, 121, 255, 0.12);
}

label {
  display: grid;
  gap: 7px;
  color: #526178;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-v2 {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 44px;
  padding: clamp(18px, 5vw, 72px);
  background:
    linear-gradient(135deg, rgba(8, 17, 31, 0.94), rgba(17, 29, 49, 0.9)),
    var(--bg);
  color: white;
}

.auth-v2 h1 {
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.98;
  margin: 26px 0 18px;
  max-width: 820px;
}

.auth-v2 p {
  max-width: 680px;
  color: #b9c8dd;
  font-size: 18px;
  line-height: 1.65;
}

.auth-card {
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.32);
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #edf3fb;
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 16px;
}

.seg button {
  height: 42px;
  border-radius: 11px;
  background: transparent;
  color: #63738b;
  font-weight: 900;
}

.seg button.active {
  background: var(--nav);
  color: white;
}

.form {
  display: none;
  gap: 13px;
}

.form.active,
.form-grid {
  display: grid;
  gap: 13px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: white;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(32, 121, 255, 0.32);
}

.logo.big {
  width: 70px;
  height: 70px;
  font-size: 24px;
}

.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--nav);
  color: white;
}

.btn.primary {
  background: linear-gradient(135deg, var(--blue), #00a5ff);
}

.btn.soft {
  background: #e8f0fb;
  color: #1a3764;
}

.btn.danger,
.mini.danger {
  background: #ffecee;
  color: var(--red);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(32, 121, 255, 0.18), transparent 260px),
    linear-gradient(180deg, var(--nav), var(--nav2));
  color: white;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 18px 0 52px rgba(8, 17, 31, 0.18);
  z-index: 10;
}

.side-head {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 18px;
}

.side-head span {
  display: block;
  color: #8fa2bd;
  font-size: 12px;
  margin-top: 4px;
}

.side nav {
  display: grid;
  gap: 7px;
  overflow: auto;
}

.side nav button {
  min-height: 48px;
  border-radius: 14px;
  background: transparent;
  color: #8fa2bd;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  font-weight: 850;
  text-align: left;
}

.side nav button i {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: #c1d4ef;
  font-style: normal;
}

.side nav button.active {
  background: rgba(32, 121, 255, 0.2);
  color: white;
  box-shadow: inset 3px 0 0 var(--cyan);
}

.collapse {
  margin-top: auto;
  min-height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  color: #b9c8dd;
  font-weight: 900;
}

.shell.collapsed {
  grid-template-columns: 88px minmax(0, 1fr);
}

.shell.collapsed .side-head div:not(.logo),
.shell.collapsed .side nav span {
  display: none;
}

.shell.collapsed .side nav button {
  justify-content: center;
}

.main {
  min-width: 0;
}

.top {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 78px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(238, 243, 249, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(220, 229, 241, 0.8);
}

.top h1 {
  margin: 0;
  font-size: 24px;
}

.top p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hamb {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow);
  display: none;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.content {
  padding: 18px;
  display: grid;
  gap: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
}

.stat,
.panel,
.work,
.modal,
.public-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  border-radius: var(--r);
  backdrop-filter: blur(14px);
}

.stat {
  padding: 18px;
}

.stat b {
  display: block;
  font-size: 28px;
}

.stat span,
.hint,
small {
  color: var(--muted);
}

.grid-2,
.accept-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.overview-hero {
  min-height: 170px;
  padding: 24px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(8, 17, 31, 0.96), rgba(20, 61, 112, 0.9)),
    var(--nav);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.overview-hero span {
  color: #9fc7ff;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
}

.overview-hero h2 {
  margin: 8px 0 0;
  max-width: 760px;
  font-size: clamp(25px, 4vw, 42px);
  line-height: 1.06;
}

.dash-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.dash-item:last-child {
  border-bottom: 0;
}

.dash-item b {
  min-height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #edf5ff;
  color: #1f6fe5;
  font-weight: 950;
  text-align: center;
  padding: 4px;
}

.dash-item strong,
.dash-item span {
  display: block;
}

.dash-item span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

.scan-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  background: #f4f8fd;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.perm-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  font-size: 13px;
}

.perm-grid input {
  width: auto;
  min-height: auto;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cards {
  display: grid;
  gap: 12px;
}

.work {
  padding: 14px;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.work h3,
.work p {
  margin: 0;
}

.work p {
  margin-top: 4px;
  color: #65758c;
}

.plate {
  min-height: 54px;
  border-radius: 12px;
  background: #101a2d;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 950;
  letter-spacing: 1px;
  text-align: center;
  padding: 6px;
}

.work-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.mini {
  min-height: 34px;
  border-radius: 10px;
  padding: 0 10px;
  background: #e8f0fb;
  color: #1a3764;
  font-weight: 900;
}

.mini.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.admin-row span {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
}

.empty,
.loader {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(8, 17, 31, 0.58);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 40;
}

.modal {
  width: min(620px, 100%);
  overflow: hidden;
}

.modal header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--nav);
  color: white;
}

.modal header button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.modal form {
  padding: 18px;
}

.camera-modal {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.camera-modal video {
  width: 100%;
  min-height: 280px;
  max-height: 52vh;
  object-fit: cover;
  background: #101827;
  border-radius: 16px;
}

.camera-modal {
  position: relative;
}

.plate-guide {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 32%;
  height: 90px;
  border: 3px solid #22c55e;
  border-radius: 12px;
  color: white;
  display: grid;
  place-items: end center;
  font-weight: 950;
  font-size: 12px;
  pointer-events: none;
  text-shadow: 0 2px 10px #000;
}

#cameraStatus {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #eef6ff;
  color: #24517d;
  font-weight: 850;
}

.toast {
  position: fixed;
  right: 18px;
  top: 92px;
  z-index: 60;
  background: #101a2d;
  color: white;
  padding: 13px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.public {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.public-card {
  width: min(720px, 100%);
  padding: 28px;
}

.public-card h1 {
  font-size: clamp(28px, 5vw, 48px);
  margin: 18px 0 12px;
}

.status {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: #e8fff2;
  color: var(--green);
  font-weight: 950;
}

.total {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: #101a2d;
  color: white;
  font-weight: 950;
}

@media (max-width: 980px) {
  .auth-v2,
  .grid-2,
  .grid-3,
  .accept-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .stats,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell,
  .shell.collapsed {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    inset: auto 0 0 0;
    height: 72px;
    padding: 8px;
    flex-direction: row;
    overflow-x: auto;
  }

  .side-head,
  .collapse {
    display: none;
  }

  .side nav {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .side nav button {
    min-width: 76px;
    height: 56px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    font-size: 10px;
  }

  .side nav button i {
    width: 24px;
    height: 24px;
  }

  .hamb {
    display: grid;
    place-items: center;
  }

  .top {
    min-height: 68px;
    padding: 10px 12px;
  }

  .top h1 {
    font-size: 19px;
  }

  .content {
    padding: 12px 12px 86px;
  }

  .stats,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .work {
    grid-template-columns: 1fr;
  }

  .plate {
    width: 100%;
  }

  .work-actions {
    justify-content: stretch;
  }

  .work-actions .mini {
    flex: 1;
  }

  .auth-v2 {
    padding: 18px;
  }
}
