* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Theme Variables (matching desktop GUI) --- */
[data-theme="dark"] {
  --bg: #1c1814;
  --bg-secondary: #241f1a;
  --bg-card: #2c2520;
  --text: #e8e2da;
  --text-muted: #8a7e75;
  --text-light: #6b6058;
  --accent: #d4943e;
  --accent-hover: #e8a84e;
  --success: #4eca8a;
  --danger: #dc4a4a;
  --border: #3a332c;
  --border-light: #322b25;
  --input-bg: #241f1a;
  --modal-bg: rgba(0,0,0,0.6);
  --hover-bg: rgba(255,255,255,0.04);
  --badge-bg: #d4943e;
  --push-in: #4eca8a;
  --push-in-bg: rgba(78,202,138,0.15);
  --pull-out: #e07a5c;
  --pull-out-bg: rgba(224,122,92,0.15);
  --math: #7b8adf;
  --math-bg: rgba(123,138,223,0.15);
  --sla: #d4943e;
  --sla-bg: rgba(212,148,62,0.15);
  --sel: #ab8bd0;
  --sel-bg: rgba(171,139,208,0.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg: #f6f3ee;
  --bg-secondary: #faf8f5;
  --bg-card: #ffffff;
  --text: #2c2520;
  --text-muted: #8a7e75;
  --text-light: #b5aa9e;
  --accent: #c4793e;
  --accent-hover: #b06830;
  --success: #3d7a5f;
  --danger: #b94040;
  --border: #e8e2da;
  --border-light: #f0ebe5;
  --input-bg: #faf8f5;
  --modal-bg: rgba(44,37,32,0.3);
  --hover-bg: rgba(44,37,32,0.03);
  --badge-bg: #c4793e;
  --push-in: #3d7a5f;
  --push-in-bg: #e8f4ee;
  --pull-out: #b45a3c;
  --pull-out-bg: #fbeee8;
  --math: #5b6abf;
  --math-bg: #eceef8;
  --sla: #c4793e;
  --sla-bg: #faf0e6;
  --sel: #8b6bb0;
  --sel-bg: #f0eaf6;
  --shadow-sm: 0 1px 3px rgba(44,37,32,0.06);
  --shadow-md: 0 4px 12px rgba(44,37,32,0.08);
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* --- Login Screen --- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--accent);
  color: white;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.login-field input:focus {
  border-color: var(--accent);
}

.login-field input::placeholder {
  color: var(--text-light);
}

.login-error {
  background: rgba(220,74,74,0.1);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover {
  background: var(--accent-hover);
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- App Shell --- */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* --- Header --- */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
}

#header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--hover-bg);
}

/* --- Tab Content --- */
#tab-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.tab-pane {
  display: none;
  padding: 16px;
  min-height: 100%;
}

.tab-pane.active {
  display: block;
}

/* --- Bottom Tab Bar --- */
#tab-bar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 2px;
  min-width: 0;
  position: relative;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn .tab-icon {
  font-size: 18px;
  line-height: 1;
}

.tab-btn .tab-label {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tab-btn .tab-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(12px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.tab-btn .tab-badge.warning {
  background: #D97706;
}

/* --- Floating Action Button --- */
#fab {
  position: fixed;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 28px;
  font-weight: 300;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: transform 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#fab:active {
  transform: scale(0.92);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 500px;
  border-radius: 16px 16px 0 0;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-primary {
  flex: 1;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  flex: 1;
  padding: 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

#capture-form textarea {
  width: 100%;
  padding: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
  outline: none;
}

#capture-form textarea:focus {
  border-color: var(--accent);
}

#capture-form textarea::placeholder {
  color: var(--text-light);
}

/* --- Common Components --- */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
}

.loading-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
}

.loading-state::after {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 12px auto 0;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--hover-bg);
  color: var(--text-muted);
  margin-right: 4px;
}

.tag.priority-high { background: rgba(220,74,74,0.15); color: #DC4A4A; }
.tag.priority-medium { background: rgba(217,119,6,0.15); color: #D97706; }
.tag.priority-low { background: rgba(59,130,246,0.15); color: #3B82F6; }
.tag.context-tag { background: var(--accent); color: white; opacity: 0.85; }
.tag.time { background: rgba(139,92,246,0.12); color: #8B5CF6; }
.tag.due { background: rgba(220,74,74,0.12); color: #DC4A4A; }
.tag.project { background: rgba(78,202,138,0.12); color: var(--success); }

.section-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Briefing / Today Tab --- */
.briefing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.summary-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.summary-card.clean .summary-number {
  color: var(--success);
}

.summary-number {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.summary-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.briefing-section {
  margin-bottom: 16px;
}

.briefing-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.briefing-item {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
}

.briefing-item.overdue {
  border-left: 3px solid #DC4A4A;
}

.briefing-item.today-event {
  border-left: 3px solid var(--accent);
}

.briefing-item.high-priority {
  border-left: 3px solid #D97706;
}

.item-text {
  font-size: 14px;
  line-height: 1.4;
}

.item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.briefing-empty {
  text-align: center;
  color: var(--success);
  padding: 20px;
  font-size: 15px;
  font-weight: 500;
}

/* --- Tasks Tab --- */
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.filter-btn {
  padding: 7px 14px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.filter-btn.add-task-btn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}

.context-group {
  margin-bottom: 16px;
}

.context-group h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.15s;
}

.task-item.completed {
  opacity: 0.5;
}

.task-item.completed .task-description {
  text-decoration: line-through;
}

.task-item.hidden {
  display: none;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

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

.task-description {
  font-size: 14px;
  line-height: 1.4;
}

.task-meta {
  margin-top: 4px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.task-notes {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Projects Tab --- */
.project-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.project-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.project-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.outcome {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

.next-action {
  font-size: 13px;
  background: var(--hover-bg);
  border-radius: 6px;
  padding: 8px 10px;
}

/* --- Calendar Tab --- */
.calendar-item {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--accent);
}

.calendar-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.calendar-text {
  font-size: 14px;
  line-height: 1.4;
}

.calendar-priority {
  margin-top: 4px;
}

.date-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.date-header:first-child {
  margin-top: 0;
}

/* --- Inbox Tab --- */
.inbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
}

.inbox-item .inbox-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.inbox-item .inbox-date {
  font-size: 11px;
  color: var(--text-muted);
}

.inbox-item .inbox-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.inbox-item .inbox-delete:hover {
  background: rgba(220,74,74,0.1);
  color: var(--danger);
}

/* --- Students Tab --- */
.student-selector {
  margin-bottom: 14px;
}

.student-selector select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.student-selector select:focus {
  border-color: var(--accent);
}

.caseload-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}

.caseload-table table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 13px;
}

.caseload-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.caseload-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.caseload-row {
  cursor: pointer;
  transition: background 0.1s;
}

.caseload-row:active {
  background: var(--hover-bg);
}

.obs-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.obs-badge.recent { background: rgba(5,150,105,0.15); color: #059669; }
.obs-badge.moderate { background: rgba(217,119,6,0.15); color: #D97706; }
.obs-badge.stale { background: rgba(220,38,38,0.15); color: #DC2626; }

.coverage-bar {
  width: 60px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.coverage-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.3s;
}

.coverage-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
}

.iep-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(37,99,235,0.15);
  color: #2563EB;
}

.iep-badge.warning { background: rgba(217,119,6,0.15); color: #D97706; }
.iep-badge.urgent { background: rgba(220,38,38,0.15); color: #DC2626; }

/* Student profile */
.student-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.student-info h2 {
  font-size: 20px;
  font-weight: 700;
}

.student-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.iep-ring {
  flex-shrink: 0;
}

.student-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.student-section {
  margin-bottom: 16px;
}

.student-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.goal-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.goal-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.goal-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.4;
}

.goal-target {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.goal-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.sparkline {
  display: block;
  margin: 4px 0 6px;
}

/* Student action buttons */
.student-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.action-btn:hover {
  background: var(--hover-bg);
}

.action-btn:active {
  background: var(--border);
}

/* Observation timeline */
.obs-timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.obs-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
}

.obs-text {
  font-size: 13px;
  line-height: 1.4;
}

/* --- Observation Guide --- */
.obs-guide {
  padding-bottom: 20px;
}

.obs-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.obs-guide-header h2 {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.obs-guide-session-banner {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
}

.obs-guide-session-banner.current {
  background: rgba(78,202,138,0.15);
  color: var(--success);
  border-left: 3px solid var(--success);
}

.obs-guide-session-banner.upcoming {
  background: rgba(212,148,62,0.15);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.obs-guide-iep-alert {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(220,38,38,0.1);
  color: #DC2626;
  border-left: 3px solid #DC2626;
  font-size: 13px;
  margin-bottom: 10px;
}

.obs-guide-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.obs-guide-priority-count {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.obs-guide-priority-count.no-data { background: rgba(220,38,38,0.15); color: #DC2626; }
.obs-guide-priority-count.stale { background: rgba(217,119,6,0.15); color: #D97706; }
.obs-guide-priority-count.recent { background: rgba(5,150,105,0.15); color: #059669; }

.obs-guide-total {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--hover-bg);
}

.obs-guide-category {
  margin-bottom: 16px;
}

.obs-guide-category h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.obs-guide-goal {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.obs-guide-goal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.obs-guide-goal-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.obs-guide-priority {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.obs-guide-goal-target {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.obs-guide-perf-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 4px;
}

.obs-guide-suggest {
  font-size: 12px;
  color: var(--success);
  font-style: italic;
}

.obs-guide-tips {
  background: var(--hover-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.obs-guide-tip-section {
  margin-bottom: 4px;
}

.obs-guide-tip-section:last-child {
  margin-bottom: 0;
}

/* --- Parent Update --- */
.parent-update {
  padding-bottom: 20px;
}

.parent-update-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.parent-update-header h2 {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.parent-update-actions {
  display: flex;
  gap: 6px;
}

.parent-update-letter {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px 16px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}

.parent-update-letter h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

.parent-update-letter h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 6px;
}

.parent-update-letter hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.parent-update-letter p {
  margin-bottom: 8px;
}

.parent-update-section {
  margin-bottom: 12px;
}

.parent-update-goal {
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

.parent-update-divider {
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

/* --- Habits Tab --- */
.habits-today {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.habits-today h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.habits-progress {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

.habits-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.habit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--input-bg);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

.habit-item:active {
  background: var(--border);
}

.habit-item.done {
  background: rgba(78,202,138,0.08);
}

.habit-check {
  font-size: 18px;
  flex-shrink: 0;
}

.habit-emoji {
  font-size: 16px;
  flex-shrink: 0;
}

.habit-label {
  font-size: 14px;
  font-weight: 500;
}

.habits-section {
  margin-bottom: 16px;
}

.habits-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.streak-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.streak-label {
  font-size: 13px;
  min-width: 120px;
  white-space: nowrap;
}

.streak-bar-bg {
  flex: 1;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.streak-bar-fill {
  height: 100%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  min-width: fit-content;
  transition: width 0.3s;
}

.streak-count {
  font-size: 11px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}

/* Contribution grid */
.contrib-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.contrib-row {
  display: flex;
  gap: 3px;
  align-items: center;
}

.contrib-label {
  width: 30px;
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.contrib-cell {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  flex-shrink: 0;
}

.contrib-none { background: var(--border-light); }
.contrib-low { background: rgba(212,148,62,0.3); }
.contrib-mid { background: rgba(212,148,62,0.6); }
.contrib-full { background: var(--accent); }
.contrib-future { background: transparent; border: 1px solid var(--border-light); }

.contrib-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.contrib-legend .contrib-cell {
  width: 14px;
  height: 14px;
}

/* --- Guide Tab --- */
.guide {
  padding-bottom: 20px;
}

.guide-header {
  margin-bottom: 16px;
}

.guide-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.guide-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.guide-toc {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.guide-toc h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.guide-toc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.guide-toc-link {
  display: block;
  padding: 8px 10px;
  background: var(--input-bg);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

.guide-toc-link:active {
  background: var(--border);
}

.guide-section {
  margin-bottom: 20px;
}

.guide-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.guide-section p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
  overflow-x: auto;
  display: block;
}

.guide-table thead {
  display: none;
}

.guide-table tbody {
  display: block;
}

.guide-table tr {
  display: block;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
}

.guide-table td {
  display: block;
  padding: 2px 0;
}

.guide-table td:first-child {
  font-weight: 600;
  color: var(--text);
}

.guide-table td:nth-child(2) {
  color: var(--accent);
  font-size: 12px;
  word-break: break-all;
}

.guide-table td:nth-child(3) {
  font-size: 12px;
  color: var(--text-muted);
}

.guide-table code {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  background: var(--input-bg);
  padding: 1px 4px;
  border-radius: 3px;
  word-break: break-all;
}

.guide-table kbd {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  background: var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--text-light);
}

.guide-note {
  background: rgba(212,148,62,0.1);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

.guide-examples {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-example-group h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.guide-example-group ul {
  list-style: none;
  padding: 0;
}

.guide-example-group li {
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg-card);
  border-radius: 6px;
  margin-bottom: 4px;
  color: var(--text);
  font-style: italic;
}

.guide-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.guide-footer code {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
}

/* --- Quick Actions --- */
.quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.quick-actions h3 {
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* --- Waiting For --- */
.waiting-item {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

/* --- Responsive fine-tuning --- */
@media (min-width: 500px) {
  .modal {
    border-radius: 16px;
    margin: auto;
    max-height: 90vh;
  }

  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .student-stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .guide-table thead {
    display: table-header-group;
  }

  .guide-table tbody {
    display: table-row-group;
  }

  .guide-table tr {
    display: table-row;
    background: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
  }

  .guide-table td {
    display: table-cell;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
  }

  .guide-table th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
  }
}

/* --- Print styles --- */
@media print {
  #header, #tab-bar, #fab, .modal-overlay,
  .student-selector, .student-actions,
  .obs-guide-header button, .parent-update-actions,
  .quick-actions, .filter-bar { display: none !important; }

  #tab-content { padding-bottom: 0; overflow: visible; }
  .tab-pane { padding: 0; }
  body { background: white; color: black; }
}
