/* ---- Publish order (community edition) ---- */
.publish-order-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--amber-fff8e6);
    border: 1px solid var(--amber-f0d78c);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}
/* `display: flex` would otherwise defeat the `hidden` attribute. */
.publish-order-banner[hidden] { display: none; }
#publish-form[hidden] { display: none; }
.publish-order-banner-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
}
.publish-order-banner-text span {
    display: block;
    color: var(--gray-600);
}
.publish-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}
#publish-result:empty { display: none; }
#publish-result {
    font-size: 13px;
    line-height: 1.3;
    text-align: right;
}
.publish-inline-status { color: var(--gray-600); }
.publish-inline-ok { color: var(--success); font-weight: 600; }
.publish-inline-link {
    margin-right: 8px;
    color: var(--gray-700);
    font-weight: 500;
}
.publish-inline-link:hover { color: var(--primary); }
.publish-result-error { font-size: 13px; }
/* The order form reads as a form, not a full-width table. */
#panel-order { max-width: 640px; }

/* ---- Create-project form ---- */
/* Explicit colors: on Linux the native popup inherits a dark theme and the
   option labels disappear when background/color are left unset. */
#panel-project-details select,
#panel-project-details select option {
    background-color: var(--white);
    color: var(--gray-900);
}
body.creating-project #pd-template-group,
body.creating-project #pd-template-edit-wrap {
    display: block !important;
}
body.creating-project #pd-version-group.pd-version-hidden {
    display: none !important;
}
.pd-custom-phase-wrap {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px;
    display: grid;
    gap: 10px;
}
.pd-custom-phase-wrap[hidden] {
    display: none !important;
}
.pd-custom-phase-heading {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 0;
}
.pd-custom-phase-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin: 0;
}
.pd-custom-phase-table-wrap {
    display: grid;
    gap: 6px;
}
.pd-custom-phase-rows {
    display: grid;
    gap: 8px;
}
.pd-custom-phase-row {
    display: grid;
    grid-template-columns: 72px minmax(110px, 0.9fr) minmax(140px, 1.3fr) minmax(200px, 1.6fr) auto;
    gap: 8px;
    align-items: start;
}
.pd-custom-phase-head {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.pd-custom-phase-row input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
}
.pd-custom-phase-row select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    min-width: 0;
}
.pd-custom-map {
    position: relative;
    min-width: 0;
}
.pd-custom-map-toggle {
    width: 100%;
    min-height: 32px;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pd-custom-map-toggle::after {
    content: '';
    width: 0;
    height: 0;
    margin-left: auto;
    flex-shrink: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--gray-500);
}
.pd-custom-map-summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pd-custom-map-summary.is-placeholder {
    color: var(--gray-500);
}
.pd-custom-map-menu {
    position: fixed;
    z-index: 220;
    min-width: 240px;
    max-width: min(360px, calc(100vw - 16px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(var(--slate-rgb), 0.12);
    padding: 4px 4px 12px;
}
.pd-custom-map-menu[hidden] {
    display: none !important;
}
.pd-custom-map-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}
.pd-custom-map-option:hover {
    background: var(--gray-100);
}
.pd-custom-map-option.is-taken {
    color: var(--gray-500);
    cursor: not-allowed;
}
.pd-custom-map-option.is-taken input {
    cursor: not-allowed;
}
.pd-custom-phase-row input.is-invalid {
    border-color: var(--danger);
}
.pd-custom-map-option input {
    width: auto;
    margin: 2px 0 0;
    padding: 0;
    flex-shrink: 0;
}
.pd-custom-map-empty {
    margin: 0;
    padding: 8px;
    font-size: 12px;
    color: var(--gray-500);
}
.pd-custom-phase-remove {
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    font-size: 12px;
}
.pd-custom-phase-remove:hover {
    border-color: var(--gray-400);
    color: var(--gray-800);
}
@media (max-width: 720px) {
    .pd-custom-phase-head { display: none; }
    .pd-custom-phase-row {
        grid-template-columns: 1fr 1fr;
    }
    .pd-custom-phase-row input:nth-child(3),
    .pd-custom-phase-row .pd-custom-map,
    .pd-custom-phase-row > .pd-custom-phase-remove {
        grid-column: 1 / -1;
    }
}

#panel-project-details .form-group {
    margin-bottom: 0;
}
#panel-project-details .form-group > label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-700);
}

/* ---- Create-project explainer ---- */
.pd-create-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}
.pd-create-layout > div:first-child { flex: 1 1 auto; }
.pd-create-explainer {
    flex: 0 0 auto;
    max-width: 320px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px 20px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--gray-600);
}
.pd-create-explainer h3 {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--gray-700);
}
.pd-create-explainer ol {
    margin: 0;
    padding-left: 18px;
}
.pd-create-explainer li { margin-bottom: 10px; }
.pd-create-explainer li:last-child { margin-bottom: 0; }
.pd-create-explainer strong {
    display: block;
    color: var(--gray-700);
}
.pd-create-explainer em { font-style: normal; font-weight: 600; }
.pd-create-explainer-link { margin: 12px 0 0; }

@media (max-width: 1000px) {
    .pd-create-layout { flex-direction: column; }
    .pd-create-explainer { max-width: 640px; }
}
/* `.form-group` carries no base styling outside modals, so the order form
   defines its own label/input rhythm. */
#publish-order-form .form-group { margin-bottom: 12px; }
#publish-order-form .form-group > label:not(.publish-order-choice) {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 13px;
}
#publish-order-form input[type="text"],
#publish-order-form input[type="email"],
#publish-order-form input[type="tel"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}
#publish-order-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
}
/* The submit row stays reachable while the form scrolls. */
.publish-order-actions {
    position: sticky;
    bottom: var(--status-bar-height);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 12px 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}
.publish-order-choice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
    cursor: pointer;
}
.publish-order-choice em {
    display: block;
    color: var(--gray-500);
    font-style: normal;
}
.publish-order-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.publish-order-row .form-group { margin-bottom: 12px; }
.publish-order-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 18px;
}
.publish-locked {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 720px) {
    .publish-order-row { grid-template-columns: 1fr; }
}


