/* JunaHub web — global layout glue. Per-component styling lives inside each
   custom element's shadow root (or its scoped class names). This file only
   handles the page chrome and reset. */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--jh-bg);
  color: var(--jh-fg);
  font-family: var(--jh-font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

jh-app {
  display: block;
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
}

/* Custom elements default to `display: inline`, which causes block-level
   children (like the auth-shell grid) to collapse to content-width. Force
   them to participate in normal block flow. */
jh-sign-in,
jh-invite-accept,
jh-auth-error,
jh-onboarding,
jh-auth-shell,
jh-app-shell {
  display: block;
  width: 100%;
}

/* Auth screens are full-bleed: escape the jh-app 1280px cap and let the
   5/7 brand-rail split span the whole viewport. */
body:has(> jh-app > jh-sign-in),
body:has(> jh-app > jh-invite-accept),
body:has(> jh-app > jh-auth-error),
body:has(> jh-app > jh-onboarding) {
  /* no-op selector — kept for parity with the rule below. */
}
jh-app:has(> jh-sign-in),
jh-app:has(> jh-invite-accept),
jh-app:has(> jh-auth-error),
jh-app:has(> jh-onboarding) {
  max-width: none;
}

/* Stack to single column on narrow viewports so the 380px-wide right pane
   never gets squeezed below its min content width. */
@media (max-width: 880px) {
  jh-auth-shell > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

a {
  color: var(--jh-accent);
  text-decoration: none;
}
a:hover {
  color: var(--jh-accent-hover);
  text-decoration: underline;
}

button {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--jh-border);
  background: var(--jh-bg-elev);
  color: var(--jh-fg);
  padding: var(--jh-pad-y) var(--jh-pad-x);
  border-radius: var(--jh-radius-md);
  cursor: pointer;
  min-height: var(--jh-row-h);
}
button:hover { border-color: var(--jh-border-strong); }
button.primary {
  background: var(--jh-accent);
  color: var(--jh-on-accent);
  border-color: var(--jh-accent);
}
button.primary:hover { background: var(--jh-accent-hover); border-color: var(--jh-accent-hover); }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  padding: var(--jh-pad-y) var(--jh-pad-x);
  border: 1px solid var(--jh-border);
  border-radius: var(--jh-radius-md);
  background: var(--jh-bg-elev);
  color: var(--jh-fg);
  min-height: var(--jh-row-h);
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--jh-focus-ring);
  outline-offset: 0;
  border-color: var(--jh-accent);
}

.jh-stack { display: flex; flex-direction: column; gap: var(--jh-gap); }
.jh-row   { display: flex; align-items: center; gap: var(--jh-gap); }
.jh-card  {
  background: var(--jh-bg-elev);
  border: 1px solid var(--jh-border);
  border-radius: var(--jh-radius-lg);
  padding: 20px;
  box-shadow: var(--jh-shadow-sm);
}

.jh-pad   { padding: 20px; }
.jh-muted { color: var(--jh-fg-muted); }
.jh-small { font-size: 12px; }

.jh-banner {
  padding: 12px 16px;
  background: var(--jh-warn-bg);
  color: var(--jh-warn);
  border-bottom: 1px solid var(--jh-border);
}

.jh-status {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  border-radius: var(--jh-radius-pill);
  background: var(--jh-bg-sunken);
  color: var(--jh-fg-muted);
}
.jh-status.new      { background: var(--jh-info-bg);    color: var(--jh-accent); }
.jh-status.quoted   { background: var(--jh-info-bg);    color: var(--jh-accent); }
.jh-status.approved { background: var(--jh-success-bg); color: var(--jh-success); }
.jh-status.complete { background: var(--jh-success-bg); color: var(--jh-success); }
.jh-status.paid     { background: var(--jh-success-bg); color: var(--jh-success); }
.jh-status.disputed { background: var(--jh-danger-bg);  color: var(--jh-danger); }
.jh-status.cancelled{ background: var(--jh-bg-sunken);  color: var(--jh-fg-subtle); }
