:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-strong: #eef3f7;
  --text: #15202b;
  --muted: #607080;
  --line: #d8e0e8;
  --brand: #1976b9;
  --brand-dark: #115b91;
  --ok: #16835c;
  --warn: #a46300;
  --danger: #b42318;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eaf3f9 0, #f3f5f7 180px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(25, 118, 185, 0.13);
  outline: 0;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
}

.member-shell {
  max-width: 760px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px 0 2px;
}

.topbar h1 {
  font-size: 26px;
  line-height: 1.15;
  margin-top: 5px;
}

.topbar p {
  color: var(--muted);
  margin-top: 4px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border: 1px solid rgba(25, 118, 185, 0.2);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}

.tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.overview div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.overview strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.overview span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 1px 2px rgba(21, 32, 43, 0.04);
}

.panel h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.member-summary {
  margin-bottom: 14px;
  border: 1px solid rgba(25, 118, 185, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.member-summary h2 {
  font-size: 20px;
}

.member-summary p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 6px;
}

.teacher-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 1px 2px rgba(21, 32, 43, 0.04);
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e1f1fb, #f8efe2);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(21, 32, 43, 0.06);
}

.teacher-main {
  min-width: 0;
}

.teacher-title-row,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.teacher-title-row h3 {
  font-size: 17px;
}

.grade-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  margin-top: 5px;
}

.grade-s {
  background: #eef7ef;
  color: #216e39;
}

.grade-ss {
  background: #eef4ff;
  color: #2458a6;
}

.grade-ssr {
  background: #fff1db;
  color: #9a5200;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f5ff;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.status-idle {
  background: #e9f7ef;
  color: #146c45;
}

.status-preparing {
  background: #fff4df;
  color: #875100;
}

.status-arrived {
  background: #e9f7ef;
  color: #146c45;
}

.status-teaching {
  background: #e8f5ff;
  color: #115b91;
}

.status-finished {
  background: #eef1f4;
  color: #53606b;
}

.status-next_time {
  background: #f0ecff;
  color: #5643a3;
}

.specialties,
.bio,
.profile,
.next-time,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.member-booking {
  display: grid;
  gap: 8px;
  margin-top: 13px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.member-booking button {
  flex: 1 1 150px;
}

.teacher-media {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.teacher-media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.teacher-media-image,
.teacher-media-video {
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  object-fit: cover;
}

.teacher-media-grid .teacher-media-image {
  aspect-ratio: 1 / 1;
  max-height: none;
}

.activity-media {
  display: grid;
  gap: 6px;
}

.activity-media span {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef4ff;
  color: #2458a6;
  font-size: 12px;
  font-weight: 700;
}

.teacher-media-video {
  max-height: 320px;
}

.list {
  display: grid;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-strong);
}

tbody tr:hover {
  background: #f8fafc;
}

.notice,
.loading,
.error {
  max-width: 720px;
  margin: 28px auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
}

.error {
  border-color: #ffd0cc;
  color: var(--danger);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}

.stat strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

@media (max-width: 680px) {
  .shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .teacher-card {
    grid-template-columns: 48px 1fr;
  }

  .avatar {
    width: 48px;
    height: 48px;
  }
}
