/* MEKCR — Representative Dashboard design system */
:root {
  --brs-pink: #e6007e;
  --brs-dark: #9c0054;
  --bg: #f4f5fa;
  --bg-soft: #fafaff;
  --card: #ffffff;
  --text: #16161d;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --border: #e7e8f0;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --blue: #2563eb;
  --blue-bg: #eef2ff;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --shadow: 0 1px 2px rgba(16, 16, 29, 0.04), 0 4px 16px rgba(16, 16, 29, 0.05);
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Telugu', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---- App bar ---- */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brs-pink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
header h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .2px; }
header .tag { color: var(--muted); font-size: 12px; }
header .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fde7f3; color: var(--brs-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
header button#logoutBtn {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
header button#logoutBtn:hover { border-color: var(--brs-pink); color: var(--brs-pink); }

/* ---- Layout ---- */
section { max-width: 920px; margin: 22px auto; padding: 0 16px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
h2 { font-size: 19px; margin: 0 0 4px; }
h3 { font-size: 15px; }

/* ---- Forms ---- */
input, select, textarea {
  display: block; width: 100%; padding: 11px 13px; margin: 6px 0;
  border: 1px solid var(--border); border-radius: 9px; font-size: 15px;
  background: #fff; color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brs-pink); box-shadow: 0 0 0 3px rgba(230,0,126,.1); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 12px; color: var(--muted); margin-top: 12px; font-weight: 500; }
label input, label select { margin-top: 4px; }

button {
  background: var(--brs-pink); color: #fff; border: 0; padding: 11px 18px;
  border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; transition: filter .12s;
}
button:hover { filter: brightness(1.05); }
button.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
button.secondary:hover { border-color: var(--brs-pink); color: var(--brs-pink); filter: none; }
button.link { background: none; color: var(--brs-pink); padding: 4px 0; font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.actions button { font-size: 13px; padding: 9px 14px; }

/* ---- Login ---- */
#loginView { max-width: 400px; margin: 70px auto; }
#loginView .logo-lg {
  width: 52px; height: 52px; border-radius: 13px; background: var(--brs-pink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 14px;
}

/* ---- Inbox header / stat strip ---- */
.rep-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rep-bar strong { font-size: 18px; }
.pill { background: #fde7f3; color: var(--brs-dark); padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.ok { background: var(--green-bg); color: var(--green); }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .n { font-size: 26px; font-weight: 700; line-height: 1; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat.alert .n { color: var(--red); }
.stat.good .n { color: var(--green); }
@media (max-width: 620px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }

/* ---- Filter tabs + search ---- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  background: #fff; border: 1px solid var(--border); color: var(--muted);
  padding: 7px 13px; border-radius: 20px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.tab:hover { border-color: var(--brs-pink); }
.tab.active { background: var(--brs-pink); color: #fff; border-color: var(--brs-pink); }
.tab .count { opacity: .8; font-variant-numeric: tabular-nums; }
.search { flex: 1; min-width: 160px; margin: 0; max-width: 280px; }

/* ---- Petition list ---- */
.list { display: flex; flex-direction: column; gap: 10px; }
.petition {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; box-shadow: var(--shadow); transition: border-color .12s, transform .06s;
}
.petition:hover { border-color: var(--brs-pink); transform: translateY(-1px); }
.petition .left { min-width: 0; }
.petition .code { font-weight: 700; font-size: 14px; }
.petition .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.petition .pri-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.pri-high, .pri-urgent { background: var(--red); }
.pri-normal { background: var(--blue); }
.pri-low { background: var(--faint); }

/* ---- Status badges ---- */
.status { font-size: 12px; padding: 4px 11px; border-radius: 20px; background: var(--blue-bg); color: #3730a3; font-weight: 600; white-space: nowrap; }
.status.resolved, .status.closed { background: var(--green-bg); color: var(--green); }
.status.escalated, .status.reopened { background: var(--amber-bg); color: var(--amber); }
.status.in_progress { background: #e0f2fe; color: #075985; }

/* ---- Detail ---- */
.detail-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.detail-head h2 { margin: 0; }
.kv { display: flex; gap: 10px; margin: 8px 0; font-size: 14px; }
.kv b { display: inline-block; min-width: 110px; color: var(--muted); font-weight: 500; }
.citizen-card { margin-top: 16px; background: var(--bg-soft); }
.citizen-card h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.citizen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
@media (max-width: 560px) { .citizen-grid { grid-template-columns: 1fr; } }
.timeline { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.timeline > b { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.event { font-size: 13px; color: var(--text); padding: 8px 0 8px 16px; position: relative; border-left: 2px solid var(--border); margin-left: 4px; }
.event::before { content: ''; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--brs-pink); }
.event span { color: var(--faint); font-size: 11px; }

/* ---- Admin ---- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 28px 0; }
