:root {
  color-scheme: light;
  --bg: #f1f5f3;
  --panel: #ffffff;
  --panel-strong: #12313b;
  --text: #18222d;
  --muted: #5e6b78;
  --line: #d7e2df;
  --primary: #1f6f76;
  --primary-dark: #15565d;
  --danger: #b64b45;
  --accent: #a06d1c;
  --shadow: 0 24px 60px rgba(23, 43, 52, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(135deg, rgba(31, 111, 118, 0.08), rgba(160, 109, 28, 0.06)),
    var(--bg);
  color: var(--text);
}

body.intro-active {
  overflow: hidden;
}

.intro-logo-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  background: #ffffff;
  pointer-events: none;
  animation: introOverlayExit 320ms ease 2850ms forwards;
  animation-play-state: paused;
}

.intro-logo-piece {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(31, 111, 118, 0.08), transparent 56%),
    #ffffff url("logo.png") center / min(94vw, 171vh, 980px) auto no-repeat;
  opacity: 0;
  transition: opacity 160ms ease;
  will-change: transform;
}

.intro-logo-piece-left {
  clip-path: polygon(0 0, 100% 0, 0 100%);
  animation: introLogoLeft 1800ms cubic-bezier(0.72, 0, 0.22, 1) 900ms forwards;
  animation-play-state: paused;
}

.intro-logo-piece-right {
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  animation: introLogoRight 1800ms cubic-bezier(0.72, 0, 0.22, 1) 900ms forwards;
  animation-play-state: paused;
}

.intro-logo-screen.is-ready {
  animation-play-state: running;
}

.intro-logo-screen.is-ready .intro-logo-piece {
  opacity: 1;
}

.intro-logo-screen.is-ready .intro-logo-piece-left,
.intro-logo-screen.is-ready .intro-logo-piece-right {
  animation-play-state: running;
}

@keyframes introLogoLeft {
  to {
    transform: translate(-115vw, -115vh);
  }
}

@keyframes introLogoRight {
  to {
    transform: translate(115vw, 115vh);
  }
}

@keyframes introOverlayExit {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.admin-panel {
  position: fixed;
  top: 16px;
  right: 72px;
  z-index: 10;
  width: auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.admin-panel.is-open {
  width: min(560px, calc(100vw - 96px));
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(216, 224, 232, 0.92);
  box-shadow: 0 16px 36px rgba(16, 32, 47, 0.18);
  backdrop-filter: blur(8px);
}

.admin-toggle {
  min-height: 36px;
  padding: 0 14px;
  box-shadow: 0 10px 24px rgba(16, 32, 47, 0.2);
  font-size: 13px;
}

.admin-panel.is-open .admin-toggle {
  width: 100%;
  margin-bottom: 12px;
  background: var(--panel-strong);
}

.admin-header {
  margin-bottom: 12px;
}

.admin-header .eyebrow {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 11px;
}

.admin-header h2 {
  font-size: 17px;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.compact-field {
  display: grid;
  gap: 5px;
}

.compact-field label {
  font-size: 12px;
}

.compact-field input,
.compact-field select {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  background: #ffffff;
}

.admin-message {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.35;
}

.admin-button {
  min-height: 36px;
  font-size: 13px;
}

.admin-user-area {
  display: grid;
  gap: 14px;
}

.user-list-block {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.user-list-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.user-role-list > li,
.user-list > li.user-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  background: #eef6f7;
  color: var(--text);
  font-size: 13px;
}

.user-role-section {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  overflow: hidden;
}

.user-role-toggle {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  background: #eef4f8;
  color: var(--panel-strong);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.user-role-toggle.is-open {
  background: #e2edf4;
}

.user-role-list {
  display: grid;
  gap: 6px;
  max-height: none;
  margin: 0;
  padding: 8px;
  overflow: visible;
  list-style: none;
}

.user-empty-item {
  justify-content: center !important;
  color: var(--muted) !important;
  background: #f2f6fa !important;
}

.user-details {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.user-details strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-details span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-user-button {
  min-height: 28px;
  flex: 0 0 auto;
  padding: 0 9px;
  background: #b33131;
  font-size: 12px;
}

.delete-user-button:hover {
  background: #932424;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 420px);
  align-items: stretch;
}

.brand-panel {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 56px;
  background:
    linear-gradient(rgba(16, 32, 47, 0.86), rgba(16, 32, 47, 0.86)),
    url("tło.jpeg");
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

.brand-mark {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  font-size: 38px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 10px;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.78;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  font-size: 48px;
  line-height: 1.05;
}

h2 {
  font-size: 28px;
}

.lead {
  max-width: 620px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.55;
}

.login-card {
  align-self: center;
  width: min(100% - 40px, 420px);
  margin: 40px auto;
  padding: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card-header {
  margin-bottom: 28px;
}

.card-header .eyebrow {
  color: var(--primary);
}

form {
  display: grid;
  gap: 18px;
}

.access-choice {
  display: grid;
  gap: 22px;
}

.access-buttons {
  display: grid;
  gap: 12px;
}

.access-button {
  min-height: 58px;
  font-size: 18px;
}

.access-button.secondary {
  background: var(--panel-strong);
}

.access-button.secondary:hover {
  background: #1b3348;
}

.field {
  display: grid;
  gap: 8px;
}

.ceidg-lookup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.ceidg-lookup button {
  min-width: 180px;
  padding: 0 16px;
}

.ceidg-message {
  min-height: 18px;
}

label {
  font-size: 14px;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  background: #ffffff;
}

input:focus {
  outline: 3px solid rgba(23, 111, 118, 0.18);
  border-color: var(--primary);
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 400;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

button {
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.back-access-button {
  background: #5e6b78;
}

.back-access-button:hover {
  background: #4c5965;
}

.credentials-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(23, 111, 118, 0.22);
  border-radius: 8px;
  background: #eef6f7;
}

.save-credentials-alert {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #d6a21f;
  border-radius: 8px;
  background: #fff8dc;
  color: #1f1a0d;
  font-weight: 700;
  line-height: 1.4;
}

.credential-row {
  display: grid;
  gap: 4px;
}

.credential-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.credential-row strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.form-actions {
  display: grid;
  gap: 10px;
}

button:hover {
  background: var(--primary-dark);
}

button:focus-visible {
  outline: 3px solid rgba(23, 111, 118, 0.28);
  outline-offset: 2px;
}

@media (max-width: 820px) {
  .admin-panel {
    top: 14px;
    right: 14px;
  }

  .admin-panel.is-open {
    width: min(360px, calc(100vw - 28px));
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 260px;
    padding: 32px 24px;
    align-items: flex-end;
  }

  .ceidg-lookup {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
    font-size: 30px;
  }

  h1 {
    font-size: 34px;
  }

  .lead {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .brand-panel {
    display: block;
  }

  .brand-mark {
    margin-bottom: 22px;
  }

  .login-card {
    width: calc(100% - 28px);
    padding: 24px;
    margin: 24px auto;
  }

  .form-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-logo-screen,
  .intro-logo-piece-left,
  .intro-logo-piece-right {
    animation-duration: 1ms;
    animation-delay: 1ms;
  }
}
