:root{
  --accent:#145570;
  --control-text:#154e65;
  --control-border:#70858c;
  --section-border:#b8c7cf;
  --page-background:#f4f7f9;
  --sql-highlight:#d6eaf7;
  --sql-error-highlight:#a61b29;
  --ui-font:"Source Sans 3",system-ui,sans-serif;
  --mono-font:ui-monospace,"SF Mono",Menlo,Monaco,Consolas,"Liberation Mono",monospace;
  --mono-size:calc(.8rem - 2px);
  --control-font-size:.875rem;
  --report-heading-size:var(--control-font-size);
  color-scheme:light;font:16px/1.5 var(--ui-font);color:#162c36;background:var(--page-background)
}
*{box-sizing:border-box}body{margin:0}main{max-width:75.4rem;margin:auto;padding:.5rem 1.2rem clamp(1.2rem,5vw,4.5rem)}
header h1{margin-block-start:0}
header p{font-size:var(--control-font-size);margin-block-end:0}
h1{font-size:1.4rem;font-weight:500;line-height:1.1;letter-spacing:-.04em;margin:.6rem 0}
textarea{display:block;margin:0 0 .65rem;width:100%;font:var(--mono-size)/1.65 var(--mono-font);padding:.5rem 1rem;border:1px solid var(--control-border);background:white;border-radius:.25rem;resize:vertical}
textarea::selection{background:var(--sql-highlight);color:inherit}
#sql.syntax-error-selection{caret-color:var(--sql-error-highlight)}
#sql.syntax-error-selection::selection{background:var(--sql-error-highlight);color:white}
a:any-link{color:var(--accent);text-decoration:underline;text-underline-offset:.1rem}
button{color:var(--control-text);background:transparent;border:0;border-radius:.25rem;font:inherit;cursor:pointer}
button:disabled{opacity:.6}
:is(a,button,summary,textarea,.reviewed-sql,.report-content,.column-handle,.column-resize):focus-visible{outline:2px solid var(--accent);outline-offset:2px}
:is([role="tab"],.report-content,.column-resize):focus-visible{outline-offset:-2px}
.actions{display:flex;gap:.45rem;flex-wrap:wrap}
.actions button{padding:.25rem .65rem;border:1px solid var(--control-border);font-size:var(--control-font-size)}
.report-actions button,#statement-tabs button{padding:.18rem .55rem;font-size:.8rem}
.report-actions{flex-wrap:nowrap;overflow-x:auto}
.report-actions button{flex:none;white-space:nowrap}
.report-actions button:focus-visible{outline-offset:-2px}
.warning-groups,.tables{padding:0 .8rem}
.report-group{border:1px solid #cbd8de;margin:.3rem 0;margin-block-start:calc(.3rem + var(--report-heading-space,0px))}
.warning-messages{padding:0 .75rem .65rem}
.warning-messages p{margin:.25rem 0 .45rem}
.warning-messages p:not(:first-child){margin-top:1rem}
.warning-locations{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:.35rem .65rem;margin:0;padding:0}
.warning-locations,.table-scroll td a{font-family:var(--ui-font);font-variant-numeric:tabular-nums}
.warning-locations{font-size:var(--mono-size)}
.warning-locations li{margin-inline-start:calc(3ch + .65em);overflow-wrap:anywhere}
.warning-locations li::marker{color:#465c68}
@media screen and (max-width:62rem){.warning-locations{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media screen and (max-width:34rem){.warning-locations{grid-template-columns:repeat(2,minmax(0,1fr))}}

.report-scroll{max-height:min(var(--report-rows-height, 55dvh), 55dvh);overflow:auto;scrollbar-gutter:stable}
.report-disclosure{margin:1rem 0;border:1px solid var(--section-border);background:white}
.report-disclosure summary{cursor:pointer;font-size:1.08rem;font-weight:500;padding:.65rem .8rem;color:var(--control-text)}
.report-disclosure > summary::marker{font-size:1.12rem}
.sql-input{margin-block-start:.25rem}
.sql-input > summary{font-size:calc(1rem - 2pt)}
.source > summary{font-size:calc(1.08rem - 2pt)}
.report-disclosure:is(.warnings,.information) > summary{font-size:var(--report-heading-size)}
.sql-editor{padding:0 .8rem .8rem}
.report-disclosure .report-group > summary{display:flex;align-items:center;gap:.35rem;padding:0 .75rem 0 0;font-size:var(--report-heading-size);overflow-wrap:anywhere;list-style:none;user-select:none}
.report-group > summary:focus{outline:2px solid var(--accent);outline-offset:-2px}
.report-group > summary::-webkit-details-marker{display:none}
.report-group > summary > .report-group-marker{flex:none;align-self:stretch;display:grid;place-items:center;width:2.5rem;min-height:1.75rem;font-size:1.5rem;line-height:1}
.report-group > summary > .report-group-marker::before{content:"▸"}
.report-group[open] > summary > .report-group-marker::before{content:"▾"}
.warning-description{font-weight:400;color:#162c36}
.table-scroll table{border-collapse:collapse;font:var(--mono-size)/1.45 var(--mono-font);width:100%;background:#fff;border:1px solid #ddd;color:#222}
.table-scroll th,.table-scroll td{padding:4px 10px;text-align:left;vertical-align:top;border-bottom:1px solid #ddd;white-space:nowrap}
.table-scroll [data-report="comments"] td{white-space:pre}
.table-scroll th{background:#d4e4ef;font-family:var(--ui-font);font-weight:500;position:sticky;top:0}
.table-scroll tbody tr:nth-child(odd){background:#edf5fa}
.table-scroll tbody tr:nth-child(even){background:#f1f2f3}
.table-scroll td:nth-child(even){background:rgb(47 106 138 / 6%)}
.table-scroll th:nth-child(even){background:#cbdfe9}
.table-scroll th.column-movable{padding-left:22px;cursor:pointer;user-select:none}
.sort-column{padding:0;background:transparent;color:inherit;font:inherit;text-align:left}
[aria-sort="ascending"] .sort-column::after{content:" \25B2"}
[aria-sort="descending"] .sort-column::after{content:" \25BC"}
.column-handle{position:absolute;left:4px;top:50%;transform:translateY(-50%);cursor:grab;color:#555}
.column-handle::before{content:"\22ee\22ee"}
.column-resize{position:absolute;right:0;top:0;bottom:0;width:9px;cursor:col-resize;touch-action:none}
.column-resize::after{content:"";position:absolute;right:2px;top:20%;bottom:20%;border-right:2px solid #555}
table.columns-sized{table-layout:fixed}
.table-scroll .columns-sized :is(th,td){overflow:hidden;text-overflow:ellipsis}

#status:empty{margin:0}
.no-warnings{margin:.65rem .8rem}
.minimum-postgres-version{font-weight:400;color:#465c68}
.reviewed-sql{margin:0;background:white;border:1px solid var(--section-border);user-select:text;overflow:auto;scrollbar-gutter:stable;font-family:var(--mono-font)}
.reviewed-sql code{font:inherit}
.reviewed-sql mark{background:var(--sql-highlight);color:inherit}

@media screen{
  #analysis-bar{display:grid;gap:.35rem;padding:.5rem 0}
  #results{min-height:100dvh}
  #statement-panels > :not([hidden]){display:flex;flex-direction:column;max-height:calc(100dvh - var(--analysis-bar-height, 3rem))}
  #statement-panels .source{flex:none;margin-top:0;overflow-anchor:none}
  .report-body{display:flex;flex-direction:column;min-height:min(10rem,45dvh);overflow-anchor:none}
  .report-actions{flex:none}
  .report-content{min-height:0;overflow:auto;overflow-anchor:none}
  :is(#sql,.reviewed-sql){min-height:var(--expanded-sql-height,0)}
  .reviewed-sql{box-sizing:content-box;white-space:pre;font-size:var(--mono-size);line-height:1.5;padding:.35rem 1rem;max-height:var(--expanded-sql-height,6lh)}
  .table-scroll :is(th,td){padding-block:1px;line-height:1.2}
}

#statement-tabs{flex-wrap:nowrap;min-width:0;max-width:100%;overflow-x:auto}
#statement-tabs[hidden]{display:none}
[role="tab"]{flex:none;white-space:nowrap}
#statement-tabs [role="tab"][aria-selected="true"]{background:#e2edf0;border-color:var(--accent)}
#print-report{display:none}

@page{margin:13mm}
@media print{
  :root{font-size:8pt;line-height:1.35;background:white;color:black}
  main{max-width:none;margin:0;padding:0}
  button,.print-ready main > :not(#print-report){display:none}
  .print-ready #print-report{display:block}
  #print-report .print-statement + .print-statement{break-before:page}
  #print-report h1{font-size:16pt}
  #print-report h2{font-size:12pt}
  #print-report h3{font-size:10pt}
  #print-report :is(h1,h2,h3){font-weight:500;break-after:avoid-page}
  #print-report .information{margin:0;border:0}
  #print-report .information:has(table){break-before:page}
  #print-report .report-scroll{max-height:none;overflow:visible;scrollbar-gutter:auto}
  #print-report table{width:100%;font-size:8pt}
  #print-report thead{display:table-header-group}
  #print-report tfoot{display:table-footer-group}
  #print-report tr,#print-report .warning-locations li{break-inside:avoid}
  #print-report .warning-locations{font-size:8pt}
  #print-report .warning-description{font-size:8pt}
  #print-report th,#print-report td{position:static;min-width:2.5rem;padding:.3rem .35rem;white-space:pre-wrap;overflow-wrap:anywhere}
  #print-report .reviewed-sql{padding:.6rem;font-size:8pt;white-space:pre-wrap;overflow-wrap:anywhere;overflow:visible;scrollbar-gutter:auto}
}
