/* Windows 98: Codename Memphis */

:root {
  --face: #ddd;
  --text: #111;
  --disabledText: #999;
  --hover: #eee;
  --highlight: #fff;
  --etch: #fff;
  --bevel1light: #fff;
  --bevel1dark: #777;
  --bevel2light: #e7e7e7;
  --bevel2dark: #bbb;
  --title1: #009;
  --title2: #9cf;
  --titleText: #fff;
  --activeBg: #006;
  --activeBg2: #00a;
  --activeText: #fff;
  --textLight: #444;
  --toolbar: #918;
  --toolbarDisabled: #b5b5b5;
  --toolbarAccent1: #888;
  --toolbarAccent2: #bbb;
  --thEtch: #fff;
  --link: #009;
  --linkHover: #03f;
  --banner: #2bc;
  --shadow: #0005;
}

@media (prefers-color-scheme: dark) {
  :root {
    --face: #222;
    --text: #f5f5f5;
    --disabledText: #666;
    --hover: #111;
    --highlight: #111;
    --etch: #555;
    --bevel1light: #555;
    --bevel1dark: #0c0c0c;
    --bevel2light: #373737;
    --bevel2dark: #1c1c1c;
    --title1: #442;
    --title2: #162;
    --titleText: #f5f5f5;
    --activeBg: #3aa;
    --activeBg2: #177;
    --activeText: #111;
    --textLight: #777;
    --toolbar: #395;
    --toolbarDisabled: #484848;
    --toolbarAccent1: #444;
    --toolbarAccent2: #000;
    --thEtch: #333;
    --link: #ff6;
    --linkHover: #fc0;
    --banner: #033;
    --shadow: #fff1;
  }
}

body { background: var(--face); color: var(--text); user-select:none;}
dialog {margin:10px; z-index:1;max-width:720px; padding:0; user-select:none; background: var(--face); color: var(--text); border-radius: 2px; box-shadow:5px 5px 30px var(--shadow); border: 1px solid; border-color: var(--bevel1light) var(--bevel1dark) var(--bevel1dark) var(--bevel1light);}
dialog:not(.menu) {top:50%; transform:translate(0, -50%);  max-height:90vh; overflow-y:auto;}
dialog>.content { padding: 0 20px 20px 20px; height: auto; min-height:100%; border: 1px solid; border-color:  var(--bevel2light) var(--bevel2dark) var(--bevel2dark) var(--bevel2light); }
dialog h2 { position:sticky; top: 0; z-index:10; padding: 4px 10px; font-size: 115%; font-weight: bold; background: linear-gradient(90deg, var(--title1) 0%, var(--title2) 100%); color: var(--titleText); margin: 0px -20px 10px -20px;}
dialog h2 .close {position:absolute; z-index: 11; top:3px; right:3px;  padding: 0 3px;}
dialog h2 .close:active { padding: 0 3px; }
dialog h2 .close>svg { margin: 0 0 1px; }

#connect { position: absolute; top: 14px; right: 10px; }
#main { }
#main>.top-border {background: linear-gradient(90deg, var(--title1) 0%, var(--title2) 100%); height:4px;}

fieldset { position:relative; border: 2px solid;border-color:   var(--bevel2dark) var(--bevel2light) var(--bevel2light) var(--bevel2dark); border-radius: 3px; padding: 0 20px 20px 20px; margin-bottom: 15px; }
fieldset::before {content:""; position:absolute; top:4px;bottom:0; left:0; width:calc(100% - 4px); pointer-events:none; border: 2px solid; border-color:var(--bevel2light) var(--bevel2dark) var(--bevel2dark) var(--bevel2light); margin-top:-4px;}
fieldset:has(legend)::before {margin-top:-15px;}
legend { padding: 3px; background:var(--face); z-index:1; position:relative;}
fieldset p { margin:5px 0; }
label.radio { display: inline-block; padding: 4px; margin: 6px; }
label.radio input { margin-right: 5px; }
label.radio:active { outline:1px dotted var(--text); }

label.text { display: block; }
label+label { margin-top:10px; }
label.text span { display: block; }
label.text input,
label.text select { background:var(--highlight); border: 2px solid; border-color:var(--bevel2dark) var(--bevel2light) var(--bevel2light) var(--bevel2dark); position:relative; border-radius: 3px; padding: 5px; width:100%; }
label.text input::before,
label.text select::before{ content:""; position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; border: 2px solid;border-color: var(--bevel2dark) var(--bevel2light) var(--bevel2light) var(--bevel2dark); }
label.text input:disabled,
label.text select:disabled { background:var(--face); }

button { color: var(--text); }
.button { padding: 5px 8px; border-radius: 1px; background:var(--face); border: 1px solid; border-color: var(--bevel1light) var(--bevel1dark) var(--bevel1dark) var(--bevel1light); margin: 0; white-space:nowrap; position:relative; }
.button::before {content:""; position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; border: 1px solid; border-color:  var(--bevel2light) var(--bevel2dark) var(--bevel2dark) var(--bevel2light); }
.button:active { border-color:var(--bevel1dark) var(--bevel1light) var(--bevel1light) var(--bevel1dark); padding:6px 8px 4px 8px; }
.button:active:not(:disabled)::before { border-color: var(--bevel2dark) var(--bevel2light) var(--bevel2light) var(--bevel2dark); }
.button:disabled { padding:5px 8px; background: var(--face); color:var(--hover); text-shadow: -1px -1px var(--textLight), 1px 1px var(--highlight); border: 1px solid;border-color: var(--bevel1light) var(--bevel1dark) var(--bevel1dark) var(--bevel1light); }
.button:disabled::before {border-color:var(--bevel2light) var(--bevel2dark) var(--bevel2dark) var(--bevel2light); }
form:focus-within .button:not([type="button"]):not([disabled]),
.button:focus:not([disabled]) { border-color:var(--text); }
form:focus-within .button:not([type="button"]):not([disabled])::before,
.button:focus:not([disabled])::before {border-color:  var(--bevel1light) var(--bevel1dark) var(--bevel1dark) var(--bevel1light); }
form:focus-within .button:active:not([type="button"]):not([disabled])::before {border-color:  var(--bevel1dark) var(--bevel1light) var(--bevel1light) var(--bevel1dark); }
form:focus-within .button:not([type="button"]):not([disabled])::after,
.button:focus:not([disabled])::after { content:""; position:absolute; top:3px; left:3px; right:3px; bottom:3px; pointer-events:none; border: 1px dotted var(--text); }

.link { text-decoration:underline; color:var(--link); }
.link:hover { color:var(--linkHover); }
.link:disabled, .link[disabled] {color:var(--hover); text-shadow: -1px -1px var(--textLight), 1px 1px var(--highlight);}
.link svg { margin-right: 8px; }

.banner { border:1px solid;border-color: var(--bevel2dark) var(--bevel2light) var(--bevel2light) var(--bevel2dark); position:relative; background:url(/world.png) no-repeat bottom center var(--banner);  background-size:contain; margin:0 20px 15px 0;  width: 30%; flex-shrink:0; height: 300px; }
.banner::before { content:""; position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; border: 1px solid;border-color:var(--bevel1dark) var(--bevel1light) var(--bevel1light) var(--bevel1dark); }
.banner.import { background-image:url(/spy.png);}
.banner.registry { background-image:url(/contacts.png);}
.banner.password { background-image:url(/lock.png);}
.banner.about { background:url(/gloweth.png) no-repeat center center #311c23; background-size:contain; width:100%; height:150px; }
.hr { border: 1px inset var(--etch); margin:15px 0;  clear:both;}
.controls { display:flex; flex-direction:row; justify-content:space-between;}
.controls.center { justify-content:space-around; }

p { margin-bottom:15px; }

.toolbar {background: var(--face); display:flex; flex-direction:row; border-bottom:1px solid var(--toolbarAccent1); box-shadow:inset 0 -1px 2px var(--toolbarAccent2), inset 0 1px 2px var(--highlight);}
.toolbar .vr {border:2px outset var(--etch); border-radius:2px; color:var(--highlight);margin:5px;}
.toolbar>button {padding: 10px; margin-left:0; border: 1px solid #0000; margin:5px; display:flex; flex-direction:column; align-items:center; text-wrap:nowrap;}
.toolbar>button>svg {color:var(--toolbar);}
.toolbar>button:hover {outline: 1px outset var(--etch);}
.toolbar>button:active {outline: 1px inset var(--etch);}
.toolbar>button:disabled {outline: 1px solid #0000;color:var(--hover); text-shadow: -1px -1px var(--textLight), 1px 1px var(--highlight);}
.toolbar>button:disabled>svg {color:var(--toolbarDisabled); }

.menubar {background:var(--face); padding:2px;}
.menubar button { background:none; border:0};
.menu-container { position:relative;}
.menubar>.menu-container>button { padding:10px 10px;}
.menubar>.menu-container>button::first-letter {text-decoration:underline;}
.menubar>.menu-container>button.active {outline:1px inset var(--etch);}
.menu-container { position: relative; display: inline-block; }

.menubar .menu {
  position: absolute;
  top: 100%; /* Directly below button */
  left: 0;
  margin: 0;
  display: none; /* Controlled via JS or [open] */
  max-height: calc(100vh - 140px); /* Leave a small gap for the top toolbar */
  overflow-y: auto;
  overflow-x: hidden;

  scrollbar-width: none;
  overscroll-behavior: contain;
  border: 1px solid;
  border-color: var(--bevel1light) var(--bevel1dark) var(--bevel1dark) var(--bevel1light);
  border-radius:2px;
  padding:8px 2px 8px 2px;
  width:fit-content;
  min-width:100px;
  z-index:999;
  box-shadow:
    inset 1px 1px 0 var(--bevel2light),
    inset -1px -1px 0 var(--bevel2dark),
    2px 2px 0px rgba(0,0,0,0.5);
}

/* Ensure the pseudo-element border stays fixed while content scrolls */
.menubar .menu::before {
  position: sticky;
  top: 0;
  left: 0;
  /* This ensures the border doesn't scroll away with the buttons */
  pointer-events: none;
}

@media (max-width:480px) {
  .menubar .menu-container:nth-last-child(-n + 3) .menu {
    left: auto;
    right: -100%;
  }
  .menubar .menu-container:nth-last-child(-n + 2) .menu {
    left: auto;
    right: 0;
  }
}

.menubar .menu[open] {
  display: block;
}

/* Remove the default backdrop for a transparent overlay */
.menubar .menu::backdrop {
  background: transparent;
}

/* Fix for nested inputs in menus */
.menu .ctl { font-size: 12px; padding: 4px 10px; }
.menubar .menu button:active { border:0;}
.menubar .menu button:focus-visible { outline:0;}
.menubar .menu button.active:before { content:"✔"; position:absolute; left:5px; top:2px;}
.menubar .menu button:after {content:attr(data-key); position:absolute; top:2px; right:10px; }

.menubar .menu button {display:block; position:relative; text-align:left; padding:2px 55px 2px 25px; width:100%;text-wrap:nowrap; }
.menubar .menu button:focus:not(:disabled)
{background: linear-gradient(90deg, var(--activeBg) 0%, var(--activeBg2) 100%); color:var(--activeText);}
.menubar .menu button:disabled {color:var(--hover); text-shadow: -1px -1px var(--textLight), 1px 1px var(--highlight);}
.menubar .menu button svg { position:absolute; left:5px; top: 7px; }

.status-bar {display:flex; color:var(--text); flex-direction:row;background:var(--face);box-shadow:inset 0 -1px 2px #666, inset 0 1px 2px var(--highlight); border-top:1px solid var(--textLight); padding:3px; position:sticky; bottom:0;}
.status-bar>div { padding:0px 5px; border:2px inset var(--highlight); flex:1;}


.panel { overflow:auto; height:calc(100vh - 171px);  background:var(--highlight); display:flex; flex-direction:column;}
.table-wrapper { flex:1; background:var(--highlight); padding-bottom:20px; }
dialog .table-wrapper { border:2px inset var(--etch); }
table {width:100%;}
th { position:sticky; top:0px;color:var(--text);  }
th span { display:block; padding: 1px 4px; background:var(--face); border: 2px outset var(--thEtch); text-wrap:nowrap;}
th:active span { border:2px inset var(--thEtch); }
td { padding: 1px 4px;color:var(--text);  }
td a { text-overflow:ellipsis; }
tbody tr.active { background: linear-gradient(90deg, var(--activeBg) 0%, var(--activeBg2) 100%); color:var(--highlight); outline: 1px dotted #ccc;}
tbody tr.active td { color:var(--activeText); }
tbody tr.active .link { color: var(--activeText); }

.hideAccepted tr:has(.submitted) { display:none; }

