* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #222;
}
a { color: #1f4e78; }

.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #1f4e78;
  color: #fff;
  padding: 20px 0;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  align-self: flex-start;
}
.sidebar .brand {
  padding: 0 20px 16px;
  font-weight: bold;
  font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 10px;
}
.sidebar a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  font-size: 14px;
}
.sidebar a:hover { background: #163a58; }

.content-area { flex: 1; min-width: 0; }

.container {
  max-width: 960px;
  margin: 24px auto;
  background: #fff;
  padding: 24px 28px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

h1 { margin-top: 0; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { margin-bottom: 0; }
.page-header .btn-export { margin-top: 0; }
.cat-title {
  margin-top: 28px;
  padding-bottom: 6px;
  border-bottom: 2px solid #1f4e78;
  color: #1f4e78;
}
h3 { color: #444; margin-bottom: 6px; }

.hint { color: #666; font-size: 14px; }

.form-row { margin-bottom: 16px; display: flex; flex-direction: column; max-width: 480px; }
.form-row label { font-weight: bold; margin-bottom: 4px; font-size: 14px; }
.form-row input, .form-row select, .form-row textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.checklist-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.checklist-table th, .checklist-table td,
.data-table th, .data-table td {
  border: 1px solid #e2e2e2;
  padding: 8px 10px;
  font-size: 14px;
  text-align: left;
}
.checklist-table th, .data-table th {
  background: #f0f3f6;
}
.center { text-align: center; }
.reason-input { width: 100%; border: 1px solid #ccc; border-radius: 4px; padding: 6px; }
.reason-input:disabled { background: #f7f7f7; color: #aaa; }

.btn-submit, .btn-export {
  display: inline-block;
  background: #1f4e78;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  margin-top: 12px;
}
.btn-submit:hover, .btn-export:hover { background: #163a58; }

.stat-cards { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #f0f3f6;
  border-radius: 8px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
}
.stat-card .num { font-size: 28px; font-weight: bold; color: #1f4e78; }
.stat-card .label { font-size: 13px; color: #666; }

.badge-used { background: #daf5e2; color: #1c7a35; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-notused { background: #fbe0e0; color: #b23; padding: 2px 8px; border-radius: 10px; font-size: 12px; }

.meta { color: #555; font-size: 14px; }
.notes { background: #fbf8e8; padding: 8px 12px; border-radius: 6px; }

.filter-row { margin-bottom: 16px; display: flex; gap: 8px; max-width: 400px; }
.filter-row input { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.filter-row button { padding: 8px 16px; border: none; background: #1f4e78; color: #fff; border-radius: 4px; cursor: pointer; }

.success { background: #daf5e2; color: #1c7a35; padding: 10px 14px; border-radius: 6px; }
.error { background: #fbe0e0; color: #b23; padding: 10px 14px; border-radius: 6px; }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.chart-box {
  background: #fafbfc;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 16px;
}
.chart-box-wide { grid-column: 1 / -1; }
.chart-box .cat-title { margin-top: 0; font-size: 15px; }

.table-scroll { overflow-x: auto; margin-bottom: 8px; }

.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; width: 130px; }

.btn-small {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: #1f4e78;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.btn-small:hover { background: #163a58; }
.btn-danger { background: #b23; }
.btn-danger:hover { background: #8a1c1c; }

.form-row-group { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.form-row-group .form-row { margin-bottom: 0; min-width: 180px; }

.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box {
  background: #fff;
  padding: 32px 36px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  width: 320px;
  text-align: center;
}
.login-box h1 { font-size: 20px; color: #1f4e78; margin-bottom: 20px; }
.login-box form { display: flex; flex-direction: column; text-align: left; }
.login-box label { font-size: 13px; font-weight: bold; margin: 10px 0 4px; }
.login-box input {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.login-box button {
  margin-top: 18px;
  padding: 10px;
  background: #1f4e78;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}
.login-box button:hover { background: #163a58; }

.password-field { display: flex; gap: 6px; align-items: stretch; }
.password-field input { flex: 1; min-width: 0; }
.toggle-password {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f0f3f6;
  color: #1f4e78;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.toggle-password:hover { background: #e2e8ee; }

.usage-track {
  display: inline-block;
  width: 90px;
  height: 8px;
  background: #e5e9ee;
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}
.usage-fill { height: 100%; background: #1f4e78; }

.reason-select { width: 100%; margin-bottom: 4px; }
.reason-select:disabled, .reason-custom:disabled { background: #f7f7f7; color: #aaa; }

/* ===== v7: Health Indicator chips + "Due for review" banner ===== */
.hi-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
  margin: 2px 3px 2px 0;
  white-space: nowrap;
}
.hi-chip.g { background: #daf5e2; color: #1c7a35; }   /* on target */
.hi-chip.a { background: #fdf0d8; color: #8a5a06; }   /* watch */
.hi-chip.r { background: #fbe0e0; color: #b23; }      /* below target */
.hi-chip.blue { background: #e5eef8; color: #1f4e78; }/* neutral (text metric) */
.hi-chip.gray { background: #eee; color: #777; }
.hi-none { color: #999; font-style: italic; font-size: 12px; }

.hi-banner {
  background: #fdf0d8;
  border: 1px solid #eccf95;
  color: #7a5206;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
.hi-banner strong { color: #5c3d04; }

.btn-report {
  display: inline-block;
  background: #fff;
  color: #b23;
  border: 1px solid #e2c2c2;
  padding: 5px 11px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: bold;
  text-decoration: none;
}
.btn-report:hover { background: #fbe0e0; }

/* v8: Client Revisit Report multi-select chips */
.rf-chips{display:flex;flex-wrap:wrap;gap:8px;max-width:640px;}
.rf-chip{font-size:13px;background:#eef;border:1px solid #ccd;padding:5px 10px;border-radius:14px;display:inline-flex;align-items:center;gap:5px;cursor:pointer;}
.rf-chip input{margin:0;}
