:root {
    --spec-table-row-height: 24px;
    --gap-standard: 5px;
    --input-height: 24px;
    --header-background-color: lightgrey;
    --header-color: darkgrey;
    --input-bordercolor: lightgrey;
    --input-bordercolor-focus: darkgrey;
    --input-backgroundcolor: rgba(240, 240, 240, 0.3);
    --input-solidbackgroundcolor: rgba(240, 240, 240);
    --input-hover-backgroundcolor: rgba(140, 140, 140, 0.3);
    --input-borderwidth: 1px;
    --input-borderradius: 4px;
    --input-transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
    /* Composite (Optional - for maximum speed) */
    --input-border: var(--input-borderwidth) solid var(--input-bordercolor);
    --input-border-focus: var(--input-borderwidth) solid var(--input-bordercolor-focus);
    --button-backgroundcolor: rgba(240, 240, 240, 0.7);
    --drag-size: 8px;
    --drag-bordersize: 3px;
    --drag-color: rgb(240, 240, 240);
    --drag-backgroundcolor: rgb(220, 220, 220);
    --rowheight-single: 21px;
    --rowheight-double: 40px;
    --table-numeric: Courier New, Courier, monospace, sans-serif;
}

.no-select {
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE/Edge */
    user-select: none;
    /* Standard */
}

div {
    overflow: hidden;
    scroll-snap-type: both mandatory;
    scrollbar-width: thin;
    scrollbar-color: #c0c0c0 #f1f1f1;
}

span {
    margin: 0;
    line-height: var(--input-height);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #505050;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Helvetica', 'Noto Sans Symbols 2', 'Segoe UI Symbol', 'DejaVu Sans', sans-serif;
    font-size: 0.875rem;
}

.act-header {
    display: flex;
    width: 100%;
    background: var(--header-background-color);
    font-size: 15px;
    font-weight: 600;
    color: var(--header-color);
    align-items: center;
    padding: 0 20px 0 20px;
}

.act-header-left {
    display: flex;
    margin-right: auto;
    text-decoration: none;
    color: gray;
    gap: 30px;
}

.act-header a,
.act-header button {
    transition: color 0.2s;
}

.act-header a:hover,
.act-header button:hover {
    color: black;
}

.act-header-right {
    display: flex;
    text-decoration: none;
    color: gray;
    gap: 30px;
}

.act-header-right span {
    background: #ccc;
    padding: 2px 6px;
    border-radius: var(--input-borderradius);
    font-size: 11px;
}

.act-buttonbar {
    display: flex;
    gap: 10px;
    z-index: 10;
    overflow: visible;
    height: var(--input-height);
    width: 100%;
}

.act-label {
    display: inline-flex;
    align-items: center;
    gap: var(--gap-standard);
    white-space: nowrap;
}

.act-listbox-item,
.act-select-dropdown-head,
.act-select-dropdown-body,
.act-select-dropdown-item,
.act-listbox,
.act-textinput,
.act-button-enabled,
.act-button-disabled,
.numberinput2digit,
.numberinput4digit,
.numberinput-int,
.numberinput-float,
.toggleCheck {
    transition: var(--input-transition);
    background-color: var(--input-backgroundcolor);
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
}

.act-select-dropdown-head,
.act-select-dropdown-body,
.act-listbox,
.act-textinput,
.act-button-enabled,
.act-button-disabled,
.numberinput2digit,
.numberinput4digit,
.numberinput-int,
.numberinput-float,
.toggleCheck {
    border: var(--input-border);
    border-radius: var(--input-borderradius);
}

.act-listbox {
    overflow: hidden;
}

.act-listbox-item {
    display: flex;
    align-items: center;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act-listbox-item-selected {
    background-color: var(--input-hover-backgroundcolor);
}

.toggleCheck {
    height: var(--input-height);
    width: var(--input-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.act-select-dropdown-item {
    text-align: left;
    padding-left: 3px;
    padding-right: 3px;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    overflow: visible !important;
    width: max-content;
    min-width: 100%;
}

.act-select-dropdown-head,
.act-select-dropdown-item,
.act-textinput,
.act-button-enabled,
.act-button-disabled,
.numberinput2digit,
.numberinput4digit,
.numberinput-int,
.numberinput-float {
    height: var(--input-height);
}

.act-button-enabled,
.act-button-disabled {
    display: flex;
    align-items: center;
    justify-content: center;
}

.act-select-dropdown-head {
    display: flex;
    justify-content: space-between;
    padding-left: 4px;
    padding-right: 4px;
}

.act-select-dropdown-body {
    position: absolute;
    top: 24px;
    right: 0;
    overflow-x: auto !important;
    /* Force the horizontal scrollbar mechanism */
    overflow-y: auto !important;
    display: block;
    /* Ensure it calculates dimensions correctly */
    z-index: 10;
    background-color: var(--input-solidbackgroundcolor);
}

.act-select-dropdown-body>div {
    overflow: visible !important;
    display: block;
    width: max-content;
    /* Tells the wrapper to stretch to the longest child */
    min-width: 100%;
}

.act-button-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.numberinput2digit {
    width: 30px;
    text-align: right;
    padding: 3px;
}

.numberinput4digit {
    width: 60px;
    text-align: right;
    padding: 3px;
}

.numberinput-int,
.numberinput-float {
    width: 80px;
    text-align: right;
    padding: 2px;
    font-family: var(--table-numeric), serif;
}

.act-textinput {
    text-align: left;
    padding: 2px;
}

.act-select-dropdown-container {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.act-button-enabled:active,
.act-select-dropdown-item:active {
    transform: scale(0.96);
    /* Shrinks it by 4% */
    filter: brightness(0.9);
    /* Makes it slightly darker */
    transition: transform 0.05s;
    /* Makes the "push" instant */
}

.act-select-dropdown-head:hover,
.act-select-dropdown-item:hover,
.act-listbox-item:hover,
.numberinput2digit:hover,
.numberinput4digit:hover,
.numberinput-int:hover,
.numberinput-float:hover,
.act-textinput:hover,
.act-button-enabled:hover,
.toggleCheck:hover {
    background-color: var(--input-hover-backgroundcolor) !important;
}

.act-label:hover .toggleCheck {
    background-color: #ddd;
}

.act-select-dropdown-head:focus,
.act-select-dropdown-item:focus,
.act-textinput:focus,
.numberinput2digit:focus,
.numberinput4digit:focus,
.numberinput-int:focus,
.numberinput-float:focus {
    border: var(--input-border-focus) !important;
    box-shadow: 0 0 0 1px var(--input-bordercolor-focus);
    outline: none !important;
}

.melt-out {
    /* Use a standard ease or cubic-bezier for a more natural feel */
    animation: melt-fade 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
    /* These 3 lines are the "Smoothness" secret */
    backface-visibility: hidden;
    will-change: opacity, filter;
    transform: translate3d(0, 0, 0);
}

@keyframes melt-fade {
    0% {
        opacity: 1;
        filter: blur(0px);
    }

    100% {
        opacity: 0;
        filter: blur(4px);
    }
}

table.specification-table-l,
table.specification-table-r {
    table-layout: fixed;
    min-width: 300px;
    max-width: 300px;
    border: none;
    white-space: nowrap;
    user-select: none;
}

table.specification-table-l tr,
table.specification-table-r tr {
    height: 26px;
}

/* Shared rules for both Left and Right tables */
table.specification-table-l td,
table.specification-table-r td {
    display: table-cell;
    /* MUST keep this for 2-column rows */
    white-space: nowrap;
    /* Prevents text/inputs from wrapping */
    vertical-align: middle;
}

/* Internal alignment for the LEFT table */
table.specification-table-l td {
    text-align: left;
    padding-left: 6px;
}

/* Internal alignment for the RIGHT table */
table.specification-table-r td {
    text-align: right;
    padding-right: 6px;
}

/* The magic trick: make the contents behave like a flexbox
   without breaking the TD itself */
table.specification-table-l td>*,
table.specification-table-r td>* {
    display: inline-flex;
    /* Sits side-by-side */
    vertical-align: middle;
    align-items: center;
}

/* 1. Remove the left padding that was making space for the absolute button */
.radio-container {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding-left: 0;
    /* Set to 0 because gap now handles the spacing */
    margin-right: 10px;
    height: var(--spec-table-row-height);
    /* 20px */
    gap: var(--gap-standard);
    /* 5px */
    cursor: pointer;
    user-select: none;
}

/* 2. Bring the box into the flex flow and remove centering offsets */
.radiobutton {
    position: relative;
    /* Change from absolute to relative to contain the dot */
    display: inline-block;
    flex-shrink: 0;
    /* Prevents the circle from squishing if text is long */
    height: var(--input-height);
    /* 20px */
    width: var(--input-height);
    /* 20px */
    border: var(--input-border);
    border-radius: var(--input-borderradius);
    /* 6px */
    background-color: var(--input-backgroundcolor);

    /* Remove these - they are what's making it "too high" in a flex container */
    top: 0;
    left: 0;
    transform: none;
}

/* 3. Fix the inner circle centering */
.radio-container .radiobutton:after {
    content: "";
    position: absolute;
    display: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Keeps it perfectly centered in the 20px box */
    width: 10px;
    height: 10px;
    border-radius: 50%;
    /* Use 50% for a perfect circle instead of the 6px variable */
    background: grey;
}

/* Hide the browser's default radio button */
.radio-container input {
    position: absolute;
    opacity: 0;
}

/* On mouse-over, add a grey background color */
.radio-container:hover input~.radiobutton {
    background-color: var(--input-hover-backgroundcolor);
}

/* Show the indicator when checked */
.radio-container input:checked~.radiobutton:after {
    display: block;
}

/* Create the indicator (the dot/inner circle) */
.radiobutton:after {
    content: "";
    position: absolute;
    display: none;
}

.modified {
    background-color: rgba(250, 200, 150, 0.5) !Important;
}

.not-default {
    font-weight: bold;
}

.resizable-container {
    display: flex;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.drag-v,
.drag-h {
    border-style: solid;
    border-width: var(--drag-bordersize);
    border-color: var(--drag-color);
    background-color: var(--drag-backgroundcolor);
    transition: var(--input-transition);
}

.drag-v:hover,
.drag-h:hover {
    background-color: rgb(200, 200, 200);
}

.drag-v {
    width: var(--drag-size);
    height: 100%;
    cursor: ew-resize;
}

.drag-h {
    height: var(--drag-size);
    width: 100%;
    cursor: ns-resize;
}

.context-menu {
    position: fixed;
    background-color: white;
    border: 1px solid gray;
    z-index: 1000;
    border-radius: var(--input-borderradius);
}

.context-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.context-menu li {
    box-sizing: border-box;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.context-menu li:hover {
    background-color: #eee;
}

table.act-table,
table.act-table-shape,
table.load-table {
    user-select: none;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: max-content;
    position: absolute;
    top: 0;
    left: 0;
}

table.act-table tr.rh_single td,
table.act-table tr.rh_single th {
    height: var(--rowheight-single);
    max-height: var(--rowheight-single);
    overflow: hidden;
    white-space: nowrap;
}

table.act-table tr.rh_double td,
table.act-table tr.rh_double th {
    height: var(--rowheight-double);
    max-height: var(--rowheight-double);
    overflow: hidden;
    white-space: normal;
}

table.act-table td {
    padding: 0 3px 0 3px;
    overflow: hidden;
    font-family: var(--table-numeric), serif;
    text-align: right;
    box-shadow: inset -1px -1px 0 #ddd;
    outline: none;
}

table.act-table-shape td {
    overflow: hidden;
    outline: none;
}

table.act-table tr:first-of-type td {
    box-shadow: inset 0 1px 0 0 #ddd, inset -1px -1px 0 #ddd !important;
}

table.act-table td:first-child {
    box-shadow: inset 1px 0 0 0 #ddd, inset -1px -1px 0 #ddd !important;
}

table.act-table tr:first-of-type td:first-child {
    box-shadow: inset 1px 1px 0 0 #ddd, inset -1px -1px 0 #ddd !important;
}

table.act-table .str {
    font-family: inherit;
    text-align: center;
}

table.act-table .left {
    text-align: left;
}

table.act-table .right {
    text-align: right;
}

table.act-table .center {
    text-align: center;
}

table.act-table .lg,
table.act-table-shape .lg {
    background-color: lightgray;
}

table.act-table .c0,
table.act-table-shape .c0 {
    background-color: rgb(229, 245, 251);
}

table.act-table .c1,
table.act-table-shape .c1 {
    background-color: rgb(209, 205, 228);
}

table.act-table .c2,
table.act-table-shape .c2 {
    background-color: rgb(210, 231, 241);
}

table.act-table .c3,
table.act-table-shape .c3 {
    background-color: rgb(222, 225, 240);
}

table.act-table .c4,
table.act-table-shape .c4 {
    background-color: rgb(196, 198, 211);
}

table.act-table .c5,
table.act-table-shape .c5 {
    background-color: rgb(173, 175, 186);
}

table.act-table .c6,
table.act-table-shape .c6 {
    background-color: rgb(169, 188, 195);
}

table.act-table .c7,
table.act-table-shape .c7 {
    background-color: rgb(183, 204, 202);
}

table.act-table,
table.act-table-shape .white {
    background-color: white;
}

table.act-table .dg,
table.act-table-shape .dg {
    background-color: darkgray;
}

table.act-table-info {
    border: none;
    user-select: none;
    position: absolute;
    top: 0;
    left: 0;
}

table.act-table-info td {
    border: none;
    padding: 0 1px 0 3px;
    overflow: hidden;
    text-align: center;
}

table .actlayout {
    table-layout: fixed;
    word-wrap: break-word;
    top: 0;
    left: 0;
    border: none;
    user-select: none;
}

.error {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}

table.load-table tr:nth-child(odd) {
    background-color: #f0f0ff;
}

table.load-table td {
    padding: 0 3px 0 3px;
    overflow: hidden;
    font-family: Courier New, Courier, monospace;
    box-shadow: inset -1px -1px 0 #ddd;
    outline: none;
}

.load-error {
    background-color: red;
}

.load-edge {
    background-color: lightgray;
    text-align: center;
}

.load-header {
    background-color: rgb(180, 180, 180);
    text-align: center;
}

.load-number {
    text-align: right;
}

.load-ignored {
    color: lightgray;
}

.pg-cell-invalid {
    background: rgba(220, 0, 0, 0.08) !important;
    color: #c00;
}

.pg-cell-notused {
    color: rgba(150, 150, 150) !important;
    text-decoration: line-through;
}

/* TriangleGrid: loading spinner */
.cell-spinner {
    display: inline-block;
    animation: actuarialSpin 1.1s linear infinite;
    font-size: 1.2rem;
}

@keyframes actuarialSpin {
    100% { transform: rotate(360deg); }
}

/* shown by blazor.web.js when the connection to the server fails with an unhandled error */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000;
    padding: 0.6rem 1.25rem; background: lightyellow;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
}
#blazor-error-ui .reload { margin-left: 0.5rem; }
