/* 玄元堂 V2 — 东方编辑设计
   低饱和、轻装饰、清晰层级。保留业务，重建界面。 */

:root {
  --paper: #f3f1eb;
  --paper-2: #ebe8df;
  --surface: #fbfaf6;
  --surface-soft: #f6f4ee;
  --ink: #20241f;
  --ink-2: #4f554d;
  --muted: #858a81;
  --line: #d9d8d0;
  --line-dark: #c6c7bf;
  --pine: #44554a;
  --pine-dark: #344139;
  --cinnabar: #8c4b3b;
  --cinnabar-soft: #eee2dc;
  --gold: #9a8254;
  --danger: #9a493f;
  --shadow: 0 18px 50px rgba(35, 40, 34, .06);
  --serif: "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -10%, rgba(154,130,84,.08), transparent 30rem),
    linear-gradient(90deg, rgba(62,72,62,.025) 1px, transparent 1px),
    linear-gradient(rgba(62,72,62,.025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 28px 28px, 28px 28px, auto;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  right: -120px;
  top: -170px;
  z-index: -1;
  width: 720px;
  height: 720px;
  border: 1px solid rgba(68,85,74,.06);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 70px rgba(68,85,74,.018),
    inset 0 0 0 140px rgba(68,85,74,.015),
    inset 0 0 0 210px rgba(68,85,74,.012);
  pointer-events: none;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--cinnabar); }

.hidden { display: none !important; }
.small, .hint { color: var(--muted); }
.danger { color: var(--danger); }
.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
}

.app {
  width: min(1500px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 24px 30px 36px;
}

/* Universal controls */
.btn, .primary-action, .quiet-action, .text-action {
  border: 0;
  border-radius: 3px;
  box-shadow: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-dark);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.btn:hover, .quiet-action:hover {
  border-color: var(--pine);
  color: var(--pine-dark);
  background: rgba(68,85,74,.045);
}

.btn.primary, .primary-action {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--pine);
  background: var(--pine);
  color: #fff;
  font-weight: 650;
  letter-spacing: .04em;
}

.btn.primary:hover, .primary-action:hover {
  border-color: var(--pine-dark);
  background: var(--pine-dark);
}

.btn.ghost, .btn.outline-action, .outline-action,
.dark-action, .return-strong-btn, .install-yellow-btn {
  border: 1px solid var(--line-dark) !important;
  background: transparent !important;
  color: var(--ink-2) !important;
  box-shadow: none !important;
}

.smallbtn { min-height: 34px; padding: 0 11px; font-size: 12px; }
.delete-soft-btn, .danger-btn, .access-disable-inline {
  border-color: rgba(154,73,63,.28) !important;
  color: var(--danger) !important;
  background: transparent !important;
}

.text-action {
  padding: 4px 0;
  border-bottom: 1px solid rgba(140,75,59,.28);
  background: transparent;
  color: var(--cinnabar);
  font-size: 13px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
}

.field input, .field select, .field textarea,
.case-select, .admin-days, .case-index-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-dark);
  border-radius: 3px;
  outline: 0;
  background: rgba(255,255,255,.6);
  color: var(--ink);
  box-shadow: none;
}

.field textarea { min-height: 92px; padding-block: 12px; resize: vertical; }

.field input:focus, .field select:focus, .field textarea:focus,
.case-select:focus, .case-index-search input:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 2px rgba(68,85,74,.08);
}

/* Header */
.site-header {
  min-height: 74px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  padding: 13px 18px;
  border: 1px solid var(--line);
  background: rgba(251,250,246,.88);
  box-shadow: 0 8px 28px rgba(35,40,34,.035);
}

.site-brand { display: flex; align-items: center; min-width: 0; }

.site-brand-copy { display: grid; gap: 2px; }
.site-brand-copy b {
  position: relative;
  padding-left: 13px;
  font: 600 21px var(--serif);
  letter-spacing: .18em;
}
.site-brand-copy b::before {
  content: "";
  position: absolute;
  left: 0;
  top: .16em;
  bottom: .16em;
  width: 2px;
  background: var(--cinnabar);
}
.site-brand-copy small { color: var(--muted); font-size: 10px; letter-spacing: .09em; }

.site-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 22px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.site-account-name { font-size: 13px; font-weight: 700; }
.site-account-status {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-size: 10px;
}

.site-actions { display: flex; align-items: center; gap: 5px; }
.quiet-action {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

/* Login */
.page-login .app { max-width: none; padding: 0; }
.xyt-r31-login {
  width: min(1180px, calc(100% - 40px));
  min-height: min(720px, calc(100vh - 64px));
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(350px, .72fr);
  margin: 32px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.xyt-r31-login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 62px 68px 48px;
  background:
    linear-gradient(90deg, rgba(248,246,239,.97), rgba(248,246,239,.72)),
    url("/xyt-topbar-bg-r3-1.png") center / cover no-repeat;
}
.xyt-r31-login-hero::after {
  content: "道法自然";
  position: absolute;
  right: 38px;
  top: 45px;
  writing-mode: vertical-rl;
  color: rgba(68,85,74,.24);
  font: 13px var(--serif);
  letter-spacing: .36em;
}
.xyt-r31-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  font: 600 20px var(--serif);
  letter-spacing: .22em;
}
.xyt-r31-badge i {
  width: 54px;
  height: 1px;
  display: block;
  background: linear-gradient(90deg, var(--cinnabar), transparent);
}
.xyt-r31-eyebrow { margin-top: 70px; color: var(--gold); font-size: 10px; letter-spacing: .22em; }
.xyt-r31-title {
  margin: 16px 0 20px;
  font: 500 clamp(43px, 5vw, 64px)/1.2 var(--serif);
  letter-spacing: .08em;
}
.xyt-r31-desc { max-width: 600px; color: var(--ink-2); font-size: 15px; line-height: 2; }
.xyt-r31-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 54px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.xyt-r31-step { padding: 0 20px; border-right: 1px solid var(--line); }
.xyt-r31-step:first-child { padding-left: 0; }
.xyt-r31-step:last-child { border-right: 0; }
.xyt-r31-step h4 { margin: 0 0 6px; font: 600 16px var(--serif); }
.xyt-r31-step p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }

.xyt-r31-auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 58px 48px;
  border-left: 1px solid var(--line);
}
.xyt-r31-auth .brand-title { margin: 0 0 6px; font: 600 31px var(--serif); letter-spacing: .14em; }
.xyt-r31-auth .brand-sub { color: var(--muted); font-size: 13px; }
.xyt-r31-auth .tabbar {
  display: flex;
  gap: 28px;
  margin: 30px 0 28px;
  border-bottom: 1px solid var(--line);
}
.xyt-r31-auth .tabbar button {
  min-height: 38px;
  padding: 0 1px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.xyt-r31-auth .tabbar button.active { border-bottom-color: var(--cinnabar); color: var(--ink); }
.login-form { display: grid; gap: 16px; }
.xyt-r31-auth .btn.primary { min-height: 46px; border-color: var(--cinnabar); background: var(--cinnabar); }
.xyt-r31-auth .center.small { margin-top: 4px; font-size: 11px; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* Hard reset for the legacy pill-style login tabs. */
body.page-login #root .xyt-r31-login .xyt-r31-auth .tabbar {
  width: 100% !important;
  min-height: 40px !important;
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-end !important;
  justify-content: flex-start !important;
  gap: 28px !important;
  margin: 30px 0 28px !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.page-login #root .xyt-r31-login .xyt-r31-auth .tabbar button {
  width: auto !important;
  min-width: 0 !important;
  height: 40px !important;
  min-height: 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 1px 10px !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  transform: none !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  line-height: 1 !important;
}

body.page-login #root .xyt-r31-login .xyt-r31-auth .tabbar button.active {
  border-bottom-color: var(--cinnabar) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}

/* Front workspace */
.consultation-shell {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(265px, 315px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.case-command, .consultation-main {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(251,250,246,.9);
  box-shadow: 0 12px 34px rgba(35,40,34,.04);
}
.case-command { padding: 25px 22px; }
.case-command > * {
  min-width: 0;
  max-width: 100%;
}
.case-command-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 15px; padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.case-command h1 { margin: 0; font: 600 26px var(--serif); letter-spacing: .08em; }
.case-picker-row { margin-top: 20px; }
.case-picker-row label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.xyt-r31-case-select {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 44px;
  padding: 0 38px 0 13px !important;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.consult-case-summary {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 15px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.consult-case-summary-main { min-width: 0; display: grid; gap: 5px; }
.consult-case-summary-main strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font: 600 20px var(--serif);
}
.consult-case-summary-main span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.6;
}
.consult-case-summary-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.consult-case-summary-meta span {
  padding: 3px 7px; border: 1px solid var(--line); border-radius: 2px;
  color: var(--muted); font-size: 10px;
}
.consult-case-summary.empty { color: var(--muted); font-size: 12px; }

.case-command-actions { margin-top: 18px; }
.case-command-actions .primary-action { width: 100%; }
.status-line {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 9px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.consultation-main { overflow: hidden; }
.consultation-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 25px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line);
}
.consultation-head h2 { margin: 0; font: 600 24px var(--serif); letter-spacing: .08em; }
.consultation-head p { max-width: 470px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; text-align: right; }
.chat-wrap { padding: 14px 16px 16px; }
.chat-box {
  height: calc(100vh - 290px);
  min-height: 500px;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid rgba(217,216,208,.8);
  background: rgba(243,241,235,.62);
}
.empty-state { min-height: 100%; display: grid; place-items: center; padding: 40px; text-align: center; color: var(--muted); }
.empty-state .icon { width: 58px; height: 58px; margin-bottom: 13px; border-radius: 50%; object-fit: cover; filter: saturate(.58); }
.empty-state h3 { margin: 0 0 8px; color: var(--ink); font: 500 22px var(--serif); letter-spacing: .06em; }
.empty-state p { max-width: 400px; margin: 0; font-size: 12px; line-height: 1.8; }
.msg { display: flex; gap: 9px; align-items: flex-start; margin: 14px 0; }
.msg.user { flex-direction: row-reverse; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
.bubble {
  max-width: min(760px, 82%);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 3px 11px 11px 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-wrap;
}
.msg.user .bubble { border-radius: 11px 3px 11px 11px; background: #e9e7df; }
.speaker { margin-bottom: 3px; color: var(--pine); font-size: 11px; font-weight: 700; }
.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  margin-top: 9px;
}
.composer textarea {
  width: 100%; height: 52px; min-height: 52px; padding: 12px 13px;
  border: 1px solid var(--line-dark); border-radius: 3px; outline: 0;
  background: var(--surface); resize: none;
}
.composer textarea:focus { border-color: var(--pine); }
.composer .primary-action { height: 52px; min-height: 52px; padding: 0; }
.composer .primary-action:disabled {
  border-color: var(--line-dark);
  background: #d9d7cf;
  color: #96988f;
  opacity: 1;
  cursor: not-allowed;
}

/* Case form */
.page-case-form .app { max-width: 1180px; }
.form-card {
  padding: 32px 38px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(251,250,246,.9);
  box-shadow: var(--shadow);
}
.form-title { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.form-title h2 { margin: 0; font: 600 28px var(--serif); letter-spacing: .08em; }
.form-section { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-section h3 { margin: 0 0 15px; color: var(--pine); font: 600 17px var(--serif); letter-spacing: .08em; }
.grid-basic { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.grid-time { display: grid; grid-template-columns: 1.3fr repeat(4, 1fr); gap: 10px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.choice-btn {
  min-height: 44px; border: 1px solid var(--line-dark); border-radius: 3px;
  background: transparent; color: var(--ink-2);
}
.choice-btn.active { border-color: var(--pine); background: var(--pine); color: #fff; }
.time-tip { margin-top: 13px; color: var(--muted); font-size: 11px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 24px; }
.form-error { margin-bottom: 15px; padding: 11px 13px; border-left: 3px solid var(--danger); background: rgba(154,73,63,.06); color: var(--danger); font-size: 12px; }

/* Admin architecture */
.page-admin .app { max-width: 1580px; }
.admin-shell {
  min-height: calc(100vh - 130px);
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  border: 1px solid var(--line);
  background: rgba(251,250,246,.9);
  box-shadow: var(--shadow);
}
.admin-sidebar {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 25px 16px 18px;
  border-right: 1px solid var(--line);
  background: rgba(235,232,223,.58);
}
.admin-sidebar-head { padding: 0 9px 19px; border-bottom: 1px solid var(--line); }
.admin-sidebar h1 { margin: 0; font: 600 23px var(--serif); letter-spacing: .08em; }
.admin-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px;
  margin-left: 5px; border-radius: 50%; background: var(--cinnabar); color: #fff;
  font: 11px var(--sans);
}
.admin-tabs { display: grid; gap: 4px; margin-top: 16px; }
.admin-tabs button {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}
.admin-tabs button:hover { background: rgba(68,85,74,.05); }
.admin-tabs button.active {
  border-left-color: var(--cinnabar);
  background: rgba(140,75,59,.065);
  color: var(--ink);
}
.admin-sidebar-note {
  margin-top: auto;
  padding: 18px 9px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}
.admin-content { min-width: 0; padding: 24px 26px 32px; }
.admin-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  margin-bottom: 16px; padding: 12px 14px;
  border: 1px solid rgba(154,130,84,.25); border-radius: 3px;
  background: rgba(154,130,84,.07); color: var(--ink-2); font-size: 12px;
}
.admin-notice b { color: var(--cinnabar); }
.admin-tools {
  display: flex; align-items: center; flex-wrap: wrap; gap: 9px;
  margin: 0 0 13px; padding: 0 0 13px; border-bottom: 1px solid var(--line);
}
.admin-tools label { color: var(--ink-2); font-size: 12px; }

.table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: auto;
  background: transparent;
}
.table th {
  padding: 11px 9px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 12px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  vertical-align: middle;
}
.table tr:hover td { background: rgba(68,85,74,.025); }
.table .left { text-align: left; }
.checkcell { width: 32px; }
.mini-avatar {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border-radius: 50%; object-fit: cover;
}
.avatar-letter { background: var(--cinnabar); color: #fff; font-size: 12px; font-weight: 700; }
.account-main { display: flex; align-items: center; gap: 9px; }
.avatar-click, .account-open, .link-btn { border: 0; background: transparent; color: inherit; text-align: left; }
.account-open b { color: var(--ink); font-size: 12px; text-decoration: none; }
.days-left { color: var(--cinnabar); font-size: 12px; font-weight: 700; }
.expire-date { color: var(--muted); font-size: 11px; }
.muted-pill, .access-status-active, .expiry-chip, .dup-pill {
  display: inline-flex; padding: 3px 6px; border: 1px solid var(--line);
  border-radius: 2px; background: transparent; color: var(--muted); font-size: 9px;
}

.access-editor { min-width: 220px; display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; }
.access-input-row { display: flex; align-items: center; gap: 5px; }
.access-input-row .admin-days { width: 76px; min-height: 32px; height: 32px; padding: 0 7px; font-size: 11px; }
.access-tag, .access-unit { color: var(--muted); font-size: 9px; white-space: nowrap; }
.access-btn-row { display: flex; gap: 5px; grid-column: 2; grid-row: 1 / span 2; }
.access-btn-row .btn { min-height: 32px; padding: 0 9px; font-size: 10px; }
.access-result { grid-column: 1 / -1; margin: 0; color: var(--cinnabar); font-size: 9px; }

.account-card, .case-card, .report-section, .runtime-section,
.report-trend-card, .report-card, .runtime-card {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: none;
}
.account-card, .case-card, .report-section, .runtime-section { padding: 17px; margin: 12px 0; }
.admin-detail-head, .report-head, .runtime-head, .case-index-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  margin-bottom: 18px;
}
.admin-detail-head h2, .admin-detail-head h3, .report-head h2,
.runtime-head h2, .case-index-head h2 {
  color: var(--ink); font-family: var(--serif); font-weight: 600;
}
.admin-actions, .case-index-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.case-index-search { display: flex; gap: 6px; min-width: min(460px, 100%); }
.case-index-search input { min-height: 36px; height: 36px; }
.report-grid, .runtime-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px;
}
.report-card, .runtime-card { padding: 16px; }
.report-card .value, .runtime-card .value { color: var(--ink); font: 600 27px var(--serif); }
.report-two, .report-trend-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toast {
  position: fixed; right: 20px; top: 20px; z-index: 99;
  max-width: 340px; padding: 15px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow);
}

/* Modals and utilities */
.music-float, .music-float-safe-fixed {
  position: fixed !important;
  right: 18px !important;
  bottom: 18px !important;
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border: 1px solid var(--line-dark) !important;
  border-radius: 50% !important;
  background: rgba(251,250,246,.9) !important;
  color: var(--pine) !important;
  box-shadow: 0 7px 20px rgba(35,40,34,.08) !important;
  opacity: .78;
}
.music-float #musicFloatText { display: none !important; }

/* Medium desktop and tablet */
@media (max-width: 1150px) {
  .app { padding: 16px; }
  .site-header { grid-template-columns: 1fr auto; }
  .site-account { display: none; }
  .consultation-shell { grid-template-columns: 1fr; }
  .case-command { display: block; padding: 22px 24px; }
  .case-picker-row { margin-top: 16px; }
  .consult-case-summary {
    min-height: 0;
    margin-top: 13px;
    padding: 14px 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .case-command-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 0;
    border: 0;
  }
  .case-command-actions .primary-action {
    width: 150px;
    flex: 0 0 150px;
    white-space: nowrap;
  }
  .case-command-actions .status-line {
    min-width: 0;
    margin: 0;
  }
  .chat-box { height: auto; min-height: 470px; }
  .admin-shell { grid-template-columns: 180px minmax(0,1fr); }
  .admin-content { padding: 20px 18px 28px; overflow-x: auto; }
  .report-grid, .runtime-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Mobile */
@media (max-width: 700px) {
  body::before { width: 440px; height: 440px; right: -180px; top: -120px; }
  .app { padding: 8px; }
  .site-header {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }
  .site-brand-copy small { display: none; }
  .site-actions { display: grid; grid-template-columns: repeat(3,1fr); }
  .quiet-action { min-height: 32px; border-color: var(--line); font-size: 10px; }

  .xyt-r31-login {
    width: calc(100% - 16px);
    min-height: calc(100vh - 16px);
    grid-template-columns: 1fr;
    margin: 8px;
  }
  .xyt-r31-login-hero { min-height: 220px; padding: 28px 24px; }
  .xyt-r31-login-hero::after, .xyt-r31-desc, .xyt-r31-steps { display: none; }
  .xyt-r31-eyebrow { margin-top: 28px; }
  .xyt-r31-title { margin: 10px 0 0; font-size: 34px; }
  .xyt-r31-auth { padding: 32px 24px 38px; border-left: 0; border-top: 1px solid var(--line); }

  .case-command {
    display: block;
    padding: 17px 15px;
  }
  .case-command-heading { padding-bottom: 14px; }
  .case-command h1 { font-size: 22px; }
  .case-picker-row { margin-top: 14px; }
  .consult-case-summary { margin-top: 11px; padding: 12px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .case-command-actions {
    display: block;
    margin-top: 12px;
    padding-top: 12px;
  }
  .case-command-actions .primary-action { width: 100%; }
  .case-command-actions .status-line { margin-top: 8px; }
  .consultation-head { display: block; padding: 16px; }
  .consultation-head p { margin-top: 6px; text-align: left; }
  .chat-wrap { padding: 7px; }
  .chat-box { min-height: 360px; padding: 12px; }
  .empty-state { padding: 32px 12px; }
  .bubble { max-width: 88%; font-size: 13px; }
  .composer { grid-template-columns: minmax(0,1fr) 62px; gap: 6px; }
  .composer textarea, .composer .primary-action { height: 48px; min-height: 48px; }

  .form-card { padding: 22px 15px; }
  .grid-basic, .grid-time { grid-template-columns: 1fr 1fr; }
  .grid-basic .field:first-child { grid-column: 1 / -1; }
  .form-actions .btn { width: 100%; }

  .admin-shell { min-height: auto; grid-template-columns: 1fr; }
  .admin-sidebar { padding: 17px 12px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-sidebar-head { padding: 0 4px 13px; }
  .admin-tabs {
    display: flex;
    gap: 3px;
    margin: 0;
    padding: 8px 0;
    overflow-x: auto;
  }
  .admin-tabs button {
    min-width: max-content;
    min-height: 36px;
    padding: 0 11px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    font-size: 11px;
  }
  .admin-tabs button.active {
    border-bottom-color: var(--cinnabar);
    background: transparent;
  }
  .admin-sidebar-note { display: none; }
  .admin-content { padding: 14px 10px 22px; }
  .admin-notice { align-items: flex-start; }
  .admin-tools { align-items: flex-start; }
  .table { min-width: 820px; }
  .report-grid, .runtime-grid, .report-two, .report-trend-pair { grid-template-columns: 1fr; }
  .admin-detail-head, .report-head, .runtime-head, .case-index-head { display: block; }
  .admin-actions, .case-index-search { margin-top: 12px; }
  .case-index-search { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
