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

:root {
  --primary: #1a7f5a;
  --primary-dark: #145c42;
  --bg: #f4f7f5;
  --card: #ffffff;
  --text: #1c2b25;
  --muted: #6b7c74;
  --danger: #c0392b;
  --border: #dde5e1;
  --radius: 14px;
}

body {
  font-family: "Noto Sans Bengali", "SolaimanLipi", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

header.topbar {
  background: var(--primary);
  color: white;
  padding: 18px 20px;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topbar .sub {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.9;
}

main {
  flex: 1;
  padding: 20px;
  padding-bottom: 100px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 14px;
}

label:first-child {
  margin-top: 0;
}

input, select, textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: #fbfdfc;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  padding: 15px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 20px;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: #a9c4ba;
  cursor: not-allowed;
}

.btn-secondary {
  width: 100%;
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 13px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  margin-top: 10px;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.action-btn {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 12px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.action-btn .icon {
  font-size: 28px;
}

.action-btn.custom {
  grid-column: span 2;
  background: var(--primary);
  color: white;
}

.student-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.student-row:last-child {
  border-bottom: none;
}

.student-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.student-info {
  flex: 1;
}

.student-name {
  font-weight: 700;
  font-size: 15px;
}

.student-meta {
  font-size: 13px;
  color: var(--muted);
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  margin-top: 10px;
  min-height: 18px;
}

.info-msg {
  color: var(--primary);
  font-size: 14px;
  margin-top: 10px;
}

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

.top-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  background: white;
  color: var(--primary);
  border: 1px solid var(--border);
}

.search-box {
  margin-bottom: 12px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.count-badge {
  background: var(--primary);
  color: white;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  display: inline-block;
}

.preview-box {
  background: #f0f7f3;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.preview-item {
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.preview-item:last-child {
  border-bottom: none;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.char-count.over {
  color: var(--danger);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

.step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.step-dot.active {
  background: var(--primary);
  width: 24px;
  border-radius: 4px;
}

.tag {
  display: inline-block;
  background: #eef4f0;
  color: var(--primary);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-left: 8px;
}
