:root {
  --bg: #f5f7fa;
  --card: rgba(255, 255, 255, 0.86);
  --card-border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.62);
  --brand: #2b5e8c;
  --brand-2: #0ea5e9;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-lg: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: rgba(15, 23, 42, 0.62);
    --card-border: rgba(148, 163, 184, 0.14);
    --text: #e5e7eb;
    --muted: rgba(229, 231, 235, 0.62);
    --brand: #7dd3fc;
    --brand-2: #38bdf8;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(14, 165, 233, 0.16), transparent 55%),
    radial-gradient(900px 500px at 95% 10%, rgba(43, 94, 140, 0.18), transparent 55%),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 14px 44px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(245, 247, 250, 0.72), rgba(245, 247, 250, 0.32));
  border-bottom: 1px solid var(--card-border);
}

@media (prefers-color-scheme: dark) {
  .topbar {
    background: linear-gradient(to bottom, rgba(11, 18, 32, 0.72), rgba(11, 18, 32, 0.32));
  }
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
}

.brand .title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand .title strong {
  font-size: 14px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .title span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

@media (prefers-color-scheme: dark) {
  .btn {
    background: rgba(15, 23, 42, 0.55);
  }
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.35);
}

.btn.primary {
  border-color: rgba(14, 165, 233, 0.35);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(43, 94, 140, 0.12));
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 16px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.card-title .bar {
  width: 10px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
}

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

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

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.tile {
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

@media (prefers-color-scheme: dark) {
  .tile {
    background: rgba(15, 23, 42, 0.5);
  }
}

.tile:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 165, 233, 0.35);
}

.tile .left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tile .emoji {
  font-size: 26px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(43, 94, 140, 0.12));
  border: 1px solid rgba(14, 165, 233, 0.22);
}

.tile .name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tile .name strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile .name span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile .arrow {
  color: var(--muted);
  font-size: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.26);
}

.form-row:last-child {
  border-bottom: none;
}

.label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

input[type="number"],
input[type="text"],
textarea {
  width: min(320px, 100%);
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

@media (prefers-color-scheme: dark) {
  input[type="number"],
  input[type="text"],
  textarea {
    background: rgba(15, 23, 42, 0.55);
  }
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.unit {
  font-size: 12px;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
}

.value {
  font-weight: 750;
  color: var(--brand);
}

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

.list-item {
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

@media (prefers-color-scheme: dark) {
  .list-item {
    background: rgba(15, 23, 42, 0.5);
  }
}

.list-item .meta {
  min-width: 0;
}

.list-item .meta .name {
  font-weight: 750;
  margin-bottom: 4px;
}

.list-item .meta .sub {
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.link {
  border: none;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 13px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 22px 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal-inner {
  width: min(720px, 100%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.modal-head strong {
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  color: white;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 60;
  max-width: min(720px, calc(100% - 24px));
}

