:root {
  --bg: #f2f7fb;
  --card: #ffffff;
  --ink: #11203a;
  --muted: #52627d;
  --line: #d8e3f0;
  --accent: #0f6cbf;
  --accent-strong: #0a579a;
  --ok-bg: #e9f8ee;
  --ok-line: #bae6c5;
  --warn-bg: #fff5e6;
  --warn-line: #ffd59a;
  --err-bg: #fff0f0;
  --err-line: #ffc9c9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at -10% 0%, #dfedff 0%, var(--bg) 48%), linear-gradient(180deg, #f8fbff 0%, #eef5fc 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
}

.brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
}

nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

.container {
  max-width: 1120px;
  margin: 22px auto;
  padding: 0 16px 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 26px rgba(9, 38, 77, 0.06);
}

.card.small {
  max-width: 540px;
}

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

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.grid.stats {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.count {
  font-size: 30px;
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.compact-gap {
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input,
textarea,
select,
button {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}

textarea {
  resize: vertical;
}

button,
.button {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 14px;
  display: inline-block;
}

button:hover,
.button:hover {
  filter: brightness(1.03);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.big-action {
  font-size: 34px;
  letter-spacing: 0.08em;
  min-height: 98px;
  border: 1px solid #0b4f88;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.flash-wrap {
  max-width: 1120px;
  margin: 14px auto 0;
  padding: 0 16px;
}

.flash {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #edf4ff;
  border: 1px solid #c8dcf8;
}

.flash.error {
  background: var(--err-bg);
  border-color: var(--err-line);
}

.flash.warning {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

.flash.success {
  background: var(--ok-bg);
  border-color: var(--ok-line);
}

.banner {
  max-width: 1120px;
  margin: 12px auto 0;
  padding: 10px 14px;
  border-radius: 10px;
}

.banner.warning {
  background: var(--err-bg);
  border: 1px solid var(--err-line);
}

.preview-box {
  width: 100%;
  min-height: 220px;
  max-height: 380px;
  overflow: auto;
  background: #f7fbff;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.danger-text {
  color: #ab2a2a;
}

.danger-zone {
  border-color: #f0c9c9;
  background: #fff8f8;
}

.list {
  display: grid;
  gap: 10px;
}

.list.compact {
  gap: 7px;
  margin-top: 8px;
}

.save-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.inline-form input {
  width: 220px;
}

.compact-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-modal {
  border: none;
  padding: 0;
  width: min(940px, 92vw);
  background: transparent;
}

.project-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal-card {
  margin: 0;
}

@media (max-width: 700px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .save-item {
    align-items: flex-start;
  }

  .inline-form input {
    width: 100%;
  }
}
