* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #f1f5f9; color: #0f172a; }

/* Login screen */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #1e4d2b; padding: 1rem; }
.login-card { background: #fff; border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { max-width: 220px; width: 100%; height: auto; display: block; margin: 0 auto 12px; }
.login-title { font-weight: 700; font-size: 16px; color: #1e4d2b; margin: 0 0 4px; }
.login-sub { font-size: 13px; color: #64748b; margin: 0; }
.login-label { font-size: 12px; font-weight: 600; color: #475569; display: block; margin-bottom: 6px; }
.login-input { width: 100%; font-size: 14px; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; outline: none; background: #fff; }
.login-input.error { border-color: #fca5a5; background: #fff5f5; }
.login-error { font-size: 12px; color: #ef4444; margin: 6px 0 0; }
.login-btn { width: 100%; background: #2d7a35; color: #fff; border: none; border-radius: 10px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 16px; }
.login-btn:hover { background: #246229; }

/* Main layout */
.app-shell { display: flex; height: 100vh; overflow: hidden; background: #f1f5f9; }

/* Sidebar */
.sidebar { width: 220px; flex-shrink: 0; background: #1e4d2b; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-head { padding: 14px; border-bottom: 1px solid rgba(255,255,255,0.08); background: #fff; }
.sidebar-logo { max-width: 100%; width: 100%; height: auto; display: block; margin: 0 auto 4px; }
.sidebar-title { color: #1e4d2b; font-weight: 700; font-size: 12px; margin: 0 0 2px; text-align: center; }
.sidebar-sub { color: #2d7a35; font-size: 10px; margin: 0; text-align: center; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; }
.sidebar-foot { padding: 10px 14px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 6px; }
.side-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #86c787; margin: 0 0 6px; }
.side-input { width: 100%; font-size: 12px; background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 7px 10px; outline: none; }
.side-input.sm { font-size: 11px; padding: 5px 8px; border-radius: 6px; margin-bottom: 6px; }
.side-input::placeholder { color: rgba(255,255,255,0.4); }
.side-checklist { display: flex; flex-direction: column; gap: 1px; }
.side-checklist.scrolly { max-height: 150px; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 2px 0; }
.check-row input { accent-color: #5cb85c; flex-shrink: 0; }
.check-row span { font-size: 12px; color: #cbd5e1; line-height: 1.3; }
.type-toggle { display: flex; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,0.12); }
.type-toggle button { flex: 1; padding: 6px; font-size: 11px; font-weight: 500; cursor: pointer; border: none; text-transform: capitalize; background: transparent; color: #94a3b8; transition: all 0.15s; }
.type-toggle button.active { background: #2d7a35; color: #fff; }
.clear-link { font-size: 11px; color: #86c787; background: none; border: none; cursor: pointer; padding: 4px 0; display: block; }
.clear-all-btn { font-size: 11px; color: #86c787; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 7px; background: transparent; cursor: pointer; width: 100%; }
.admin-btn { width: 100%; font-size: 12px; font-weight: 500; background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; padding: 8px; cursor: pointer; }
.signout-btn { width: 100%; font-size: 11px; background: transparent; color: #94a3b8; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 6px; cursor: pointer; }

/* Main */
.main-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-bar { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.main-bar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.count-text { font-size: 13px; color: #475569; }
.count-text strong { font-weight: 700; color: #0f172a; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; border-radius: 20px; padding: 2px 8px; border: 1px solid; }
.chip-spec { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.chip-mod { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.chip button { background: none; border: none; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.chip-spec button { color: #16a34a; }
.chip-mod button { color: #2563eb; }
.sort-wrap { display: flex; align-items: center; gap: 6px; }
.sort-wrap label { font-size: 12px; color: #94a3b8; }
.sort-wrap select { font-size: 12px; border: 1px solid #e2e8f0; border-radius: 8px; padding: 5px 8px; background: #fff; color: #334155; outline: none; }
.cards-area { flex: 1; overflow-y: auto; padding: 16px 20px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 180px; color: #94a3b8; gap: 8px; }
.empty-state p { font-size: 15px; margin: 0; }
.empty-state button { font-size: 13px; color: #2d7a35; background: none; border: none; cursor: pointer; text-decoration: underline; }

/* Card */
.card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; overflow: hidden; display: flex; flex-direction: column; }
.card-bar { height: 4px; }
.card-bar.high { background: #f43f5e; }
.card-bar.medium { background: #fbbf24; }
.card-bar.low { background: #60a5fa; }
.card-body { padding: 14px 14px 0; flex: 1; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-name-wrap { flex: 1; min-width: 0; }
.card-name { font-weight: 600; font-size: 13px; color: #0f172a; line-height: 1.3; margin: 0 0 5px; }
.office-row { display: flex; flex-wrap: wrap; gap: 4px; }
.office-tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.office-DTSP { background: #f3e8ff; color: #7c3aed; }
.office-Tyrone { background: #ccfbf1; color: #0f766e; }
.office-Tampa { background: #ffedd5; color: #c2410c; }
.office-Sarasota { background: #e0e7ff; color: #4338ca; }
.office-Virtual { background: #f1f5f9; color: #64748b; }
.office-other { background: #f1f5f9; color: #64748b; }
.tag-virtual { background: #f1f5f9; color: #64748b; }
.tag-psych { background: #ede9fe; color: #7c3aed; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; border: 1px solid; }
.badge-Accepting { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge-NeedsClients { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-NotAccepting { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-High { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-Medium { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-Low { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.meta-list { font-size: 12px; color: #475569; display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.meta-row { display: flex; gap: 6px; }
.meta-row .icon { color: #94a3b8; }
.section { margin-bottom: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.section-title { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.section-edit { font-size: 11px; color: #2d7a35; background: none; border: none; cursor: pointer; padding: 0; }
.modalities-text { font-size: 12px; color: #475569; line-height: 1.6; margin: 0; }
.spec-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.spec-tag { font-size: 11px; background: #f1f5f9; color: #475569; padding: 2px 8px; border-radius: 20px; }
.more-btn { font-size: 11px; color: #2d7a35; background: none; border: none; cursor: pointer; padding: 2px 4px; }
.less-btn { font-size: 11px; color: #94a3b8; background: none; border: none; cursor: pointer; padding: 2px 4px; }
.note-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.note-box p { font-size: 12px; color: #92400e; margin: 0; }
.note-box strong { font-weight: 600; }
.card-foot { border-top: 1px solid #f1f5f9; padding: 8px 14px; }
.card-foot button { font-size: 12px; color: #2d7a35; background: none; border: none; cursor: pointer; padding: 0; font-weight: 500; }
.card-edit { border-top: 1px solid #f1f5f9; padding: 12px 14px; background: #f8fafc; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.edit-grid label { font-size: 11px; color: #64748b; display: block; margin-bottom: 3px; }
.edit-grid select, .edit-input { width: 100%; font-size: 12px; border: 1px solid #e2e8f0; border-radius: 8px; padding: 5px 8px; background: #fff; outline: none; }
.edit-input-wrap { margin-bottom: 8px; }
.edit-input-wrap label { font-size: 11px; color: #64748b; display: block; margin-bottom: 3px; }
.edit-actions { display: flex; gap: 8px; }
.edit-actions button { flex: 1; font-size: 12px; border-radius: 8px; padding: 7px; cursor: pointer; }
.btn-save { background: #2d7a35; color: #fff; border: none; font-weight: 500; }
.btn-cancel { background: #fff; color: #475569; border: 1px solid #e2e8f0; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: #fff; border-radius: 1rem; width: 100%; max-width: 480px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal.lg { max-width: 600px; max-height: 92vh; background: #f8fafc; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #e2e8f0; background: #fff; border-radius: 1rem 1rem 0 0; }
.modal-head .title { font-weight: 600; font-size: 15px; color: #0f172a; margin: 0; }
.modal-head .sub { font-size: 12px; color: #64748b; margin: 2px 0 0; }
.modal-close { color: #94a3b8; font-size: 22px; line-height: 1; background: none; border: none; cursor: pointer; }
.modal-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid #e2e8f0; background: #fff; border-radius: 0 0 1rem 1rem; display: flex; gap: 10px; }
.modal-foot button { flex: 1; border-radius: 10px; padding: 10px; font-size: 14px; cursor: pointer; }

.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; max-height: 220px; overflow-y: auto; margin-bottom: 16px; }
.spec-check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.spec-check-row input { accent-color: #2d7a35; }
.modal-section { border-top: 1px solid #f1f5f9; padding-top: 12px; margin-bottom: 16px; }
.modal-section p.label { font-size: 12px; font-weight: 500; color: #475569; margin: 0 0 8px; }
.modal-add-row { display: flex; gap: 8px; }
.modal-add-row input { flex: 1; font-size: 13px; border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px 10px; outline: none; }
.modal-add-row button { font-size: 13px; background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.mod-list { margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.mod-list-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: #f8fafc; border-radius: 8px; }
.mod-list-row span { font-size: 13px; color: #334155; }
.mod-list-row button { color: #94a3b8; background: none; border: none; cursor: pointer; font-size: 14px; }
.mod-empty { font-size: 13px; color: #94a3b8; font-style: italic; margin: 0; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions button { flex: 1; border-radius: 10px; padding: 10px; font-size: 13px; cursor: pointer; }

/* Admin panel */
.admin-section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: #94a3b8; text-transform: uppercase; margin: 0 0 8px; }
.admin-section-label.spaced { margin-top: 16px; }
.admin-row { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.admin-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.admin-row-name { font-weight: 600; font-size: 13px; color: #0f172a; flex: 1; margin: 0; }

/* Footer utility buttons (health / backup / restore) */
.foot-utils { display: flex; gap: 6px; }
.foot-utils button { flex: 1; font-size: 11px; background: rgba(255,255,255,0.06); color: #cbd5e1; border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 6px 4px; cursor: pointer; }
.foot-utils button:hover { background: rgba(255,255,255,0.14); }

/* Health check panel */
.audit-ok { text-align: center; color: #16a34a; padding: 28px 0; font-size: 14px; font-weight: 500; }
.audit-summary { display: flex; gap: 12px; margin-bottom: 14px; font-size: 12px; }
.audit-count { font-weight: 600; }
.audit-count.err { color: #b91c1c; }
.audit-count.warn { color: #b45309; }
.audit-count.info { color: #1d4ed8; }
.audit-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 12.5px; line-height: 1.4; border: 1px solid; }
.audit-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.audit-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.audit-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.audit-who { font-weight: 700; }

/* Responsive: stack layout on phones/tablets */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; height: auto; min-height: 100dvh; overflow: visible; }
  .sidebar { width: 100%; }
  .sidebar-body { max-height: 45vh; }
  .main-pane { overflow: visible; }
  .cards-area { overflow: visible; padding: 12px; }
  .cards-grid { grid-template-columns: 1fr; }
  .main-bar { position: sticky; top: 0; z-index: 5; }
  .modal { max-height: 92vh; }
  .sidebar-logo, .login-logo { max-width: 180px; }
}
