:root {
  --bg: #f4f8fe;
  --card: #ffffff;
  --text: #1f2f45;
  --muted: #6a7a92;
  --accent: #5d81c7;
  --accent-hover: #4b6faf;
  --danger: #c56c66;
  --danger-hover: #ae5954;
  --border: #d9e4f2;
  --table-head: #dce8f7;
  --group-head: #ebf2fb;
  --shadow: 0 16px 40px rgba(76, 104, 150, 0.12);
  --app-height: 100dvh;
  --app-layout-height: 100vh;
  --app-keyboard-inset: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, rgba(196, 221, 247, 0.55) 0%, transparent 40%),
    radial-gradient(circle at 92% 16%, rgba(216, 230, 249, 0.65) 0%, transparent 32%),
    radial-gradient(circle at 88% 86%, rgba(198, 215, 240, 0.48) 0%, transparent 30%),
    radial-gradient(circle at 48% 100%, rgba(226, 237, 250, 0.42) 0%, transparent 34%),
    var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  min-height: max(var(--app-layout-height), var(--app-height));
}

body.popup-open {
  overflow: hidden;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.45;
}

.bg-shape-a {
  width: 220px;
  height: 220px;
  background: #c6daf4;
  left: -40px;
  top: -30px;
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  background: #d8e4f6;
  right: -70px;
  bottom: -80px;
}

.container {
  width: min(1320px, 95vw);
  margin: 28px auto 36px;
  padding-bottom: calc(12px + var(--safe-bottom));
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
  gap: 28px;
  align-items: end;
  padding: 14px 0 22px;
  animation: rise 380ms ease;
}

.hero-copy {
  max-width: 780px;
}

.hero-kicker,
.section-kicker {
  margin: 0 0 10px;
  color: #6d88b3;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.7rem);
  line-height: 0.98;
  letter-spacing: 0.2px;
}

.hero-lead {
  margin: 16px 0 0;
  color: var(--muted);
  max-width: 40rem;
  font-size: 1.03rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: auto;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
}

.hero-visual {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(236, 244, 254, 0.92)),
    radial-gradient(circle at top right, rgba(159, 190, 237, 0.34), transparent 42%);
  box-shadow: var(--shadow);
  min-height: 280px;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 18px;
  border: 1px solid rgba(143, 176, 230, 0.34);
  pointer-events: none;
}

.hero-visual-note {
  position: relative;
  margin: 0 0 24px;
  max-width: 18rem;
  color: var(--muted);
  line-height: 1.55;
}

.hero-visual-lines {
  position: relative;
  display: grid;
  gap: 16px;
}

.hero-visual-lines div {
  padding-top: 16px;
  border-top: 1px solid rgba(143, 176, 230, 0.42);
}

.hero-visual-lines span {
  display: block;
  margin-bottom: 4px;
  color: #6d88b3;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-visual-lines strong {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.45;
}

.startup-popup {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
}

.startup-popup[hidden] {
  display: none;
}

.startup-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 31, 53, 0.34);
  backdrop-filter: blur(10px);
}

.startup-popup-dialog {
  position: relative;
  width: min(560px, calc(100vw - 28px));
  padding: 24px 24px 22px;
  border: 1px solid rgba(127, 161, 217, 0.34);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(241, 247, 255, 0.975)),
    radial-gradient(circle at top right, rgba(139, 176, 231, 0.24), transparent 38%);
  box-shadow: 0 28px 64px rgba(30, 52, 88, 0.22);
  animation: popup-rise 260ms ease;
}

.startup-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(127, 161, 217, 0.24);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  padding: 0;
}

.startup-popup-close:hover {
  background: rgba(93, 129, 199, 0.1);
  color: var(--accent-hover);
}

.startup-popup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin: 0 0 14px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(93, 129, 199, 0.14);
  color: var(--accent-hover);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.startup-popup-dialog h2 {
  margin: 0 0 10px;
  max-width: 19ch;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  line-height: 1.2;
}

.startup-popup-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.68;
}

.startup-popup-text-icon,
.startup-popup-text-heart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45em;
  height: 1.45em;
  margin-right: 0.18em;
  border-radius: 999px;
  background: rgba(93, 129, 199, 0.12);
  color: var(--accent-hover);
  font-size: 0.92em;
  vertical-align: -0.12em;
}

.startup-popup-text-heart {
  margin-left: 0.18em;
  margin-right: 0;
  color: #c56c66;
}

.startup-popup-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.startup-popup-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  justify-self: start;
}

.startup-popup-check span {
  line-height: 1.35;
}

.startup-popup-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 14px;
}

.startup-popup-action {
  min-height: 42px;
  padding-inline: 16px;
}

.confirm-popup-dialog {
  width: min(520px, calc(100vw - 28px));
}

.confirm-popup-badge {
  background: rgba(198, 108, 102, 0.12);
  color: #a9534e;
}

.confirm-popup-dialog h2 {
  max-width: 16ch;
}

.confirm-popup-text {
  margin-bottom: 0;
}

.confirm-popup-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.confirm-popup-cancel,
.confirm-popup-delete {
  min-height: 44px;
  padding-inline: 18px;
}

.confirm-popup-cancel {
  border: 1px solid rgba(127, 161, 217, 0.22);
  background: rgba(237, 243, 251, 0.92);
}

.confirm-popup-cancel:hover {
  background: #e4edf9;
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: max(18px, calc(18px + var(--safe-bottom)));
  z-index: 45;
  display: grid;
  justify-items: center;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  min-width: min(420px, calc(100vw - 28px));
  max-width: min(420px, calc(100vw - 28px));
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(127, 161, 217, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 247, 255, 0.96)),
    radial-gradient(circle at top right, rgba(139, 176, 231, 0.18), transparent 40%);
  color: #24446f;
  box-shadow: 0 18px 36px rgba(30, 52, 88, 0.18);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-success {
  border-color: rgba(93, 129, 199, 0.28);
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 0 0 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(143, 176, 230, 0.34);
}

.benefit-grid article {
  padding-right: 10px;
}

.benefit-grid h2 {
  margin: 0 0 8px;
  font-size: 1.04rem;
  line-height: 1.35;
}

.benefit-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(248, 251, 255, 0.97));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  animation: rise 380ms ease;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1.08rem;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8fb0e6;
  outline: 3px solid rgba(93, 129, 199, 0.16);
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-hover);
}

.secondary {
  background: #edf3fb;
  color: #34527e;
  align-self: end;
}

.secondary:hover {
  background: #e0eafb;
}

.danger {
  background: var(--danger);
  color: #fff;
}

.danger:hover {
  background: var(--danger-hover);
}

.full {
  grid-column: 1 / -1;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.entry-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.editor-heading h2 {
  margin: 0;
}

.edit-mode-notice {
  margin: 0;
  max-width: 34ch;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(93, 129, 199, 0.1);
  color: #3f5d92;
  font-size: 0.82rem;
  line-height: 1.45;
}

#editor.is-editing {
  border-color: rgba(93, 129, 199, 0.34);
  box-shadow: 0 20px 44px rgba(66, 98, 153, 0.12);
}

.entry-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.item-library-trigger {
  flex: 0 0 auto;
  min-height: 54px;
  padding: 0 22px;
  align-self: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(76, 111, 168, 0.16);
  border-radius: 16px;
  background: linear-gradient(180deg, #6f93d7 0%, #587ec6 100%);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 28px rgba(93, 129, 199, 0.24);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease,
    background 160ms ease;
}

.item-library-trigger::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.item-library-trigger:hover {
  background: linear-gradient(180deg, #6a8fd6 0%, #4f74bc 100%);
  box-shadow: 0 16px 30px rgba(93, 129, 199, 0.28);
  transform: translateY(-1px);
}

.item-library-trigger:focus-visible {
  outline: 3px solid rgba(93, 129, 199, 0.18);
  outline-offset: 2px;
}

.item-library-trigger:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(93, 129, 199, 0.2);
  filter: saturate(0.97);
}

.item-entry-helper {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 48rem;
  padding-top: 4px;
}

.entry-selected-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
  gap: 12px;
}

.entry-selected-field {
  min-width: 0;
}

.entry-selected-field input {
  background: rgba(248, 252, 255, 0.96);
}

.form-submit {
  width: 100%;
  min-height: 46px;
  align-self: end;
}

.form-submit-actions {
  display: grid;
  gap: 10px;
  align-content: end;
}

.form-cancel-edit {
  width: 100%;
}

.mode-switch {
  margin-top: 2px;
}

.mode-switch-control {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.mode-switch-control select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
  color: var(--text);
  font: inherit;
}

.mode-switch-helper {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.library-modal {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: 20px 20px calc(20px + var(--safe-bottom));
}

.library-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 31, 53, 0.3);
  backdrop-filter: blur(10px);
}

.library-modal-dialog {
  position: relative;
  width: min(1040px, calc(100vw - 28px));
  max-height: min(920px, calc(var(--app-height) - 40px - var(--safe-bottom)));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(223, 233, 248, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(37, 61, 96, 0.22);
  animation: popup-rise 220ms ease;
}

.library-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(37, 61, 96, 0.1);
}

.library-modal-close:hover {
  background: #fff;
}

.library-search {
  gap: 8px;
  padding-right: 56px;
}

.library-search input {
  background: #fbfdff;
}

.library-recent-strip {
  padding: 12px 14px;
}

.library-modal-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 16px;
}

.library-categories,
.library-items-panel {
  min-height: 0;
}

.library-categories {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.library-category-list,
.library-items-panel {
  min-height: 0;
}

.library-category-list {
  overflow: auto;
  padding-right: 4px;
}

.library-categories-block {
  display: flex;
  flex-direction: column;
}

.library-items-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.library-block {
  min-height: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(249, 252, 255, 0.88);
}

.library-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.library-panel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  transform: none;
}

.library-panel-toggle:hover {
  transform: none;
}

.library-panel-toggle strong {
  min-width: 0;
}

.library-panel-chevron {
  display: none;
  width: 9px;
  height: 9px;
  margin-left: auto;
  border-right: 2px solid rgba(82, 110, 156, 0.72);
  border-bottom: 2px solid rgba(82, 110, 156, 0.72);
  transform: rotate(45deg);
  transition: transform 180ms ease, opacity 180ms ease;
  opacity: 0.85;
  flex: 0 0 auto;
}

.library-panel-toggle[aria-expanded="true"] .library-panel-chevron {
  transform: rotate(-135deg);
}

.library-block-heading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.library-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(93, 129, 199, 0.12);
  color: var(--accent-hover);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.library-step-badge.is-soft {
  background: rgba(93, 129, 199, 0.08);
}

.library-block-head small {
  color: var(--muted);
  font-size: 0.8rem;
}

.library-category-button,
.library-item-button,
.recent-library-button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  text-align: left;
  transform: none;
}

.library-category-button {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  background: #fff;
  color: var(--text);
  border: 1px solid transparent;
}

.library-category-button:hover,
.library-item-button:hover,
.recent-library-button:hover {
  transform: none;
}

.library-category-button.is-active {
  border-color: #9eb8e8;
  background: #eef4ff;
}

.library-category-button small {
  color: var(--muted);
  font-size: 0.76rem;
}

.recent-library-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.recent-library-button {
  width: auto;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #36527e;
  border: 1px solid #d5e2f4;
  font-size: 0.86rem;
}

.recent-library-button span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
}

.recent-library-item,
.recent-library-category {
  display: block;
}

.library-item-list {
  display: grid;
  gap: 10px;
  max-height: 100%;
  overflow: auto;
  padding-right: 4px;
}

.library-item-button {
  display: grid;
  gap: 4px;
  background: #fff;
  color: var(--text);
  border: 1px solid transparent;
}

.library-item-button.is-current-category {
  background: #f3f7ff;
  border-color: #d8e4f6;
}

.library-item-button strong,
.library-category-button strong {
  font-size: 0.92rem;
}

.library-item-button small {
  color: var(--muted);
  font-size: 0.79rem;
}

.library-empty {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.library-custom-trigger {
  white-space: nowrap;
}

.library-inline-form {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #d9e4f2;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
}

.library-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.ghost-button:hover {
  background: rgba(237, 243, 251, 0.8);
}

.library-current-category {
  display: inline-flex;
  align-self: flex-start;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(93, 129, 199, 0.08);
  color: #5674a6;
  font-size: 0.84rem;
  line-height: 1.4;
}

.library-item-preview {
  display: none;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.library-panel-body {
  min-height: 0;
}

.table-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}

.table-meta h2 {
  margin: 0 0 4px;
}

.table-meta p {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.meta-date {
  color: var(--muted);
  font-size: 0.92rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

thead {
  background: var(--table-head);
}

th,
td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: center;
  vertical-align: middle;
  font-size: 0.9rem;
}

th {
  font-weight: 800;
  white-space: nowrap;
}

.table-header-stack {
  display: inline-block;
  white-space: pre-line;
  line-height: 1.15;
}

.group-row td {
  background: var(--group-head);
  font-weight: 700;
}

.group-name {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.group-sum {
  text-align: center;
  white-space: nowrap;
}

.row-name-main {
  font-weight: 600;
  color: #2f507f;
  text-align: left;
}

tbody td:first-child {
  text-align: left;
}

.row-subheading {
  display: inline-flex;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4fc;
  color: #5b78a4;
  font-size: 0.76rem;
  font-weight: 600;
}

tfoot td {
  font-weight: 800;
  background: var(--table-head);
}

tfoot td:first-child {
  text-align: left;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.seo-section,
.workflow-section,
.faq-section {
  padding: 22px 0 10px;
  border-top: 1px solid rgba(143, 176, 230, 0.34);
}

.section-head {
  max-width: 860px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.1;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.seo-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.seo-columns article {
  padding-top: 14px;
  border-top: 1px solid rgba(143, 176, 230, 0.34);
}

.seo-columns h3,
.workflow-list h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.seo-columns p,
.workflow-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.workflow-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.workflow-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: flex-start;
  padding-top: 16px;
  border-top: 1px solid rgba(143, 176, 230, 0.34);
}

.workflow-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(93, 129, 199, 0.1);
  color: #456aaf;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  padding: 14px 0;
  border-top: 1px solid rgba(143, 176, 230, 0.34);
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 700;
  line-height: 1.45;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
  max-width: 880px;
}

.site-footer {
  width: min(1320px, 95vw);
  margin: 4px auto 26px;
  padding: 10px 4px 0;
  text-align: center;
  animation: rise 520ms ease;
}

.site-footer-motto,
.site-footer-note,
.site-footer-domain,
.site-footer-copyright,
.site-footer-contact,
.site-footer-legal {
  margin: 0;
  color: var(--muted);
}

.site-footer-motto {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer-heart {
  display: inline-block;
  color: #6f95dd;
  transform-origin: center;
  animation: heart-glow 3.6s ease-in-out infinite;
}

.site-footer-note {
  margin-top: 8px;
  font-size: 0.9rem;
}

.site-footer-domain {
  margin-top: 7px;
  font-size: 0.82rem;
  opacity: 0.78;
}

.site-footer-copyright {
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.84;
}

.site-footer-contact {
  margin-top: 6px;
  font-size: 0.78rem;
  opacity: 0.8;
}

.site-footer-link {
  color: var(--accent-hover);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgba(93, 129, 199, 0.22);
}

.site-footer-link:hover,
.site-footer-link:focus-visible {
  color: var(--accent);
  border-bottom-color: rgba(93, 129, 199, 0.55);
}

.site-footer-legal {
  margin-top: 5px;
  font-size: 0.76rem;
  line-height: 1.45;
  opacity: 0.72;
}

.row-actions-cell {
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-edit,
.inline-remove {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.inline-edit {
  background: #e9f1ff;
  color: #46679d;
}

.inline-edit:hover {
  background: #dce8fb;
}

.inline-remove {
  background: #f8e8e5;
  color: #8b5650;
}

.inline-remove:hover {
  background: #f2d9d4;
}

.table-item-row.is-editing td {
  background: #f3f7ff;
}

.table-item-row.is-editing td:first-child {
  box-shadow: inset 3px 0 0 #5d81c7;
}

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

@keyframes heart-glow {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.92;
  }
  10% {
    transform: scale(1.12);
    opacity: 1;
  }
  18% {
    transform: scale(1);
  }
  28% {
    transform: scale(1.08);
  }
  36% {
    transform: scale(1);
  }
}

@keyframes popup-rise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1024px) {
  .grid-3,
  .grid-4,
  .grid-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .benefit-grid,
  .seo-columns {
    grid-template-columns: 1fr;
  }

  .entry-toolbar,
  .entry-selected-fields,
  .library-block-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .library-modal-layout {
    grid-template-columns: 1fr;
  }

  .library-items-panel {
    grid-template-rows: auto auto;
  }

  .span-2,
  .span-3,
  .span-4,
  .span-5,
  .full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(1320px, 96vw);
    margin-top: 18px;
    padding-bottom: calc(18px + var(--safe-bottom));
  }

  .startup-popup {
    padding: 16px;
  }

  .startup-popup-close {
    top: 10px;
    right: 10px;
  }

  .startup-popup-dialog {
    width: min(100vw - 20px, 100%);
    padding: 20px 18px 18px;
  }

  .confirm-popup-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .confirm-popup-cancel,
  .confirm-popup-delete {
    width: 100%;
  }

  .library-modal {
    align-items: start;
    padding: 10px 10px calc(10px + var(--safe-bottom));
  }

  .library-modal-dialog {
    width: min(100vw - 10px, 100%);
    height: calc(var(--app-height) - 12px - var(--safe-bottom));
    max-height: calc(var(--app-height) - 12px - var(--safe-bottom));
    padding: 16px 12px 12px;
    border-radius: 22px;
    gap: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .library-modal-close {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .library-recent-strip {
    padding: 10px 12px;
  }

  .library-search {
    gap: 5px;
    font-size: 0.82rem;
    padding-right: 42px;
  }

  .library-search input {
    padding: 9px 11px;
    font-size: 0.96rem;
  }

  .library-modal-layout {
    gap: 10px;
    position: relative;
  }

  .library-categories,
  .library-items-panel {
    gap: 10px;
  }

  .library-items-panel {
    display: flex;
    flex-direction: column;
  }

  .library-block {
    padding: 12px;
    border-radius: 16px;
  }

  .library-mobile-panel {
    position: relative;
    overflow: visible;
  }

  .library-block-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
  }

  .library-block-heading {
    gap: 8px;
  }

  .library-panel-toggle {
    flex: 1 1 auto;
    min-width: 0;
  }

  .library-panel-chevron {
    display: inline-block;
  }

  .library-block-head strong {
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .library-step-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .library-custom-trigger {
    padding: 8px 12px;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .library-current-category {
    margin-bottom: 8px;
    padding: 5px 9px;
    font-size: 0.76rem;
  }

  .library-item-preview {
    display: block;
    margin-bottom: 0;
    font-size: 0.76rem;
  }

  .library-panel-body {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.985);
    transform-origin: top center;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  }

  .library-mobile-panel.is-mobile-open {
    z-index: 8;
  }

  .library-mobile-panel.is-mobile-open .library-panel-body {
    position: absolute;
    left: -1px;
    right: -1px;
    z-index: 9;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 34px rgba(37, 61, 96, 0.14);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .library-categories-block.is-mobile-open .library-panel-body {
    top: calc(100% - 10px);
    transform-origin: top center;
  }

  #libraryItemSection.is-mobile-open .library-panel-body {
    bottom: calc(100% - 10px);
    transform-origin: bottom center;
  }

  .library-category-list {
    max-height: clamp(260px, calc(var(--app-height) - 300px - var(--safe-bottom)), 420px);
    padding-right: 2px;
    padding-bottom: 2px;
  }

  .library-item-list {
    max-height: clamp(300px, calc(var(--app-height) - 270px - var(--safe-bottom)), 520px);
    padding-right: 2px;
    padding-bottom: 2px;
  }

  .library-category-button,
  .library-item-button,
  .recent-library-button {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .library-category-button {
    margin-bottom: 6px;
  }

  .library-category-button strong,
  .library-item-button strong {
    font-size: 0.86rem;
    line-height: 1.22;
  }

  .library-category-button small,
  .library-item-button small,
  .recent-library-category {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .recent-library-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin: 0 -2px;
    padding: 0 2px 4px;
    scroll-snap-type: x proximity;
  }

  .recent-library-button {
    flex: 0 0 78%;
    max-width: none;
    display: grid;
    gap: 4px;
    align-items: start;
    scroll-snap-align: start;
  }

  .recent-library-item {
    font-size: 0.82rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .recent-library-category {
    white-space: normal;
  }

  .library-empty {
    padding: 12px;
    border-radius: 12px;
    font-size: 0.8rem;
  }

  .library-modal.is-search-focused .library-recent-strip,
  .library-modal.is-search-focused .library-categories {
    display: none !important;
  }

  .library-modal.is-search-focused .library-items-panel {
    display: block;
  }

  .library-modal.is-search-focused #libraryItemSection {
    z-index: auto;
  }

  .library-modal.is-search-focused #libraryItemSection .library-item-preview {
    display: none;
  }

  .library-modal.is-search-focused #libraryItemSection .library-panel-body {
    display: block;
    position: static;
    margin-top: 10px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .library-modal.is-search-focused .library-item-list {
    max-height: clamp(320px, calc(var(--app-height) - 180px - var(--safe-bottom)), 620px);
  }

  .library-modal.is-search-focused .library-modal-dialog {
    max-height: calc(var(--app-height) - 12px - var(--safe-bottom));
  }

  .keyboard-open .library-modal-dialog {
    height: calc(var(--app-height) - 10px - var(--safe-bottom));
    max-height: calc(var(--app-height) - 10px - var(--safe-bottom));
  }

  .hero {
    gap: 18px;
    padding-bottom: 18px;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 10vw, 3rem);
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-link {
    width: 100%;
  }

  .entry-selected-fields {
    grid-template-columns: 1fr;
  }

  .library-inline-actions {
    flex-direction: column;
  }

  .entry-toolbar {
    gap: 10px;
  }

  .editor-heading {
    flex-direction: column;
    gap: 10px;
  }

  .edit-mode-notice {
    max-width: none;
  }

  .entry-toolbar .item-library-trigger {
    width: 100%;
    min-height: 58px;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 12px 24px rgba(93, 129, 199, 0.22);
  }

  .entry-toolbar .item-library-trigger::before {
    width: 26px;
    height: 26px;
    font-size: 1.05rem;
  }

  .grid-3,
  .grid-4,
  .grid-6 {
    grid-template-columns: 1fr;
  }

  .table-meta {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  .row-actions {
    display: grid;
    width: 100%;
  }

  .workflow-list li {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .site-footer {
    width: min(1320px, 96vw);
    margin-bottom: 22px;
  }

  .site-footer-motto {
    font-size: 0.88rem;
    letter-spacing: 0.06em;
  }

  .site-footer-note {
    font-size: 0.85rem;
  }

  .site-footer-copyright {
    font-size: 0.76rem;
  }

  .site-footer-contact {
    font-size: 0.74rem;
  }

  .site-footer-legal {
    font-size: 0.72rem;
  }
}
