/* Full-page editor for the Kituwa Tools rail.
   Loaded only by the operator route /network/widgets/edit. The rail and its
   controls live in the <kituwa-tools> shadow root; this file owns the page
   chrome, the sticky action bar and the feedback surfaces. */
:root {
  --page-ink: #16211c;
  --page-paper: #f5f2e9;
  --page-muted: #5c6b60;
  --page-line: #cfd4c6;
  --page-accent: #2f6b47;
  --page-accent-strong: #245237;
  --page-danger: #b42318;
  --page-danger-bg: #fdecea;
  --page-yes: #1f7a4c;
  --page-card: #ffffff;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  padding: 0 0 220px;
  background: var(--page-paper);
  color: var(--page-ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}
a { color: var(--page-accent); }
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--page-accent);
  outline-offset: 3px;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 10px 14px;
  background: var(--page-card);
  color: var(--page-ink);
  z-index: 20;
}
.skip-link:focus { left: 12px; top: 12px; }
.editor-page { max-width: 1320px; margin: 0 auto; padding: 26px 24px 40px; }
.editor-mast {
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--page-line);
}
.eyebrow {
  margin: 0 0 7px;
  font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--page-accent);
}
h1 { margin: 0 0 8px; font: 42px/1.05 Georgia, serif; letter-spacing: -.02em; }
.lede { margin: 0; max-width: 64ch; color: var(--page-muted); font-size: 17px; }
.mast-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 16px;
}
.version-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid #9fc4ad;
  border-radius: 999px;
  background: #e8f3ec;
  color: #1c5a3b;
  font: 700 13px/1 system-ui, sans-serif;
}
.version-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--page-yes);
}
.view-live {
  font-weight: 650;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.preview-card {
  margin-top: 20px;
  padding: 0;
  background: transparent;
}
.preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 18px;
  margin: 0 0 10px;
}
.preview-head h2 {
  margin: 0;
  font: 600 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--page-accent);
}
.preview-note { margin: 0; color: var(--page-muted); font-size: 13px; }
.preview-card kituwa-tools {
  display: block;
  min-width: 0;
  color: var(--page-ink);
}
.editor-notice {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--page-danger);
  border-left-width: 6px;
  border-radius: 10px;
  background: var(--page-danger-bg);
  color: #7a1710;
  font-weight: 550;
}
.editor-notice[hidden] { display: none; }
.editor-notice a { color: #7a1710; font-weight: 750; }
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  border-top: 1px solid var(--page-line);
  background: #fffdf7f2;
  backdrop-filter: blur(8px);
  box-shadow: 0 -8px 24px #16211c14;
}
.action-bar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.action {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.action button {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #9aa79e;
  border-radius: 9px;
  background: var(--page-card);
  color: var(--page-ink);
  font: 700 14px/1.1 system-ui, sans-serif;
  cursor: pointer;
}
.action button:hover:not(:disabled) { border-color: var(--page-accent); }
.action button:disabled { opacity: .45; cursor: not-allowed; }
.action .save {
  border-color: var(--page-accent);
  background: var(--page-accent);
  color: #fffdf7;
}
.action .save:hover:not(:disabled) { background: var(--page-accent-strong); }
.action .discard { background: transparent; border-color: transparent; text-decoration: underline; }
.action small {
  color: var(--page-muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 136px;
  z-index: 12;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 12px;
  background: #10351f;
  color: #f4f7ec;
  font: 650 15px/1.35 system-ui, sans-serif;
  box-shadow: 0 12px 32px #0004;
}
.toast[hidden] { display: none; }
.toast.is-error { background: #7a1710; }
.toast a { color: #fff; }
/* Signed-out page: one plain card and one large action. Never a dead rail. */
.signin-page {
  max-width: 620px;
  margin: 12vh auto 0;
  padding: 0 24px;
}
.signin-card {
  padding: 34px 32px 36px;
  border: 1px solid var(--page-line);
  border-radius: 18px;
  background: var(--page-card);
  box-shadow: 0 16px 40px #16211c12;
}
.signin-card h1 { font-size: 38px; }
.signin-card p { color: var(--page-muted); }
.signin-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  margin: 14px 0 10px;
  padding: 16px 30px;
  border-radius: 999px;
  background: var(--page-accent);
  color: #fffdf7;
  font: 750 18px/1 system-ui, sans-serif;
  text-decoration: none;
}
.signin-action:hover { background: var(--page-accent-strong); }
.signin-links { margin: 18px 0 0; font-size: 14px; }
@media (max-width: 900px) {
  .action-bar-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body { padding-bottom: 250px; }
  .toast { bottom: 190px; }
}
@media (max-width: 560px) {
  .editor-page { padding: 18px 14px 32px; }
  h1 { font-size: 34px; }
  .preview-card { padding: 0; }
  .action-bar-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .action small { display: none; }
  .action button { padding: 12px 10px; font-size: 12.5px; }
  body { padding-bottom: 190px; }
  .toast { right: 14px; left: 14px; max-width: none; bottom: 160px; }
  .signin-card { padding: 26px 20px 28px; }
  .signin-card h1 { font-size: 31px; }
  .signin-action { width: 100%; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
