/* ==========================================================================
   ACPYPE Server — design tokens
   Brand identity preserved: #077F3F (deep green) / #75AE6C (leaf green)
   ========================================================================== */

:root {
    --brand: #077F3F;
    --brand-light: #75AE6C;
    --brand-dark: #05602f;
    --brand-soft: #EAF6ED;
    --brand-soft-strong: #DCEFE0;
    --brand-border: #CFE6D4;

    --text: #23302A;
    --text-muted: #62726B;
    --text-faint: #8A968F;

    --bg: #F4F6F5;
    --surface: #FFFFFF;
    --border: #E3E8E5;
    --border-strong: #D2DAD6;

    --danger: #B42318;
    --danger-soft: #FDEAEA;
    --warning: #A15C00;
    --warning-soft: #FFF3DF;
    --info: #1B58A8;
    --info-soft: #E7F0FF;
    --plum: #8A247F;
    --plum-soft: #F8E8F8;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(20, 30, 25, 0.06);
    --shadow-md: 0 6px 20px rgba(20, 30, 25, 0.08);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", Consolas, Monaco, "Liberation Mono", monospace;
}

/* ==========================================================================
   Reset & base elements
   ========================================================================== */

html {
    background-color: var(--bg) !important;
}

* {
    box-sizing: border-box;
}

/* same specificity as Bootstrap's element-level resets, so load order (base.css
   comes after Bootstrap in base.html) decides the tie in our favour */
body, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, li,
fieldset, figure, blockquote, input, select, textarea, button {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    min-height: 100vh;
    max-width: 100%;
    background-color: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    font-family: var(--font-sans);
    text-align: left;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }
a:visited { color: var(--brand); }

li { list-style: none; }

h2 { padding: 18pt 0 6pt 0; color: var(--text); }
h3 { padding: 12pt 0 6pt 0; color: var(--text); }
input, select, textarea { font-family: inherit; }
input { margin: 0; display: inline; }
form { margin: 0; padding: 0; display: inline; }

blockquote {
    background: var(--border-strong);
    display: block;
    font-weight: bold;
    padding-left: 28px;
}

.clearer { clear: both; font-size: 0; }
.left { float: left; }
.right { float: right; }

img { border-width: 0; }

/* ==========================================================================
   Page structure
   ========================================================================== */

.outer-container {
    min-height: 100vh;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 5%;
    display: flex;
    align-items: center;
}

.header .title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header .title table,
.header .title tr,
.header .title td {
    display: block;
    border: 0;
}

.header .title .login {
    display: none;
}

.header .homesite a {
    display: inline-flex;
    align-items: center;
    border: 0;
}

.header img {
    height: 44px;
    display: block;
}

.header-subtitle {
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding-left: 2px;
}

/* brand accent bar under the header */
.path {
    height: 4px;
    border: 0;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-light) 100%);
}

.inner-container {
    flex: 1;
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
    padding: 24px 3% 0;
    background: transparent;
}

.main {
    background: transparent;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 28px;
    padding-bottom: 40px;
}

.content {
    flex: 1;
    min-width: 0;
    text-align: justify;
    text-justify: inter-word;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 28px 32px;
}

.content .descr {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 6px;
    text-align: justify;
}

.index-content {
    font-size: 1.05em;
    line-height: 1.6em;
    font-weight: normal;
}

/* changelog / "webserver updates" panel — a quiet list rather than a warning banner */
.changelog-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px 20px;
}

.changelog-entry {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.changelog-entry:last-child {
    border-bottom: 0;
}

.changelog-entry p {
    padding-top: 6px;
    font-size: 0.92em;
    color: var(--text-muted);
}

.changelog-date {
    padding: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

/* ==========================================================================
   Sidebar navigation
   ========================================================================== */

.navigation {
    flex: 0 0 220px;
    width: 220px;
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 8px;
}

.navigation h2 {
    color: var(--text-faint);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.2;
    margin: 0;
    padding: 14px 14px 8px;
}

.navigation ul {
    padding: 0;
    margin: 0;
    border-top: 0;
}

.navigation li {
    width: 100%;
    min-height: 0;
    border-bottom: 0;
    font-size: 13.5px;
    display: block;
    margin: 2px 0;
}

.navigation li a {
    display: block;
    color: var(--text);
    width: 100%;
    height: 100%;
    padding: 9px 14px;
    line-height: 1.3;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.navigation li a:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
    text-decoration: none;
}

.navigation li.active a {
    background: var(--brand-soft-strong);
    color: var(--brand-dark);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--brand);
}

.navigation li a.nav-action {
    color: #ffffff !important;
    background-color: var(--brand) !important;
    text-align: center;
    font-weight: 600;
}

.navigation li a.nav-action:hover {
    background-color: var(--brand-dark) !important;
}

.navigation .nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 6px;
}

.navigation .nav-meta {
    padding: 6px 14px 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.navigation .nav-meta label {
    color: var(--text-faint);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 2px;
}

.navigation .nav-meta span {
    overflow-wrap: break-word;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    margin-top: 40px;
    padding: 28px 5%;
    background: var(--brand);
    color: #EAF6ED;
}

.footer .footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

.footer .footer-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.footer .footer-logo img {
    width: 160px;
    height: auto;
    background: #ffffff;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.footer .footer-text {
    flex: 1 1 320px;
    text-align: left;
    font-size: 13px;
    line-height: 1.7;
}

.footer .footer-text span { display: block; }

.footer a { color: #ffffff; text-decoration: none; font-weight: 700; }
.footer a:hover { color: #DFF3E3; text-decoration: underline; }

/* ==========================================================================
   Buttons (Bootstrap overrides, brand-aligned)
   ========================================================================== */

.btn {
    border-radius: var(--radius-sm) !important;
    font-weight: 600;
    box-shadow: none !important;
}

.btn-primary,
.btn-success {
    background-color: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.btn-success:hover {
    background-color: var(--brand-dark) !important;
    border-color: var(--brand-dark) !important;
}

.btn-secondary {
    background-color: var(--surface) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
}

.btn-secondary:hover {
    background-color: var(--bg) !important;
}

.btn-danger { background-color: var(--danger) !important; border-color: var(--danger) !important; }
.btn-warning { background-color: var(--warning) !important; border-color: var(--warning) !important; color: #fff !important; }

/* tab-shell: a tab bar attached directly to the panel it controls
   (used on the Submit page's File / Smiles switcher) */
.tab-shell {
    width: 100%;
    max-width: 640px;
    margin: 20px auto 0;
}

.tab-shell ul.nav-pills {
    display: flex;
    width: 100%;
    gap: 0;
    background: transparent;
    border: 0;
    padding: 0;
    margin-bottom: 0;
}

.tab-shell .nav-pills > li {
    flex: 1 1 0;
    margin: 0;
}

.tab-shell .nav-pills > li > a {
    display: block;
    text-align: center;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 20px;
    margin-right: -1px;
}

.tab-shell .nav-pills > li:last-child > a {
    margin-right: 0;
}

.tab-shell .nav-pills > li > a:hover,
.tab-shell .nav-pills > li > a:focus {
    background-color: var(--brand-soft);
    color: var(--brand-dark);
}

.tab-shell .nav-pills > li > a.active,
.tab-shell .nav-pills > li > a.active:hover,
.tab-shell .nav-pills > li > a.active:focus {
    background-color: var(--brand-soft) !important;
    color: var(--brand-dark) !important;
    border-color: var(--border);
    position: relative;
    z-index: 1;
}

.tab-shell .tab-content {
    margin-top: -1px;
}

.tab-shell fieldset.head {
    margin: 0 auto;
    border-radius: 0;
    border-top: 0;
}

/* ==========================================================================
   Forms / fieldsets (Submit page)
   ========================================================================== */

ul.errorlist {
    color: var(--danger);
    font-size: .85em;
}

fieldset {
    width: 100%;
    max-width: 640px;
    border: 1px solid var(--border);
    border-top: 0;
    background-color: var(--surface);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    margin: 0 auto;
    height: auto;
}

fieldset.head {
    border: 1px solid var(--border);
    border-bottom: 0;
    background-color: var(--brand-soft);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    max-width: 640px;
    margin: 16px auto 0;
}

fieldset h2 {
    color: var(--brand-dark);
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    padding: 12px 16px;
}

fieldset p {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    padding: 10px 16px;
    height: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

fieldset.collapse a {
    font-size: 10pt;
    font-style: normal;
    font-weight: bold;
    color: var(--text-faint);
    padding-left: 3px;
    text-decoration: none;
    float: left;
}

fieldset.collapse a:hover { color: var(--text); }

fieldset label {
    padding-right: 0;
    float: none;
    width: 14em;
    font-weight: 600;
    color: var(--text-muted);
}

fieldset input,
fieldset select,
fieldset textarea {
    padding: 5px 8px;
    width: 15em;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

fieldset input[type="file"] {
    background: transparent;
    border: 0;
    padding: 0;
}

fieldset input:focus,
fieldset select:focus,
fieldset textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft-strong);
}

.buttonSubmit {
    padding: 15px 0 0 15px;
}

.errors {
    color: var(--danger);
    font-size: .8em;
    font-weight: normal;
}

.collapsible {
    padding-top: 10px;
    float: none;
}

fieldset.collapsed * { display: none; }
fieldset.collapsed a, fieldset.collapsed { display: block !important; }
fieldset.collapsed a { background-position: bottom left; color: var(--text-faint); }
fieldset.collapsed .collapse-toggle { background: transparent; display: inline !important; }

.toggle {
    float: left;
    display: block !important;
}

/* ==========================================================================
   Tables — shared "modern" table component
   Used by the Status page and the Public entries listing.
   ========================================================================== */

.table-scroll {
    margin-top: 16px;
    overflow-x: auto;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

table.table-modern {
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
    width: 100%;
    min-width: 720px;
    background: var(--surface);
}

.cell-truncate {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

table.table-modern th {
    background: var(--brand-soft);
    border-bottom: 2px solid var(--brand-border);
    color: var(--brand-dark);
    font-weight: 700;
    padding: 11px 12px;
    text-align: left;
    white-space: nowrap;
}

table.table-modern td {
    border-bottom: 1px solid var(--border);
    padding: 11px 12px;
    vertical-align: top;
}

table.table-modern tbody tr:last-child td {
    border-bottom: 0;
}

table.table-modern tbody tr:hover {
    background: var(--brand-soft);
}

/* legacy selectors kept only for backwards compatibility with old markup */
table.status,
.componentTable {
    border-collapse: collapse;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.componentTable th,
.componentTable td {
    border: 1px solid var(--border);
    padding: 8px 12px;
}

.componentTable th {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

form.status { margin-bottom: 1%; }

.result {
    font-size: 1.0em;
    margin-top: 6px;
    margin-bottom: 0px;
}

.pagination {
    display: flex;
    gap: 4px;
    padding: 0;
    margin: 16px 0 0;
    flex-wrap: wrap;
}

.pagination li a,
.pagination li span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
}

.pagination li a:hover {
    background: var(--brand-soft);
    text-decoration: none;
}

.pagination li.active span {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.pagination li.disabled span {
    color: var(--text-faint);
}

/* ==========================================================================
   Job listing utilities (Status page)
   ========================================================================== */

.status-toolbar {
    margin: 4px 0 8px;
    text-align: center;
}

.status-info {
    color: var(--text-muted);
    font-size: 14px;
    margin: 5px 0;
}

.queue-summary {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 5px;
}

.queue-pill {
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    display: inline-block;
    font-size: 13px;
    padding: 4px 10px;
}

.job-name {
    font-weight: 700;
    max-width: 220px;
    overflow-wrap: anywhere;
}

.job-muted {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.param-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 8px;
    line-height: 1.4;
    margin: 0;
}

.param-list dt {
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}

.param-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* row-actions disclosure (Status page) — a single toggle instead of a
   button row, so the table never needs to scroll horizontally */
.actions-menu {
    position: relative;
}

.actions-menu summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.actions-menu summary::-webkit-details-marker {
    display: none;
}

.actions-menu summary::after {
    content: "▾";
    font-size: 10px;
    color: var(--text-faint);
}

.actions-menu summary:hover {
    background: var(--brand-soft);
    border-color: var(--brand-border);
}

.actions-menu[open] summary {
    background: var(--brand-soft-strong);
    border-color: var(--brand-border);
    color: var(--brand-dark);
}

.actions-menu .actions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    padding: 6px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.actions-menu .actions-list .btn {
    margin: 0;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

.empty-status {
    margin: 25px 0;
    text-align: center;
}

/* ==========================================================================
   Status badges (job status pills)
   ========================================================================== */

.job-status {
    border-radius: 999px;
    display: inline-block;
    font-weight: 700;
    font-size: 12px;
    padding: 3px 10px;
}

.status-Finished { background: #E7F5EA; color: #1B7F35; }
.status-Running { background: var(--info-soft); color: var(--info); }
.status-Queued { background: var(--border); color: var(--text); }
.status-Failed { background: var(--danger-soft); color: var(--danger); }
.status-Cancelled { background: var(--plum-soft); color: var(--plum); }
.status-Deleted,
.status-Deleted_by_time { background: var(--warning-soft); color: var(--warning); }

/* ==========================================================================
   Code / preformatted blocks
   ========================================================================== */

pre, code {
    width: 99%;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: block;
    font-family: var(--font-mono);
    font-size: 12.5px;
    padding: 10px 12px;
    margin: 0px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ==========================================================================
   Error states (error / internal_error / not_found pages)
   ========================================================================== */

.error-state {
    text-align: center;
    max-width: 520px;
    margin: 40px auto;
    padding: 10px 0 20px;
}

.error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--danger-soft);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
}

.error-state h2 {
    padding: 0 0 8px;
    font-size: 22px;
    color: var(--text);
}

.error-state p {
    padding-top: 6px;
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.6;
    text-align: center;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* ==========================================================================
   Misc utility classes used across pages
   ========================================================================== */

p { padding-top: 16px; }

.pageTitle {
    padding: 0 0 6px 0;
    font-size: 24px;
    color: var(--text);
    font-weight: 700;
    text-align: left;
}

.pageHelp {
    font-size: 14px;
    padding: 0 0 16px 0;
    background-color: transparent;
}

.workflow img {
    float: right;
    vertical-align: top;
    padding-left: 12px;
    width: 300px;
    border-radius: var(--radius-md);
}

.workflow ul {
    margin: 13px 0 13px 22px;
}

.workflow li {
    list-style-type: disc;
    padding: 2px 0;
}

/* ==========================================================================
   Responsive layout
   ========================================================================== */

@media only screen and (max-width: 900px) {
    .inner-container {
        padding: 16px 4% 0;
    }

    .main {
        flex-direction: column;
        gap: 16px;
    }

    .navigation {
        position: static;
        width: 100%;
        flex: none;
    }

    .navigation ul {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .navigation li {
        margin: 0;
        flex: 1 1 auto;
    }

    .navigation .nav-meta {
        flex: 1 1 100%;
    }

    .content {
        padding: 20px;
    }

    fieldset,
    fieldset.head {
        max-width: 100%;
    }
}

@media only screen and (max-width: 600px) {
    .header {
        padding: 12px 5%;
    }

    .header img {
        height: 38px;
    }

    .footer .footer-inner {
        flex-direction: column;
        text-align: center;
    }

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

    fieldset label {
        width: 100%;
    }

    fieldset input,
    fieldset select,
    fieldset textarea {
        width: 100%;
        max-width: 320px;
    }
}
