:root {
  --bg: #f5f6f8; --card: #ffffff; --border: #e2e5ea;
  --text: #1c2330; --muted: #6b7280; --accent: #2563eb;
  --amber: #b45309; --blue: #1d4ed8; --purple: #7c3aed; --green: #15803d;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav { display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-bottom: 1px solid var(--border); padding: 10px 20px; }
.brand { font-weight: 700; color: var(--text); font-size: 16px; }
.navlinks { display: flex; gap: 16px; align-items: center; }
.whoami { color: var(--muted); font-size: 13px; }

.wrap { max-width: 960px; margin: 24px auto; padding: 0 16px; }

.card { background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 17px; }

table.list { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { background: #fafbfc; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
table.list tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-open { background: #fef3c7; color: var(--amber); }
.b-in_progress { background: #dbeafe; color: var(--blue); }
.b-waiting { background: #ede9fe; color: var(--purple); }
.b-closed { background: #dcfce7; color: var(--green); }

.btn { display: inline-block; background: var(--accent); color: #fff;
  border: 0; border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.btn:hover { opacity: .9; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-danger { background: #b91c1c; }

input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; font: inherit; background: #fff; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.flash { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 13px; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; }

.reply { border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; background: #fafbfc; }
.reply .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.reply.staff { background: #eff6ff; border-color: #bfdbfe; }

.login-box { max-width: 380px; margin: 80px auto; }
.stat { font-size: 26px; font-weight: 700; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap: 12px; margin-bottom: 16px; }
.tagchip { display: inline-block; background: #f1f5f9; border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text); }
.inline-form { display: inline; }
