:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e0e3e8;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --primary: #1d6f42;
  --primary-dark: #145530;
  --danger: #c0392b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

.container.wide {
  max-width: 1100px;
}

h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 12px; }
p.muted { color: var(--text-muted); margin: 0 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  margin-top: 16px;
}
label:first-child { margin-top: 0; }

input, select, textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

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

button {
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  width: 100%;
}

button.primary { background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.primary:disabled { background: #9fb9ab; cursor: not-allowed; }

button.secondary { background: #eef0f3; color: var(--text); }
button.small { width: auto; padding: 8px 14px; font-size: 0.85rem; }
button.danger { background: var(--danger); color: #fff; }
button.link { background: none; color: var(--primary); padding: 4px; width: auto; text-decoration: underline; }

.error-box {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
  font-size: 0.9rem;
}

.success-screen { text-align: center; padding: 40px 16px; }
.success-screen .checkmark { font-size: 3rem; color: var(--primary); }

.summary-row { display: flex; gap: 12px; margin-top: 16px; }
.summary-box { flex: 1; background: #eef6f0; border-radius: 8px; padding: 12px; text-align: center; }
.summary-box .value { font-size: 1.4rem; font-weight: 700; color: var(--primary-dark); }
.summary-box .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table th, table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.tag.active { background: #e3f3e9; color: var(--primary-dark); }
.tag.completed { background: #eef0f3; color: var(--text-muted); }
.tag.inactive { background: #fdecea; color: var(--danger); }

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.top-nav .brand { font-weight: 700; }
.tabs { display: flex; gap: 6px; padding: 12px 20px 0; background: #fff; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab-btn { background: none; border: none; padding: 10px 14px; font-weight: 600; color: var(--text-muted); width: auto; border-bottom: 2px solid transparent; border-radius: 0; }
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters > div { min-width: 140px; }

.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.entry-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.entry-item:last-child { border-bottom: none; }
.entry-item .meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.entry-item .desc { font-size: 0.9rem; margin-top: 4px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal { background: #fff; border-radius: var(--radius); padding: 20px; max-width: 420px; width: 100%; max-height: 90vh; overflow-y: auto; }

.link-box { display: flex; gap: 8px; align-items: center; background: #f1f3f5; border-radius: 8px; padding: 8px 10px; font-size: 0.8rem; word-break: break-all; }

@media (max-width: 640px) {
  .filters > div { flex: 1 1 45%; min-width: 0; }
}
