/* =========================================================
   Grace – Providence Christian College
   Brand: Providence Style Guide 2019
   ========================================================= */

/* ----- Variables ---------------------------------------- */
:root {
  --blue:           #004C97;   /* Providence Blue */
  --dark:           #041E42;   /* Providence Dark Blue */
  --red:            #DA291C;   /* Providence Red – alerts/errors only */
  --silver:         #B2B4B2;   /* borders, muted */
  --bg:             #F4F7FB;   /* page background */
  --surface:        #FFFFFF;
  --text-primary:   #041E42;
  --text-secondary: #6B7A8D;
  --border:         #D6DDE8;
  --assistant-bubble: #FCFDFE;
  --assistant-bubble-edge: #E2E8F2;
  --assistant-bubble-shadow: 0 10px 24px rgba(4, 30, 66, 0.08);
  --user-bubble-top: #0A5DB5;
  --user-bubble-bottom: #004C97;
  --user-bubble-shadow: 0 12px 28px rgba(0, 76, 151, 0.22);
  --avatar-ring: rgba(255, 255, 255, 0.92);
  --grace-avatar-image: image-set(
    url('../img/grace-avatar.webp') type('image/webp'),
    url('../img/grace.png') type('image/png')
  );
}

/* ----- Reset -------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

/* ----- Base --------------------------------------------- */
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ----- Chat layout (index.html) ------------------------- */
body:not(.admin-page) {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100svh; /* JS resize handler overrides this for keyboard handling */
}

.app-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  flex: 1;
  min-height: 0;
  background: var(--surface);
}

/* Subtle side border so the frame reads as a card on wide screens */
@media (min-width: 560px) {
  body:not(.admin-page) {
    background: var(--bg);
  }

  .app-frame {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* ----- Header ------------------------------------------- */
.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.header-logo {
  height: 40px;
  width: auto;
  display: block;
  max-width: calc(100vw - 160px); /* prevent overlap with nav link on narrow screens */
}

/* Back link sits at the right without shifting the centred logo */
.header-nav-link {
  position: absolute;
  right: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  line-height: 1.4;
  white-space: nowrap;
}

.header-nav-link:hover {
  color: var(--blue);
  border-color: var(--blue);
}

/* ----- Chat main --------------------------------------- */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* critical: allows flex children to shrink below content size */
}

/* ----- Messages ---------------------------------------- */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at top left, rgba(0, 76, 151, 0.06), transparent 32%),
    linear-gradient(180deg, #f6f9fc 0%, #f2f6fb 100%);
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  animation: msg-in 0.22s cubic-bezier(0.18, 0.72, 0.24, 1) both;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.user-message {
  align-items: flex-end;
}

/* Bot messages: row layout so the avatar sits to the left */
.assistant-message {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

/* Grace avatar — aligned to the top of the bubble */
.assistant-message::before {
  content: '';
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grace-avatar-image) center / cover no-repeat;
  flex-shrink: 0;
  margin-top: 4px;
  border: 3px solid var(--avatar-ring);
  box-shadow:
    0 8px 18px rgba(4, 30, 66, 0.14),
    0 0 0 1px rgba(4, 30, 66, 0.05);
}

/* ----- Message bubbles --------------------------------- */
.message-content {
  position: relative;
  max-width: min(78%, 28rem);
  padding: 12px 16px;
  border-radius: 22px;
  font-size: 1rem;
  line-height: 1.65;
  word-break: break-word;
}

.user-message .message-content {
  background: linear-gradient(180deg, var(--user-bubble-top) 0%, var(--user-bubble-bottom) 100%);
  color: #fff;
  border: 1px solid rgba(4, 30, 66, 0.08);
  border-top-right-radius: 8px;
  box-shadow: var(--user-bubble-shadow);
}

/* Tail on user bubble — points up-right */
.user-message .message-content::after {
  content: '';
  position: absolute;
  top: 10px;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-left: 10px solid var(--user-bubble-bottom);
  border-bottom: 4px solid transparent;
}

.assistant-message .message-content {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.98) 100%);
  color: var(--text-primary);
  border: 1px solid var(--assistant-bubble-edge);
  border-top-left-radius: 8px;
  box-shadow: var(--assistant-bubble-shadow);
}

/* Tail — only on real bubbles, never on the thinking indicator */
.assistant-message .message-content:not(.thinking)::before {
  content: '';
  position: absolute;
  top: 11px;
  left: -10px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-right: 11px solid var(--assistant-bubble-edge);
  border-bottom: 4px solid transparent;
}

.assistant-message .message-content:not(.thinking)::after {
  content: '';
  position: absolute;
  top: 12px;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-right: 10px solid var(--assistant-bubble);
  border-bottom: 4px solid transparent;
}

/* ----- Thinking indicator ------------------------------ */
/* Strip the bubble — "Grace is typing…" floats beside the avatar */
.assistant-message .message-content.thinking {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(214, 221, 232, 0.75);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(4, 30, 66, 0.06);
  border-radius: 999px;
  max-width: none;
  padding: 6px 14px;
  font-size: 14px;
  font-style: italic;
  color: var(--text-secondary);
  animation: typing-pulse 1.6s ease-in-out infinite;
}

/* Align the row so the label sits at the bottom of Grace's avatar */
.assistant-message:has(.thinking) {
  align-items: flex-end;
}

@keyframes typing-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* ----- Rich text inside bubbles ------------------------ */
.message-content p {
  margin: 0 0 0.7em;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul {
  margin: 0.5em 0 0.7em 1.15em;
  padding: 0;
}

.message-content li + li {
  margin-top: 0.25em;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 0 0 0.5em;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.message-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: rgba(4, 30, 66, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}

.message-content a {
  color: inherit;
  text-decoration: underline;
}

/* ----- Empty / intro state (chat) ---------------------- */
.messages .empty-state {
  padding: 4px 0;
}

/* Hide once real messages appear */
.messages:has(.message) .empty-state {
  display: none;
}

/* Intro bubble: same layout as .assistant-message */
.grace-intro {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

.grace-intro-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--grace-avatar-image) center / cover no-repeat;
  flex-shrink: 0;
  margin-top: 4px;
  border: 3px solid var(--avatar-ring);
  box-shadow:
    0 8px 18px rgba(4, 30, 66, 0.14),
    0 0 0 1px rgba(4, 30, 66, 0.05);
}

.grace-intro-bubble {
  position: relative;
  max-width: min(78%, 30rem);
  padding: 13px 16px;
  border-radius: 22px;
  border-top-left-radius: 8px;
  font-size: 1rem;
  line-height: 1.65;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.98) 100%);
  color: var(--text-primary);
  border: 1px solid var(--assistant-bubble-edge);
  box-shadow: var(--assistant-bubble-shadow);
}

/* Matching tail on intro bubble */
.grace-intro-bubble::before {
  content: '';
  position: absolute;
  top: 11px;
  left: -10px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-right: 11px solid var(--assistant-bubble-edge);
  border-bottom: 4px solid transparent;
}

.grace-intro-bubble::after {
  content: '';
  position: absolute;
  top: 12px;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-right: 10px solid var(--assistant-bubble);
  border-bottom: 4px solid transparent;
}

.assistant-message .message-content,
.grace-intro-bubble {
  background-color: var(--assistant-bubble);
}

@media (max-width: 540px) {
  .messages {
    padding: 18px 12px 22px;
  }

  .assistant-message,
  .grace-intro {
    gap: 10px;
  }

  .assistant-message::before,
  .grace-intro-avatar {
    width: 40px;
    height: 40px;
  }

  .message-content,
  .grace-intro-bubble {
    max-width: calc(100% - 52px);
  }
}

/* ----- Input bar --------------------------------------- */
.input-bar {
  flex-shrink: 0;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); /* iPhone home indicator */
  display: flex;
  align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

#chat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

#chat-input {
  flex: 1;
  height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font: inherit;
  font-size: 16px; /* 16px minimum prevents iOS Safari from zooming on focus */
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color 0.12s;
  -webkit-appearance: none;
}

#chat-input:focus {
  border-color: var(--blue);
}

#chat-input::placeholder {
  color: var(--text-secondary);
}

#chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#chat-submit {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  font: inherit;
  transition: background 0.12s;
}

#chat-submit:hover {
  background: #003d7a;
}

#chat-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ----- Status indicator dot ---------------------------- */
#status-banner,
#admin-status-banner {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 100;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--silver);
  box-shadow: 0 0 0 3px var(--surface), 0 1px 3px rgba(0, 0, 0, 0.08);
}

#status-banner[data-status="pending"],
#admin-status-banner[data-status="pending"] {
  background: var(--silver);
}

#status-banner[data-status="online"],
#admin-status-banner[data-status="online"] {
  background: var(--blue);
}

#status-banner[data-status="offline"],
#admin-status-banner[data-status="offline"] {
  background: var(--red);
}

#status-banner[data-clickable="true"] {
  cursor: pointer;
}

#status-banner[data-clickable="true"]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* =========================================================
   Admin page
   ========================================================= */

body.admin-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(0, 76, 151, 0.24), transparent 42%),
    rgba(4, 30, 66, 0.76);
  backdrop-filter: blur(10px);
}

.upload-overlay[hidden] {
  display: none;
}

.upload-overlay-panel {
  width: min(100%, 560px);
  padding: 28px 28px 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, #eef4fb 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 30px 70px rgba(4, 30, 66, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.upload-overlay-title {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--dark);
}

.upload-gauge {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 22px;
  border-radius: 999px;
  background: rgba(4, 30, 66, 0.1);
  box-shadow: inset 0 1px 3px rgba(4, 30, 66, 0.12);
}

.upload-gauge-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a5db5 0%, #2b8cff 52%, #8bc4ff 100%);
  box-shadow:
    0 0 18px rgba(43, 140, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: width 0.18s ease-out;
}

.upload-overlay-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.upload-overlay-stats span:first-child {
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  color: var(--blue);
}

.upload-overlay-stats span:last-child {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: right;
}

.upload-overlay-copy {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.admin-main {
  flex: 1;
  padding: 24px 16px 48px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

/* ----- Admin panel card -------------------------------- */
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.admin-panel-header {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.admin-panel-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
}

.admin-panel-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.panel-section {
  padding: 20px;
}

.panel-section + .panel-section {
  border-top: 1px solid var(--border);
}

.panel-section h3 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Summary / limits text */
.workspace-label {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}

.workspace-note,
.panel-copy,
#documents-summary,
#documents-limits {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

#documents-limits {
  margin-top: 4px;
}

/* ----- Forms (admin) ----------------------------------- */
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#admin-password,
#admin-user-email,
#upload-tags,
#upload-files,
#upload-metadata {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color 0.12s;
  -webkit-appearance: none;
}

#admin-password:focus,
#admin-user-email:focus,
#upload-tags:focus,
#upload-metadata:focus {
  border-color: var(--blue);
}

#upload-tags.ai-analyzing,
#upload-metadata.ai-analyzing {
  color: var(--blue);
  border-color: #0066cc;
  background: linear-gradient(135deg, rgba(0, 102, 204, 0.2), rgba(88, 176, 255, 0.28));
  box-shadow:
    0 0 0 2px rgba(0, 102, 204, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    inset 0 0 18px rgba(88, 176, 255, 0.22);
  animation: ai-tag-pulse 0.82s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes ai-tag-pulse {
  0%,
  100% {
    border-color: #0066cc;
    box-shadow:
      0 0 0 2px rgba(0, 102, 204, 0.22),
      0 0 0 0 rgba(0, 102, 204, 0.18),
      0 0 0 0 rgba(88, 176, 255, 0.18),
      inset 0 0 0 1px rgba(255, 255, 255, 0.42),
      inset 0 0 18px rgba(88, 176, 255, 0.22);
  }

  50% {
    border-color: #2b8cff;
    box-shadow:
      0 0 0 2px rgba(0, 102, 204, 0.3),
      0 0 0 10px rgba(0, 102, 204, 0.18),
      0 0 22px 6px rgba(88, 176, 255, 0.24),
      inset 0 0 0 1px rgba(255, 255, 255, 0.56),
      inset 0 0 24px rgba(88, 176, 255, 0.34);
  }
}

#admin-password::placeholder,
#admin-user-email::placeholder,
#upload-tags::placeholder {
  color: var(--text-secondary);
}

#upload-metadata {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

#upload-metadata::placeholder {
  color: var(--text-secondary);
}

#upload-files {
  padding: 8px 14px;
  cursor: pointer;
}

/* ----- Buttons ----------------------------------------- */
button {
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  line-height: 1.4;
  transition: background 0.12s;
}

button:hover {
  background: #003d7a;
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

/* Secondary – outlined */
.secondary-button {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}

.secondary-button:hover {
  background: rgba(0, 76, 151, 0.06);
}

/* Destructive – delete buttons */
.document-delete.secondary-button {
  color: var(--red);
  border-color: var(--red);
}

.document-delete.secondary-button:hover {
  background: rgba(218, 41, 28, 0.06);
}

/* ----- Admin state badge ------------------------------- */
.admin-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(4, 30, 66, 0.06);
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.admin-state::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.admin-state[data-state="unlocked"] {
  background: rgba(0, 76, 151, 0.08);
  color: var(--blue);
}

/* ----- Inline actions row ------------------------------ */
.inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ----- Error text -------------------------------------- */
.inline-error {
  font-size: 14px;
  color: var(--red);
  min-height: 1.2em;
  margin-top: 8px;
}

/* ----- Document list ----------------------------------- */
.documents-list {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}

.admin-users-form {
  margin-top: 14px;
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.admin-user-email {
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-word;
}

.admin-user-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 76, 151, 0.08);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}

.admin-user-remove {
  flex-shrink: 0;
}

.admin-user-fixed {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(4, 30, 66, 0.06);
}

.document-card {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.document-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.document-card:first-child {
  padding-top: 0;
}

.document-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.document-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.document-filename {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.document-meta-line {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 2px;
  word-break: break-word;
}

.document-status {
  font-weight: 600;
}

.document-status[data-status="completed"] {
  color: var(--blue);
}

.document-status[data-status="failed"] {
  color: var(--red);
}

.document-status[data-status="in_progress"] {
  color: var(--text-secondary);
}

.document-status[data-status="stuck"] {
  color: #b76a00;
}

.document-error {
  font-size: 13px;
  color: var(--red);
  margin-top: 6px;
}

.document-lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(4, 30, 66, 0.04) 0%, rgba(4, 30, 66, 0.08) 100%);
  border: 1px solid rgba(4, 30, 66, 0.08);
  user-select: none;
}

.document-lock-toggle.is-busy {
  opacity: 0.72;
}

.document-lock-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.document-lock-track {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(180deg, #c7d3e2 0%, #aebdd1 100%);
  box-shadow: inset 0 2px 5px rgba(4, 30, 66, 0.18);
  transition: background 0.18s ease;
}

.document-lock-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #e9eff7 100%);
  box-shadow:
    0 3px 8px rgba(4, 30, 66, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform 0.18s ease;
}

.document-lock-input:checked + .document-lock-track {
  background: linear-gradient(180deg, #0a5db5 0%, #004c97 100%);
}

.document-lock-input:checked + .document-lock-track .document-lock-thumb {
  transform: translateX(22px);
}

.document-lock-input:disabled + .document-lock-track {
  opacity: 0.55;
}

.document-lock-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  min-width: 58px;
}

.document-retry.secondary-button {
  color: #b76a00;
  border-color: #b76a00;
}

.document-retry.secondary-button:hover {
  background: rgba(183, 106, 0, 0.08);
}

/* ----- Empty state (documents list) -------------------- */
.documents-list .empty-state {
  padding: 20px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ----- Admin footer ------------------------------------ */
.admin-footer {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.admin-footer p {
  margin: 0;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 600px) {
  .admin-main {
    padding: 16px 12px 40px;
  }

  .panel-section {
    padding: 16px;
  }

  .admin-panel-header {
    padding: 14px 16px;
  }

  .document-card-header {
    flex-direction: column;
    gap: 8px;
  }

  .inline-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 390px) {
  .messages {
    padding: 16px 12px;
  }

  .input-bar {
    padding: 0 12px;
  }
}
