/* ==========================================================================
   FFCC Apps launcher (admin) - Free Flux Consulting (styles copied from Ask)
   Follows the Free Flux App Style Guide. Mobile-first: base rules are for phones.
     min-width 600px  tablet
     min-width 900px  desktop
   ========================================================================== */
:root {
  --orient-dark: #015474;
  --curious-blue: #2ba0c1;
  --neptune-grey: #81bab6;
  --cerulean-bright: #0C8ED7;
  --light-grey-blue: #dde6ec;
  --light-greyish: #99bdd7;
  --white: #ffffff;
  --border-color: #99bdd7;
  --text-dark: #015474;
  --text-light: #333333;
  --muted: #5b7786;
  --page-bg: #f5f7fa;
  --radius: 8px;
  --tap: 44px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--page-bg); color: var(--text-light);
}
body { min-height: 100vh; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); -webkit-tap-highlight-color: rgba(12,142,215,.12); }
button, input { font-family: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--cerulean-bright); outline-offset: 2px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 max(12px, env(safe-area-inset-left)) 24px max(12px, env(safe-area-inset-right)); }

/* ============= HEADER ============= */
.header {
  background: linear-gradient(135deg, var(--orient-dark) 0%, var(--curious-blue) 100%);
  color: var(--white);
  padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top));
  box-shadow: 0 2px 8px rgba(1,84,116,.15);
  margin: 0 calc(-1 * max(12px, env(safe-area-inset-left))) 16px calc(-1 * max(12px, env(safe-area-inset-right)));
}
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.header :focus-visible { outline-color: var(--white); }
.logo-img { height: 36px; width: auto; max-width: 45vw; object-fit: contain; display: block; }
.header h1 { font-size: 18px; font-weight: 600; line-height: 1.2; }
.header .badge {
  margin-left: auto; font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 18px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.5);
}

/* ============= INTRO ============= */
.intro {
  background: var(--white); border-radius: var(--radius); border-left: 4px solid var(--cerulean-bright);
  box-shadow: 0 2px 8px rgba(1,84,116,.08);
  padding: 16px 12px; display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.intro img { width: 56px; height: 56px; flex: none; border-radius: 14px; box-shadow: 0 2px 8px rgba(1,84,116,.2); }
.intro h2 { font-size: 20px; font-weight: 700; color: var(--orient-dark); }
.intro p { font-size: 14px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.input-field {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--border-color); border-radius: 6px; font-size: 16px;
  background: var(--white); color: var(--text-light);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input-field:focus { outline: none; border-color: var(--cerulean-bright); box-shadow: 0 0 0 3px rgba(12,142,215,.15); }
.summary { font-size: 13px; color: var(--muted); }
.summary b { color: var(--orient-dark); font-variant-numeric: tabular-nums; }

/* ============= APP CARDS ============= */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.app {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  background: var(--white); border-radius: var(--radius);
  border-left: 4px solid var(--cerulean-bright);
  box-shadow: 0 2px 8px rgba(1,84,116,.08);
  padding: 16px 12px; min-height: var(--tap);
  transition: box-shadow .2s ease, transform .2s ease;
}
.app-top { display: flex; align-items: center; gap: 12px; }
.tile {
  width: 52px; height: 52px; flex: none; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--tint-a), var(--tint-b));
}
.tile svg { width: 30px; height: 30px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app h3 { font-size: 17px; font-weight: 600; color: var(--orient-dark); line-height: 1.2; }
.host { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.app p.desc { font-size: 15px; line-height: 1.45; }
.app-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }

.status { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 18px; background: #eef2f5; color: var(--muted); white-space: nowrap; }
.status.live { background: #e8f6ee; color: #14613a; }
.status.down { background: #fdecea; color: #c0392b; }

.btn {
  min-height: var(--tap); padding: 10px 18px; border: none; border-radius: 6px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  background: var(--curious-blue); color: var(--white);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .2s ease;
}
.btn:active { background: var(--orient-dark); }
.stretch { position: absolute; inset: 0; border-radius: var(--radius); }
.stretch:focus-visible { outline: 2px solid var(--cerulean-bright); outline-offset: 2px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; display: none; }

.footer { text-align: center; font-size: 13px; color: var(--muted); margin-top: 24px; }
.footer a { color: var(--cerulean-bright); font-weight: 600; text-decoration: underline; }

@media (min-width: 600px) {
  .intro, .app { padding: 20px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .controls { flex-direction: row; align-items: center; }
  .controls .input-field { max-width: 360px; }
  .summary { margin-left: auto; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (hover: hover) and (pointer: fine) {
  .app:hover { box-shadow: 0 8px 24px rgba(1,84,116,.2); transform: translateY(-2px); }
  .app:hover .btn { background: var(--orient-dark); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ============= ADDED FOR MULTI-PAGE LAUNCHER ============= */
.logo-section { display: flex; align-items: center; gap: 12px; width: fit-content; color: inherit; }
.logo-section:focus-visible { outline: 2px solid var(--white); outline-offset: 4px; border-radius: 4px; }
.logo-placeholder {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 2px solid var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: bold;
}
.section-label { display: block; margin: 20px 2px 10px; font-weight: 600; color: var(--text-dark); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.back-link { display: inline-block; min-height: var(--tap); line-height: var(--tap); color: var(--curious-blue); font-weight: 600; font-size: 14px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--orient-dark); }
.page-sub { font-size: 14px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.app.secondary { border-left-color: var(--neptune-grey); }
.app.soon { border-left-color: var(--light-greyish); background: #fbfcfd; }
.app.soon .tile { opacity: .75; }
.status.info { background: #e3f2fc; color: #0C8ED7; }
.btn.off { background: var(--light-grey-blue); color: var(--muted); }

/* ============= SIGN IN / SIGN OUT ============= */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 12px; }
label { font-weight: 600; color: var(--text-dark); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.form-error { color: var(--danger-dark, #c0392b); font-size: 14px; margin: 4px 0 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--curious-blue); color: var(--white); }
.btn-block { width: 100%; justify-content: center; }
.login-wrap { display: flex; justify-content: center; padding-top: 4vh; }
.login-card {
  width: 100%; max-width: 440px; background: var(--white); border-radius: var(--radius);
  border-left: 4px solid var(--cerulean-bright); box-shadow: 0 2px 8px rgba(1,84,116,.08);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 4px;
}
.login-card .page-sub { margin-bottom: 14px; }
.login-icon { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 2px 8px rgba(1,84,116,.2); margin-bottom: 10px; }
.signout {
  min-height: 36px; padding: 6px 12px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--white);
  background: transparent; border: 1px solid rgba(255,255,255,.6);
}
.signout:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.header .badge + .signout { margin-left: 8px; }
@media (min-width: 600px) { .login-card { padding: 24px; } }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--orient-dark); }
  .signout:hover { background: rgba(255,255,255,.15); }
}
.signout { white-space: nowrap; flex: none; margin-left: auto; }
.header h1 { white-space: nowrap; }
@media (max-width: 599px) {
  .header .badge { display: none; }
  .logo-img { max-width: 38vw; }
}

/* Show / hide passcode */
.pass-wrap { position: relative; }
.pass-wrap .input-field { padding-right: 52px; }
.pass-toggle {
  position: absolute; top: 50%; right: 2px; transform: translateY(-50%);
  width: 44px; height: 40px; border: none; border-radius: 6px; background: none;
  color: var(--orient-dark); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pass-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pass-toggle:focus-visible { outline: 2px solid var(--cerulean-bright); outline-offset: 0; }
@media (hover: hover) and (pointer: fine) { .pass-toggle:hover { background: var(--light-grey-blue); } }
.pass-toggle svg[hidden] { display: none; }
