:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --line: #e4e2db;
  --line-strong: #cfccc3;
  --text: #1d1d1b;
  --muted: #6b6a64;
  --faint: #9c9a92;
  --info: #185fa5;
  --info-bg: #e6f1fb;
  --radius: 10px;
  --radius-lg: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

a { color: var(--info); text-decoration: none; }

/* ---- phone-width app shell ---- */
.app {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .icon {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--info-bg); color: var(--info);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.topbar h1 { font-size: 15px; font-weight: 600; margin: 0; }
.topbar .sub { font-size: 12px; color: var(--muted); }
.topbar .link { font-size: 13px; }

.content { padding: 16px; flex: 1; }

/* ---- type selector ---- */
.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.type {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 4px; text-align: center; cursor: pointer; background: var(--surface);
  transition: border-color .12s, background .12s;
}
.type i { font-size: 20px; color: var(--muted); display: block; }
.type span { font-size: 12px; color: var(--muted); display: block; margin-top: 5px; }
.type.active { border: 2px solid var(--info); background: var(--info-bg); }
.type.active i, .type.active span { color: var(--info); font-weight: 600; }

/* ---- form ---- */
label.field { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 12px; font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--surface); margin-bottom: 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
textarea { resize: vertical; min-height: 90px; }

.filebox {
  display: flex; align-items: center; gap: 8px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 11px 12px; color: var(--faint); font-size: 13px; margin-bottom: 16px; cursor: pointer;
}
.filebox.has-file { color: var(--info); border-color: var(--info); }

.btn {
  display: block; width: 100%; border: none; border-radius: var(--radius);
  background: var(--info); color: #fff; font-size: 15px; font-weight: 600;
  padding: 13px; cursor: pointer; font-family: inherit;
}
.btn:active { transform: scale(.99); }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }

/* ---- report list ---- */
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.list-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
}
.card .row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.card .title { font-size: 14px; font-weight: 600; margin: 2px 0; }
.card .meta { font-size: 12px; color: var(--faint); }

/* ---- pills ---- */
.pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: .02em; text-transform: uppercase; }
.t-bug      { color: #993c1d; background: #faece7; }
.t-feature  { color: #185fa5; background: #e6f1fb; }
.t-question { color: #5f5e5a; background: #f1efe8; }
.s-new         { color: #534ab7; background: #eeedfe; }
.s-in_progress { color: #854f0b; background: #faeeda; }
.s-resolved    { color: #0f6e56; background: #e1f5ee; }

/* ---- login ---- */
.login-wrap { max-width: 360px; margin: 8vh auto 0; padding: 0 20px; }
.login-wrap .logo {
  width: 52px; height: 52px; border-radius: var(--radius-lg); background: var(--info-bg); color: var(--info);
  display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto 16px;
}
.login-wrap h1 { font-size: 20px; text-align: center; margin: 0 0 4px; }
.login-wrap p.tag { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.error { background: #fcebeb; color: #a32d2d; font-size: 13px; padding: 9px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.flash { background: #e1f5ee; color: #0f6e56; font-size: 13px; padding: 9px 12px; border-radius: var(--radius); margin-bottom: 14px; }
.empty { text-align: center; color: var(--faint); font-size: 13px; padding: 40px 0; }

/* ---- admin (wider) ---- */
.admin { max-width: 1000px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.metric { background: var(--bg); border-radius: var(--radius); padding: 14px 16px; }
.metric .label { font-size: 12px; color: var(--muted); }
.metric .num { font-size: 24px; font-weight: 600; margin-top: 4px; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 28px; }
table.data th { background: var(--bg); text-align: left; font-weight: 600; color: var(--muted); padding: 10px 12px; font-size: 12px; }
table.data td { padding: 10px 12px; border-top: 1px solid var(--line); }
select.mini { font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters select { font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-family: inherit; background: var(--surface); }
@media (max-width: 560px) {
  .metrics { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .metric { padding: 10px 8px; }
  .metric .label { font-size: 10px; }
  .metric .num { font-size: 18px; }
}

/* ---- admin add-forms ---- */
.addform { margin-bottom: 26px; }
.addgrid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.addgrid input, .addgrid select {
  margin-bottom: 0; width: auto; flex: 1 1 160px; min-width: 140px;
  padding: 9px 10px; font-size: 13px; border: 1px solid var(--line);
  border-radius: var(--radius); font-family: inherit; background: var(--surface);
}
.addgrid #app-wrap { flex: 1 1 160px; min-width: 140px; }
.addgrid #app-wrap select { width: 100%; }
.addgrid .btn { flex: 0 0 auto; padding: 9px 18px; font-size: 13px; }

/* ---- admin nav bar ---- */
.adminnav {
  display: flex; gap: 4px; padding: 0 16px;
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 61px; z-index: 9; overflow-x: auto;
}
.adminnav a {
  padding: 12px 14px; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500;
}
.adminnav a.active { color: var(--info); border-bottom-color: var(--info); }
.adminnav a:hover { color: var(--text); }
.adminnav a i { font-size: 16px; vertical-align: -2px; margin-right: 4px; }
