:root {
    --color-bg: #ffffff;
    --color-fg: #212529;
    --header-bg: rgba(42, 53, 71, 1);
    --header-fg: #ffffff;
    --section-bg: #f8f9fa;
    --section-alt-bg: #ffffff;
    --table-stripe: #f2f2f2;
    --pre-bg: #f5f5f5;
    --modal-bg: #ffffff;
    --modal-fg: #212529;
    --border-color: #dee2e6;
    --link-color: #0d6efd;
    --btn-color: #0d6efd;
    --label-color: #212529;
    --pagination-bg: #ffffff;
    --pagination-fg: #212529;
    --pagination-hover: #e9ecef;
    --pagination-active-bg: #0d6efd;
    --pagination-active-fg: #ffffff;
    --private-color: #dc3545;
}

[data-theme="dark"] {
    --color-bg: #222526;
    --color-fg: #ffffff;
    --header-bg: rgba(42, 53, 71, 1);
    --header-fg: #ffffff;
    --section-bg: #1e2021;
    --section-alt-bg: #222526;
    --table-stripe: #212425;
    --pre-bg: #2d2d2d;
    --modal-bg: #2d2d2d;
    --modal-fg: #ffffff;
    --border-color: #495057;
    --link-color: #6ea8fe;
    --btn-color: #0d6efd;
    --label-color: #e0e0e0;
    --pagination-bg: #212529;
    --pagination-fg: #ffffff;
    --pagination-hover: #343a40;
    --pagination-active-bg: #0d6efd;
    --pagination-active-fg: #ffffff;
    --private-color: #ff6b70;
}

body {
    background-color: var(--color-bg);
    color: var(--color-fg);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
}

h2 {
    margin-bottom: 1.5rem;
    color: var(--color-fg);
}

[data-theme="dark"] h4 {
    color: #ffffff;
}

header {
    background-color: var(--header-bg) !important;
    color: var(--header-fg) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link {
    color: var(--header-fg) !important;
    transition: color 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

.theme-toggle {
    color: var(--header-fg) !important;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle i {
    font-size: 1.25rem;
}

.sections-bg {
    background-color: var(--section-bg);
    padding: 3rem 0;
    transition: background-color 0.3s ease;
}

.sections-bg:nth-child(even) {
    background-color: var(--section-alt-bg);
}

#hero {
    background-color: var(--header-bg);
    color: var(--header-fg);
    padding: 4rem 0;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#hero .lead {
    margin-top: 1.5rem;
    font-size: 1.25rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    color: var(--header-fg);
    font-weight: 500;
}

.repo-private {
    color: var(--private-color);
    font-weight: bold;
}

footer {
    background-color: var(--header-bg);
    color: var(--header-fg);
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 1.5rem 0;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-color);
    text-decoration: underline;
}

.text-muted {
    color: var(--color-fg) !important;
    opacity: 0.7;
}

[data-theme="dark"] .text-muted {
    color: #adb5bd !important;
}

.fs-1 {
    font-size: 0.75rem !important;
}

.table {
    color: var(--color-fg) !important;
    border-color: var(--border-color);
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table thead th {
    background-color: var(--header-bg);
    color: var(--header-fg);
    border-color: var(--border-color);
    padding: 1rem 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.table tbody td {
    padding: 0.75rem;
    border-color: var(--border-color);
    vertical-align: middle;
    transition: background-color 0.3s ease;
}

.table-striped tbody tr {
    background-color: transparent;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--table-stripe);
}

[data-theme="light"] .table-striped tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .table-striped tbody tr {
    background-color: #4e5458 !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: #212425 !important;
}

[data-theme="dark"] .table-striped {
    --bs-table-striped-bg: #212425;
    --bs-table-striped-color: var(--color-fg);
}

[data-theme="dark"] .table-striped tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nowrap {
    white-space: nowrap;
}

.pagination .page-link {
    background-color: var(--pagination-bg);
    color: var(--pagination-fg);
    border-color: var(--border-color);
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background-color: var(--pagination-hover);
    color: var(--pagination-fg);
    border-color: var(--border-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--pagination-active-bg);
    color: var(--pagination-active-fg);
    border-color: var(--pagination-active-bg);
}

.pagination .page-item.disabled .page-link {
    background-color: var(--pagination-bg);
    color: var(--pagination-fg);
    opacity: 0.5;
    border-color: var(--border-color);
}

#page-nav {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

#page-nav .nav-link {
    color: var(--color-fg) !important;
    font-weight: 500;
    border-radius: 0.25rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

#page-nav .nav-link:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--link-color) !important;
}

#page-nav .nav-link.active {
    background-color: var(--btn-color);
    color: #ffffff !important;
}

pre {
    background-color: var(--pre-bg);
    color: var(--color-fg);
    padding: 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
}

[data-theme="dark"] code {
    color: #e83e8c;
    background-color: rgba(232, 62, 140, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

.modal-content {
    background-color: var(--modal-bg);
    color: var(--modal-fg);
    border-color: var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
}

.modal-header {
    border-bottom-color: var(--border-color);
    padding: 1rem 1.5rem;
    background-color: var(--header-bg);
    color: var(--header-fg);
}

.modal-header .btn-close {
    color: var(--header-fg);
    opacity: 0.8;
    transition: opacity 0.3s ease;
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-header .btn-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: var(--header-fg);
}

.modal-body h6 {
    font-weight: 600;
    color: var(--color-fg);
}

[data-theme="dark"] .modal-body h6 {
    color: #ffffff;
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--border-color);
}

.form-label {
    color: var(--color-fg);
    font-weight: 500;
    transition: color 0.3s ease;
}

[data-theme="dark"] .form-label {
    color: var(--label-color);
}

.form-control,
.form-select {
    background-color: var(--color-bg);
    color: var(--color-fg);
    border-color: var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--color-bg);
    color: var(--color-fg);
    border-color: var(--btn-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .form-control:read-only {
    background-color: #1e1e1e;
}

.input-group {
    position: relative;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 0.5rem 1rem;
}

.input-group .btn i {
    font-size: 1.1rem;
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--color-fg);
}

.btn-outline-secondary:hover {
    background-color: var(--border-color);
    color: var(--color-fg);
}

.package-link {
    color: var(--link-color);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
}

.package-link:hover {
    text-decoration: none;
    border-bottom-color: var(--link-color);
    transform: translateY(-1px);
}

[data-theme="dark"] .list-group-item {
    background-color: var(--section-bg);
    color: var(--color-fg);
    border-color: var(--border-color);
}

[data-theme="dark"] .list-group-item:hover {
    background-color: var(--section-alt-bg);
}

[data-theme="dark"] .list-group-item small {
    color: var(--color-fg);
    opacity: 0.7;
}

[data-theme="dark"] .list-group-item h5 {
    color: #ffffff;
    font-weight: 600;
}

[data-theme="dark"] .card {
    background-color: var(--section-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .card-body {
    background-color: var(--section-bg);
    color: var(--color-fg);
}

[data-theme="dark"] .card-body h5 {
    color: #ffffff;
    font-weight: 600;
}

.list-group-item .save-icon {
    margin-right: 10px;
    color: var(--link-color);
}

.repo-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background: var(--section-alt-bg);
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
    margin-bottom: 20px;
}

.repo-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.repo-title {
    color: var(--link-color);
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 10px;
}

.repo-link {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    background: var(--section-bg);
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
    margin: 10px 0;
    transition: background-color 0.3s ease;
}

.repo-link:hover {
    background: var(--pagination-hover);
    text-decoration: underline;
}

.repo-desc {
    color: var(--color-fg);
    opacity: 0.7;
    margin-top: 10px;
    line-height: 1.5;
}

.error-code {
    font-family: 'Courier New', monospace;
    color: var(--private-color);
    font-weight: 600;
}

/* ============================================================================
 * pkg.depotd (OmniOS IPS) compatibility
 * ----------------------------------------------------------------------------
 * The pkg.depotd Mako templates emit plain markup that does NOT carry Bootstrap
 * classes (no `.table`, `.form-control`, etc.).  These rules re-apply the same
 * STARTcloud look-and-feel to the depot's native markup so the OmniOS package
 * pages match the Debian / FreeBSD index pages.
 *
 * Selectors targeted: #yui-main, .yui-b, .yui-b.results, .section-title,
 * <table> inside the depot grid, tr.first / tr.odd / tr.last striping, a.p5i,
 * a#catalog-feed, form.search, plus the .depot-crumbs breadcrumb the theme adds.
 * ============================================================================ */

#yui-main,
.yui-b {
    color: var(--color-fg);
}

#yui-main {
    background-color: var(--section-alt-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem auto;
    max-width: 1140px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* the right rail (stats sidebar) renders as a sibling .yui-b after #yui-main */
body > .yui-b,
#bd > .yui-b,
.yui-b + .yui-b {
    background-color: var(--section-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1rem auto 1.5rem auto;
    max-width: 1140px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (min-width: 992px) {
    /* two-column layout on wider screens, mirroring upstream yui-t4 intent */
    #bd {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 1.25rem;
        max-width: 1140px;
        margin: 0 auto;
        padding: 0 1rem;
        align-items: start;
    }
    #bd > #yui-main,
    #bd > .yui-b {
        margin: 1.5rem 0;
        max-width: none;
    }
}

.section-title,
h2.section-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-fg);
    margin: 0 0 0.85rem 0;
    padding-bottom: 0.45rem;
    border-bottom: 2px solid var(--btn-color);
    display: inline-block;
}

/* depot tables (no .table class) — re-skin to match .table appearance */
#yui-main table,
.yui-b table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--section-alt-bg);
    color: var(--color-fg);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 1rem 0;
    transition: all 0.3s ease;
}

#yui-main table th,
#yui-main table td,
.yui-b table th,
.yui-b table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

/* depot uses <tr class="first"> on the header row */
#yui-main table tr.first th,
#yui-main table tr.first td,
.yui-b table tr.first th,
.yui-b table tr.first td {
    background-color: var(--header-bg);
    color: var(--header-fg);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    border-bottom: none;
    padding: 1rem 0.85rem;
}

/* depot's alternating-row striping */
#yui-main table tr.odd,
.yui-b table tr.odd {
    background-color: var(--table-stripe);
}

[data-theme="dark"] #yui-main table tr.odd,
[data-theme="dark"] .yui-b table tr.odd {
    background-color: #212425 !important;
}

[data-theme="light"] #yui-main table tr:hover,
[data-theme="light"] .yui-b table tr:hover {
    background-color: rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] #yui-main table tr:hover,
[data-theme="dark"] .yui-b table tr:hover {
    background-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] #yui-main table tr.first:hover th,
[data-theme="dark"] #yui-main table tr.first:hover td {
    background-color: var(--header-bg);
}

/* total-row footer */
#yui-main table tr.last td,
.yui-b table tr.last td {
    background-color: var(--section-bg);
    font-weight: 600;
    border-bottom: none;
}

/* the small stats sidebar table */
table.stats { font-size: 0.92rem; }
table.stats td.label { color: var(--color-fg); opacity: 0.7; width: 40%; }
table.stats td.value { font-weight: 600; }

/* depot search form */
form.search,
form.search p { margin: 0 0 1rem 0; }

#yui-main input[type="text"],
.yui-b input[type="text"],
input#search-field {
    background-color: var(--color-bg);
    color: var(--color-fg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.45rem 0.7rem;
    font: inherit;
    min-width: 240px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#yui-main input[type="text"]:focus,
.yui-b input[type="text"]:focus,
input#search-field:focus {
    border-color: var(--btn-color);
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.2);
}

#yui-main input[type="submit"],
.yui-b input[type="submit"],
#yui-main button:not(.theme-toggle):not(.btn-close),
.yui-b button:not(.theme-toggle):not(.btn-close) {
    background-color: var(--btn-color);
    color: #ffffff;
    border: none;
    border-radius: 0.375rem;
    padding: 0.45rem 1rem;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.1s ease;
}
#yui-main input[type="submit"]:hover,
.yui-b input[type="submit"]:hover,
#yui-main button:not(.theme-toggle):not(.btn-close):hover,
.yui-b button:not(.theme-toggle):not(.btn-close):hover { filter: brightness(0.92); }

#yui-main select,
.yui-b select {
    background-color: var(--color-bg);
    color: var(--color-fg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.4rem 0.55rem;
    font: inherit;
}

#yui-main label,
.yui-b label { font-weight: 500; margin-right: 0.5rem; color: var(--color-fg); }

#yui-main input[type="checkbox"],
.yui-b input[type="checkbox"] { margin-right: 0.3rem; vertical-align: middle; }

/* p5i install link — depot emits <a class="p5i"> for the install button */
a.p5i {
    background-color: var(--btn-color);
    color: #ffffff !important;
    padding: 0.2rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none !important;
    white-space: nowrap;
    display: inline-block;
    transition: filter 0.2s ease;
}
a.p5i:hover { filter: brightness(0.9); text-decoration: none !important; }

/* RSS feed icon next to "Catalog" header in stats table */
a#catalog-feed {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: middle;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23ff8c00' d='M6.18 15.64a2.18 2.18 0 1 1 0 4.36 2.18 2.18 0 0 1 0-4.36zM4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44zm0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
}

/* depot breadcrumb under the hero (rendered by theme/en/header.shtml) */
.depot-crumbs {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}
.depot-crumbs a { color: rgba(255, 255, 255, 0.85); text-decoration: underline; }
.depot-crumbs a:hover { color: #ffffff; }
.depot-crumb-sep { opacity: 0.6; margin: 0 0.25rem; }

/* upstream layout wrapper — strip the YUI grid box-model artefacts so our
 * #yui-main / .yui-b cards center properly inside the page */
#custom-doc { width: auto; max-width: none; padding: 0; }
#hd, #ft { /* outer wrappers — header.shtml / footer.shtml provide the visuals */ }
#bd { padding: 0 1rem; }

/* mobile tweaks for depot tables */
@media (max-width: 700px) {
    #yui-main { padding: 1rem; }
    #yui-main table th,
    #yui-main table td { padding: 0.5rem 0.55rem; font-size: 0.9rem; }
    .section-title { font-size: 1.05rem; }
}

