:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #17211d;
  background: #f3f5f4;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f3f5f4; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-panel { width: min(100%, 420px); background: #fff; border: 1px solid #e1e6e3; border-radius: 8px; padding: 28px 24px; box-shadow: 0 12px 34px rgba(22, 43, 34, .08); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark { width: 52px; height: 52px; flex: 0 0 52px; background: url("/static/app-icon-64.png") center/contain no-repeat; }
h1 { font-size: 22px; margin: 0; font-weight: 650; }
.subtitle { color: #6c7772; font-size: 14px; margin: 5px 0 0; }
.form-grid { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-size: 14px; color: #47534e; }
input, select, textarea { width: 100%; border: 1px solid #cfd7d3; border-radius: 6px; background: #fff; padding: 11px 12px; color: #17211d; outline: none; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #07a950; box-shadow: 0 0 0 3px rgba(7, 193, 96, .12); }
.primary { width: 100%; border: 0; border-radius: 6px; padding: 12px 16px; background: #07c160; color: #fff; font-weight: 650; }
.primary:disabled { opacity: .55; cursor: wait; }
.secondary { border: 1px solid #ccd5d0; border-radius: 6px; padding: 9px 13px; background: #fff; color: #26332d; }
.danger { color: #d74747; }
.form-footer { margin-top: 20px; text-align: center; color: #7a8580; font-size: 14px; }
a { color: #078d49; text-decoration: none; }
.error { min-height: 20px; margin: 0; color: #d13e3e; font-size: 14px; }
.avatar-upload { display: flex; gap: 14px; align-items: center; }
.avatar-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; background: #e8ecea; border: 1px solid #d7dedb; }
.page-shell { min-height: 100vh; }
.topbar { height: 58px; background: #fff; border-bottom: 1px solid #e1e5e3; display: flex; align-items: center; justify-content: space-between; padding: 0 max(16px, calc((100vw - 1120px)/2)); }
.topbar strong { font-size: 17px; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.content { width: min(1120px, calc(100% - 32px)); margin: 24px auto; }
.section { background: #fff; border: 1px solid #e1e6e3; border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.section h2 { font-size: 18px; margin: 0 0 18px; }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.toolbar label { min-width: 130px; }
.invite-result { margin: 14px 0 0; padding: 12px; background: #f0f8f4; border-left: 3px solid #07c160; overflow-wrap: anywhere; }
.user-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.user-table th, .user-table td { padding: 12px 9px; text-align: left; border-bottom: 1px solid #e8ecea; }
.user-table th { color: #65706b; font-weight: 600; }
.status { display: inline-block; padding: 3px 8px; border-radius: 12px; background: #e8f7ef; color: #078644; }
.status.disabled { background: #f8eaea; color: #bd3f3f; }
.topbar nav a.active { color: #056b38; font-weight: 650; }
.admin-doctors-content { max-width: 1120px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-heading h1 { margin: 0; font-size: 22px; }
.page-heading p { margin: 6px 0 0; color: #6c7772; font-size: 14px; }
.icon-command { width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 0; border-radius: 6px; background: #07c160; color: #fff; font-size: 26px; line-height: 1; }
.icon-command:hover { background: #06ab55; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; }
.doctor-form-section { border-color: #b9d9c5; }
.doctor-form { display: grid; gap: 16px; }
.doctor-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.doctor-form label { min-width: 0; }
.doctor-form input[type="file"] { padding: 8px; }
.consent { display: flex; align-items: center; gap: 8px; }
.consent input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; }
.form-actions .primary { width: auto; min-width: 116px; }
.form-status { min-height: 20px; margin: 0; color: #5d6a64; font-size: 14px; }
.field-error { min-height: 0; color: #d13e3e; font-size: 12px; line-height: 1.4; }
.field-error:not(:empty) { min-height: 17px; }
.doctor-form [aria-invalid="true"] { border-color: #d13e3e; }
.view-switch { display: flex; gap: 6px; margin: 0 0 12px; }
.view-tab { border: 1px solid #ccd5d0; border-radius: 6px; padding: 8px 12px; background: #fff; color: #53605a; }
.view-tab.active { border-color: #07c160; background: #eaf8f0; color: #087c41; font-weight: 650; }
.doctor-kind-switch { display: flex; gap: 6px; margin: 0 0 12px; }
.doctor-kind-tab { border: 1px solid #ccd5d0; border-radius: 6px; padding: 9px 14px; background: #fff; color: #53605a; }
.doctor-kind-tab.active { border-color: #07c160; background: #eaf8f0; color: #087c41; font-weight: 650; }
.personal-search { margin: 0 0 12px; }
.personal-search label { max-width: 420px; }
.publication-editor { border-color: #b9d9c5; }
.publication-description { margin: 0 0 14px; color: #5d6a64; font-size: 14px; overflow-wrap: anywhere; }
.publication-modes { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; }
.publication-modes label { display: flex; align-items: center; gap: 7px; }
.publication-modes input { width: auto; }
.publication-selection { display: grid; gap: 12px; }
.publication-users { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; border: 1px solid #e1e6e3; border-radius: 6px; padding: 10px; }
.publication-user { display: flex; align-items: flex-start; gap: 8px; color: #26332d; overflow-wrap: anywhere; }
.publication-user input { width: auto; flex: 0 0 auto; margin-top: 2px; }
.publication-user span { min-width: 0; }
.list-count { color: #6c7772; font-size: 14px; }
.empty-state { margin: 0; padding: 20px 0; color: #6c7772; font-size: 14px; }
.table-scroll { overflow-x: auto; }
.doctor-table { width: 100%; min-width: 660px; border-collapse: collapse; font-size: 14px; }
.doctor-table th, .doctor-table td { padding: 12px 9px; text-align: left; vertical-align: middle; border-bottom: 1px solid #e8ecea; }
.doctor-table th { color: #65706b; font-weight: 600; }
.doctor-identity { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.doctor-identity > div { min-width: 0; display: grid; gap: 3px; }
.doctor-identity strong, .doctor-identity span { overflow-wrap: anywhere; }
.doctor-identity span { color: #6c7772; font-size: 13px; }
.doctor-owner { white-space: pre-line; overflow-wrap: anywhere; }
.doctor-thumb { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 6px; object-fit: cover; background: #e8ecea; }
.model-status { font-weight: 600; }
.model-status.ready { color: #078644; }
.model-status.building { color: #9a6d09; }
.model-status.failed { color: #bd3f3f; }
.doctor-actions { white-space: nowrap; }
.doctor-actions .secondary + .secondary { margin-left: 6px; }
@media (max-width: 680px) {
  .auth-shell { padding: 0; background: #fff; align-items: start; }
  .auth-panel { border: 0; box-shadow: none; padding-top: 46px; }
  .content { width: 100%; margin: 0; }
  .section { border-width: 0 0 1px; border-radius: 0; margin: 0; }
  .user-table thead { display: none; }
  .user-table tr { display: grid; padding: 10px 0; border-bottom: 1px solid #e8ecea; }
  .user-table td { border: 0; padding: 4px 0; }
  .topbar { height: auto; min-height: 58px; display: grid; grid-template-columns: 1fr; align-items: center; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .topbar strong { white-space: nowrap; }
  .topbar nav { width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 8px 16px; }
  .page-heading { margin: 18px 16px; }
  .page-heading h1 { font-size: 20px; }
  .doctor-form-grid { grid-template-columns: 1fr; }
  .doctor-form-section { padding: 20px 16px; }
  .view-switch { margin: 0 16px 12px; }
  .doctor-kind-switch { margin: 0 16px 12px; flex-wrap: wrap; }
  .personal-search { margin: 0 16px 12px; }
  .publication-editor { padding: 20px 16px; }
  .publication-modes { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .publication-users { max-height: 280px; }
  .publication-user { align-items: flex-start; }
  .doctor-list-section { padding: 20px 16px; }
  .doctor-table { min-width: 0; }
  .doctor-table thead { display: none; }
  .doctor-table, .doctor-table tbody, .doctor-table tr, .doctor-table td { display: block; width: 100%; }
  .doctor-table tr { padding: 12px 0; border-bottom: 1px solid #e8ecea; }
  .doctor-table td { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; border: 0; padding: 5px 0; overflow-wrap: anywhere; }
  .doctor-table td::before { content: attr(data-label); color: #65706b; font-size: 13px; }
  .doctor-table .doctor-identity { display: flex; }
  .doctor-table .doctor-identity::before { content: none; }
  .doctor-actions { white-space: normal; display: flex !important; grid-template-columns: none !important; flex-wrap: wrap; }
  .doctor-actions::before { display: none; }
  .doctor-actions .secondary { margin: 0 !important; }
  .form-actions .primary { width: 100%; }
}
