/* UI layer added on top of the inline styles of index.html: notices, in-app dialogs, toasts, app lock.
   (index.html carries its own <style>; style.css is not linked by the page.) */
:root {
  --wa-teal: #128c7e;
  --wa-dark-teal: #075e54;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-card: #e2e8f0;
  --border-focus: #128c7e;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

/* Non-blocking notices (notification permission, backup reminder) */
.notice-bar {
  background: #ecfdf5;
  border-bottom: 2px solid #34d399;
  padding: 10px 16px;
}
.notice-card {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.notice-icon { font-size: 1.6rem; }
.notice-text {
  flex: 1 1 240px;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #064e3b;
  line-height: 1.5;
}
.notice-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* In-app dialogs & toasts (dialogs.js) */
.ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000; /* above the app's own modals (1000) */
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ui-dialog {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.3);
}
.ui-title { margin: 0 0 10px; font-size: 1.15rem; font-weight: 900; color: var(--wa-dark-teal); }
.ui-message { white-space: pre-wrap; word-break: break-word; line-height: 1.7; font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.ui-form { margin-top: 12px; }
.ui-field { display: block; margin-bottom: 12px; }
.ui-field-label { display: block; margin-bottom: 4px; font-size: 0.88rem; font-weight: 800; color: var(--text-secondary); }
.ui-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font: inherit;
  font-size: 1rem;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-primary);
}
.ui-input:focus { outline: none; border-color: var(--border-focus); }
.ui-error { min-height: 1.2em; margin: 2px 0 8px; font-size: 0.85rem; font-weight: 800; color: #b91c1c; }
.ui-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 18px; }
.ui-btn {
  flex: 1 1 auto;
  min-height: 44px; /* comfortable touch target */
  padding: 10px 18px;
  font: inherit;
  font-weight: 900;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
}
.ui-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.ui-btn-primary { background: var(--wa-teal); color: #ffffff; }
.ui-btn-danger { background: #dc2626; color: #ffffff; }
.ui-btn-secondary { background: #ffffff; color: var(--text-secondary); border-color: var(--border-card); }

.ui-toasts {
  position: fixed;
  z-index: 3100;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.ui-toast {
  pointer-events: auto;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: #ffffff;
  background: #0f172a;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
}
.ui-toast-success { background: #047857; }
.ui-toast-warn { background: #b45309; }
.ui-toast-error { background: #b91c1c; }


/* App lock (pin-lock.js): everything except the lock screen and dialogs is hidden while locked */
html.app-locked body > *:not(#pinLockScreen):not(.ui-overlay):not(.ui-toasts):not(script) { display: none !important; }
.pin-screen {
  position: fixed;
  inset: 0;
  z-index: 2500; /* above the app, below the dialogs (3000) so "forgot PIN" can confirm */
  background: linear-gradient(135deg, #075e54 0%, #128c7e 55%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pin-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 340px;
  padding: 28px 24px 20px;
  text-align: center;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.35);
}
.pin-icon { font-size: 2.6rem; }
.pin-title { margin: 6px 0 4px; font-size: 1.3rem; font-weight: 900; color: var(--wa-dark-teal); }
.pin-hint { margin: 0 0 14px; font-size: 0.9rem; font-weight: 700; color: var(--text-secondary); }
.pin-input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 1.5rem;
  padding: 12px;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-sm);
}
.pin-input:focus { outline: none; border-color: var(--border-focus); }
.pin-error { min-height: 1.4em; margin: 8px 0; font-size: 0.85rem; font-weight: 800; color: #b91c1c; }
.pin-card .ui-btn { width: 100%; }
.pin-card .ui-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.pin-forgot { margin-top: 10px; background: none; border: none; color: var(--text-secondary); font: inherit; font-size: 0.85rem; font-weight: 700; text-decoration: underline; cursor: pointer; }
