:root {
    --sub-accent-color: #1a1a1a;
    --sub-bg-accent-color: #1a1a1a;
    --keyd-accent: #FFCC00;
}

html,
body {
    margin-top: 0 !important;
    box-sizing: border-box !important;
    overflow: auto !important;
}

body {
    font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji !important;
}

body div {
    box-sizing: border-box !important;
}

button {
    cursor: pointer;
}

.wrap {
    padding: 100px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.wrap.home {
    max-height: 100dvh;
    overflow: hidden;
}

.keyd-content {
    flex: 1;
    position: relative;
    min-height: 70vh;
}

#no-results-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 500;
    color: gray;
}

#submissions-table {
    width: 100%;
    max-height: calc(100dvh - 265px);
    overflow: auto;
}

#new-submissions-table {
    width: 100%;
    max-height: calc(100dvh - 195px);
    overflow: auto;
}

#submissions-table:active,
#new-submissions-table:active {
    cursor: grabbing;
}

.wrap h1 {
    margin-bottom: 25px;
}

#wpadminbar {
    display: none;
}

button {
    font-family: inherit !important;
    border-radius: 0 !important;
}

button:disabled,
button:disabled:hover {
    background-color: light-dark(rgba(239, 239, 239, 0.3), rgba(19, 1, 1, 0.3)) !important;
    color: light-dark(rgba(16, 16, 16, 0.3), rgba(255, 255, 255, 0.3)) !important;
    border-color: light-dark(rgba(118, 118, 118, 0.3), rgba(195, 195, 195, 0.3)) !important;
}

.keyd-button.dark-bg {
    border: 1px solid var(--keyd-accent) !important;
    background-color: #FFCC00 !important;
}

.comments-cell > .add-comment-button {
    text-align: left;
}

.comments-cell > .add-comment-button.keyd-button.dark {
    border: none !important;
}

.comments-cell > .add-comment-button.keyd-button.dark:hover,
.comments-cell > .add-comment-button.keyd-button.dark:active,
.comments-cell > .add-comment-button.keyd-button.dark:focus {
    background-color: transparent !important;
    color:var(--sub-accent-color) !important;
    text-decoration: underline;
}

.keyd-button.dark-bg:hover {
    background-color: transparent !important;
    color: #FFCC00 !important;
}

.keyd-button.small {
    font-size: 0.8rem;
    padding: 5px 7px !important;
    width: 100%;
}

.keyd-button.dark {
    border: 2px solid var(--sub-bg-accent-color) !important;
}

.keyd-button.dark:hover,
.keyd-button.dark:active,
.keyd-button.dark:focus {
    color: white !important;
    background-color: var(--sub-bg-accent-color) !important;
}

.keyd-button {
    color: var(--sub-bg-accent-color) !important;
    border: 2px solid var(--keyd-accent) !important;
    background: transparent !important;
    font-weight: 500 !important;
    padding: 10px 20px !important;
    text-align: center !important;
}

.keyd-button:hover,
.keyd-button:focus,
.keyd-button:active {
    color: var(--sub-bg-accent-color) !important;
    background-color: var(--keyd-accent) !important;
}

h1 {
    margin-block-end: 0 !important;
    margin-block-start: 0 !important;
    font-family: inherit !important;
    text-transform: unset !important;
    font-weight: 600 !important;
}

.keyd-content th {
    line-height: 1.2;
    text-wrap: nowrap;
    vertical-align: middle;
    font-weight: 500 !important;
}

.edit-key-button {
    padding: 0;
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
}

.editable-key::first-letter {
    text-transform: uppercase;
}

.edit-key-button:hover,
.edit-key-button:active,
.edit-key-button:focus {
    background-color: transparent !important;
}

.edit-key-button svg {
    width: 15px;
    height: 15px;
}

.editable-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 2px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.editable-header:has(.editable-key-input) {
    background-color: #f1f1f1;
}

.copyright {
    position: fixed;
    background-color: var(--sub-bg-accent-color);
    color: white;
    font-weight: 500;
    bottom: 0;
    width: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.copyright p {
    text-align: center;
    margin: 0;
    padding: 10px;
    color: inherit;
    font-size: 12px;
}

.site-footer,
header,
footer,
#site-header,
#main-footer,
header,
[data-elementor-type="header"] {
    display: none !important;
}

.key-input {
    width: 130px !important;
    padding: 5px !important;
    font-family: inherit;
}

input,
select {
    font-family: inherit !important;
}

.key-input:focus {
    outline: none;
}

.contact-status-header {
    background-color: #1C1C1C !important;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 0 10px 0 !important;
    border: none !important;
}

.contact-status-header svg {
    width: 24px;
    height: 24px;
}

.contact-status-header,
.contact-status-cell {
    width: 60px;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
}

.status-cell-wrap {
    display: flex;
    flex-wrap: wrap;
    max-width: 300px;
}

.status-cell-outer {
    max-width: 280px !important;
}

.keyd-content td {
    max-width: 500px;
}

table tbody>tr>td {
    background-color: white !important;
}

#new-submissions-table tr {
  cursor: pointer;
}

#new-submissions-table tr.unread td {
  filter: brightness(100%);
}

.submission-row:hover td,
#new-submissions-table tr:hover td,
#new-submissions-table tr td {
  filter: brightness(97%);
}

.small-title {
  font-size: 1.3rem;
}

.small-disclaimer {
  margin: 0;
  color: gray;
  font-size: 0.9rem;
  font-weight: 600;
}

table th {
    background-color: rgb(241, 241, 241);
}

table th,
table td {
    border: 1px solid #ccc !important;
    font-family: inherit !important;
    padding: 4px 10px 4px 12px !important;
    font-size: 0.9rem !important;
}

#new-submissions-table table th {
  padding: 10px 10px 10px 12px !important;
}

table td {
    vertical-align: middle !important;
}

tr.unread > td { font-weight: 600; }

.message {
    min-width: 450px !important;
}

table > tbody > tr > td:not(:first-child) {
    min-width: 150px;
}

/* Plugin header */

.plugin-header {
    background-color: var(--sub-bg-accent-color);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 25px;
    position: relative;
    z-index: 1001;
}

.logo {
    flex-basis: 185px;
    margin-top: 3px;
    margin-bottom: -3px;
}

.logo svg {
    width: 80px;
    height: auto;
    display: block;
}

.plugin-header h1 {
    font-size: 1.5rem;
    color: rgb(150, 150, 150);
}

/* End of Plugin header */

/* Submission checkbox */

select {
    color: #1a1a1a !important;
    background-position: calc(100% - 4px) !important; /* Move background arrow icon 8px from right edge */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: 1em;
    padding-right: 24px !important;  /* Increased right padding for arrow */
    padding-left: 8px !important;
    background-position: calc(100% - 8px) center !important;
    background-size: 14px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    min-width: 140px; /* Ensure minimum width for readability */
}

.select-submission {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 3px;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    position: relative;
    margin-top: 5px;
}

.select-submission:checked {
    background-color: var(--sub-accent-color);
    border-color: var(--sub-accent-color);
}

.select-submission:checked::after {
    content: '\2713';
    font-weight: 600;
    color: white;
    font-size: 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* end of Submission checkbox */

/* truncate text */

.truncated-text {
    display: inline;
}

.full-text {
    display: none;
}

.toggle-text-button {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
    margin-left: 5px;
    padding: 0;
    text-decoration: none;
    font-weight: 500;
    color: var(--sub-accent-color);
}

.toggle-text-button:hover,
.toggle-text-button:active,
.toggle-text-button:focus {
    color: var(--sub-accent-color);
    background: none;
}

/* end of truncate text */

/* manual submission form */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group input,
.form-group select {
    padding: 10px !important;
}

#form-fields-container,
#add-submission-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* manual submission form - on pc not as wide */

@media (min-width: 1210px) {
    .wrap.add-submission h1, 
    .wrap.add-submission form#add-submission-form {
        padding-left: 20%;
        padding-right: 20%;
        box-sizing: border-box;
    }
}

#form-fields-container > p {
    text-align: left;
    margin: 0;
}

#submit-button {
    margin-top: 10px;
}

.add-submission {
    gap: 25px;
}

.add-submission > h1 {
    margin-top: 25px;
    font-size: 2.5rem !important;
}

.add-submission > button {
    width: fit-content;
}

/* End of manual submission form */

/* Operations */

.operations-container {
    margin-bottom: 25px;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 25px;
    flex-wrap: wrap;
}

.operations-container > .left-operations {
    display: flex;
    align-items: flex-end;
    gap: 25px;
    flex: 2;
}

#operations-dropdown {
    position: absolute;
    z-index: 99;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 5px;
    display: none;
    top: 50px;
}

#operations-dropdown ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

#operations-dropdown li {
    cursor: pointer;
    padding: 5px 10px;
    text-wrap: nowrap;
}

#operations-dropdown li:hover {
    background: #f0f0f0;
}

.status-list-head {
    padding-left: 10px;
    font-weight: 600;
}

#delete-submissions {
    color: rgb(161, 15, 15);
    font-weight: 600;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 5px 10px;
    text-wrap: nowrap;
}

#delete-submissions:hover {
    background: #ffe6e6 !important;
}

#delete-submissions > svg {
    width: 12px;
    height: 12px;
}

#form-filter,
#sort-order {
    padding: 5px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    width: 100%;
    max-width: 160px;
}

.form-filter-wrap,
.sort-options {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 100px;
    flex: 1;
    max-width: 160px;
}

.form-filter-wrap > label,
.sort-options > label {
    font-weight: 500;
    font-size: 14px;
}

/* end of Operations */

.dropdown-wrap {
    position: relative;
}

.dropdown-wrap button {
    text-wrap: nowrap;
}

.right-operations {
    display: flex;
    gap: 25px;
    flex: 1;
    justify-content: flex-end;
}

/* Status management */

#status-manager-dropdown {
    position: absolute;
    z-index: 99;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 15px;
    display: none;
    top: 50px;
    right: 0;
}

.delete-status-icon {
    width: 8px;
    height: auto;
}

#status-manager-list li {
    list-style: none;
    padding: 5px 0px;
    display: flex;
    align-items: center;
    gap: 7px;
}

#status-manager-list > li > span {
    display: block;
    line-height: 1.3;
}

#status-manager-list > li > img {
    cursor: pointer;
}

#status-manager-list {
    padding: 0;
    margin-bottom: 10px;
}

/* End of Status management */

/* Status filters */

#filter-dropdown {
    position: absolute;
    z-index: 99;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 5px;
    display: none;
    top: 50px;
    right: 0;
}

#filter-dropdown ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

#filter-dropdown li {
    padding: 7px 10px;
}

#filter-dropdown li:hover {
    background: #f0f0f0;
}

#filter-dropdown label {
    display: flex;
    gap: 7px;
    align-items: center;
}

.filter-section-title {
    font-weight: 500;
    padding: 0px 10px 0px 10px;
    display: block;
}

.filter-section-title:not(:first-child) {
    padding: 10px 10px 0px 10px;
}

/* Status filter checkbox */

.status-filter {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border: 1px solid #ccc;
    border-radius: 2px;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    position: relative;
}

.status-filter:checked {
    background-color: var(--sub-accent-color);
    border-color: var(--sub-accent-color);
}

.status-filter:checked::after {
    content: '\2713';
    font-weight: 600;
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Status filter radio buttons */

.status-radio {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    position: relative;
}

.status-radio:checked {
    background-color: var(--sub-bg-accent-color);
    border-color: var(--sub-bg-accent-color);
}

.status-radio:checked::after {
    content: '';
    width: 9px;
    height: 9px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* End of status filters */


/* Spinner */

#loading-spinner {
    position: absolute;
    min-height: 200px; /* Adjust as needed */
    text-align: center;
    color: #555;
    font-size: 16px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.spinner {
    border: 4px solid #dadada;
    border-top: 4px solid var(--keyd-accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* End of Spinner */

/* Status pills */

.status-pill {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
    border-width: 2px;
    border-style: solid;
    border-color: gray;
    text-wrap: nowrap;
    display: block;
    margin: 5px;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
}

.cell-status-reached_out {
    border-color: #49a7eb;
    border-width: 2px;
}

.cell-status-scheduled_meeting {
    border-color: #b849eb;
    border-width: 2px;
}

.cell-status-sent_offer {
    border-color: var(--keyd-accent);
    border-width: 2px;
}

.cell-status-made_deal {
    border-color: #23af23;
    border-width: 2px;
}

.cell-status-denied {
    border-color: gray;
    border-width: 2px;
}


/* End of Status pills */

/* Comments */

.comments-cell > div {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.comment-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    gap: 7px;
    background-color: transparent;
    border: 1px solid gray;
    border-radius: 4px;
    font-size: 12px;
}

.comment-pill button {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.delete-comment-button > svg,
.delete-comment-button > img {
    width: 12px;
    height: auto;
}

.delete-status-button > svg,
.delete-status-button > img {
    width: 8px;
    height: auto;
    margin-top: 2px;
}

.delete-comment-button,
.delete-status-button {
    padding: 0;
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    flex-shrink: 0;
}

.delete-comment-button:hover,
.delete-comment-button:active,
.delete-comment-button:focus,
.delete-status-button:hover,
.delete-status-button:active,
.delete-status-button:focus {
    background-color: transparent !important;
}

.comments-cell {
    min-width: 350px !important;
}

/* End of comments */

@media (max-width: 1110px) {
    button,
    label,
    .status-pill,
    li {
        font-size: 0.8rem !important;
    }
    .add-submission h1 {
        font-size: 2rem;
    }
    .delete-status-icon {
        width: 12px;
    }
    .add-submission > h1 {
        font-size: 2rem !important;
        line-height: 2.3rem !important;
    }
    .left-operations,
    .right-operations {
        justify-content: space-between;
    }
    .dropdown-wrap {
        flex: 1;
    }
    .dropdown-wrap button {
        width: 100%;
    }
}

@media (max-width: 900px) {
    #submissions-table {
        max-height: calc(100dvh - 295px);
    }
    #new-submissions-table {
        max-height: calc(100dvh - 225px);
    }
}

@media (max-width: 830px) {
    table th {
        font-size: 0.8rem !important;
    }
    table {
        margin-block-end: 0 !important;
    }
    .wrap {
        padding: 90px 20px 20px 20px;
    }
    .operations-container {
        flex-direction: column;
        gap: 15px;
    }
    .right-operations {
        width: 100%;
        justify-content: space-between;
    }
    .left-operations {
        width: 100%;
    }
    .left-operations > div {
        flex: 1;
    }
    .plugin-header h1 {
        display: none;
    }
    .logo {
        flex-basis: initial;
    }
    .logo svg {
        width: 60px;
    }
    .keyd-button {
        padding: 5px;
    }
    #operations-dropdown,
    #filter-dropdown,
    #status-manager-dropdown {
        top: 40px;
    }
    .keyd-content {
        min-height: 0px;
    }
}

@media (max-width: 540px) {
    .left-operations {
        gap: 15px !important;
    }
    .add-submission > h1 {
        font-size: 1.5rem !important;
        line-height: 1.8rem !important;
    }
    .left-operations {
        flex-wrap: wrap;
    }
    #submissions-table {
        max-height: calc(100dvh - 340px);
    }
    #new-submissions-table {
        max-height: calc(100dvh - 270px);
    }
}

@media (max-width: 440px) {
    .left-operations {
        flex-direction: column-reverse;
        gap: 5px !important;
    }
    .dropdown-wrap {
        width: 100%;
    }
    #operations-dropdown,
    #filter-dropdown,
    #status-manager-dropdown {
        top: 35px;
        width: 100%;
    }
    #submissions-table {
        max-height: calc(100dvh - 370px);
    }
    #new-submissions-table {
        max-height: calc(100dvh - 270px);
    }
}

/* Start of show-hide columns feature */
.small-icon {
    width: 22px !important; 
    height: 22px !important; 
    fill: rgb(241, 241, 241);
    cursor: pointer; 
    background-color: transparent;
}

.small-icon svg {
    width: 100% !important; 
    height: 100% !important;
    fill: currentColor;
    fill-opacity: 1;
}

.eye-icon {
    display: inline-block; /* Ensure the icon is visible */
    cursor: pointer;
    width: 18px;
    height: 18px;
    fill: #000; /* Ensure the icon has a visible fill color */
    margin-left: 5px; /* Add some spacing */
    vertical-align: middle; /* Align the icon vertically */
    transition: opacity 0.3s ease;
}

.eye-icon:hover {
    opacity: 0.7;
}

/* Initially hide both edit and eye icons */
.edit-key-button, .eye-icon {
    display: none;
}

/* Column visibility styles */
.hide-column {
    opacity: 0.3;
}

.hidden-column {
    display: none !important;
}

th.hidden-column {
    display: none !important;
}

td.hidden-column {
    display: none !important;
}

/* Column visibility styles */
.column-marked-hidden {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.column-hidden {
    display: none !important;
}

/* Update eye icon styles */
.eye-icon.marked-for-hiding {
    opacity: 0.3;
}

/* Small edit icon in header */
#edit-columns.small-icon {
    width: 18px !important;
    height: 18px !important;
}

#edit-columns.small-icon svg {
    width: 18px !important;
    height: 18px !important;
}

.editable-key-input {
    font-size: 0.9rem;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    width: auto;
    min-width: 100px;
    background-color: #f1f1f1;
    transition: all 0.2s ease;
    color: var(--sub-accent-color);
}

.editable-key-input:focus {
    outline: none;
    background-color: #f1f1f1;
}

/* Form input styles */
input[type=date], 
input[type=email], 
input[type=number], 
input[type=password], 
input[type=search], 
input[type=tel], 
input[type=text], 
input[type=url], 
select, 
textarea {
    border: 1px solid #CCCCCC !important;
    border-radius: 0px !important;
    padding: 5px 10px !important;
}

/* Update editable key input to override the new default styles */
.editable-key-input {
    border: none;
    border-radius: 4px;
    background-color: #f1f1f1;
}

/* Tooltip styles */
.tooltip-container {
    position: relative;
    z-index: 1000;
}

.tooltip {
    visibility: hidden;
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffcc00;
    color: #1a1a1a;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;
    font-weight: 500;
    opacity: 1 !important;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.12);
}

.tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;    transform: translateX(-50%) rotate(45deg);    width: 8px;    height: 8px;    background-color: #ffcc00;    opacity: 1 !important;}.tooltip-container:hover .tooltip {    visibility: visible;}

/* Header icons styles */
.small-icon {
    width: 22px !important; 
    height: 22px !important; 
    cursor: pointer;
}

.small-icon svg {
    width: 100% !important; 
    height: 100% !important;
    fill: white !important; /* Force white color for header icons */
}

.header-right .small-icon {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.header-right .small-icon:hover {
    opacity: 1;
}

/* Dashboard Styles */
.wrap.dashboard {
    padding-top: 100px;
    contain: content; /* Contain layout and paint operations */
}

.date-range-filter, 
.form-filter-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 150px;
}

.date-range-filter label, 
.form-filter-wrap label {
    font-weight: 500;
    font-size: 14px;
}

.date-range-filter select,
.form-filter-wrap select {
    width: 100%;
}

/* Add spacing between header and filter controls */
.filter-controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 0;
    contain: content; /* Contain layout and paint operations */
    margin-top: 15px; /* Increased from 10px to 15px */
}

/* Optimize loading overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    will-change: opacity; /* Hardware acceleration hint */
    contain: layout style; /* Contain layout to prevent reflow */
}

/* Optimize stat grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    contain: content; /* Contain layout and paint operations */
}

.stat-card {
    padding: 15px;
    border-radius: 6px;
    background-color: #f8f8f8;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    transform: translateZ(0); /* Force hardware acceleration */
    contain: content; /* Contain layout and paint operations */
    position: relative;
}

/* No hover effects for better performance */
.stat-card:hover {
    transform: none;
}

.stat-card h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
}

.stat-card .stat-period {
    font-size: 0.75rem;
    color: #888;
    margin: 5px 0 0 0;
}

.stat-comparison {
    font-size: 0.75rem;
    color: #888;
    margin: 0;
    position: absolute;
    top: 15px;
    right: 15px;
}

.stat-comparison .change-value {
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 500;
}

.stat-comparison .change-value.positive {
    background-color: rgba(35, 175, 35, 0.1);
    color: #23af23;
}

.stat-comparison .change-value.negative {
    background-color: rgba(255, 99, 132, 0.1);
    color: #ff6384;
}

/* Optimize charts grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 35px;
    contain: content;
    perspective: none;
}

.chart-container {
    background-color: #f8f8f8; /* Changed from white to light gray to match stat cards */
    border-radius: 6px;
    padding: 20px 15px; /* Increased top/bottom padding */
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    height: 380px; /* Increased from 350px */
    position: relative;
    transform: none;
    contain: size layout style paint;
    overflow: hidden;
}

.chart-container h3 {
    margin: 0 0 20px 0;
    font-size: 1rem;
    color: #1a1a1a;
    text-align: center;
    font-weight: 500;
}

canvas {
    width: 100% !important;
    height: calc(100% - 25px) !important; /* Adjusted for more chart space */
    transform: none;
    contain: strict;
    touch-action: none;
}

.error-message {
    background-color: #ffe0e0;
    color: #d32f2f;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    border-left: 3px solid #d32f2f;
    font-size: 0.9rem;
}

/* Responsive dashboard */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .header-with-button {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 350px; /* Keep consistent with desktop height */
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .date-range-filter, 
    .form-filter-wrap {
        width: 100%;
        justify-content: space-between;
    }
}

/* End of Dashboard Styles */

.header-with-button {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Changed from center to align at bottom */
    margin-bottom: 30px; /* Increased from 25px to 30px */
    flex-wrap: wrap;
    gap: 20px; /* Increased from 15px to 20px */
}

.header-with-button .return-button {
    white-space: nowrap;
    margin-right: auto;
}

.filter-controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 0;
    contain: content; /* Contain layout and paint operations */
}

@media (max-width: 900px) {
    .header-with-button {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-controls {
        margin-top: 10px;
        justify-content: flex-start;
        width: 100%;
    }
}

/* Missing plugin message */
.missing-plugin {
    opacity: 0.5;
}

.stat-card .stat-period a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.stat-card .stat-period a:hover {
    text-decoration: underline;
}

/* Session count style */
.session-count {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
}

/* End of Missing plugin message */

/* Filter controls layout */
.filter-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-controls-row .return-button {
    margin-right: auto;
}

.right-controls {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

@media (max-width: 768px) {
    .filter-controls-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .right-controls {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* Remove old filter controls style */
.filter-controls {
    display: none;
}

/* Date cell styles */
.date-cell {
    white-space: nowrap;
    font-size: 0.9em;
    text-align: left;
}

/* Make sure the date column has a reasonable width */
#table-a th:nth-child(3) {
    width: 150px;
    min-width: 150px;
}

.submission-modal { 
  position: fixed; 
  inset: 0; 
  z-index: 10000; 
}

.submission-modal .modal-overlay { 
  position: absolute; 
  inset: 0; 
  background: rgba(0,0,0,.45); 
}

.submission-modal .modal-dialog {
  position: relative;
  max-width: 1100px;
  margin: 5vh auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 80px rgba(0,0,0,.25);
  padding: 24px 24px 72px;
}

@media (max-width: 1140px) {
  .submission-modal .modal-dialog { margin-left: 20px; margin-right: 20px; }
}

.loading {
  text-align: center;
  font-weight: bold;
  padding: 50px;
}

.submission-modal .modal-title { 
  margin: 0 0 16px; 
  font-size: 20px; 
  font-weight: 700; 
}

.submission-modal .fields-grid { 
  display: grid; 
  gap: 16px; 
}

@media (min-width: 1025px) { 
  .submission-modal .fields-grid { 
    grid-template-columns: repeat(3, minmax(0,1fr)); 
  } 
}

@media (min-width: 641px) and (max-width: 1024px) { 
  .submission-modal .fields-grid { 
    grid-template-columns: repeat(2, minmax(0,1fr)); 
  } 
}

@media (max-width: 640px) { 
  .submission-modal .fields-grid { 
    grid-template-columns: 1fr; 
  } 
}

.submission-modal .field { 
  background:#f8f8f8; 
  border-radius:12px; 
  padding:12px 14px; 
}

.submission-modal .field .key { 
  font-weight:700; 
  margin-bottom:6px; 
}

.submission-modal .field .key::after { 
  content: ":"; 
}

.submission-modal .field .value { 
  white-space: pre-wrap; 
  word-break: break-word; 
}

.submission-modal .modal-close { 
  position: absolute; 
  right: 24px; 
  bottom: 16px; 
}

body.keyd-modal-open { 
  overflow: hidden; 
}

#submission-modal .remove-status,
#submission-modal .delete-comment {
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: opacity 0.2s ease;
}

#submission-modal .remove-status svg,
#submission-modal .remove-status img,
#submission-modal .delete-comment svg,
#submission-modal .delete-comment img {
  width: 14px;
  height: auto;
  display: block;
}

#submission-modal .remove-status:hover,
#submission-modal .remove-status:focus,
#submission-modal .delete-comment:hover,
#submission-modal .delete-comment:focus {
  opacity: 0.7;
}

.keyd-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding-bottom: 20px;
}

.keyd-header-row .header-actions { 
  margin-left: auto; 
}

@media (max-width: 640px) {
  .keyd-header-row { 
    flex-direction: column; 
    align-items: stretch; 
  }
  .keyd-header-row .header-actions { 
    align-self: flex-end; 
  }
}
