/* =========================================================================
   Empire Tools — Shared component layer (chrome)
   -------------------------------------------------------------------------
   Canonical implementation of the UI every tool has in common: app shell,
   topbar, brand lockup, form controls, buttons, focus rings, status and
   empty/error states. Built entirely on the tokens in tokens.css.

   Import order in each app (main.tsx):
     import "@empire/design-system/tokens.css";   // variables
     import "./index.css";                          // per-app globals
     import App from "./App";                        // per-app App.css
     import "@empire/design-system/base.css";       // LAST = authoritative

   base.css is imported LAST on purpose: it governs the shared chrome so every
   app matches, even if an app still carries an older copy of a rule. Keep
   app-specific layout/components in the app's own CSS.
   ========================================================================= */

/* ---- Form-control + button base ---------------------------------------- */
button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  padding: 0 34px 0 10px;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
}

input {
  min-height: 38px;
  padding: 0 10px;
}

input::placeholder,
textarea::placeholder {
  color: #89919d;
}

/* ---- App shell ----------------------------------------------------------
   No default rule here on purpose: every app defines its own complete
   .app-shell (row count varies per app), and a base-layer copy of the same
   selector risks the build's CSS minifier merging the two by plain
   property overwrite — whichever file lands later in that app's specific
   import graph wins, which is not reliably the app's own file. -----------*/

/* ---- Topbar + brand ---------------------------------------------------- */
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-button {
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-icon,
.brand svg {
  color: var(--accent);
  flex: 0 0 auto;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-label {
  color: #4f5964;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

/* ---- Hub strip ----------------------------------------------------------
   Thin bar above each app's own topbar linking back to the App Hub. Lives
   above (not inside) each app's topbar so it never depends on that app's
   own header layout. ------------------------------------------------------ */
.hub-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 36px;
  padding: 0 18px;
  background: var(--ink);
  color: #cfd6de;
  font-size: 12.5px;
}

.hub-strip-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.hub-strip-link svg {
  color: var(--accent);
  flex: 0 0 auto;
}

.hub-strip-link:hover {
  color: var(--accent);
}

.hub-strip-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Section / results headings (normalized to 700) -------------------- */
.panel-heading h2,
.results-heading h2 {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
}

/* ---- Buttons ----------------------------------------------------------- */
.primary-button,
.secondary-button,
.icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button {
  padding: 0 14px;
  background: var(--ink);
  color: var(--white);
}

.primary-button:not(:disabled):hover {
  background: #263242;
}

.secondary-button,
.icon-button {
  background: var(--surface-strong);
  color: var(--ink);
}

.secondary-button {
  padding: 0 13px;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.secondary-button:not(:disabled):hover,
.icon-button:not(:disabled):hover {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ---- Status + empty / error states ------------------------------------- */
.status {
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--success);
  font-size: 13px;
  line-height: 1.35;
}

.status.bad {
  color: var(--danger);
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
}
