/* Andean UI v1 — shared theme tokens and the settings menu.
   Served from https://andean.world/ui/v1/andean.css and loaded by every tool.
   Dark is canonical; light is its strict inversion. The accent gradient is
   never inverted. Edit here, deploy the world repo, every tool follows. */

:root {
  color-scheme: dark;
  --color-bg:             #000000;
  --color-foreground:     #EDEDED;
  --color-full:           rgba(255, 255, 255, 1);
  --color-text-primary:   rgba(255, 255, 255, 1);
  --color-text:           rgba(255, 255, 255, 0.9);
  --color-text-secondary: rgba(255, 255, 255, 0.75);
  --color-text-muted:     rgba(255, 255, 255, 0.6);
  --color-text-faint:     rgba(255, 255, 255, 0.4);
  --color-border:         rgba(255, 255, 255, 0.2);
  --color-border-strong:  rgba(255, 255, 255, 0.3);
  --color-border-subtle:  rgba(255, 255, 255, 0.1);
  --color-hover-surface:  #111827;
  --color-texture-gray:   #636363;
  --accent-gradient:      linear-gradient(to right, #FB923C, #FACC15);
  --font:                 "Open Sans", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --mono:                 "Geist Mono", "SF Mono", Menlo, Consolas, monospace;
}
[data-theme="light"] {
  color-scheme: light;
  --color-bg:             #FFFFFF;
  --color-foreground:     #121212;
  --color-full:           rgba(0, 0, 0, 1);
  --color-text-primary:   rgba(0, 0, 0, 1);
  --color-text:           rgba(0, 0, 0, 0.9);
  --color-text-secondary: rgba(0, 0, 0, 0.75);
  --color-text-muted:     rgba(0, 0, 0, 0.6);
  --color-text-faint:     rgba(0, 0, 0, 0.4);
  --color-border:         rgba(0, 0, 0, 0.2);
  --color-border-strong:  rgba(0, 0, 0, 0.3);
  --color-border-subtle:  rgba(0, 0, 0, 0.1);
  --color-hover-surface:  #F3F4F6;
  /* --accent-gradient and --color-texture-gray are the same on both grounds */
}

/* ---------- <andean-settings> ---------- */
andean-settings {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: var(--font);
  font-weight: 300;
  line-height: 1.4;
}
andean-settings[fixed] {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1000;
}
.andean-settings__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 200ms ease;
}
.andean-settings__btn:hover,
.andean-settings__btn[aria-expanded="true"] { color: var(--color-foreground); }
.andean-settings__btn:focus-visible {
  outline: 1px solid var(--color-border-strong);
  outline-offset: 2px;
}
.andean-settings__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: none;
  z-index: 1000;
}
.andean-settings__menu[hidden] { display: none; }
.andean-settings__row {
  appearance: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  background: none;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--color-foreground);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}
.andean-settings__row + .andean-settings__row { border-top: 1px solid var(--color-border-subtle); }
.andean-settings__row:hover { background: var(--color-hover-surface); }
.andean-settings__row:focus-visible {
  outline: 1px solid var(--color-border-strong);
  outline-offset: -2px;
}
/* Key hint at the right of a row (Return to World: Option+W / Alt+W). */
.andean-settings__key {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}
@media (hover: none) and (pointer: coarse) {
  .andean-settings__key { display: none; }  /* no keyboard on a phone */
}

/* ---------- Report a bug dialog (opened from <andean-settings>) ---------- */
.andean-report {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-weight: 300;
  line-height: 1.5;
  box-sizing: border-box;
  overflow: auto;
}
.andean-report::backdrop { background: rgba(0, 0, 0, 0.6); }
.andean-report button, .andean-report label { -webkit-tap-highlight-color: transparent; }
.andean-report__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}
.andean-report__form *, .andean-report__form *::before, .andean-report__form *::after { box-sizing: border-box; }
.andean-report__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.andean-report__title {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
}
.andean-report__close {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px;
  margin: -8px;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.andean-report__close:hover { color: var(--color-foreground); }
.andean-report__kind {
  display: flex;
  border: 1px solid var(--color-border-subtle);
}
.andean-report__kind label {
  flex: 1;
  position: relative;
  cursor: pointer;
}
.andean-report__kind label + label { border-left: 1px solid var(--color-border-subtle); }
.andean-report__kind input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.andean-report__kind span {
  display: block;
  padding: 10px 12px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color 200ms ease, background 200ms ease;
}
.andean-report__kind input:checked + span {
  color: var(--color-bg);
  background: var(--color-foreground);
}
.andean-report__kind input:focus-visible + span { outline: 1px solid var(--color-text-primary); outline-offset: -1px; }
.andean-report textarea,
.andean-report input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}
.andean-report textarea { resize: vertical; min-height: 120px; }
.andean-report textarea::placeholder,
.andean-report input::placeholder { color: var(--color-text-faint); }
.andean-report textarea:focus,
.andean-report input[type="text"]:focus { outline: none; border-color: var(--color-border-strong); }
.andean-report__attach {
  align-self: flex-start;
  padding: 2px 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}
.andean-report__attach:hover { color: var(--color-foreground); border-color: var(--color-foreground); }
.andean-report__files {
  list-style: none;
  margin: -6px 0 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--color-text-muted);
}
.andean-report__files:empty { display: none; }
.andean-report__files li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border-subtle);
  overflow-wrap: anywhere;
}
.andean-report__files button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-text-faint);
  font-size: 12px;
  padding: 4px;
  cursor: pointer;
}
.andean-report__files button:hover { color: var(--color-foreground); }
.andean-report__status {
  margin: 0;
  min-height: 1.5em;
  font-size: 13px;
  color: var(--color-text-muted);
}
.andean-report__status--error { color: #FB923C; }
.andean-report__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.andean-report__actions button {
  appearance: none;
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 10px 20px;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
}
.andean-report__actions button:hover { color: var(--color-foreground); border-color: var(--color-border-strong); }
.andean-report__send {
  background: var(--color-foreground) !important;
  border-color: var(--color-foreground) !important;
  color: var(--color-bg) !important;
}
.andean-report__send:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 520px) {
  .andean-report {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
  }
  .andean-report__form { padding: 20px; min-height: 100dvh; }
  .andean-report__actions { margin-top: auto; }
  .andean-report__actions button { flex: 1; padding: 14px 20px; }
}

/* ---------- Sign-in gate ----------
   Every tool's front door: the mark, the tool name with the one accent bar,
   an "Andean Systems · what it does" line, then the actions. The markup is
   the same in every app:

     <main class="andean-gate">                (add andean-gate--overlay to
       <andean-settings fixed></andean-settings>  float over a live page)
       <div class="andean-gate__inner">
         <div class="andean-gate__mark" aria-hidden="true"></div>
         <h1 class="andean-gate__title">Hawkeye</h1>
         <p class="andean-gate__sub">Andean Systems &middot; Process visibility</p>
         <p class="andean-gate__error" hidden>…</p>
         <div class="andean-gate__actions">
           <button class="andean-gate__btn andean-gate__btn--primary">Continue with Google</button>
           <button class="andean-gate__btn andean-gate__btn--quiet">Sign out</button>
         </div>
       </div>
     </main>

   Plain text inside __actions ("loading…", "checking access…") is styled as
   a status line. __pin is the four-digit field for PIN-gated tools. */
.andean-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 24px;
  box-sizing: border-box;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.andean-gate--overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
}
.andean-gate[hidden] { display: none; }
.andean-gate *, .andean-gate *::before, .andean-gate *::after { box-sizing: border-box; }
.andean-gate__inner {
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.andean-gate__mark {
  width: 40px;
  height: 22px;
  margin: 0 auto 28px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 228 1000 545'%3E%3Cg fill='%23D9BFB3' transform='translate(0 228)'%3E%3Cpath d='M484 4 L484 290 Q484 301 477 311 L348 452 L158 344 L468 7 Q474 0 484 4 Z'/%3E%3Cpath d='M135 370 L325 487 L318 497 L85 438 Z'/%3E%3Cpath d='M68 458 L292 545 L286 545 L0 545 L0 536 Z'/%3E%3Cpath d='M516 4 L516 290 Q516 301 523 311 L652 452 L842 344 L532 7 Q526 0 516 4 Z'/%3E%3Cpath d='M865 370 L675 487 L682 497 L915 438 Z'/%3E%3Cpath d='M932 458 L708 545 L714 545 L1000 545 L1000 536 Z'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.andean-gate__title {
  margin: 0;
  font-family: var(--font);
  font-size: 28px;
  font-weight: 300;
  font-style: normal;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-transform: none;
  color: var(--color-text-primary);
}
.andean-gate__title::after {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  margin: 12px auto 0;
  background: var(--accent-gradient);
}
.andean-gate__sub {
  margin: 14px 0 36px;
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.andean-gate__error {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.andean-gate__error[hidden], .andean-gate__error:empty { display: none; }
.andean-gate__actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.andean-gate .andean-gate__btn {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 20px;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease;
}
.andean-gate .andean-gate__btn:hover:not(:disabled) {
  color: var(--color-foreground);
  border-color: var(--color-border-strong);
  background: var(--color-hover-surface);
}
.andean-gate .andean-gate__btn:focus-visible {
  outline: 1px solid var(--color-border-strong);
  outline-offset: 2px;
}
.andean-gate .andean-gate__btn:disabled { opacity: 0.5; cursor: default; }
.andean-gate .andean-gate__btn--primary {
  background: var(--color-foreground);
  border-color: var(--color-foreground);
  color: var(--color-bg);
}
.andean-gate .andean-gate__btn--primary:hover:not(:disabled) {
  background: var(--color-full);
  border-color: var(--color-full);
  color: var(--color-bg);
}
.andean-gate .andean-gate__btn--quiet {
  border-color: transparent;
  color: var(--color-text-faint);
}
.andean-gate .andean-gate__btn--quiet:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  color: var(--color-text);
}
.andean-gate .andean-gate__pin {
  display: block;
  width: 210px;
  max-width: 100%;
  margin: 0 auto;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--color-border-strong);
  border-radius: 0;
  color: var(--color-text-primary);
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 300;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  caret-color: #FB923C;
}
.andean-gate .andean-gate__pin:focus { outline: none; border-bottom-color: var(--color-text-muted); }
.andean-gate__pin + .andean-gate__error { margin: 20px 0 0; }
