/* z0rs — researcher brand
   Field-notes aesthetic: stone paper · deep forest · portal gold · Sora + Literata + Plex Mono
*/

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Literata:ital,opsz,wght@0,7..72,400;0,7..72,500;0,7..72,600;1,7..72,400&family=Sora:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #0c1210;
  --ink-soft: #24302c;
  --muted: #66756f;
  --paper: #eef1ef;
  --paper-2: #e6ebe8;
  --elevated: rgba(255, 255, 255, 0.62);
  --line: rgba(12, 18, 16, 0.09);
  --line-strong: rgba(12, 18, 16, 0.15);
  --accent: #0f766e;
  --accent-deep: #0b5550;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --gold: #b8892d;
  --gold-dim: rgba(184, 137, 45, 0.55);
  --night: #050908;
  --night-elev: #0a1412;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font-ui: Sora, system-ui, sans-serif;
  --font-serif: Literata, Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --max: 40rem;
  --wide: 74rem;
  --nav-h: 4.5rem;
  --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 100% 60% at 100% -20%, rgba(15, 118, 110, 0.09), transparent 55%),
    radial-gradient(ellipse 80% 50% at -15% 110%, rgba(184, 137, 45, 0.06), transparent 50%),
    linear-gradient(180deg, #f3f5f4 0%, var(--paper) 40%, var(--paper-2) 100%);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.035;
  background-image: var(--grain);
  background-repeat: repeat;
  background-size: 180px 180px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent-deep);
  text-underline-offset: 0.22em;
  transition: color 180ms var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

code {
  font-family: var(--font-mono);
}

/* ========== Top bar ========== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--nav-h);
  width: 100%;
  padding: 0 clamp(1.25rem, 4vw, 2.75rem);
  background: rgba(238, 241, 239, 0.78);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid var(--line);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.045em;
  color: var(--ink);
  text-decoration: none;
}

.brand-link .mark {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0;
  color: #fff;
  background: var(--ink);
}

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

.brand-link:hover .mark {
  background: var(--accent);
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.4rem;
  justify-content: flex-end;
  align-items: center;
}

.top-nav a {
  position: relative;
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0;
}

.top-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.15rem;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms var(--ease);
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--ink);
}

.top-nav a:hover::after,
.top-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* ========== Landing ========== */

body.landing {
  background: var(--night);
  color: #f3f6f4;
}

body.landing::before {
  opacity: 0.05;
  mix-blend-mode: soft-light;
}

body.landing .topbar {
  position: absolute;
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.landing .topbar.is-solid {
  background: rgba(5, 9, 8, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

body.landing .brand-link {
  color: rgba(243, 246, 244, 0.95);
}

body.landing .brand-link .mark {
  background: rgba(243, 246, 244, 0.95);
  color: var(--night);
}

body.landing .brand-link:hover {
  color: #fff;
}

body.landing .top-nav a {
  color: rgba(243, 246, 244, 0.72);
}

body.landing .top-nav a::after {
  background: var(--gold);
}

body.landing .top-nav a:hover,
body.landing .top-nav a[aria-current="page"] {
  color: #fff;
}

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-items: end;
  overflow: hidden;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 42%;
  transform: scale(1.05);
  animation: heroDrift 40s var(--ease-out) infinite alternate;
  will-change: transform;
}

.hero-media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(5, 9, 8, 0.55) 0%, rgba(5, 9, 8, 0.12) 32%, rgba(5, 9, 8, 0.4) 62%, rgba(5, 9, 8, 0.96) 100%);
  pointer-events: none;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse 65% 55% at 58% 38%, transparent 0%, rgba(5, 9, 8, 0.4) 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(100%, var(--wide));
  margin: 0 auto;
  padding:
    calc(var(--nav-h) + 2rem)
    clamp(1.25rem, 4vw, 2.75rem)
    clamp(3.25rem, 10vh, 5.75rem);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1.35rem;
  animation: riseIn 900ms var(--ease-out) both;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero-meta .sep {
  width: 1.25rem;
  height: 1px;
  background: rgba(243, 246, 244, 0.28);
}

.hero-meta .scope {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(243, 246, 244, 0.5);
}

.brand {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: clamp(4.25rem, 16vw, 8rem);
  line-height: 0.86;
  letter-spacing: -0.06em;
  color: #fff;
  margin-bottom: 1.2rem;
  text-wrap: balance;
  animation: riseIn 950ms var(--ease-out) 80ms both;
}

.hero-content h1 {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  letter-spacing: -0.03em;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.94);
  max-width: 22ch;
  margin-bottom: 0.9rem;
  animation: riseIn 950ms var(--ease-out) 140ms both;
}

.hero-content .lede {
  color: rgba(243, 246, 244, 0.66);
  font-size: clamp(0.98rem, 1.8vw, 1.08rem);
  font-weight: 400;
  max-width: 34rem;
  margin-bottom: 2.1rem;
  line-height: 1.6;
  animation: riseIn 950ms var(--ease-out) 200ms both;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.6rem;
  animation: riseIn 950ms var(--ease-out) 260ms both;
}

.cta-primary {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: var(--night);
  background: #f3f6f4;
  padding: 0.95rem 1.5rem;
  text-decoration: none;
  transition: transform 220ms var(--ease), background 220ms var(--ease);
}

.cta-primary:hover,
.cta-primary:focus-visible {
  color: var(--night);
  background: #fff;
  transform: translateY(-3px);
}

.cta-secondary {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.92rem;
  color: rgba(243, 246, 244, 0.88);
  text-decoration: none;
  padding: 0.95rem 0.1rem;
  border-bottom: 1px solid var(--gold-dim);
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}

.cta-secondary:hover,
.cta-secondary:focus-visible {
  color: #fff;
  border-bottom-color: #fff;
}

/* ========== Masthead ========== */

.masthead {
  position: relative;
  height: clamp(12rem, 28vw, 19rem);
  overflow: hidden;
}

.masthead img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  transform: scale(1.04);
  animation: heroDrift 42s var(--ease-out) infinite alternate;
  filter: saturate(0.92) contrast(1.03);
}

.masthead::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 9, 8, 0.2) 0%, transparent 40%, rgba(238, 241, 239, 0.55) 78%, var(--paper) 100%);
  pointer-events: none;
}

/* ========== Main ========== */

main {
  flex: 1 0 auto;
  width: min(100% - 2.5rem, var(--max));
  margin: 0 auto;
  padding: 2.5rem 0 4.75rem;
  animation: riseIn 750ms var(--ease-out) both;
}

main.wide {
  width: min(100% - 2.5rem, 58rem);
}

.page-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.85rem;
}

main h1 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(2.25rem, 5.5vw, 3.15rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 0.7rem;
  color: var(--ink);
  text-wrap: balance;
}

.page-sub {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 2.25rem;
  max-width: 36rem;
  line-height: 1.55;
}

.prose {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
}

.prose p {
  color: var(--ink-soft);
  margin: 0 0 1.25em;
  font-size: 1.125rem;
  line-height: 1.8;
}

.prose p:last-child {
  margin-bottom: 0;
}

.whoami-layout {
  display: grid;
  gap: 2.75rem;
  align-items: start;
}

@media (min-width: 900px) {
  .whoami-layout {
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 3.5rem;
  }
}

.portrait {
  justify-self: center;
  width: min(100%, 16rem);
}

.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
  filter: saturate(0.9) contrast(1.04);
}

.portrait figcaption {
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.focus-rail {
  margin: 2.75rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.focus-rail h2 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.focus-list {
  list-style: none;
  display: grid;
  gap: 0;
}

.focus-list li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.focus-list .label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
}

.focus-list .desc {
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.greet {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 2.85rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin-bottom: 0.55rem;
}

.note {
  margin-top: 2.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.actions {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: center;
}

.contact-layout {
  display: grid;
  gap: 2rem;
}

@media (min-width: 820px) {
  .contact-layout {
    grid-template-columns: minmax(12rem, 0.85fr) minmax(0, 1.15fr);
    gap: 3rem;
    align-items: start;
  }
}

.contact-aside {
  padding-top: 0.25rem;
}

.contact-aside p {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.contact-aside .mono-line {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

/* ========== Buttons / forms ========== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: #fff;
  background: var(--accent);
  padding: 0.9rem 1.4rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 200ms var(--ease), transform 200ms var(--ease);
}

.btn:hover,
.btn:focus-visible {
  color: #fff;
  background: var(--accent-deep);
  transform: translateY(-2px);
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--accent);
}

button.btn h5 {
  margin: 0;
  font: inherit;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin-top: 0.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.contact-form label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--line-strong);
  background: var(--elevated);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  border-radius: 0;
  outline: none;
  transition: border-color 180ms, box-shadow 180ms, background 180ms;
}

.contact-form textarea {
  min-height: 12.5rem;
  resize: vertical;
  line-height: 1.55;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: #8a9691;
}

.contact-form input:hover,
.contact-form textarea:hover {
  background: rgba(255, 255, 255, 0.88);
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}

#status {
  min-height: 1.4em;
  margin-top: 0.75rem;
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ========== Char ========== */

.char-stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.35rem;
  padding: 2rem;
}

.char-box {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 3.25rem);
  letter-spacing: -0.03em;
  padding: 1.35rem 1.6rem;
  border: 1px solid var(--line-strong);
  background: var(--elevated);
  user-select: all;
}

/* ========== Footer ========== */

.site-footer {
  width: 100%;
  margin-top: auto;
  padding: 1.6rem clamp(1.25rem, 4vw, 2.75rem) 2.1rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer .footer-brand {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.site-footer .footer-brand:hover {
  color: var(--accent);
}

.site-footer .footer-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ========== Motion ========== */

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroDrift {
  from { transform: scale(1.05) translate3d(0, 0, 0); }
  to { transform: scale(1.11) translate3d(-1.1%, -0.7%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .hero-media img,
  .masthead img {
    transform: none;
  }
}

@media (max-width: 640px) {
  .top-nav {
    gap: 0.15rem 0.95rem;
  }

  .top-nav a {
    font-size: 0.84rem;
  }

  .cta-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .focus-list li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
/* ========== Tools: dash / poc / auth ========== */

main.tool {
  width: min(100% - 2.5rem, 64rem);
  padding-top: 1.75rem;
}

.tool-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.tool-header h1 {
  margin-bottom: 0.25rem;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.status-banner {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.status-banner.error {
  border-color: rgba(180, 60, 60, 0.35);
  background: rgba(180, 60, 60, 0.08);
  color: #7a2e2e;
}

/* Tabs */
.widget-container {
  width: 100%;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.widget-tab {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1rem;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}

.widget-tab:hover,
.widget-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.widget-tab-content {
  display: none;
  animation: riseIn 400ms var(--ease-out) both;
}

.widget-tab-content.active {
  display: block;
}

.config-block {
  margin-bottom: 2rem;
}

.config-block h2 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.config-block h3,
.config-block h4 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0.75rem 0 0.35rem;
}

.config-block ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.config-block li {
  margin: 0.25rem 0;
}

.config-block li > p,
.config-block li p {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  word-break: break-all;
}

.config-block ul ul {
  margin-left: 0.75rem;
  margin-top: 0.35rem;
}

.panel {
  margin-bottom: 1.75rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.panel h2 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.tool-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 32rem;
}

.tool-form label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tool-form input[type="text"],
.tool-form input[type="password"],
.tool-form input[type="search"],
.tool-form select,
.tool-form textarea,
#searchInput {
  width: 100%;
  max-width: 32rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 180ms, box-shadow 180ms;
}

.tool-form input:focus,
.tool-form select:focus,
.tool-form textarea:focus,
#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.tool-form input[type="submit"],
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: var(--accent);
  border: none;
  padding: 0.7rem 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 180ms var(--ease), transform 180ms var(--ease);
}

.tool-form input[type="submit"]:hover,
.btn-sm:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.tool-form input[type="submit"].danger,
.btn-sm.danger {
  background: #8b3a3a;
}

.tool-form input[type="submit"].danger:hover,
.btn-sm.danger:hover {
  background: #6e2d2d;
}

.tool-form input[type="submit"].ghost,
.btn-sm.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.tool-form input[type="submit"].ghost:hover,
.btn-sm.ghost:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.6);
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.table-wrap table,
#filesTable,
.table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table-wrap th,
.table-wrap td,
#filesTable th,
#filesTable td,
.table-container th,
.table-container td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table-wrap th,
#filesTable th,
.table-container th {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.table-wrap th.sorted,
#filesTable th.sorted {
  color: var(--accent-deep);
}

.table-wrap tr:hover td,
#filesTable tbody tr:hover td {
  background: rgba(20, 122, 110, 0.05);
}

.table-wrap pre,
.table-container pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.copy-button {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  transition: border-color 180ms, background 180ms;
}

.copy-button:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.7);
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.file-actions form {
  display: inline;
  margin: 0;
}

.file-name a {
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-deep);
  word-break: break-all;
}

.file-name a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.upload-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1.25rem;
  padding: 1.15rem 1.25rem;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.4);
}

.upload-zone input[type="file"] {
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.toolbar #searchInput {
  max-width: 22rem;
}

/* Auth */
body.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.auth-shell {
  width: min(100%, 24rem);
  animation: riseIn 700ms var(--ease-out) both;
}

.auth-shell .brand-link {
  display: inline-block;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 1.5rem;
}

.auth-panel {
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.auth-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.auth-panel .page-sub {
  margin-bottom: 1.35rem;
}

.auth-panel .error-message {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(180, 60, 60, 0.3);
  background: rgba(180, 60, 60, 0.08);
  color: #7a2e2e;
  font-size: 0.9rem;
}

.auth-panel .tool-form {
  max-width: none;
}

.auth-panel .tool-form input[type="submit"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.9rem 1rem;
}

.panel-help {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 1rem;
  max-width: 46rem;
}

.panel .panel-help {
  margin-top: -0.35rem;
}

.panel-help code,
.page-sub code,
.config-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  padding: 0.1em 0.35em;
  background: rgba(16, 24, 22, 0.06);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.status-banner:not(.error) {
  border-color: rgba(20, 122, 110, 0.28);
  background: rgba(20, 122, 110, 0.08);
  color: var(--accent-deep);
}
