:root {
  --navy-950: #04101f;
  --navy-900: #07182d;
  --navy-800: #0d2944;
  --ink: #10243a;
  --muted: #607287;
  --line: #d9e3ec;
  --line-strong: #bdcbd8;
  --surface: #ffffff;
  --surface-soft: #f4f8fb;
  --cyan: #2bd9c3;
  --cyan-dark: #087c74;
  --cyan-soft: #dcfaf5;
  --blue: #3a7bff;
  --danger: #bb2d3b;
  --danger-soft: #fff1f2;
  --success: #087b59;
  --shadow: 0 24px 70px rgba(7, 24, 45, 0.13);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(43, 217, 195, 0.08), transparent 32rem),
    var(--surface-soft);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.noscript {
  padding: 1rem;
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
}

.page-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-header,
.site-footer,
.auth-view,
.dashboard-view,
.demo-banner {
  width: min(calc(100% - 2rem), var(--max-width));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--navy-900);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  background: var(--navy-900);
  box-shadow: 0 8px 22px rgba(7, 24, 45, 0.18);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span,
.brand-mark i {
  position: absolute;
  display: block;
  content: "";
}

.brand-mark::before {
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: #fff;
  transform: translate(5px, 7px);
}

.brand-mark::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  transform: translate(-7px, -7px);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-copy small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.58rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--navy-800);
  font-size: 0.82rem;
  font-weight: 750;
}

.privacy-chip svg,
.login-footnote svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #efc76d;
  border-radius: var(--radius-md);
  background: #fff8df;
  color: #674a09;
  font-size: 0.9rem;
}

main {
  display: flex;
  flex: 1;
}

.auth-view {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  gap: clamp(2rem, 6vw, 6.25rem);
  padding-block: clamp(2.5rem, 7vh, 6rem);
}

.auth-intro {
  max-width: 690px;
}

.eyebrow,
.section-index,
.card-kicker {
  margin: 0;
  color: var(--cyan-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-intro h1,
.dashboard-topline h1 {
  margin: 0.9rem 0 1.25rem;
  color: var(--navy-900);
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  font-weight: 780;
  letter-spacing: -0.06em;
  line-height: 0.98;
}

.auth-intro h1 span {
  color: var(--cyan-dark);
}

.intro-text {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.trust-list {
  display: grid;
  gap: 0.85rem;
  margin: 2.2rem 0 0;
  padding: 0;
  list-style: none;
}

.trust-list li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--navy-800);
  font-weight: 650;
}

.trust-list li span {
  display: grid;
  width: 38px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--cyan-dark);
  font-size: 0.75rem;
  font-weight: 850;
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 2.35rem);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.login-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  content: "";
}

.login-card h2 {
  margin: 0.7rem 0 0.4rem;
  color: var(--navy-900);
  font-size: clamp(1.75rem, 4vw, 2.3rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.card-help {
  margin: 0 0 1.7rem;
  color: var(--muted);
}

label {
  display: block;
  margin: 0 0 0.45rem;
  color: var(--navy-800);
  font-size: 0.88rem;
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 52px;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder {
  color: #8c9aab;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(58, 123, 255, 0.14);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.05rem;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 5.4rem;
}

.reveal-button {
  position: absolute;
  top: 50%;
  right: 0.7rem;
  padding: 0.35rem 0.45rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--cyan-dark);
  font-size: 0.78rem;
  font-weight: 800;
  transform: translateY(-50%);
}

.reveal-button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(58, 123, 255, 0.32);
  outline-offset: 2px;
}

.primary-button,
.secondary-button,
.open-button,
.text-button {
  border-radius: 12px;
  font-weight: 800;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.2rem;
  padding: 0.8rem 1rem 0.8rem 1.1rem;
  border: 0;
  background: var(--navy-900);
  color: #fff;
  box-shadow: 0 12px 24px rgba(7, 24, 45, 0.18);
  transition: transform 150ms ease, background 150ms ease;
}

.primary-button:hover {
  background: var(--navy-800);
  transform: translateY(-1px);
}

.primary-button:disabled,
.open-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.button-arrow {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--cyan);
  color: var(--navy-900);
  font-size: 1.2rem;
}

.login-footnote {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.login-footnote svg {
  flex: 0 0 auto;
  margin-top: 0.1rem;
  color: var(--cyan-dark);
}

.login-footnote p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
}

.form-message {
  margin: 0.8rem 0 0;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  background: var(--cyan-soft);
  color: var(--success);
  font-size: 0.86rem;
  font-weight: 650;
}

.form-message.error,
.form-message.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.dashboard-view {
  padding-block: clamp(2rem, 5vw, 4rem) 5rem;
}

.dashboard-topline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line-strong);
}

.dashboard-topline h1 {
  margin-bottom: 0.45rem;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

.user-email {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.secondary-button {
  min-height: 44px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--navy-800);
}

.secondary-button:hover {
  border-color: var(--navy-800);
}

.text-button {
  min-height: 44px;
  padding: 0.65rem 0.5rem;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.text-button:hover {
  color: var(--danger);
}

.library-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 3rem 0 1.5rem;
}

.library-heading h2 {
  margin: 0.45rem 0 0;
  color: var(--navy-900);
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.count-badge {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.library-breadcrumbs {
  display: flex;
  min-height: 40px;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: -0.3rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.library-breadcrumbs button {
  min-height: 36px;
  padding: 0.35rem 0.55rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--cyan-dark);
  font: inherit;
}

.library-breadcrumbs button:hover {
  background: var(--cyan-soft);
}

.library-breadcrumbs button:focus-visible,
.library-folder:focus-visible {
  outline: 3px solid rgba(58, 123, 255, 0.32);
  outline-offset: 2px;
}

.breadcrumb-separator {
  color: #94a4b5;
}

.breadcrumb-current {
  color: var(--navy-800);
}

.library-path-help {
  max-width: 680px;
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.library-folders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.library-folder {
  position: relative;
  display: flex;
  min-height: 190px;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.2rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 30px rgba(7, 24, 45, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.library-folder::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 38%;
  height: 6px;
  border-radius: 0 0 0 999px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  content: "";
}

.library-folder:hover {
  border-color: #9fb5c8;
  box-shadow: 0 18px 40px rgba(7, 24, 45, 0.1);
  transform: translateY(-2px);
}

.folder-marker {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 1.05rem;
  font-weight: 900;
}

.folder-eyebrow {
  margin-bottom: 1.15rem;
  color: var(--cyan-dark);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.library-folder strong {
  max-width: calc(100% - 3rem);
  color: var(--navy-900);
  font-size: 1.35rem;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.folder-description {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.folder-count {
  margin-top: auto;
  padding-top: 1rem;
  color: var(--navy-800);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.package-card {
  display: flex;
  min-width: 0;
  min-height: 355px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(7, 24, 45, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.package-card:hover {
  border-color: #9fb5c8;
  box-shadow: 0 18px 40px rgba(7, 24, 45, 0.1);
  transform: translateY(-2px);
}

.package-topline,
.package-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.package-topline {
  padding: 1rem 1rem 0;
}

.grade-pill {
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.subject-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.package-body {
  position: relative;
  flex: 1;
  padding: 2.4rem 1.15rem 1.4rem;
}

.package-number {
  position: absolute;
  top: 0.7rem;
  right: 1rem;
  color: #e9eff4;
  font-size: 4.2rem;
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
  pointer-events: none;
}

.package-body h3 {
  position: relative;
  margin: 0;
  color: var(--navy-900);
  font-size: 1.55rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.package-subtitle {
  position: relative;
  margin: 0.45rem 0 0;
  color: var(--cyan-dark);
  font-size: 0.86rem;
  font-weight: 800;
}

.package-description {
  position: relative;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.58;
}

.package-footer {
  min-height: 70px;
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.access-expiry {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.25;
}

.open-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 0.55rem;
  padding: 0.58rem 0.75rem;
  border: 0;
  background: var(--navy-900);
  color: #fff;
  font-size: 0.82rem;
  white-space: nowrap;
}

.open-button:hover {
  background: var(--cyan-dark);
}

.state-panel {
  display: grid;
  min-height: 250px;
  place-items: center;
  align-content: center;
  padding: 2rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.64);
  text-align: center;
}

.state-panel h3,
.state-panel p {
  margin: 0;
}

.state-panel h3 {
  color: var(--navy-900);
  font-size: 1.35rem;
}

.state-panel p {
  margin-top: 0.4rem;
  color: var(--muted);
}

.state-number {
  margin-bottom: 0.6rem;
  color: var(--cyan-dark);
  font-size: 2rem;
  font-weight: 900;
}

.loader {
  width: 30px;
  height: 30px;
  margin-bottom: 0.8rem;
  border: 3px solid var(--line);
  border-top-color: var(--cyan-dark);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid #cbece5;
  border-radius: var(--radius-md);
  background: rgba(220, 250, 245, 0.72);
  color: var(--navy-800);
}

.security-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--cyan-dark);
  color: #fff;
  font-family: Georgia, serif;
  font-weight: 700;
}

.security-note p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer nav {
  display: flex;
  gap: 1rem;
}

.site-footer a:hover {
  color: var(--navy-900);
}

.account-dialog {
  width: min(calc(100% - 2rem), 520px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.account-dialog::backdrop {
  background: rgba(4, 16, 31, 0.7);
  backdrop-filter: blur(4px);
}

.account-dialog form {
  padding: 1.4rem;
}

.account-dialog h2 {
  margin: 0.35rem 0 0;
  color: var(--navy-900);
  font-size: 1.75rem;
  letter-spacing: -0.04em;
}

.account-dialog form > p {
  margin: 0.8rem 0 1.2rem;
  color: var(--muted);
}

.account-dialog label:not(:first-of-type) {
  margin-top: 1rem;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--navy-900);
  font-size: 1.45rem;
  line-height: 1;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.primary-button.compact {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding-inline: 1rem;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: var(--navy-900);
  color: #fff;
  box-shadow: 0 14px 35px rgba(4, 16, 31, 0.28);
  font-size: 0.9rem;
  font-weight: 650;
}

@media (max-width: 920px) {
  .auth-view {
    grid-template-columns: 1fr;
    gap: 2.3rem;
    padding-block: 2.2rem 4rem;
  }

  .auth-intro {
    max-width: 760px;
  }

  .auth-intro h1 {
    font-size: clamp(2.65rem, 10vw, 4.5rem);
  }

  .trust-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trust-list li {
    align-items: flex-start;
    flex-direction: column;
    font-size: 0.9rem;
  }

  .login-card {
    width: 100%;
    max-width: 680px;
  }

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

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

@media (max-width: 640px) {
  .site-header,
  .site-footer,
  .auth-view,
  .dashboard-view,
  .demo-banner {
    width: min(calc(100% - 1.25rem), var(--max-width));
  }

  .site-header {
    min-height: 76px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .privacy-chip {
    padding: 0.5rem;
    font-size: 0;
  }

  .privacy-chip svg {
    width: 20px;
    height: 20px;
  }

  .demo-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.82rem;
  }

  .auth-view {
    gap: 1.8rem;
    padding-block: 1.5rem 3rem;
  }

  .auth-intro h1 {
    margin-top: 0.7rem;
    font-size: clamp(2.35rem, 12vw, 3.3rem);
  }

  .intro-text {
    font-size: 1rem;
  }

  .trust-list {
    grid-template-columns: 1fr;
    margin-top: 1.6rem;
  }

  .trust-list li {
    align-items: center;
    flex-direction: row;
  }

  .login-card {
    border-radius: 22px;
  }

  .dashboard-topline,
  .library-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-topline h1 {
    font-size: clamp(2.4rem, 13vw, 3.5rem);
  }

  .account-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .library-folders {
    grid-template-columns: 1fr;
  }

  .package-card {
    min-height: 330px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions .primary-button,
  .dialog-actions .secondary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* OTP, Inhaberbereich und geschützter Dokumenten-Viewer */

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

select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(58, 123, 255, 0.14);
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.otp-input {
  min-height: 64px;
  text-align: center;
  font-size: clamp(1.15rem, 5.5vw, 1.65rem);
  font-weight: 850;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
}

.input-help {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.declaration-box {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #f7fbff;
}

.declaration-check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  cursor: pointer;
}

.declaration-check input {
  flex: 0 0 auto;
  width: 1.2rem;
  min-height: 1.2rem;
  margin: 0.15rem 0 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--cyan-dark);
}

.declaration-check span {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.5;
}

.declaration-box > p {
  margin: 0.65rem 0 0 1.9rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.inline-actions,
.demo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.inline-actions {
  margin-top: 0.7rem;
}

.demo-banner {
  justify-content: space-between;
}

.demo-banner > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.mini-button {
  min-height: 34px;
  padding: 0.38rem 0.7rem;
  border: 1px solid rgba(103, 74, 9, 0.35);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  color: #674a09;
  font-size: 0.78rem;
  font-weight: 800;
}

.identity-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.role-badge,
.secure-admin-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.28rem 0.62rem;
  border: 1px solid #bfe9e2;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin: -0.25rem 0 1.2rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
}

.filter-bar label {
  min-width: 180px;
  margin: 0;
}

.filter-bar label span {
  display: block;
  margin-bottom: 0.35rem;
}

.filter-bar select {
  min-height: 42px;
  padding-block: 0.45rem;
}

.filter-bar .text-button {
  margin-left: auto;
}

.owner-panel {
  padding-bottom: 1rem;
}

.owner-heading-row {
  margin-top: 2.7rem;
}

.owner-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.2rem;
}

.owner-stats article {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: var(--navy-900);
  color: #fff;
  box-shadow: 0 14px 32px rgba(7, 24, 45, 0.12);
}

.owner-stats span {
  color: #a9bbca;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.owner-stats strong {
  color: var(--cyan);
  font-size: 2.15rem;
  line-height: 1;
}

.owner-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #eaf0f5;
}

.owner-tab {
  min-height: 42px;
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.owner-tab.is-active {
  background: #fff;
  color: var(--navy-900);
  box-shadow: 0 4px 12px rgba(7, 24, 45, 0.08);
}

.owner-tab:focus-visible,
.status-toggle:focus-visible,
.viewer-button:focus-visible,
.mini-button:focus-visible {
  outline: 3px solid rgba(58, 123, 255, 0.3);
  outline-offset: 2px;
}

.owner-grid {
  display: grid;
  grid-template-columns: minmax(290px, 0.68fr) minmax(0, 1.32fr);
  gap: 1rem;
  align-items: start;
}

.owner-form,
.owner-list-area {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 12px 30px rgba(7, 24, 45, 0.05);
}

.owner-form {
  position: sticky;
  top: 1rem;
  padding: 1.2rem;
}

.owner-form h3,
.owner-list-area h3 {
  margin: 0.32rem 0 0;
  color: var(--navy-900);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.owner-form > div:first-child > p:last-child {
  margin: 0.45rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.owner-form > label:not(:first-of-type),
.owner-form > input + label,
.owner-form > textarea + label {
  margin-top: 0.9rem;
}

.owner-form input[type="file"] {
  min-height: 48px;
  padding: 0.55rem;
  background: var(--surface-soft);
}

.owner-form input[type="file"]::file-selector-button {
  margin-right: 0.65rem;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: var(--navy-900);
  color: #fff;
  font-weight: 750;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.form-row label {
  margin: 0;
}

.owner-list-area {
  min-width: 0;
  overflow: hidden;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.compact-input {
  width: min(240px, 45%);
  min-height: 42px;
}

.customers-list,
.owner-packages-list {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
}

.customer-card,
.owner-package-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfdff;
}

.customer-card {
  padding: 0.9rem;
}

.customer-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
}

.customer-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--navy-900);
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 900;
}

.customer-main h4,
.owner-package-card h4 {
  margin: 0;
  color: var(--navy-900);
  font-size: 1rem;
}

.customer-email,
.owner-package-card p {
  overflow: hidden;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
}

.status-toggle {
  min-height: 36px;
  padding: 0.42rem 0.65rem;
  border: 1px solid #b6dfd6;
  border-radius: 999px;
  background: #e9faf5;
  color: var(--success);
  font-size: 0.74rem;
  font-weight: 850;
}

.status-toggle.is-inactive {
  border-color: #efc7cb;
  background: var(--danger-soft);
  color: var(--danger);
}

.customer-grants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.grant-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.32rem 0.42rem 0.32rem 0.58rem;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 0.72rem;
  font-weight: 750;
}

.grant-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grant-chip button {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 124, 116, 0.12);
  color: currentColor;
  font-size: 1rem;
  line-height: 1;
}

.no-grants {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.grant-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(135px, 0.6fr) auto;
  align-items: end;
  gap: 0.55rem;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.grant-form label {
  margin: 0;
  font-size: 0.75rem;
}

.grant-form select,
.grant-form input {
  min-height: 40px;
  margin-top: 0.3rem;
  padding-block: 0.4rem;
  font-size: 0.8rem;
}

.grant-form .secondary-button {
  min-height: 40px;
}

.owner-package-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem;
}

.owner-package-card > div {
  min-width: 0;
}

.package-meta-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.package-meta-line .subject-label {
  max-width: none;
}

.declarations-area {
  overflow: hidden;
}

.declarations-heading .secondary-button {
  flex: 0 0 auto;
}

.declarations-intro {
  margin: 0;
  padding: 1rem 1.1rem 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.declarations-list {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
}

.declaration-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfdff;
}

.declaration-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.declaration-card h4 {
  margin: 0;
  color: var(--navy-900);
  font-size: 1rem;
}

.declaration-email {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.declaration-date {
  flex: 0 0 auto;
  color: var(--navy-800);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.declaration-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.declaration-meta span {
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 0.7rem;
  font-weight: 800;
}

.declaration-card details {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.declaration-card summary {
  color: var(--navy-800);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}

.declaration-text {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.declarations-empty {
  margin: 0;
  padding: 1.2rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.viewer-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #020912;
  color: #fff;
}

.viewer-dialog::backdrop {
  background: #020912;
}

.viewer-shell {
  display: grid;
  min-width: 320px;
  height: 100dvh;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.viewer-header,
.viewer-toolbar,
.viewer-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-inline: clamp(0.75rem, 3vw, 1.5rem);
  background: #07182d;
}

.viewer-header {
  justify-content: space-between;
  min-height: 78px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.viewer-header .card-kicker {
  color: var(--cyan);
}

.viewer-header h2 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
}

.icon-button.inverse {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.viewer-toolbar {
  min-height: 56px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #c3d0da;
  font-size: 0.8rem;
  white-space: nowrap;
}

.toolbar-spacer {
  flex: 1;
}

.viewer-button {
  min-height: 34px;
  padding: 0.38rem 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 750;
}

.viewer-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.viewer-stage {
  position: relative;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(0.75rem, 3vw, 1.5rem);
  background:
    radial-gradient(circle at top, rgba(58, 123, 255, 0.12), transparent 28rem),
    #020912;
  text-align: center;
}

.viewer-loading {
  display: grid;
  min-height: 50vh;
  place-items: center;
  align-content: center;
  color: #c3d0da;
}

.viewer-loading p {
  margin: 0.7rem 0 0;
}

.viewer-loading .loader {
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: var(--cyan);
}

.pdf-page-wrap {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
  line-height: 0;
  user-select: none;
}

#pdf-canvas {
  display: block;
  max-width: none;
  background: #fff;
}

.document-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: rgba(7, 24, 45, 0.12);
  font-size: clamp(0.85rem, 2vw, 1.35rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 2.8;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-28deg) scale(1.15);
  white-space: pre-wrap;
}

.viewer-footer {
  justify-content: space-between;
  min-height: 44px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #9db0c0;
  font-size: 0.72rem;
}

.toast {
  z-index: 100;
}

@media (max-width: 920px) {
  .owner-grid {
    grid-template-columns: 1fr;
  }

  .owner-form {
    position: static;
  }
}

@media (max-width: 640px) {
  .demo-banner {
    gap: 0.6rem;
  }

  .demo-actions {
    width: 100%;
  }

  .mini-button {
    flex: 1;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar label {
    min-width: 0;
  }

  .filter-bar .text-button {
    margin-left: 0;
  }

  .owner-heading-row {
    gap: 0.8rem;
  }

  .owner-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .owner-stats article {
    min-height: 92px;
    padding: 0.75rem;
  }

  .owner-stats span {
    font-size: 0.62rem;
  }

  .owner-stats strong {
    font-size: 1.65rem;
  }

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

  .list-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-input {
    width: 100%;
  }

  .customer-main {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .customer-main .status-toggle {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .owner-package-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .declaration-card-heading {
    flex-direction: column;
    gap: 0.45rem;
  }

  .declaration-date {
    text-align: left;
  }

  .viewer-header {
    min-height: 68px;
  }

  .viewer-toolbar {
    padding-inline: 0.65rem;
  }

  .viewer-stage {
    padding: 0.55rem;
  }

  .viewer-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
    padding-block: 0.5rem;
  }
}
