:root {
  --navy: #17365f;
  --navy-hover: #102b50;
  --orange: #e87722;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d0d5dd;
  --page: #f5f6f8;
  --surface: #ffffff;
  --error: #b42318;
  --error-surface: #fef3f2;
  --success: #18794e;
  --focus: rgba(232, 119, 34, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.brand-logo {
  display: block;
  width: 118px;
  height: auto;
}

.poc-label {
  margin: 0;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.login-shell {
  width: min(100%, 460px);
}

.login-panel {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(23, 54, 95, 0.08);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 700;
}

.login-panel h1 {
  margin: 0 0 20px;
  color: var(--navy);
  font-size: 1.85rem;
  line-height: 1.2;
}

.login-form {
  display: grid;
  gap: 16px;
}

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

.field label {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
}

.field input {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}

.login-error {
  display: none;
  margin: 0 0 16px;
  border-left: 4px solid var(--error);
  padding: 10px 12px;
  background: var(--error-surface);
  color: var(--error);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
}

.login-error.is-visible {
  display: block;
}

.primary-button,
.secondary-button,
.open-button {
  border-radius: 6px;
  font-weight: 800;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button {
  width: 100%;
  margin-top: 4px;
  background: var(--navy);
  color: #fff;
}

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

.secondary-button {
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-button:active,
.secondary-button:active,
.open-button:active {
  transform: scale(0.99);
}

.legal-note,
.legal-footer {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.legal-note {
  margin: 22px 0 0;
}

.app-layout {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px max(clamp(18px, 4vw, 44px), env(safe-area-inset-right)) 16px max(clamp(18px, 4vw, 44px), env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar-brand,
.topbar-actions,
.student-card {
  display: flex;
  align-items: center;
}

.topbar-brand {
  gap: 18px;
}

.topbar-actions {
  gap: 18px;
}

.student-card {
  gap: 10px;
  font-size: 0.94rem;
}

.student-card span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
}

.shelf-main {
  padding: 30px max(clamp(18px, 4vw, 44px), env(safe-area-inset-right)) max(36px, env(safe-area-inset-bottom)) max(clamp(18px, 4vw, 44px), env(safe-area-inset-left));
}

.shelf-header {
  max-width: 1180px;
  margin: 0 auto 22px;
}

.shelf-header h1 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.2;
}

.shelf-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.books-grid {
  display: grid;
  max-width: 1180px;
  margin: 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.book-card {
  display: flex;
  min-width: 0;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(31, 41, 51, 0.05);
}

.book-details {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px;
}

.book-type {
  margin: 0 0 7px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.book-card h2 {
  width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.35;
}

.publisher {
  margin: 7px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  margin-top: auto;
  padding: 0 16px;
  background: var(--navy);
  color: #fff;
}

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

.print-label {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.launch-status {
  min-height: 24px;
  max-width: 1180px;
  margin: 20px auto 0;
  color: var(--error);
  font-weight: 800;
}

.launch-status.is-success {
  color: var(--success);
}

.notice,
.empty-state {
  max-width: 1180px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.notice-error {
  border-color: #fecdca;
  background: var(--error-surface);
  color: var(--error);
  font-weight: 700;
}

.empty-state h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.2rem;
}

.empty-state p {
  margin: 7px 0 0;
  color: var(--muted);
}

.legal-footer {
  max-width: 1180px;
  margin: 34px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.legal-footer p {
  margin: 0 0 7px;
}

@media (max-width: 900px) {
  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .student-card {
    min-width: 0;
  }

  .student-card strong {
    overflow-wrap: anywhere;
  }

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

@media (max-width: 430px) {
  .login-panel {
    padding: 22px;
  }

  .auth-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
