:root {
  --bg: #efefef;
  --panel: #ffffff;
  --panel-2: #f8f8f8;
  --text: #171717;
  --muted: #626262;
  --border: #c8c8c8;
  --accent: #0b6f79;
  --accent-dark: #07535b;
  --danger: #a11919;
  --warning: #8a5b00;
  --success: #226522;
  font-family: "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { border: 1px solid #8d8d8d; background: linear-gradient(#fff,#e8e8e8); padding: 7px 12px; border-radius: 3px; cursor: pointer; }
button:hover { background: #f5f5f5; }
button.primary { background: var(--accent); color: white; border-color: var(--accent-dark); }
button.danger { color: white; background: var(--danger); border-color: #761111; }
.topbar { height: 84px; background: #202020; color: white; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 3px solid var(--accent); }
.topbar h1 { font-size: 20px; margin: 0 0 3px; font-weight: 600; }
.topbar p { margin: 0; color: #d2d2d2; }
.top-actions { display: flex; gap: 7px; }
.layout { display: grid; grid-template-columns: 285px 1fr; min-height: calc(100vh - 84px); }
.sidebar { background: #dddddd; border-right: 1px solid #a9a9a9; padding: 14px; }
.search-label { display: block; font-weight: 600; margin-bottom: 5px; }
#medSearch { width: 100%; padding: 8px; border: 1px solid #909090; margin-bottom: 10px; }
.med-list { height: calc(100vh - 295px); overflow: auto; background: white; border: 1px solid #aaa; }
.med-row { padding: 8px 9px; border-bottom: 1px solid #e1e1e1; cursor: pointer; }
.med-row:hover { background: #edf5f6; }
.med-row.active { background: #cfe5e8; outline: 1px solid var(--accent); }
.med-row small { display: block; color: var(--muted); margin-top: 2px; }
.status-card { background: #f4f4f4; border: 1px solid #aaa; padding: 9px; margin-top: 12px; }
.status-card h3 { margin: 0 0 8px; font-size: 14px; }
dl { margin: 0; }
dl div { display: flex; justify-content: space-between; margin: 4px 0; }
.workspace { min-width: 0; }
.tabs { background: #d5d5d5; border-bottom: 1px solid #9f9f9f; padding: 7px 10px 0; display: flex; gap: 2px; }
.tabs button { border-bottom-left-radius: 0; border-bottom-right-radius: 0; padding: 8px 15px; }
.tabs button.active { background: white; border-bottom-color: white; font-weight: 600; }
.tab-panel { display: none; padding: 16px; }
.tab-panel.active { display: block; }
.panel { background: white; border: 1px solid #b2b2b2; margin-bottom: 14px; }
.panel-header { background: #e8e8e8; padding: 9px 12px; border-bottom: 1px solid #b2b2b2; display: flex; justify-content: space-between; align-items: center; }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 12px; }
.grid { display: grid; grid-template-columns: repeat(2,minmax(220px,1fr)); gap: 10px 14px; }
.grid.three { grid-template-columns: repeat(3,minmax(180px,1fr)); }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #929292; padding: 7px; background: white; }
.field textarea { min-height: 70px; resize: vertical; }
.field.wide { grid-column: 1 / -1; }
.field .help { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.toolbar { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow: auto; border: 1px solid #b8b8b8; }
table { border-collapse: collapse; width: 100%; background: white; }
th { background: #ececec; text-align: left; font-weight: 600; position: sticky; top: 0; }
th,td { border: 1px solid #c7c7c7; padding: 7px; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f0f7f8; }
.badge { display: inline-block; border: 1px solid #777; border-radius: 10px; padding: 1px 7px; font-size: 12px; background: #f4f4f4; }
.badge.validated { color: var(--success); border-color: var(--success); }
.badge.conflicted, .badge.blocked { color: var(--danger); border-color: var(--danger); }
.badge.pending, .badge.draft { color: var(--warning); border-color: var(--warning); }
.notice { border-left: 5px solid var(--accent); background: #eef7f8; padding: 10px; margin-bottom: 12px; }
.notice.error { border-color: var(--danger); background: #fff0f0; }
.notice.warning { border-color: #b77900; background: #fff8e7; }
.empty { padding: 28px; color: var(--muted); text-align: center; border: 1px dashed #aaa; background: #fafafa; }
.split { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(320px,.8fr); gap: 14px; }
pre { white-space: pre-wrap; word-break: break-word; background: #f3f3f3; border: 1px solid #bbb; padding: 10px; }
#toast { position: fixed; right: 18px; bottom: 18px; background: #202020; color: white; padding: 10px 14px; border-radius: 3px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
@media (max-width: 900px) { .layout { grid-template-columns: 220px 1fr; } .grid,.grid.three,.split { grid-template-columns: 1fr; } }

.owner-mode{display:inline-block;margin-top:6px;padding:2px 8px;border:1px solid #d09a20;background:#fff2c7;color:#5f4300;font-size:12px;border-radius:10px;}
progress{width:180px;vertical-align:middle;}
input[data-ra],input[data-si],select[data-ra],select[data-si]{width:100%;min-width:110px;padding:5px;border:1px solid #999;}

.connector-grid{display:flex;gap:18px;flex-wrap:wrap;padding:8px;border:1px solid #aaa;background:#f7f7f7}.connector-grid label{font-weight:600}.metric-row{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:12px}.file-button{display:inline-block;border:1px solid #8d8d8d;background:linear-gradient(#fff,#e8e8e8);padding:7px 12px;border-radius:3px;cursor:pointer}a{color:#075f68}td small{display:block;color:var(--muted)}


/* RC9 calculator truth console */
.calculator-layout{
  display:grid;
  grid-template-columns:minmax(230px,300px) minmax(0,1fr);
  gap:16px;
  align-items:start;
}
.calculator-list{
  max-height:72vh;
  overflow:auto;
  border:1px solid var(--border,#d8dde3);
  border-radius:8px;
  padding:6px;
  background:var(--surface,#fff);
}
.calculator-list .med-row{
  display:block;
  width:100%;
  text-align:left;
  margin:0 0 5px;
}
.panel.nested{margin-bottom:14px;}
.validation-output{
  white-space:pre-wrap;
  min-height:72px;
  max-height:240px;
  overflow:auto;
  border:1px solid var(--border,#d8dde3);
  background:var(--surface-alt,#f6f8fa);
  padding:10px;
  border-radius:6px;
}
@media(max-width:900px){
  .calculator-layout{grid-template-columns:1fr;}
  .calculator-list{max-height:260px;}
}


/* RC10 finding-rule console */
.calculator-layout{
  display:grid;
  grid-template-columns:minmax(240px,310px) minmax(0,1fr);
  gap:16px;
  align-items:start;
}
.calculator-list{
  max-height:72vh;
  overflow:auto;
  border:1px solid var(--border,#d8dde3);
  border-radius:8px;
  padding:6px;
}
.calculator-list .med-row{
  display:block;
  width:100%;
  text-align:left;
  margin-bottom:5px;
}
.panel.nested{margin-bottom:14px;}
.validation-output{
  white-space:pre-wrap;
  min-height:72px;
  max-height:280px;
  overflow:auto;
  border:1px solid var(--border,#d8dde3);
  padding:10px;
  border-radius:6px;
}
@media(max-width:900px){
  .calculator-layout{grid-template-columns:1fr;}
  .calculator-list{max-height:260px;}
}
