:root {
  color-scheme: light dark;

  /* Same palette as kpb-days-off/kpb-timesheet — see their styles.css:
     navy #17385F, gold #FCD603, Kanit typeface, pulled from kpbusa.com. */
  --bg: #fbfcfe;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --text: #2b3542;
  --muted: #7c8798;
  --border: #e9edf2;

  --navy: #17385f;
  --navy-hover: #1f4a7d;
  --navy-contrast: #ffffff;
  --gold: #fcd603;
  --gold-hover: #e6c200;
  --gold-contrast: #17385f;

  --ring: rgba(23, 56, 95, 0.2);
  --shadow: 0 1px 2px rgba(23, 56, 95, 0.04), 0 10px 24px rgba(23, 56, 95, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b2534;
    --surface: #232f40;
    --surface-2: #2b3849;
    --text: #eef2f7;
    --muted: #a3b0c2;
    --border: #3a4a60;
    --navy: #7eb0e0;
    --navy-hover: #97c0e6;
    --navy-contrast: #16202c;
    --gold-contrast: #17385f;
    --ring: rgba(126, 176, 224, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 12px 32px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  --bg: #0d1420;
  --surface: #15202e;
  --surface-2: #1c2836;
  --text: #eef2f7;
  --muted: #93a0b3;
  --border: #263349;
  --navy: #6fa3d8;
  --navy-hover: #8ab6e0;
  --navy-contrast: #0d1420;
  --gold-contrast: #17385f;
  --ring: rgba(111, 163, 216, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: "Kanit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 2.5rem 1.25rem;
}

.shell {
  /* Gives .launcher's width:100% something definite to resolve against —
     without this, main shrink-to-fits as a flex item of body and the
     percentage collapses, squashing the tool grid to one column. */
  width: 100%;
  display: flex;
  justify-content: center;
}

/* --- Sign-in screen (reuses the same card look as the other tools) --- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 0.35s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand-logo {
  height: 34px;
  width: auto;
  margin: 0 auto 1rem;
  display: block;
}

.brand-logo-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-light {
    display: none;
  }
  :root:not([data-theme="light"]) .brand-logo-dark {
    display: block;
  }
}

:root[data-theme="dark"] .brand-logo-light {
  display: none;
}
:root[data-theme="dark"] .brand-logo-dark {
  display: block;
}

.card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 0.35rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.fineprint {
  margin: 1rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.primary-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--navy);
  color: var(--navy-contrast);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.primary-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* --- Launcher screen --- */

.launcher {
  max-width: 720px;
  width: 100%;
  animation: rise 0.35s ease-out;
}

.launcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  /* On narrow viewports, brand+title and user+sign-out were forced onto
     one row with nowhere to go — title, name, and even "Sign out" itself
     wrapped mid-word into a squeezed, broken-looking header. Wrapping
     lets each side claim its own row instead. */
  flex-wrap: wrap;
}

.launcher-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

@media (max-width: 480px) {
  .launcher-user {
    width: 100%;
    justify-content: space-between;
  }

  .user-info {
    text-align: left;
  }
}

.brand-logo-sm {
  height: 24px;
  width: auto;
}

.brand-logo-sm.brand-logo-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-sm.brand-logo-light {
    display: none;
  }
  :root:not([data-theme="light"]) .brand-logo-sm.brand-logo-dark {
    display: block;
  }
}

:root[data-theme="dark"] .brand-logo-sm.brand-logo-light {
  display: none;
}
:root[data-theme="dark"] .brand-logo-sm.brand-logo-dark {
  display: block;
}

.hub-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

.launcher-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.user-info {
  text-align: right;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

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

.link-btn {
  background: none;
  border: none;
  color: var(--navy);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.launcher-subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--navy);
}

.tool-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.tool-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.9rem;
}

.tool-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.3rem;
}

.tool-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.tool-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

/* --- Resources page --- */

/* Same pattern as kpb-timesheet/kpb-days-off's own .home-link (a pill
   rather than a plain text link, so it reads as a real nav control) —
   only needed here on resources.html, since index.html *is* home. */
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.home-link:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--navy-contrast);
}

.home-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

#login-screen .home-link {
  margin-top: 1rem;
}

#resources-screen > .home-link {
  display: inline-flex;
  margin: 0.75rem 0 1.5rem;
}

.resource-category {
  margin-bottom: 2rem;
}

.resource-category-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 0.25rem;
}

.resource-category-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.resource-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.resource-item:hover {
  border-color: var(--navy);
}

.resource-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.resource-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resource-item-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.resource-lang {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--gold-contrast);
  background: var(--gold);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.resource-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 1rem 1.1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  margin: 0;
}

/* Same shape/mechanics as kpb-days-off's own .lang-toggle. On the (narrow,
   centered) login card it's positioned absolute in the corner, matching
   Day-Off's card layout; in the resources header it sits inline in the
   normal flex flow instead, since that header is already a wide row. */
.lang-toggle {
  display: inline-flex;
  gap: 0.15rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem;
}

.lang-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
}

.lang-toggle button.active {
  background: var(--navy);
  color: var(--navy-contrast);
}

.lang-toggle button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

#login-screen .lang-toggle {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
}

/* Intake Form Options page (intake-options.html) */
.opt-group {
  margin-bottom: 2.25rem;
}

.opt-message {
  margin: 0 0 1.25rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.85rem;
}

.opt-message.error {
  border-color: #d64545;
  color: #d64545;
}

.opt-add {
  display: flex;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
}

.opt-add input,
.opt-name-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
}

.opt-add input:focus-visible,
.opt-name-input:focus-visible {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--ring);
}

.opt-btn {
  width: auto;
  margin: 0;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
}

.opt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
}

.opt-row.is-hidden .opt-name {
  color: var(--muted);
  text-decoration: line-through;
}

.opt-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 500;
}

.opt-tag {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.opt-actions {
  display: flex;
  gap: 0.25rem;
}

@media (max-width: 520px) {
  .opt-row {
    flex-wrap: wrap;
  }
  .opt-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.section-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
}
