@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  --ink: #172021;
  --muted: #687373;
  --line: #dfe5e0;
  --paper: #f6f7f2;
  --surface: #ffffff;
  --lime: #b8eb58;
  --lime-dark: #7ea52f;
  --green: #2e8c65;
  --amber: #c98429;
  --red: #cf4b43;
  --shadow: 0 18px 50px rgba(30, 47, 42, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(22, 32, 33, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 32, 33, .025) 1px, transparent 1px),
    var(--paper);
  background-size: 40px 40px;
  font: 15px/1.6 "DM Sans", "Noto Sans SC", system-ui, sans-serif;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.block { display: block; }

.page-glow { position: fixed; z-index: -1; border-radius: 50%; filter: blur(20px); pointer-events: none; }
.page-glow-one { width: 500px; height: 500px; background: rgba(184, 235, 88, .15); top: -260px; right: -130px; }
.page-glow-two { width: 400px; height: 400px; background: rgba(127, 184, 165, .1); left: -220px; top: 420px; }

.site-header {
  width: min(1240px, calc(100% - 40px));
  height: 82px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(83, 98, 94, .15);
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: var(--lime); }
.brand-mark svg { width: 21px; stroke: none; fill: currentColor; }
.header-nav { display: flex; align-items: center; gap: 22px; color: #566160; font-size: 14px; font-weight: 600; }
.header-nav a, .link-button { transition: color .2s; }
.header-nav a:hover, .link-button:hover { color: var(--ink); }
.link-button { color: inherit; background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
.inline-form { display: inline-flex; margin: 0; }

.hero { padding: 98px 0 64px; }
.eyebrow, .section-kicker { color: #728077; font-size: 11px; font-weight: 700; letter-spacing: .18em; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow span { width: 28px; height: 1px; background: var(--lime-dark); }
.hero h1 { max-width: 750px; margin: 20px 0 22px; font-size: clamp(50px, 7.2vw, 88px); line-height: .98; letter-spacing: -.065em; font-weight: 600; }
.hero h1 em { color: var(--green); font-style: normal; }
.hero > p { max-width: 600px; margin: 0; color: var(--muted); font-size: 17px; }
.overview-bar {
  max-width: 800px;
  margin-top: 52px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .64);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(34, 53, 47, .04);
}
.overview-bar > div { display: flex; align-items: baseline; gap: 8px; min-width: 145px; padding: 0 18px; border-right: 1px solid var(--line); }
.overview-bar > div:first-child { padding-left: 0; }
.overview-bar > div:last-child { border: 0; }
.overview-bar strong { font-size: 24px; line-height: 1; }
.overview-bar span { color: var(--muted); font-size: 12px; }
.overview-bar .live-indicator { margin-left: auto; min-width: 0; align-items: center; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(46, 140, 101, .1); }

.directory { padding: 30px 0 120px; }
.directory-heading { display: flex; justify-content: space-between; align-items: end; gap: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.directory-heading h2, .admin-heading h1 { margin: 5px 0 0; font-size: clamp(31px, 4vw, 44px); letter-spacing: -.045em; line-height: 1.15; }
.search-box { width: min(390px, 45%); height: 50px; display: flex; align-items: center; gap: 11px; padding: 0 13px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; transition: border .2s, box-shadow .2s; }
.search-box:focus-within { border-color: #9bb366; box-shadow: 0 0 0 4px rgba(184, 235, 88, .18); }
.search-box svg { width: 19px; color: #8a9591; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box input::placeholder { color: #99a29f; }
.search-box kbd { padding: 2px 7px; color: #8f9995; border: 1px solid var(--line); border-radius: 6px; background: #f7f8f4; font: 11px/1.5 inherit; }
.category-tabs { display: flex; gap: 8px; padding: 22px 0 27px; overflow-x: auto; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs button { flex: 0 0 auto; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: #66716f; background: rgba(255,255,255,.5); cursor: pointer; font-size: 13px; transition: all .2s; }
.category-tabs button:hover { border-color: #b6c0bb; }
.category-tabs button.active { color: #13201b; border-color: var(--lime); background: var(--lime); font-weight: 600; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tool-card { min-height: 330px; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .86); box-shadow: 0 4px 0 rgba(42, 58, 52, .015); transition: transform .25s, box-shadow .25s, border-color .25s; }
.tool-card:hover { transform: translateY(-5px); border-color: #c7d0c9; box-shadow: var(--shadow); }
.card-topline, .card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tool-icon, .mini-icon { display: grid; place-items: center; overflow: hidden; color: #334038; background: #edf2e5; font-weight: 700; }
.tool-icon { width: 48px; height: 48px; border-radius: 14px; font-size: 18px; }
.tool-icon img { width: 100%; height: 100%; object-fit: cover; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; width: max-content; padding: 6px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-healthy { color: var(--green); background: rgba(46, 140, 101, .055); }
.status-degraded { color: var(--amber); background: rgba(201, 132, 41, .06); }
.status-down { color: var(--red); background: rgba(207, 75, 67, .055); }
.status-pending { color: #7c8582; background: rgba(124, 133, 130, .055); }
.tool-copy { padding: 28px 0 24px; }
.tool-category { color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.tool-copy h3 { margin: 6px 0 9px; font-size: 24px; letter-spacing: -.035em; line-height: 1.25; }
.tool-copy p { display: -webkit-box; margin: 0; color: var(--muted); overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.card-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid #e9ede8; }
.health-compact { display: flex; align-items: center; gap: 10px; }
.health-compact > span:last-child { display: flex; flex-direction: column; }
.health-compact b { font-size: 12px; }
.health-compact small { color: #8a9591; font-size: 10px; }
.score-ring { --ring: #9ba4a0; width: 38px; height: 38px; display: grid; place-items: center; position: relative; border-radius: 50%; background: conic-gradient(var(--ring) calc(var(--score) * 1%), #e9ede8 0); }
.score-ring::after { position: absolute; inset: 4px; content: ""; background: white; border-radius: 50%; }
.score-ring b { z-index: 1; font-size: 10px; }
.score-ring.score-healthy { --ring: var(--green); }
.score-ring.score-degraded { --ring: var(--amber); }
.score-ring.score-down { --ring: var(--red); }
.visit-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 11px; color: #32403b; border-radius: 10px; font-size: 12px; font-weight: 600; transition: background .2s; }
.visit-button:hover { background: #f0f3ed; }
.visit-button svg { width: 16px; }
.empty-state { padding: 75px 20px; text-align: center; color: var(--muted); }
.empty-state > span { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: #e9ede5; font-size: 26px; }
.empty-state h3 { margin: 16px 0 4px; color: var(--ink); }
.empty-state p { margin: 0; }

.site-footer { width: min(1240px, calc(100% - 40px)); margin-inline: auto; padding: 28px 0 34px; display: flex; justify-content: space-between; color: #8a9490; border-top: 1px solid var(--line); font-size: 11px; }
.toast { position: fixed; z-index: 20; top: 94px; left: 50%; transform: translateX(-50%); padding: 11px 17px; border: 1px solid #cdd8ca; border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 12px 35px rgba(31,45,40,.14); font-size: 13px; transition: opacity .3s, transform .3s; }
.toast-hide { opacity: 0; transform: translate(-50%, -8px); }
.toast-error { color: var(--red); border-color: #efc4c1; }

.auth-shell { min-height: calc(100vh - 156px); display: grid; place-items: center; padding: 60px 20px 100px; }
.auth-card { width: min(430px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); }
.auth-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 25px; color: var(--lime); border-radius: 14px; background: var(--ink); }
.auth-icon svg { width: 23px; }
.auth-card h1 { margin: 7px 0 8px; font-size: 31px; letter-spacing: -.04em; }
.auth-card > p { margin: 0 0 27px; color: var(--muted); }
.stack-form { display: grid; gap: 18px; }
.stack-form label, .detail-form label { display: grid; gap: 7px; }
.stack-form label > span, .detail-form label > span { font-size: 12px; font-weight: 600; }
input, textarea { width: 100%; border: 1px solid #d8dfda; border-radius: 12px; color: var(--ink); background: #fff; outline: 0; transition: border .2s, box-shadow .2s; }
input { height: 47px; padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; }
input:focus, textarea:focus { border-color: #9db768; box-shadow: 0 0 0 4px rgba(184,235,88,.17); }
.form-alert { margin-bottom: 17px; padding: 10px 12px; color: #9f342e; border: 1px solid #efc4c1; border-radius: 10px; background: #fff4f2; font-size: 13px; }

.primary-button, .secondary-button, .danger-button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 13px; transition: transform .15s, background .2s, border-color .2s; }
.primary-button { color: #122014; background: var(--lime); }
.primary-button:hover { background: #c2f168; transform: translateY(-1px); }
.secondary-button { color: #3e4a46; border-color: var(--line); background: #fff; }
.secondary-button:hover { border-color: #b9c3be; background: #fafbf8; }
.danger-button { color: var(--red); border-color: #ebc8c5; background: #fff8f7; }
.danger-button:hover { background: #ffefed; }
.primary-button svg, .secondary-button svg { width: 17px; }
button:disabled { cursor: wait; opacity: .65; }

.admin-shell { padding: 70px 0 110px; }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.admin-heading p { margin: 8px 0 0; color: var(--muted); }
.admin-actions { display: flex; gap: 10px; }
.admin-stats { margin: 38px 0 18px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.7); overflow: hidden; }
.admin-stats > div { min-height: 100px; display: flex; flex-direction: column; justify-content: center; padding: 18px 24px; border-right: 1px solid var(--line); }
.admin-stats > div:last-child { border: 0; }
.admin-stats span { color: var(--muted); font-size: 11px; }
.admin-stats strong { margin-top: 3px; font-size: 29px; line-height: 1.2; }
.text-healthy { color: var(--green); }
.text-down { color: var(--red); }
.admin-panel { border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.86); box-shadow: 0 14px 45px rgba(30,47,42,.045); overflow: hidden; }
.panel-heading { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 18px; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
.site-table { width: 100%; border-collapse: collapse; text-align: left; }
.site-table th { padding: 12px 20px; color: #84908b; background: #fafbf8; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.site-table td { padding: 17px 20px; border-top: 1px solid #edf0ec; font-size: 12px; vertical-align: middle; }
.site-table tbody tr:hover { background: rgba(246,248,242,.75); }
.table-tool { display: flex; align-items: center; gap: 11px; min-width: 225px; }
.mini-icon { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px; }
.table-tool > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.table-tool b { font-size: 13px; }
.table-tool small { max-width: 260px; color: #8b9591; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.publish-state { padding: 4px 8px; border-radius: 999px; font-size: 10px; }
.publish-state.on { color: var(--green); background: #edf8f3; }
.publish-state.off { color: #7c8582; background: #f1f2f0; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; color: #67716e; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; }
.icon-button:hover { color: var(--ink); border-color: #b9c3be; }
.icon-button svg { width: 16px; }
.date-time { white-space: nowrap; }
.panel-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.panel-empty p { margin: 0; }
.panel-empty a { color: var(--green); font-weight: 600; }

.form-page { padding: 55px 0 110px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--ink); }
.back-link svg { width: 16px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.form-panel, .history-panel { border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.88); box-shadow: 0 12px 40px rgba(30,47,42,.045); }
.form-panel { padding: 34px; }
.form-panel > h1 { margin: 5px 0 5px; font-size: 32px; letter-spacing: -.04em; }
.form-panel > p { margin: 0 0 28px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full-width { grid-column: 1 / -1; }
.detail-form label > span i { color: var(--red); font-style: normal; }
.detail-form label > small { color: #89938f; font-size: 10px; }
.switch-row { grid-template-columns: 1fr auto auto !important; align-items: center; margin-top: 24px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row > span { display: flex; flex-direction: column; }
.switch-row > span small { color: var(--muted); font-weight: 400; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row > i { width: 42px; height: 24px; position: relative; border-radius: 999px; background: #ccd3ce; transition: background .2s; }
.switch-row > i::after { position: absolute; top: 3px; left: 3px; content: ""; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .2s; }
.switch-row input:checked + i { background: var(--green); }
.switch-row input:checked + i::after { transform: translateX(18px); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 22px; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 36px; padding-top: 24px; border-top: 1px solid #efd7d4; }
.danger-zone p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.history-panel { padding: 24px; }
.history-panel h2 { margin: 5px 0 20px; font-size: 20px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; align-items: start; padding: 13px 0; border-top: 1px solid #edf0ec; }
.history-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: currentColor; }
.history-list div { display: flex; flex-direction: column; }
.history-list b { font-size: 11px; }
.history-list span, .history-list small { color: #87918d; font-size: 9px; white-space: nowrap; }

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-stats > div:nth-child(2) { border-right: 0; }
  .admin-stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .form-layout { grid-template-columns: 1fr; }
  .history-panel { order: 2; }
}

@media (max-width: 640px) {
  .shell, .site-header, .site-footer { width: min(100% - 28px, 1180px); }
  .site-header { height: 70px; }
  .header-nav { gap: 12px; }
  .hero { padding: 66px 0 45px; }
  .hero h1 { font-size: 52px; }
  .hero > p { font-size: 15px; }
  .overview-bar { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 10px; }
  .overview-bar > div { min-width: 0; padding: 2px 10px; flex-direction: column; gap: 1px; }
  .overview-bar > div:first-child { padding-left: 10px; }
  .overview-bar strong { font-size: 20px; }
  .overview-bar .live-indicator { grid-column: 1 / -1; margin: 10px 6px 0; padding-top: 10px; flex-direction: row; justify-content: center; border-top: 1px solid var(--line); border-right: 0; }
  .directory { padding-top: 20px; }
  .directory-heading { align-items: stretch; flex-direction: column; gap: 18px; }
  .search-box { width: 100%; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 300px; }
  .site-footer { gap: 10px; flex-direction: column; }
  .auth-card { padding: 28px 23px; }
  .admin-shell { padding-top: 48px; }
  .admin-heading { align-items: stretch; flex-direction: column; }
  .admin-actions { width: 100%; }
  .admin-actions > * { flex: 1; }
  .admin-actions button, .admin-actions a { width: 100%; }
  .admin-stats > div { padding: 15px; }
  .panel-heading p { display: none; }
  .form-page { padding-top: 35px; }
  .form-panel { padding: 25px 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: auto; }
  .danger-zone { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
