:root {
    --theme-color: #00b199;
    --theme-color-light: #cef9f5;
    --theme-color-mid: #e0f7f4;
    --nav-height: 5rem;
    --content-padding: 4rem;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
}

@media screen and (orientation: landscape) {
    :root {
        --content-padding: 4rem;
    }
}

@media screen and (orientation: portrait) {
    :root {
        --content-padding: 2rem;
    }
}

* {
    margin: 0;
    padding: 0;
    --scrollbarBG: var(--background-color);
    --thumbBG: var(--theme-color);
    --foreground-text: var(--theme-color);
    --background-color: #f9f9f6;
    --scrollbar-width: thin;
    --scrollbar-color: var(--scrollbarBG) var(--thumbBG);
    font-family: Montserrat, sans-serif;
    line-height: 1.3;
}

html, body {
    min-height: 100% !important;
    height: 100%;
    width: 100%;
    overflow: auto;
    color: var(--foreground-text);
}

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

body::-webkit-scrollbar-track {
    background: var(--scrollbarBG);
}

.body::-webkit-scrollbar-thumb {
    background-color: var(--thumbBG);
    border-radius: 3px;
    border: 3px solid var(--thumbBG);
}

nav {
    position: absolute;
    display: block;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: var(--theme-color);
    box-shadow: var(--shadow-md);
    z-index: 20;
}

footer {
    display: block;
    width: 100%;
    height: 4rem;
    background-color: var(--theme-color-light);
}

content {
    position: absolute;
    top: var(--nav-height);
    display: block;
    left: var(--content-padding);
    padding: 1rem;
    padding-bottom: 7rem;
    width: calc(100% - var(--content-padding) * 2);
}

.logo {
    position: absolute;
    top: 0.5rem;
    z-index: 10;
    left: var(--content-padding);
    padding-left: 10px;
    display: inline-block;
}

.logo-nav {
    display: block;
    height: calc(var(--nav-height) - 2rem);
}

.nav-user {
    position: absolute;
    bottom: 0.4rem;
    right: var(--content-padding);
    color: white;
    font-size: 0.9rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-user a {
    display: flex;
    align-items: center;
}

.nav-role {
    font-size: 0.75rem;
    opacity: 0.7;
    padding: 0.1rem 0.4rem;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 3px;
}

.nav-login-link {
    color: white;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-login-link:hover {
    opacity: 1;
}

.nav-logout-icon {
    height: 1rem;
    filter: brightness(0) invert(1);
    opacity: 0.85;
    cursor: pointer;
    transition: opacity 0.2s;
}

.nav-logout-icon:hover {
    opacity: 1;
}

.nav-links {
    position: absolute;
    bottom: 0.4rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.7;
    text-decoration: none;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-bottom: 2px solid transparent;
    padding-bottom: 0.15rem;
}

a.nav-link:hover {
    opacity: 1;
    text-decoration: none;
}

.nav-link-active {
    opacity: 1;
    border-bottom-color: white;
}

.nav-link-icon {
    height: 0.85em;
    width: auto;
    filter: brightness(0) invert(1);
}

.landing-btn-icon {
    height: 1.2em;
    width: auto;
}

.landing-btn-primary .landing-btn-icon {
    filter: brightness(0) invert(1);
}

.landing-btn-secondary .landing-btn-icon {
    filter: invert(58%) sepia(85%) saturate(953%) hue-rotate(124deg) brightness(79%) contrast(103%);
}

.topics-table .icon-disabled {
    pointer-events: auto;
    cursor: not-allowed;
}

.topics-table .icon-disabled:hover {
    transform: none;
}

/* Citizens table column widths */
.citizens-table col:nth-child(1) { width: 35%; }
.citizens-table col:nth-child(2) { width: 25%; }
.citizens-table col:nth-child(3) { width: 20%; }
.citizens-table col:nth-child(4) { width: 20%; }

.citizens-table td:last-child {
    padding-left: 1rem;
}

.citizens-table .icon-disabled {
    pointer-events: auto;
    cursor: not-allowed;
}

.citizens-table .icon-disabled:hover {
    transform: none;
}

.oh-hai {
    cursor: pointer;
    align-self: flex-end;
    margin-left: auto;
    padding-right: 1rem;
    text-align: right;
}

.oh-access {
    cursor: pointer;
    align-self: flex-start;
    padding-left: 1rem;
}

.link-cotainer {
    position: absolute;
    bottom: 5%;
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
}

.landing-buttons {
    position: absolute;
    bottom: 8%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.landing-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.6rem;
    border-radius: 2rem;
    font-size: 0.95rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
    min-width: 260px;
    justify-content: center;
}

.landing-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.landing-btn-primary {
    background-color: var(--theme-color);
    color: white;
}

.landing-btn-primary:hover {
    background-color: #009e88;
}

.landing-btn-secondary {
    background-color: white;
    color: var(--theme-color);
    border: 1.5px solid var(--theme-color);
}

.landing-btn-secondary:hover {
    background-color: #f0faf8;
}

.landing-footer {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--theme-color);
    opacity: 0.6;
}

a {
    color: var(--theme-color);
    text-decoration: underline;
    text-underline-offset: 0.2rem;
}

.banner {
    display: block;
    max-height: 50%;
    margin-top: 10%;
    margin-left: auto;
    margin-right: auto;
}

.table-mandatory {
    padding-top: 1rem;
    border-collapse: separate;
    border-spacing: 0 1rem;
}

.table-mandatory tr {

}

.table-mandatory th {
    text-align: left;
    vertical-align: top;
    padding-right: 2rem;
    width: 30%;
}

.th-sub {
    padding-left: 1rem;
}

.table-mandatory td {
    padding-right: 2rem;
    width: fit-content;
    white-space: pre-wrap;
}

.pre-wrap {
    padding-right: 2rem;
    width: fit-content;
    white-space: pre-wrap;
}

.no-padding {
    padding-left: 0 !important;
    white-space: normal !important;
}

h1 {
    font-weight: 600;
    font-size: 1.6rem;
    margin-top: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

ul {
    margin-left: 2rem;
}

th {
    font-weight: 600;
    text-align: left;
}

.link-table thead th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.6rem 0.5rem;
    border-bottom: 2px solid var(--theme-color);
    color: var(--theme-color);
    opacity: 0.7;
}

.link-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.2rem;
}

.link-table thead th.sortable:hover {
    opacity: 1;
}

.link-table thead th.sorted-asc::after {
    content: '\25B2';
    position: absolute;
    right: 0.2rem;
    opacity: 0.9;
    font-size: 0.6rem;
}

.link-table thead th.sorted-desc::after {
    content: '\25BC';
    position: absolute;
    right: 0.2rem;
    opacity: 0.9;
    font-size: 0.6rem;
}

.link-list {
    line-height: 1.6rem;
}

.link-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.link-table col:nth-child(1) { width: 8%; }
.link-table col:nth-child(2) { width: 10%; }
.link-table col:nth-child(3) { width: 10%; }
.link-table col:nth-child(4) { width: 20%; }
.link-table col:nth-child(5) { width: 13%; }
.link-table col:nth-child(6) { width: 15%; }
.link-table col:nth-child(7) { width: 10%; }
.link-table col:nth-child(8) { width: 14%; }

.link-table.viewer-mode col:nth-child(4) { width: 22%; }
.link-table.viewer-mode col:nth-child(5) { width: 15%; }
.link-table.viewer-mode col:nth-child(6) { width: 17%; }
.link-table.viewer-mode col:nth-child(7) { width: 12%; }
.link-table.viewer-mode col:nth-child(8) { width: 3%; }

/* Topics table: name column fills remaining space */
.topics-table { table-layout: auto; }
.topics-table col:nth-child(1) { width: auto; }
.topics-table col:nth-child(2) { width: 120px; }

.link-table th,
.link-table td {
    vertical-align: top;
    padding: 0.6rem 0.5rem;
    white-space: normal;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-table td {
    border-bottom: 1px solid #eee;
}

.link-table tbody tr[data-published="1"] {
    background-color: var(--theme-color-mid);
}

.link-table tfoot td {
    font-size: 0.8rem;
    opacity: 0.6;
    padding-top: 0.8rem;
    border: none;
}

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

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

.svg-theme {
    filter: invert(58%) sepia(85%) saturate(953%) hue-rotate(124deg) brightness(79%) contrast(103%) !important;
}

.svg-red {
    filter: invert(19%) sepia(95%) saturate(6932%) hue-rotate(358deg) brightness(100%) contrast(110%) !important;
}

.svg-orange {
    filter: invert(62%) sepia(92%) saturate(1752%) hue-rotate(1deg) brightness(104%) contrast(106%) !important;
}

.svg-grey {
    filter: invert(50%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(90%) !important;
}

.icon-disabled {
    opacity: 0.3;
    pointer-events: none;
}

.clickable {
    cursor: pointer;
    transition: transform .2s;
}

.clickable:hover {
    transform: scale(1.2);
}

.icon {
    width: 1rem;
    height: 1rem;
    color: var(--theme-color);
}

.spinner {
    position: fixed;
    display: block;
    left: calc(50% - 2.5rem);
    top: calc(50% - 2.5rem);
    width: 80px;
    height: 80px;
    z-index: 1000;
}

.spinner div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 64px;
    height: 64px;
    margin: 8px;
    border: 8px solid #fff;
    border-radius: 50%;
    animation: spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--theme-color) transparent transparent transparent;

}

.spinner div:nth-child(1) {
    animation-delay: -0.45s;
}

.spinner div:nth-child(2) {
    animation-delay: -0.3s;
}

.spinner div:nth-child(3) {
    animation-delay: -0.15s;
}

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

.backdrop {
    display: block;
    backdrop-filter: blur(6px);
    background: rgba(0,0,0,0.1);
    position: fixed;
    _position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
}

#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #fff;
    color: var(--theme-color);
    text-align: center;
    border: 1px solid rgba(0,177,153,0.3);
    border-radius: 12px;
    outline-color: var(--theme-color);
    padding: 16px;
    position: fixed !important;
    z-index: 10000 !important;
    left: 50% !important;
    transform: translateX(-50%);
    top: unset !important;
    bottom: 30px !important;
    box-shadow: var(--shadow-md);
    font-weight: 500;
}

#toast.show {
    visibility: visible;
    -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

.toast-ok {
    content: url(/assets/img/check-circle.svg);
}

.toast-err {
    content: url(/assets/img/exclamation-triangle.svg);
}

#check {
    float: right;
    padding-right: 0.5rem;
}

#toast-icon {
    float: left;
    padding-left: 0.5rem;
}

.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
}

footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3rem;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 1.5rem 1.5rem 0 0;
    z-index: 5;
    min-width: 25rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

cta {
    position: fixed;
    display: block;
    margin: auto;
    background-color: var(--theme-color);
    width: 5rem;
    height: 5rem;
    z-index: 10;
    bottom: 0;
    border-radius: 50%;
    border: 0.25rem solid white;
    left: calc(50% - 2.5rem);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
}

cta:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
}

cta icon {
    display: block;
    height: 3.45rem;
    width: 3.45rem;
    cursor: pointer;
    text-align: center;
    margin-left: 0.8rem;
    margin-top: 0.8rem;
}

version {
    position: absolute;
    display: block;
    font-size: 0.7rem;
    color: var(--theme-color);
    opacity: 0.6;
    bottom: 0.5rem;
    right: 0.5rem;
}

/* Animations to fade the snackbar in and out */
@-webkit-keyframes fadein {
    from {
        bottom: 0;
        opacity: 0;
    }
    to {
        bottom: 30px;
        opacity: 1;
    }
}

@keyframes fadein {
    from {
        bottom: 0;
        opacity: 0;
    }
    to {
        bottom: 30px;
        opacity: 1;
    }
}

@-webkit-keyframes fadeout {
    from {
        bottom: 30px;
        opacity: 1;
    }
    to {
        bottom: 0;
        opacity: 0;
    }
}

@keyframes fadeout {
    from {
        bottom: 30px;
        opacity: 1;
    }
    to {
        bottom: 0;
        opacity: 0;
    }
}

.message {
    text-align: center;
    width: 100%;
    margin-top: 10%;
}

.ok {
    color: #00b199;
}

.error {
    color: #ff0000;
}

.warning {
    color: #ffcc00;
}

.message-text {
    font-size: 4rem;
    font-weight: bold;
    margin-top: 1rem;
}

.about {
    position: absolute;
    bottom: 0;
    right: 0;
    margin-right: 1rem;
    margin-bottom: 1rem;
    color: var(--theme-color);
    font-size: small;
}

.oh-login {
    cursor: pointer;
    text-align: center;
    justify-content: center;
    color: var(--theme-color);
    font-size: small;
    width: 100%;
}

a {
    color: var(--theme-color);
    text-decoration: none;
    text-underline-offset: 0.2rem;
}

a:hover {
    text-decoration: underline;
}

input[type=text], input[type=date] {
    position: relative;
    display: block;
    text-align: center;
    height: 2rem;
    border: 2px solid var(--theme-color);
    border-radius: 0 0 8px 8px;
    outline-color: var(--theme-color);
    padding-left: 4rem;
    padding-right: 4rem;
    width: calc(100% - 8rem);
}

.permit-icon {
    float: right;
    padding-right: 0.5rem;
    position: relative;
    top: -1.5rem;
}

.permit-button {
    float: right;
    padding-left: 0.5rem;
    text-align: center;
}

.icon {
    width: 1rem;
    height: 1rem;
    color: var(--theme-color);
}

.icon-button {
    width: 2rem;
    height: 2rem;
    color: var(--theme-color);
}

#edit-form {
    position: fixed;
    display: block;
    z-index: 1000;
    left: 20%;
    width: 60%;
    top: calc(var(--nav-height) + 4rem);
    max-height: calc(100vh - var(--nav-height) - 8rem);
    overflow-y: auto;
}

#inter-form-container {
    background-color: #fff;
    border: 1px solid rgba(0,177,153,0.2);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

#inter-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--theme-color);
}

.form-row {
    margin-bottom: 1rem;
}

.form-row-half {
    display: flex;
    gap: 1rem;
}

.form-row-half > .form-col {
    flex: 1;
}

.form-col {
    display: flex;
    flex-direction: column;
}

.inter-input {
    display: block;
    width: 100%;
    height: 2.2rem;
    border: 2px solid var(--theme-color);
    border-radius: 0 0 8px 8px;
    outline-color: var(--theme-color);
    padding: 0 0.5rem;
    font-size: 0.9rem;
    font-family: Montserrat, sans-serif;
    text-align: left;
    box-sizing: border-box;
    color: var(--theme-color);
}

input[type=text].inter-input {
    width: 100%;
    padding: 0 0.5rem;
    box-sizing: border-box;
    text-align: left;
}

input[type=date].inter-input {
    height: 2.2rem;
    padding: 0 0.5rem;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
    color-scheme: light;
}

input[type=date].inter-input::-webkit-calendar-picker-indicator {
    filter: invert(58%) sepia(85%) saturate(953%) hue-rotate(124deg) brightness(79%) contrast(103%);
}

input[type=date].inter-input::-webkit-datetime-edit,
input[type=datetime-local].inter-input::-webkit-datetime-edit {
    color: var(--theme-color);
    font-family: Montserrat, sans-serif;
}

input[type=date].inter-input::-webkit-datetime-edit-text,
input[type=datetime-local].inter-input::-webkit-datetime-edit-text {
    color: var(--theme-color);
    opacity: 0.55;
}

.inter-input:focus,
input.combo-input:focus {
    box-shadow: 0 0 0 3px rgba(0,177,153,0.15);
    border-color: var(--theme-color);
    outline: none;
}

.inter-textarea:focus {
    box-shadow: 0 0 0 3px rgba(0,177,153,0.15);
    border-color: var(--theme-color);
    outline: none;
}

.inter-input::placeholder,
input.combo-input::placeholder {
    color: var(--theme-color);
    opacity: 0.55;
}

select.inter-input {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300b199'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 1.2rem;
    padding-right: 2rem;
    cursor: pointer;
}

.inter-display {
    background-color: var(--theme-color-light);
    border: 2px solid var(--theme-color);
    border-radius: 0 0 8px 8px;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    color: var(--theme-color);
    min-height: 1.4rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.lds-ring {
    position: fixed;
    display: block;
    left: calc(50% - 2.5rem);
    top: calc(50% - 2.5rem);
    width: 80px;
    height: 80px;
    z-index: 1000;
}

.lds-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 64px;
    height: 64px;
    margin: 8px;
    border: 8px solid #fff;
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--theme-color) transparent transparent transparent;
}

.lds-ring div:nth-child(1) {
    animation-delay: -0.45s;
}

.lds-ring div:nth-child(2) {
    animation-delay: -0.3s;
}

.lds-ring div:nth-child(3) {
    animation-delay: -0.15s;
}

@keyframes lds-ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.copy-link {
    cursor: pointer;
}

tr.row-highlight {
    transition: background-color 0.15s;
}

tr.row-highlight:hover {
    background-color: var(--theme-color-light) !important;
}

.link-table td:last-child {
    overflow: visible;
}

.icon-row {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.icon-row .icon {
    width: 1.1rem;
    height: 1.1rem;
    padding: 0.3rem;
    border-radius: 50%;
    transition: background-color 0.15s, transform 0.2s;
}

.icon-row .icon:not(.icon-disabled):hover {
    background-color: rgba(0,177,153,0.08);
}

/* Searchable combobox */
.combo-wrap {
    position: relative;
}

select.combo-hidden {
    display: none;
}

input.combo-input {
    display: block;
    width: 100%;
    height: 2.2rem;
    border: 2px solid var(--theme-color);
    border-radius: 0 0 8px 8px;
    outline-color: var(--theme-color);
    padding: 0 2rem 0 0.5rem;
    font-size: 0.9rem;
    font-family: Montserrat, sans-serif;
    text-align: left;
    box-sizing: border-box;
    color: var(--theme-color);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300b199'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 1.2rem;
    cursor: pointer;
}

.combo-list {
    display: none;
    position: fixed;
    max-height: 14rem;
    overflow-y: auto;
    background: #fff;
    border: 2px solid var(--theme-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 2000;
}

.combo-list.open {
    display: block;
}

.combo-item {
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    color: var(--theme-color);
    cursor: pointer;
}

.combo-item:hover,
.combo-item.highlighted {
    background-color: var(--theme-color-light);
}

.combo-item.active {
    font-weight: 600;
    background-color: var(--theme-color-light);
}

/* Combobox with add button */
.combo-with-add {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
}

.combo-with-add select.inter-input,
.combo-with-add .combo-wrap {
    flex: 1;
    min-width: 0;
}

.combo-add-btn {
    width: 2.2rem;
    height: 2.2rem;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--theme-color);
    font-size: 1.6rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    line-height: 2.2rem;
    padding: 0;
}

.combo-add-btn:hover {
    transform: scale(1.2);
}

/* Mini-modal for inline creation */
.mini-modal {
    position: fixed;
    z-index: 1500;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(var(--nav-height) + 2rem);
    padding-bottom: 2rem;
    overflow: hidden;
}

.mini-modal-container {
    background: #fff;
    border: 1px solid rgba(0,177,153,0.2);
    border-radius: 8px;
    padding: 1.5rem 1.5rem 2.5rem;
    box-sizing: border-box;
    width: 30rem;
    max-width: 90vw;
    max-height: 100%;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.mini-modal-container label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--theme-color);
}

.mini-modal-container .inter-input {
    margin-bottom: 0.5rem;
}

.reassign-source-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding: 0.4rem 0.6rem;
    background: var(--theme-color-mid);
    border-radius: 4px;
}

/* Confirm message */
.confirm-message {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Modal title */
modal-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--theme-color);
}

/* Wide text modal */
.text-modal-wide {
    width: 40rem;
}

/* Textarea styled like inter-input */
.inter-textarea {
    height: auto;
    resize: vertical;
    padding: 0.5rem;
    line-height: 1.4;
}

/* Toggle buttons for questioner type */
.toggle-buttons {
    display: flex;
    gap: 0;
}

.toggle-btn {
    flex: 1;
    height: 2.2rem;
    border: 2px solid var(--theme-color);
    background: #fff;
    color: var(--theme-color);
    font-size: 0.9rem;
    font-family: Montserrat, sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.toggle-btn:first-child {
    border-radius: 0 0 0 8px;
}

.toggle-btn:last-child {
    border-radius: 0 0 8px 0;
    border-left: none;
}

.toggle-btn.active {
    background-color: var(--theme-color);
    color: #fff;
}

/* Questioner fields spacing */
.questioner-fields {
    margin-top: 0.5rem;
}

.questioner-fields.hidden {
    display: none !important;
}

/* Datetime-local input */
input[type=datetime-local].inter-input {
    height: 2.2rem;
    padding: 0 0.5rem;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
    color-scheme: light;
}

input[type=datetime-local].inter-input::-webkit-calendar-picker-indicator {
    filter: invert(58%) sepia(85%) saturate(953%) hue-rotate(124deg) brightness(79%) contrast(103%);
}

/* Attachment rows */
.attachment-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 0.5rem;
}

.attachment-row input[type=file] {
    flex: 1;
    min-width: 0;
    height: 2.4rem;
    border: 2px solid var(--theme-color);
    border-radius: 0 0 8px 8px;
    outline-color: var(--theme-color);
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    font-family: Montserrat, sans-serif;
    color: var(--theme-color);
    box-sizing: border-box;
    cursor: pointer;
}

.attachment-row input[type=text] {
    flex: 1;
    min-width: 0;
    height: 2.4rem;
    border: 2px solid var(--theme-color);
    border-radius: 0 0 8px 8px;
    outline-color: var(--theme-color);
    padding: 0 0.5rem;
    font-size: 0.85rem;
    font-family: Montserrat, sans-serif;
    color: var(--theme-color);
    box-sizing: border-box;
    text-align: left;
    width: auto;
    display: flex;
}

.attachment-row input[type=file]::file-selector-button {
    background: var(--theme-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-family: Montserrat, sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 0.5rem;
}

.attachment-remove-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--theme-color);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0;
    width: 1.5rem;
}

.attachment-remove-btn:hover {
    transform: scale(1.2);
}

/* Detail panel */
#detail-panel {
    position: fixed;
    display: block;
    z-index: 1000;
    left: 15%;
    width: 70%;
    top: calc(var(--nav-height) + 2rem);
    max-height: calc(100vh - var(--nav-height) - 6rem);
    overflow-y: auto;
}

#detail-panel-container {
    background-color: #fff;
    border: 1px solid rgba(0,177,153,0.2);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

#detail-panel-container label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--theme-color);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.detail-header modal-title {
    margin-bottom: 0;
}

.detail-section {
    margin-top: 1.5rem;
}

.detail-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-color);
    border-bottom: 2px solid var(--theme-color);
    padding-bottom: 0.3rem;
    margin-bottom: 0.8rem;
}

.detail-text-card {
    background-color: var(--theme-color-light);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.8rem;
}

.detail-text-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.detail-text-chevron {
    font-size: 0.85rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.detail-text-card.expanded .detail-text-chevron {
    transform: rotate(90deg);
}

.detail-text-type {
    font-weight: 700;
    font-size: 0.95rem;
}

.detail-text-who {
    font-size: 0.85rem;
    opacity: 0.8;
}

.detail-text-meta {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-left: auto;
}

.detail-text-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.detail-text-card.expanded .detail-text-body {
    max-height: 2000px;
    opacity: 1;
}

.detail-text-questioner {
    font-style: italic;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.detail-text-content {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 0.5rem;
}

.detail-attachment-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--theme-color-light);
}

.detail-attachment-row:last-child {
    border-bottom: none;
}

.detail-attachment-icon {
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

.detail-attachment-info {
    flex: 1;
    min-width: 0;
}

.detail-attachment-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.detail-attachment-filename {
    font-size: 0.8rem;
    opacity: 0.7;
}

.detail-attachment-size {
    font-size: 0.8rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.detail-attachment-download {
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.detail-attachment-download:hover {
    transform: scale(1.2);
}

.detail-history-row {
    display: flex;
    gap: 0.8rem;
    padding: 0.4rem 0.4rem;
    border-bottom: 1px solid var(--theme-color-light);
    font-size: 0.85rem;
    align-items: baseline;
}

.detail-history-row.clickable {
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.detail-history-row.clickable:hover {
    background-color: var(--theme-color-light);
    transform: none;
}

.detail-history-row:last-child {
    border-bottom: none;
}

.detail-history-action {
    font-weight: 600;
    flex-shrink: 0;
    min-width: 6.5rem;
}

.detail-history-subject {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.detail-history-user {
    opacity: 0.7;
    flex-shrink: 0;
}

.detail-history-time {
    opacity: 0.7;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.detail-empty {
    font-style: italic;
    font-size: 0.9rem;
    opacity: 0.6;
}

#list tr[data-gid] {
    cursor: pointer;
}

/* Year filter */
.year-filter {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.8rem;
}

.year-btn {
    flex: none;
    height: 2.2rem;
    padding: 0 1rem;
    border: 2px solid var(--theme-color);
    border-radius: 0 0 6px 6px;
    background: #fff;
    color: var(--theme-color);
    font-size: 0.9rem;
    font-family: Montserrat, sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.year-btn:not(.active):hover {
    background-color: var(--theme-color-light);
}

.year-btn.active {
    background-color: var(--theme-color);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* Column filter row */
.filter-row.filter-hidden {
    display: none;
}

.link-table .filter-row th {
    padding: 0.4rem 0.5rem 0.4rem;
    border-bottom: none;
    text-transform: none;
    letter-spacing: normal;
    opacity: 1;
}

.link-table thead tr:first-child th:last-child {
    text-align: right;
}

.filter-wrap {
    position: relative;
    display: block;
}

.filter-clear {
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-color);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.filter-clear:hover {
    opacity: 1;
}

.filter-wrap.has-value .filter-clear {
    display: block;
}

input[type=text].filter-input {
    width: 100%;
    height: 1.8rem;
    border: 1px solid var(--theme-color);
    border-radius: 0 0 6px 6px;
    outline: none;
    padding: 0 1.4rem 0 0.4rem;
    font-size: 0.8rem;
    font-family: Montserrat, sans-serif;
    color: var(--theme-color);
    box-sizing: border-box;
    text-align: left;
}

input[type=text].filter-input::placeholder {
    color: var(--theme-color);
    opacity: 0.4;
}

input[type=text].filter-input:focus {
    box-shadow: 0 0 0 2px rgba(0,177,153,0.15);
    border-color: var(--theme-color);
}

#filter-toggle {
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
}

#filter-toggle:hover {
    opacity: 0.8;
}

#filter-toggle.active {
    opacity: 1;
}

/* History diff modal */
.history-diff-container {
    width: 38rem;
}

.history-diff-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.history-diff-table th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    padding: 0.5rem 0.6rem;
    border-bottom: 2px solid var(--theme-color);
    color: var(--theme-color);
    opacity: 0.7;
    text-align: left;
}

.history-diff-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    word-break: break-word;
}

.history-diff-table td:first-child {
    font-weight: 600;
    white-space: nowrap;
    width: 8rem;
}

.history-diff-old {
    background-color: #fff0f0;
}

.history-diff-new {
    background-color: #f0fff0;
}

/* Input clear button (modal text inputs) */
.input-wrap {
    position: relative;
    display: block;
    margin-bottom: 0.5rem;
}
.input-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-color);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.input-clear:hover { opacity: 1; }
.input-wrap.has-value .input-clear { display: block; }
.input-wrap .inter-input { padding-right: 1.6rem; margin-bottom: 0; }
.attachment-row .input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
}

/* Responsive: horizontal scroll for table on narrow screens */
@media (max-width: 900px) {
    content.main {
        overflow-x: auto;
    }
    .link-table {
        min-width: 800px;
    }
}

/* Statistics page */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stats-card {
    background: #fff;
    border: 1px solid rgba(0,177,153,0.15);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stats-card-wide {
    grid-column: 1 / -1;
}

.stats-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-color);
    border-bottom: 2px solid var(--theme-color);
    padding-bottom: 0.3rem;
    margin-bottom: 1rem;
}

.stats-empty {
    font-style: italic;
    font-size: 0.9rem;
    opacity: 0.5;
    padding: 1rem 0;
}

/* Bar chart */
.bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.bar-label {
    flex: 0 0 10rem;
    font-size: 0.85rem;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-label-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.bar-label-link:hover {
    text-decoration: underline;
    color: var(--theme-color);
}

.bar-track {
    flex: 1;
    height: 1.4rem;
    background: #f0f0ed;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.bar-count {
    flex: 0 0 2.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
}

/* Donut chart */
.donut-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 0;
}

.donut {
    position: relative;
    width: 10rem;
    height: 10rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-hole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-total {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--theme-color);
    line-height: 1.2;
}

.donut-total-label {
    font-size: 0.75rem;
    opacity: 0.6;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.donut-legend-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.donut-legend-link:hover .donut-legend-name {
    text-decoration: underline;
    color: var(--theme-color);
}

.donut-legend-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-legend-name {
    font-weight: 600;
}

.donut-legend-count {
    opacity: 0.7;
    font-size: 0.85rem;
}

/* Year bars (vertical) */
.year-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.8rem;
    height: 10rem;
    padding: 0.5rem 0;
}

.year-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 5rem;
    height: 100%;
    justify-content: flex-end;
}

.year-bar-count {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--theme-color);
}

.year-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease;
}

.year-bar-label {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    opacity: 0.7;
}

.year-bar-active .year-bar-label {
    font-weight: 700;
    opacity: 1;
}

.year-bar-active .year-bar-count {
    font-weight: 700;
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .bar-label {
        flex: 0 0 7rem;
        font-size: 0.8rem;
    }
    .donut-wrap {
        flex-direction: column;
        gap: 1rem;
    }
    .donut {
        width: 8rem;
        height: 8rem;
    }
    .donut-hole {
        width: 5rem;
        height: 5rem;
    }
    .donut-total {
        font-size: 1.3rem;
    }
}
