* {
  box-sizing: border-box;
}
[v-cloak] {
  display: none;
}
:root {
  --bg: #f6f7fb;
  --paper: #fff;
  --ink: #1f2328;
  --muted: #667085;
  --brand: #673ab7;
  --brand-ink: #fff;
  --danger: #e53935;
  --line: #e5e7eb;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.wrap {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 0 16px;
  box-sizing: border-box;
}
.app-header {
  background: linear-gradient(135deg, var(--brand), #8e5cf0);
  color: var(--brand-ink);
}
.app-header .wrap {
  padding: 24px 16px;
}
h1 {
  margin: 0 0 6px 0;
  font-size: 24px;
}
h2 {
  margin: 0 0 12px 0;
}
p {
  margin: 6px 0 12px 0;
}
p.hint {
  color: var(--muted);
  margin-top: -6px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px 0;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}
.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.tab.active {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}
.card.muted {
  background: #fafafa;
  margin-top: 16px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}
.row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  align-items: start;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  position: relative;
}

.row.regular-event {
  grid-template-columns: repeat(15, 1fr);
  position: relative;
}
.row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.field {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.grow {
  grid-column: span 6;
}
.field.achievement {
  grid-column: span 5;
}
.field.small {
  grid-column: span 2;
}
.field label {
  font-size: 12px;
  color: var(--muted);
}
.field .value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.inline {
  display: flex;
  align-items: center;
  gap: 6px;
}
.inline .qty {
  max-width: 90px;
  text-align: center;
}
.unit {
  color: var(--muted);
}

.actions {
  grid-column: span 1;
  display: flex;
  justify-content: flex-end;
}
.toolbar {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  width: 100%;
}
.btn:hover {
  filter: brightness(0.95);
}
.btn.danger {
  background: var(--danger);
  margin-top: 10px;
}
.btn.icon {
  padding: 6px 10px;
  background: #f3f4f6;
  color: #111;
  border: 1px solid var(--line);
  max-width: 64px;
}
.btn.file-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: fit-content;
}
.btn.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.total {
  margin-top: 8px;
  font-weight: 600;
}
.totals {
  list-style: none;
  padding: 0;
  margin: 0 0 8px 0;
}
.totals li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sticky {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}
.spacer {
  flex: 1;
}
.mini-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  box-sizing: border-box;
  width: fit-content;
  justify-content: flex-end;
}
.mini {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.mini.active {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

input,
select {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
input[type="number"] {
  font-variant-numeric: tabular-nums;
}

pre.code {
  background: #0b1020;
  color: #e6edf3;
  padding: 12px;
  border-radius: 10px;
  overflow: auto;
}

/* Анимация удаления */
.item-removing {
  position: relative;
  overflow: hidden;
  transition: all 0.5s ease;
  opacity: 0.7;
  transform: scale(0.98);
}

.item-removing::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, #ff6b6b, transparent);
  animation: borderFlow 5s linear;
  z-index: 1;
}

@keyframes borderFlow {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.restore-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  animation: fadeIn 0.2s ease;
  padding: 8px;
  min-height: 100%;
  box-sizing: border-box;
  border: 2px solid #ff6b6b;
  border-radius: 6px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.restore-text {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
  text-align: center;
  line-height: 1.2;
}

.restore-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.restore-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 40px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.restore-yes {
  background: #4caf50;
  color: white;
  border: 1px solid #45a049;
}

.restore-yes:hover {
  background: #45a049;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.restore-no {
  background: #f44336;
  color: white;
  border: 1px solid #da190b;
}

.restore-no:hover {
  background: #da190b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.countdown {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
  line-height: 1;
}

/* Адаптивность для маленьких экранов */
@media (max-width: 560px) {
  .restore-overlay {
    padding: 6px;
  }

  .restore-text {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .restore-buttons {
    gap: 6px;
    margin-bottom: 4px;
  }

  .restore-btn {
    padding: 4px 8px;
    font-size: 10px;
    min-width: 32px;
  }

  .countdown {
    font-size: 9px;
  }
}

@media (max-width: 900px) {
  .row,
  .row.regular-event {
    grid-template-columns: repeat(6, 1fr);
    white-space: normal;
  }
  .field {
    grid-column: span 3;
  }
  .field.grow {
    grid-column: span 6;
  }
  .field.achievement {
    grid-column: span 3;
  }
  .field.small {
    grid-column: span 2;
  }
  .actions {
    grid-column: span 6;
    justify-content: flex-start;
  }
  .tab {
    width: 100%;
  }
  .tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .mini-tabs {
    width: 100%;
  }
}
@media (max-width: 560px) {
  .row {
    grid-template-columns: repeat(2, 1fr);
  }
  .field,
  .field.grow,
  .field.small,
  .actions {
    grid-column: span 2;
  }
  .tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}
