:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2330;
  --muted: #6b7384;
  --line: #e4e7ec;
  --brand: #3b5bdb;
  --brand-ink: #ffffff;
  --amber: #b7791f;
  --amber-bg: #fdf3e0;
  --green: #1f7a4d;
  --green-bg: #e4f5ec;
  --red: #b42424;
  --red-bg: #fbe7e7;
  --blue: #2456b4;
  --blue-bg: #e6eefb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.08), 0 1px 2px rgba(20, 30, 50, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 14px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.topbar nav a.active { color: var(--ink); font-weight: 600; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }

/* Sections */
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 28px 0 12px; }
.count { background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 13px; margin-left: 6px; vertical-align: middle; }
.page-title { font-size: 24px; margin: 8px 0 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-title { font-size: 18px; margin: 0; }
.age { color: var(--muted); font-size: 14px; white-space: nowrap; }
.meta { color: var(--muted); font-size: 14px; margin: 6px 0; }
.desc { margin: 8px 0; white-space: pre-wrap; }
.card-foot { margin: 12px 0 0; }
.link { color: var(--brand); }
.link-quiet { color: var(--muted); font-size: 14px; text-decoration: none; }

/* Decide block */
.decide { margin-top: 12px; }
.note-input { width: 100%; }
.decide-buttons { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.decide-buttons .btn { flex: 1 1 auto; min-width: 110px; }

/* Buttons - big tap targets */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter .12s ease, transform .02s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 38px; padding: 7px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-approve { background: var(--green-bg); color: var(--green); border-color: #bfe3cf; }
.btn-changes { background: var(--blue-bg); color: var(--blue); border-color: #c3d6f5; }
.btn-reject { background: var(--red-bg); color: var(--red); border-color: #f0c5c5; }
.btn-wa { background: #e7f7ec; color: #128c4b; border-color: #b9e7c8; }
.btn:hover { filter: brightness(0.98); }

/* Rows (lists) */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--ink);
}
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 14px; }
.row-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* Pills */
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill-pending { background: var(--amber-bg); color: var(--amber); }
.pill-approved { background: var(--green-bg); color: var(--green); }
.pill-rejected { background: var(--red-bg); color: var(--red); }
.pill-changes_requested { background: var(--blue-bg); color: var(--blue); }

/* Empty + alert */
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 18px; color: var(--muted); text-align: center; }
.alert { background: var(--red-bg); color: var(--red); border: 1px solid #f0c5c5; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }

/* Forms */
.stack label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=datetime-local], select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px 12px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.hint { display: block; font-weight: 400; color: var(--muted); margin-top: 6px; font-size: 13px; }
.req { color: var(--red); }
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.back { display: inline-block; color: var(--muted); text-decoration: none; margin: 4px 0 8px; font-size: 14px; }

/* Login */
.login-card { max-width: 360px; margin: 8vh auto 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); }
.login-title { text-align: center; margin: 0 0 4px; font-size: 26px; }

/* Panels + timeline */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head .section-title { margin: 0; }
.panel-actions { display: flex; gap: 8px; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li:last-child { border-bottom: none; }
.t-time { color: var(--muted); display: inline-block; min-width: 56px; }
.t-tag { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; margin-right: 6px; }
.decided-note { color: var(--muted); margin: 12px 0 0; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.stat-num { display: block; font-size: 22px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }

.admin-run { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

@media (min-width: 560px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
