: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);
}

* {
  box-sizing: border-box;
}

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;
}

.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;
}

.hero {
  padding: 14px 4px 12px;
  animation: rise 380ms ease;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: 0.2px;
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
}

.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);
}

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);
}

.combo-field {
  position: relative;
  width: 100%;
}

.combo-field input {
  display: block;
  width: 100%;
  min-width: 0;
  padding-right: 42px;
}

.combo-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.combo-toggle:hover {
  background: #edf3fb;
  transform: translateY(-50%);
}

.combo-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: var(--shadow);
  padding: 6px;
}

.combo-option,
.combo-empty {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
}

.combo-option {
  background: transparent;
  color: var(--text);
  font-weight: 500;
}

.combo-option:hover {
  background: #edf3fb;
  transform: none;
}

.combo-empty {
  color: var(--muted);
}

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;
}

.form-topline {
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(0, 2.9fr);
  gap: 12px;
  align-items: end;
}

.form-topline-category,
.form-topline-item {
  min-width: 0;
}

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

.combo-field input::placeholder {
  font-size: 0.92rem;
}

.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: 1250px;
}

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;
}

.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);
}

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

.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 {
  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;
}

.inline-remove {
  background: #f8e8e5;
  color: #8b5650;
  padding: 6px 10px;
  font-size: 0.85rem;
}

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

@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);
  }
}

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

  .form-topline {
    grid-template-columns: 1fr;
  }

  .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;
  }

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

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

  .actions button {
    width: 100%;
  }

  .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;
  }
}
