:root {
  --green:  #27ae60;
  --blue:   #2980b9;
  --red:    #e74c3c;
  --orange: #e67e22;
  --dark:   #2c3e50;
  --light:  #ecf0f1;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  background: #f4f6f8;
  color: #222;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }

/* ── Header ─────────────────────────────────────────── */
header {
  background: var(--dark);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 { font-size: 16px; font-weight: 600; }
header .apt-badge {
  background: var(--green);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
}
header .logout-link { font-size: 12px; color: #aaa; }

/* ── Flash ───────────────────────────────────────────── */
.flash {
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
}
.flash.ok  { background: #d4edda; color: #155724; }
.flash.err { background: #f8d7da; color: #721c24; }
.flash.info { background: #d1ecf1; color: #0c5460; }

/* ── Main container ──────────────────────────────────── */
main { padding: 16px; max-width: 640px; margin: 0 auto; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.card h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--light);
}

/* ── Big home buttons ────────────────────────────────── */
.home-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 12px;
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.10);
  text-decoration: none;
  color: #222;
  transition: transform .1s;
}
.home-btn:active { transform: scale(.97); }
.home-btn .icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.home-btn.green .icon { background: #d4f3e4; }
.home-btn.blue  .icon { background: #d0e8f8; }
.home-btn.gray  .icon { background: #e8eaf0; }
.home-btn.orange .icon { background: #fde8d0; }
.home-btn sub   { display: block; font-size: 12px; font-weight: 400; color: #777; margin-top: 2px; }

/* ── Forms ───────────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #444; }
input[type=text], input[type=password], input[type=time], input[type=date],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  background: #fafafa;
  transition: border-color .15s;
  margin-bottom: 10px;
  appearance: auto;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
}
textarea { min-height: 70px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 > div input { margin-bottom: 0; }
.form-row { margin-bottom: 10px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  text-decoration: none;
}
.btn:active { opacity: .8; }
.btn-green  { background: var(--green);  color: #fff; }
.btn-blue   { background: var(--blue);   color: #fff; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-gray   { background: #95a5a6;       color: #fff; }
.btn-light  { background: var(--light);  color: var(--dark); }
.btn-sm     { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-full   { width: 100%; }

/* ── Request / availability items ───────────────────── */
.item {
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  background: #fafafa;
}
.item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.item-title { font-weight: 700; font-size: 14px; }
.item-sub   { font-size: 12px; color: #666; margin-top: 2px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ── Status badges ───────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-pending  { background: #fff3cd; color: #856404; }
.badge-assigned { background: #d4edda; color: #155724; }
.badge-done     { background: #d1ecf1; color: #0c5460; }
.badge-cancelled{ background: #e2e3e5; color: #555; }

/* ── Suggestion highlight ────────────────────────────── */
.item.suggestion { border-color: var(--green); background: #f0faf4; }
.item.suggestion .item-title::before { content: '✋ '; }

/* ── Admin table ─────────────────────────────────────── */
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th { background: var(--dark); color: #fff; padding: 7px 8px; text-align: left; }
.adm-table td { padding: 7px 8px; border-bottom: 1px solid #eee; vertical-align: middle; }
.adm-table tr:nth-child(even) td { background: #f8f8f8; }

/* ── Tabs (admin) ────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 14px;
  border: 2px solid #ccc;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #555;
}
.tab-btn.active { background: var(--dark); border-color: var(--dark); color: #fff; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── QR code print page ──────────────────────────────── */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.qr-card {
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px 8px;
  background: #fff;
}
.qr-card .apt-num { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.qr-canvas { display: flex; justify-content: center; }
@media print {
  header, .no-print { display: none !important; }
  main { padding: 0; }
  .card { box-shadow: none; }
  body { background: #fff; }
}

/* ── Login page ──────────────────────────────────────── */
.login-wrap {
  max-width: 380px;
  margin: 40px auto 0;
  padding: 0 16px;
}
.login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo .building { font-size: 48px; }
.login-logo h2 { font-size: 20px; font-weight: 800; color: var(--dark); }
.login-logo p  { font-size: 13px; color: #777; margin-top: 4px; }

/* ── Empty state ─────────────────────────────────────── */
.empty { text-align: center; padding: 24px 0; color: #999; font-size: 14px; }
.empty .e-icon { font-size: 36px; display: block; margin-bottom: 8px; }

/* ── Captcha ─────────────────────────────────────────── */
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-eq  { font-size: 18px; font-weight: 800; white-space: nowrap; }
.captcha-row input { margin-bottom: 0; width: 80px; }
