/* Verbatim component styles from the desktop app (app_gradio.py css block),
   filtered to .gao-* / .mat-* rules. */

.mat-brand-wrap {
      background: linear-gradient(130deg, rgba(10,23,49,0.96), rgba(9,30,61,0.96));
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 12px 14px;
      box-shadow: 0 10px 28px rgba(0,0,0,0.35);
      margin-bottom: 8px;
    }

.mat-brand-row { display: flex; gap: 12px; align-items: center; }

.mat-brand-title {
      font-size: 26px;
      font-weight: 800;
      line-height: 1.05;
      letter-spacing: 0.02em;
      color: #eaf3ff;
      text-shadow: 0 0 24px rgba(83,212,255,0.35);
    }

.mat-brand-sub { color: var(--muted); font-size: 13px; letter-spacing: 0.01em; margin-top: 3px; }

.mat-card {
      background: linear-gradient(180deg, rgba(17,33,66,0.90), rgba(13,26,54,0.90));
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 12px;
      box-shadow: 0 8px 18px rgba(0,0,0,0.32);
    }

.gao-layout { gap: 12px; align-items: stretch; flex-wrap: wrap; }

.gao-panel {
      background: linear-gradient(180deg, rgba(16,30,58,0.80), rgba(12,26,52,0.80));
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 10px;
    }

.gao-left { min-width: 270px; max-width: 340px; }

.gao-right { min-width: 320px; max-width: 420px; }

.gao-center { min-height: 560px; min-width: 560px; }

.mat-dash { align-items: flex-start; gap: 16px; }

.mat-casehub-top-actions { align-items: stretch; gap: 16px; margin-bottom: 4px; }

.mat-casehub-top-actions .gr-button { height: 100%; min-height: 40px; }

.mat-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: rgba(6,16,36,0.65); }

.mat-case-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--txt); }

.mat-case-table th {
      text-align: left; padding: 10px 12px; background: rgba(26,52,96,0.85);
      color: var(--silver); font-weight: 600; border-bottom: 1px solid var(--line);
    }

.mat-case-table td { padding: 9px 12px; border-bottom: 1px solid rgba(45,95,149,0.35); vertical-align: top; }

.mat-case-table tr.mat-case-row { cursor: pointer; }

.mat-case-table tr.mat-case-row:hover td { background: rgba(42,128,218,0.12); }

.mat-case-table tr.mat-row-selected td {
      background: rgba(42,128,218,0.34) !important;
      box-shadow: inset 4px 0 0 #53d4ff;
    }

.mat-case-table td.mat-src { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mat-case-table .mat-empty { text-align: center; color: var(--muted); padding: 20px; }

.mat-past { color: var(--muted); font-size: 12px; }

.mat-sidebar-host { min-height: 280px; }

.mat-sidebar-inner { color: var(--txt); font-size: 14px; line-height: 1.45; }

.mat-callout {
      background: rgba(42,128,218,0.12); border: 1px solid rgba(83,212,255,0.35);
      border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
    }

.mat-sidebar-card {
      background: linear-gradient(180deg, rgba(20,38,72,0.95), rgba(14,28,54,0.95));
      border: 1px solid var(--line); border-radius: 12px; padding: 14px;
    }

.mat-sidebar-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; color: #eaf3ff; }

.mat-sidebar-list { list-style: none; padding: 0; margin: 0 0 12px; }

.mat-sidebar-list li { margin-bottom: 6px; }

.mat-sidebar-list span { color: var(--muted); display: inline-block; min-width: 110px; }

.mat-src-detail { font-size: 12px; color: var(--muted); word-break: break-all; }

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

.mat-new-case {
      background: linear-gradient(165deg, rgba(22,44,82,0.95), rgba(12,26,52,0.92));
      border: 1px solid rgba(90,200,255,0.45); border-radius: 14px; padding: 14px 16px;
      box-shadow: 0 12px 28px rgba(0,0,0,0.35);
    }

.mat-new-case h3 { margin: 0 0 10px; font-size: 18px; color: #eaf3ff; }

.mat-new-case > .gr-markdown:first-child .mat-section-title { margin-bottom: 10px; }

.mat-section-title { font-size: 15px; font-weight: 700; color: #eaf3ff; margin: 0 0 8px; letter-spacing: 0.02em; }

#mat_footer_host .mat-footer-sticky {
      position: static !important;
      inset: auto !important;
      padding: 0 !important;
      margin: 0 !important;
      pointer-events: auto !important;
      width: 100% !important;
      box-sizing: border-box !important;
    }

.mat-footer-sticky {
      position: static;
      padding: 0;
      margin: 0;
      pointer-events: auto;
      box-sizing: border-box;
      width: 100%;
    }

#mat_footer_host .mat-footer-sticky .mat-footer-bar,
    .mat-footer-sticky .mat-footer-bar { pointer-events: auto; }

.mat-footer-bar {
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      width: 100%;
      box-sizing: border-box;
      margin: 0;
      padding: 10px max(14px, env(safe-area-inset-right)) max(10px, calc(10px + env(safe-area-inset-bottom))) max(14px, env(safe-area-inset-left));
      border-radius: 0;
      border: none;
      border-top: 1px solid #2a5080;
      background: linear-gradient(90deg, #0c1628, #152a4a);
      font-size: 12px; color: var(--muted);
      box-shadow: none;
    }

.mat-footer-mid { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mat-eval-tab-root {
      background: #0b1220;
      border: 1px solid #2e6fb8;
      border-radius: 12px;
      padding: 12px;
      box-shadow: 0 10px 24px rgba(0,0,0,0.42);
      box-sizing: border-box;
    }

.mat-eval-layout { align-items: stretch !important; }

.mat-eval-panel {
      background: linear-gradient(180deg, rgba(15,27,53,0.98), rgba(9,20,42,0.98)) !important;
      border: 1px solid #2e6fb8 !important;
      box-shadow: 0 10px 24px rgba(0,0,0,0.42) !important;
    }

.mat-eval-panel .gr-markdown h3 { color: #eaf3ff !important; margin-top: 0; }

.mat-eval-panel-side label, .mat-eval-panel-main label { color: #d5e4f6 !important; }

.mat-eval-viewer-wrap {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 2px;
      min-height: 420px;
    }

#mat_eval_lock_pose_btn button.mat-lock-off {
      background: linear-gradient(90deg, #2f9ad6, #6fe3ff) !important;
      border-color: #84e7ff !important;
      color: #08203f !important;
      box-shadow: 0 0 0 1px rgba(111,227,255,0.18), 0 0 18px rgba(111,227,255,0.26) !important;
    }

#mat_eval_lock_pose_btn button.mat-lock-off::before {
      left: auto !important;
      right: 8px !important;
    }

#mat_eval_lock_pose_btn button.mat-lock-on {
      background: linear-gradient(90deg, #123865, #1f4f8c) !important;
      border-color: #2d6bb2 !important;
      color: #f7fcff !important;
      box-shadow: 0 0 0 1px rgba(83,146,214,0.24), 0 0 18px rgba(36,90,150,0.28) !important;
    }

#mat_eval_lock_pose_btn button.mat-lock-on::before {
      right: auto !important;
      left: 8px !important;
    }

#mat_eval_pose_pad.mat-pose-locked {
      opacity: 0.60;
      filter: saturate(0.65);
      border-color: #315984;
    }

#mat_eval_pose_pad.mat-pose-locked .mat-pose-btn {
      pointer-events: none;
      cursor: not-allowed;
      opacity: 0.55;
    }

#mat_eval_pose_pad.mat-pose-locked::after {
      content: "Meniscus position locked";
      display: block;
      margin-top: 8px;
      font-size: 11px;
      color: #b7d5f5;
      text-align: center;
      letter-spacing: 0.01em;
    }

.mat-eval-hidden-slider { display: none !important; }

.mat-eval-pose-pad {
      border: 1px solid #2f5f93;
      border-radius: 10px;
      padding: 8px 8px 10px;
      background: linear-gradient(180deg, rgba(8,20,41,0.95), rgba(7,17,34,0.95));
      margin-bottom: 8px;
    }

.mat-eval-pose-head {
      color: #d5e4f6;
      font-size: 12px;
      font-weight: 700;
      margin-bottom: 6px;
      letter-spacing: 0.01em;
    }

.mat-eval-depth-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 8px;
    }

.mat-depth-label {
      color: #d5e4f6;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.01em;
    }

.mat-depth-btn {
      width: 40px;
      height: 36px;
      font-size: 20px !important;
      font-weight: 900 !important;
    }

.mat-eval-pose-cross {
      position: relative;
      width: 100%;
      max-width: 248px;
      height: 226px;
      margin: 0 auto 10px;
      border: 1px solid rgba(95, 150, 210, 0.35);
      border-radius: 10px;
      background: radial-gradient(120px 92px at 50% 50%, rgba(83,212,255,0.14), rgba(5,15,28,0.0));
    }

.mat-pose-node {
      position: absolute;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
    }

.mat-pose-lbl {
      color: #cfe5ff;
      font-size: 11px;
      font-weight: 700;
      line-height: 1;
      letter-spacing: 0.03em;
      text-shadow: 0 1px 3px rgba(0,0,0,0.7);
      min-width: 12px;
      text-align: center;
    }

.mat-pose-up { top: 10px; left: 50%; transform: translateX(-50%); }

.mat-pose-down { bottom: 10px; left: 50%; transform: translateX(-50%); }

.mat-pose-left { left: 10px; top: 50%; transform: translateY(-50%); }

.mat-pose-right { right: 10px; top: 50%; transform: translateY(-50%); }

.mat-pose-cartoon {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 86px;
      height: 86px;
      border-radius: 9px;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
    }

.mat-pose-cartoon svg { width: 88%; height: 88%; }

.mat-pose-btn {
      width: 34px;
      height: 34px;
      border-radius: 8px !important;
      border: 1px solid #4f87bf !important;
      background: linear-gradient(180deg, #173764, #11294a) !important;
      color: #dff0ff !important;
      font-weight: 800 !important;
      font-size: 16px !important;
      line-height: 1 !important;
      padding: 0 !important;
    }

.mat-pose-btn:hover { border-color: #73c8ff !important; color: #ffffff !important; }

.mat-eval-rot-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      margin-top: 4px;
      color: #c7dcf4;
      font-size: 12px;
    }

.mat-rot-btn { width: 30px; height: 28px; font-size: 15px !important; }

.mat-entry-pad {
      border: 1px solid #2f5f93;
      border-radius: 10px;
      padding: 8px;
      background: linear-gradient(180deg, rgba(8,20,41,0.95), rgba(7,17,34,0.95));
      margin-top: 8px;
    }

.mat-entry-title {
      color: #d5e4f6;
      font-size: 12px;
      font-weight: 700;
      margin-bottom: 6px;
      letter-spacing: 0.01em;
    }

.mat-entry-cross {
      position: relative;
      width: 142px;
      height: 110px;
      margin: 0 auto;
      border: 1px solid rgba(95,150,210,0.35);
      border-radius: 10px;
      background: radial-gradient(80px 56px at 50% 50%, rgba(83,212,255,0.11), rgba(5,15,28,0.0));
    }

.mat-entry-btn { position: absolute; width: 34px; height: 34px; }

.mat-entry-up { left: 50%; top: 6px; transform: translateX(-50%); }

.mat-entry-down { left: 50%; bottom: 6px; transform: translateX(-50%); }

.mat-entry-left { left: 8px; top: 50%; transform: translateY(-50%); }

.mat-entry-right { right: 8px; top: 50%; transform: translateY(-50%); }

.mat-entry-core {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      color: #d5e4f6;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.04em;
      pointer-events: none;
    }

.mat-entry-dist-wrap {
      margin-top: 10px;
      border: 1px solid rgba(67,126,182,0.42);
      border-radius: 10px;
      padding: 8px 10px;
      background: linear-gradient(180deg, rgba(8,18,34,0.92), rgba(7,16,31,0.9));
    }

.mat-entry-dist-head {
      color: #d6e6f8;
      font-size: 12px;
      font-weight: 700;
      margin-bottom: 6px;
      letter-spacing: 0.01em;
    }

.mat-entry-dist-row {
      color: #c2d8ef;
      font-size: 12px;
      line-height: 1.4;
      margin-top: 2px;
    }

.mat-entry-dist-row strong {
      color: #ffffff;
      font-weight: 800;
      font-size: 13px;
    }

.mat-fix-metrics-wrap {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-top: 10px;
      margin-bottom: 6px;
    }

.mat-fix-metric-card {
      border: 1px solid #2e6fb8;
      border-radius: 10px;
      background: linear-gradient(180deg, rgba(10,21,41,0.92), rgba(8,18,36,0.9));
      padding: 10px 12px;
    }

.mat-fix-metric-head {
      color: #eaf3ff;
      font-size: 14px;
      font-weight: 800;
      margin-bottom: 6px;
      letter-spacing: 0.02em;
    }

.mat-fix-metric-row {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      margin-top: 4px;
      color: #bcd3ed;
      font-size: 13px;
    }

.mat-fix-metric-row strong {
      color: #ffffff;
      font-size: 15px;
      font-weight: 800;
      letter-spacing: 0.01em;
    }

.mat-fix-metric-subhead {
      margin-top: 10px;
      margin-bottom: 4px;
      color: #d7e8fb;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.01em;
    }

.mat-fix-anchor-indent {
      margin-left: 14px;
      padding-left: 10px;
      border-left: 1px solid rgba(109, 162, 210, 0.42);
      margin-top: 6px;
    }

.mat-fix-anchor-choice-row {
      display: grid;
      grid-template-columns: 1fr;
      gap: 6px;
    }

.mat-fix-socket-panel {
      margin-top: 10px;
      padding: 8px 10px 4px;
      border: 1px solid rgba(78, 132, 188, 0.42);
      border-radius: 8px;
      background: linear-gradient(180deg, rgba(9, 21, 40, 0.78), rgba(7, 17, 33, 0.78));
    }

.mat-fix-socket-panel > .markdown {
      margin-bottom: 4px;
    }

.mat-planner-topbar .tab-nav button { font-weight: 650; letter-spacing: 0.03em; }

.mat-processing-backdrop {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 25000;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(2, 6, 18, 0.88);
      backdrop-filter: blur(16px) saturate(1.02);
      -webkit-backdrop-filter: blur(16px) saturate(1.02);
    }

.mat-processing-card {
      max-width: 460px;
      margin: 16px;
      padding: 24px 28px;
      border-radius: 14px;
      border: 1px solid rgba(110, 200, 255, 0.55);
      background: linear-gradient(180deg, #142a52 0%, #0d1c38 100%);
      box-shadow: 0 8px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.35) inset;
      opacity: 1;
    }

.mat-processing-title {
      font-size: 20px;
      font-weight: 800;
      color: #eaf3ff;
      margin: 0 0 10px;
      letter-spacing: 0.02em;
    }

.mat-processing-text {
      color: #c5d8f0;
      font-size: 14px;
      line-height: 1.45;
      margin: 0;
    }

.mat-processing-progress-row {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 18px;
    }

.mat-processing-progress-track {
      flex: 1 1 auto;
      min-width: 0;
      height: 10px;
      border-radius: 999px;
      background: rgba(255,255,255,0.1);
      overflow: hidden;
      border: 1px solid rgba(90,200,255,0.25);
    }

.mat-processing-progress-fill {
      height: 100%;
      min-width: 0;
      border-radius: 999px;
      background: linear-gradient(90deg, #2a6ab0, #53d4ff);
      transition: width 0.18s ease-out;
    }

.mat-processing-pct-inline {
      flex: 0 0 auto;
      font-size: 15px;
      font-weight: 700;
      color: #eaf3ff;
      letter-spacing: 0.04em;
      min-width: 3.25em;
      text-align: right;
    }

.mat-processing-timer {
      margin-top: 10px;
      text-align: center;
      font-size: 13px;
      color: #9cb7d9;
      letter-spacing: 0.02em;
    }

.mat-processing-timer strong {
      color: #dce7f7;
      font-weight: 700;
    }

.mat-processing-desc {
      color: #9cb7d9;
      font-size: 12px;
      margin: 10px 0 0 0;
      line-height: 1.35;
      word-break: break-word;
    }

.mat-processing-desc--muted { color: #6b8ab8; font-style: italic; }

.mat-study-setup {
      background: linear-gradient(180deg, rgba(16,32,62,0.92), rgba(12,26,52,0.88));
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 12px 14px;
      margin-bottom: 14px;
    }

.mat-right-workflow {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

.mat-details-bottom-wrap {
      padding-top: 12px;
      margin-top: 0;
      border-top: 1px solid rgba(45,95,149,0.45);
    }

.mat-manager-status {
      margin-bottom: 50px !important;
    }

.mat-demo-compact .gr-form { gap: 6px; }

.mat-demo-compact label { font-size: 13px !important; }

.mat-upload-compact .file-preview,
    .mat-upload-compact .file-preview-holder,
    .mat-upload-compact .file-list,
    .mat-upload-compact ul[class*="file"] {
      display: none !important;
      max-height: 0 !important;
      overflow: hidden !important;
      margin: 0 !important;
      padding: 0 !important;
    }

.mat-upload-compact .wrap { min-height: auto !important; }

.mat-casehub-gap { height: 22px; }

/* Card inset comes from inner .mat-new-case Group; keep column flush with the right column */
    .mat-saved-studies-zone {
      margin-top: 0;
      padding-top: 0;
      border-top: none;
    }

.mat-saved-studies-zone .mat-new-case > .gr-markdown:first-child .mat-section-title,
    .mat-saved-studies-zone .mat-section-title { margin-top: 0 !important; }

.mat-storage-block.mat-storage-tight {
      margin-top: 0 !important;
      margin-bottom: 0 !important;
      padding-bottom: 0 !important;
      gap: 0 !important;
    }

.mat-storage-tight .mat-section-title {
      margin-top: 0 !important;
      margin-bottom: 4px !important;
    }

.mat-storage-row { align-items: center; gap: 8px; flex-wrap: nowrap; margin: 0 !important; }

.mat-storage-row .mat-storage-text { flex: 1 1 auto; min-width: 0; }

.mat-storage-row > * { margin-bottom: 0 !important; }

.mat-storage-row .block,
    .mat-storage-row [class*="textbox"],
    .mat-storage-row [class*="file"] {
      margin-bottom: 0 !important;
    }

/* Empty MRI summary sits here; collapse chrome + cancel flex gap below storage column */
    .mat-right-workflow .mat-storage-block + .mat-upload-summary {
      margin-top: -10px !important;
    }

.mat-upload-summary {
      margin-bottom: 0 !important;
      padding: 0 !important;
      min-height: 0 !important;
    }

.mat-upload-summary .prose:empty {
      display: none !important;
      margin: 0 !important;
      padding: 0 !important;
      min-height: 0 !important;
    }

/* Compact ⋯ folder picker: no tall drop zone */
    .mat-storage-folder-pick {
      flex: 0 0 40px !important;
      width: 40px !important;
      max-width: 40px !important;
      min-width: 40px !important;
      margin-bottom: 0 !important;
      min-height: 0 !important;
    }

.mat-storage-folder-pick .block,
    .mat-storage-folder-pick > div { padding: 0 !important; margin: 0 !important; }

.mat-storage-folder-pick .form { gap: 0 !important; margin: 0 !important; padding: 0 !important; }

.mat-storage-folder-pick .wrap,
    .mat-storage-folder-pick [class*="wrap"] {
      min-height: 36px !important;
      max-height: 36px !important;
      height: 36px !important;
      width: 40px !important;
      padding: 0 !important;
      margin: 0 !important;
      overflow: hidden !important;
      align-items: center !important;
      justify-content: center !important;
      border: none !important;
      background: transparent !important;
    }

.mat-storage-folder-pick .file-preview,
    .mat-storage-folder-pick .file-preview-holder,
    .mat-storage-folder-pick .file-list,
    .mat-storage-folder-pick ul[class*="file"] {
      display: none !important;
      height: 0 !important;
      margin: 0 !important;
      padding: 0 !important;
      overflow: hidden !important;
    }

.mat-storage-folder-pick label,
    .mat-storage-folder-pick .label-wrap { display: none !important; }

/* Gradio puts "Drop File Here" (icon + stacked text) inside the button; hide all of it. */
    .mat-storage-folder-pick button > *,
    .mat-storage-folder-pick .gr-button > * {
      display: none !important;
    }

.mat-storage-folder-pick button,
    .mat-storage-folder-pick .gr-button {
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      width: 36px !important;
      min-width: 36px !important;
      max-width: 36px !important;
      height: 34px !important;
      min-height: 34px !important;
      max-height: 34px !important;
      padding: 0 !important;
      margin: 0 !important;
      font-size: 0 !important;
      line-height: 0 !important;
      border-radius: 8px !important;
      overflow: visible !important;
    }

.mat-storage-folder-pick button::after,
    .mat-storage-folder-pick .gr-button::after {
      content: "⋯";
      font-size: 22px !important;
      line-height: 1 !important;
      color: #dce7f7 !important;
      letter-spacing: 0;
      display: block !important;
      margin-top: 0;
    }
