:root{
  --bg: #f5f7fb;
  --card: rgb(224, 225, 228);
  --accent: #3b82f6;
  --muted: #6b7280;
}
*{box-sizing:border-box}
body{font-family:Inter,ui-sans-serif,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;margin:0;background:var(--bg);color:#111}
.container{max-width:900px;margin:32px auto;padding:16px}
h1{margin:0}
.top-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}
.header-actions{display:flex;gap:8px}
.primary{background:var(--accent)}
.small{padding:6px 8px;border-radius:6px}
.danger{background:#ef4444}
.form-section{background:var(--card);padding:16px;border-radius:8px;margin-bottom:18px;box-shadow:0 2px 6px rgba(12,14,20,0.06)}
form label{display:block;margin-bottom:10px;color:var(--muted)}
form label .hint{display:block;margin-top:6px;font-size:12px;color:#9ca3af}

.visually-hidden{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px,1px,1px,1px);white-space:nowrap}

/* Modal */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;z-index:60}
.modal[aria-hidden="false"]{display:flex}
.modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,0.35)}
.modal-content{position:relative;background:var(--card);padding:18px;border-radius:8px;z-index:70;max-width:560px;width:100%;box-shadow:0 6px 24px rgba(2,6,23,0.2)}
.modal-actions{justify-content:flex-end}

input[type="text"],input[type="url"],input[type="number"],textarea{width:100%;padding:8px;border:1px solid #e6e9ee;border-radius:6px;margin-top:6px}
.form-actions{display:flex;gap:8px;margin-top:8px}
button{background:var(--accent);color:white;border:0;padding:8px 12px;border-radius:6px;cursor:pointer}
button[aria-pressed="true"]{opacity:0.9}
button[type="button"]{background:#ef4444}

.teachers-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
.teacher-card{display:flex;flex-direction:column;align-items:center;justify-content:space-between;gap:10px;background:var(--card);padding:18px;border-radius:10px;box-shadow:0 4px 12px rgba(12,14,20,0.08);height:360px}
.teacher-avatar{width:110px;height:110px;border-radius:50%;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#e6e9ee;flex:0 0 auto}
.teacher-photo{width:100%;height:100%;object-fit:cover;display:block}
.initial{font-size:42px;font-weight:700;color:#111}

/* name & description centered */
.teacher-name{margin:0;text-align:center;flex:0 0 auto}
.teacher-description{margin:0;text-align:center;color:var(--muted);white-space:normal;overflow-wrap:break-word;word-break:break-word;flex:1 1 auto;min-height:0;overflow:auto;padding:6px 4px;-webkit-overflow-scrolling:touch}

.swear-count-line{display:flex;gap:8px;align-items:center;flex:0 0 auto}
.swear-count{font-weight:700;background:#111;color:white;padding:6px 10px;border-radius:6px}
.swear-actions{display:flex;gap:8px}
.swear-actions button{min-width:110px}
.action-row{display:flex;gap:8px}
.swear-count{font-weight:700;background:#111;color:white;padding:6px 8px;border-radius:6px}
.inc-swear{background:#10b981}
.dec-swear{background:#f59e0b}
.remove-teacher{background:#ef4444}
.edit-teacher{background:#6366f1}

@media (max-width:520px){
  .teacher-card{flex-direction:column;align-items:center;text-align:center}
  .teacher-photo{width:120px;height:120px}
}