/* anchor: the menu positions itself relative to this */
#duui-url-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* the ⋮ trigger */
#duui-url-wrapper > button {
    cursor: pointer;
}

/* the dropdown panel */
.drop-down {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.drop-down.up{
    top: auto;
    bottom: 100%;
}
.drop-down.hidden {
    display: none;
}

.drop-down-item {
    position: relative;
}

/* button in an item */
.drop-down-item > button {
    width: 100%;
    box-sizing: border-box;
}
/* the aside: overrides top:100% and right:0 from .drop-down */
.drop-down.aside {
    top: 0;            /* aligned with the row's top edge */
    right: auto;       /* its right edge sits at the row's left edge */
    left: 100%;
}
/* safety: cancels the flip class if positionDropDown ever runs on it */
.drop-down.aside.up {
    top: 0;
    bottom: auto;
}
/* the items inside the panel */
.drop-down button {
    padding: 8px 12px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}

.drop-down button:hover {
    background: #f0f0f0;
}


.dropdown-wrapper > .drop-down {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}
/* footer */
.sidebar-footer {
    position: relative;
    margin-top: auto;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.app-body.sidebar-expanded .sidebar-footer {
    opacity: 1;
    pointer-events: auto;
}
/* preset button */

#preset-button{
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    color: var(--c-text-muted);
}
#hr-divider{
    border-top: 1px solid var(--c-border);
}
.toast {
    position: fixed;
    inset: auto;            /* resets the popover default (inset: 0) */
    margin: 0;              /* resets the popover default (margin: auto) */
    top: 70px;              /* adjust to your navbar height */
    right: 20px;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    background: rgba(30, 30, 30, 0.92);
    color: #fff;
    font-size: 0.95rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    animation: toast-drop 0.25s ease-out;
    transform-origin: top right;
    white-space: pre-line; /* new lines */
}
@keyframes toast-drop {
    from { opacity: 0; transform: translateY(-16px) scaleY(0.8); }
    to   { opacity: 1; transform: translateY(0) scaleY(1); }
}


#login-dialog {
    width: min(92vw, 400px);
    padding: 2rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-display);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
#login-dialog[open] {
    animation: dialog-in 0.2s ease-out;
}
#login-dialog::backdrop {
    background: rgba(28, 38, 36, 0.45);
    backdrop-filter: blur(3px);
}
@keyframes dialog-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

#login-dialog form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
#login-dialog form[hidden] { display: none; }

#login-dialog .card-title {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
    font-weight: 600;
}

#login-dialog input {
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg-sunken);
    color: var(--c-text);
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
#login-dialog input::placeholder { color: var(--c-text-muted); }
#login-dialog input:focus {
    outline: none;
    background: var(--c-bg);
    border-color: var(--c-teal);
    box-shadow: 0 0 0 3px rgba(1, 92, 99, 0.15);
}

#login-dialog .btn-accent {
    margin-top: 0.5rem;
    padding: 0.7rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--c-teal);
    color: #fff;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
#login-dialog .btn-accent:hover { background: var(--c-green); }

#login-dialog .btn-toggle {
    padding: 0.4rem;
    border: none;
    background: none;
    color: var(--c-text-muted);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
#login-dialog .btn-toggle:hover { color: var(--c-teal); }

#login-dialog p[id$="-error"] {
    margin: 0;
    color: var(--c-red);
    font-size: 0.85rem;
}

.prompt-dialog {
    width: min(92vw, 380px);
    padding: 1.75rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-display);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.prompt-dialog[open] { animation: dialog-in 0.2s ease-out; }
.prompt-dialog::backdrop {
    background: rgba(28, 38, 36, 0.45);
    backdrop-filter: blur(3px);
}

.prompt-dialog form { display: flex; flex-direction: column; gap: 0.75rem; }
.prompt-dialog .card-title { margin: 0; font-size: 1.25rem; font-weight: 600; }
.prompt-dialog .prompt-message { margin: 0; color: var(--c-text-muted); font-size: 0.9rem; }

.prompt-dialog input {
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg-sunken);
    color: var(--c-text);
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.prompt-dialog input:focus {
    outline: none;
    background: var(--c-bg);
    border-color: var(--c-teal);
    box-shadow: 0 0 0 3px rgba(1, 92, 99, 0.15);
}

.prompt-dialog .prompt-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.prompt-dialog .btn-accent {
    padding: 0.6rem 1.25rem; border: none; border-radius: var(--radius-sm);
    background: var(--c-teal); color: #fff; font: inherit; font-weight: 500; cursor: pointer;
    transition: background 0.15s;
}
.prompt-dialog .btn-accent:hover { background: var(--c-green); }
.prompt-dialog .btn-toggle {
    padding: 0.6rem 1rem; border: none; background: none;
    color: var(--c-text-muted); font: inherit; cursor: pointer;
}
.prompt-dialog .btn-toggle:hover { color: var(--c-teal); }


#endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
#endpoint-list > * {
    padding: 0.75rem 1rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-bg);
    transition: border-color 0.15s;
}
#endpoint-list > *:hover { border-color: var(--c-teal); }
#endpoint-list button {
    padding: 0.15rem 0.45rem;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--c-text-muted);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
#endpoint-list button:hover { color: var(--c-teal); background: var(--c-bg-sunken); }

#endpoint-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-bg-sunken);
}
#endpoint-form input,
#endpoint-form select {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 0.9rem;

    transition: border-color 0.15s, box-shadow 0.15s;
}
#endpoint-form input:focus,
#endpoint-form select:focus {
    outline: none;
    border-color: var(--c-teal);
    box-shadow: 0 0 0 3px rgba(1, 92, 99, 0.15);
}
#ep-name { flex: 1 1 140px; }
#ep-uri  { flex: 2 1 220px; }
#endpoint-form .btn-accent {
    padding: 0.45rem 0.9rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--c-teal);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
#endpoint-form .btn-accent:hover { background: var(--c-green); }



.property-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.menu-wrapper { position: relative; display: inline-block; }

.select-trigger {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    color: var(--c-text);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 90px;
    text-align: left;
}
.select-trigger:hover { border-color: var(--c-teal); }
.select-dropdown .drop-down { left: 0; right: auto; }

/* toggle button in the last column */
.row-toggle {
    padding: 0.15rem 0.45rem;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--c-text-muted);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.row-toggle:hover {
    color: var(--c-teal);
    background: var(--c-bg-sunken);
}

/* the hidden detail row */
.job-details {
    padding: 0.75rem 1rem;
    background: var(--c-bg-sunken);
    color: var(--c-text-muted);
    font-size: 0.85rem;
}

/* keys and values as two columns instead of one long line */
.job-details dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1.25rem;
    margin: 0;
}
.job-details dt {
    color: var(--c-text);
    font-weight: 500;
}
.job-details dd {
    margin: 0;                 /* browsers indent dd by default */
    overflow-wrap: anywhere;   /* long values wrap instead of stretching the table */
}


/* WIDGETTTSSSSS */
/* widget column: the grid cell itself */
.widgets {
    position: absolute;
    top: 0;
    left: calc(100% + 1.25rem);
    width: var(--widget-width);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.widget-card {
    padding: 0.9rem 1rem;
    border: 1px solid var(--c-green);
    border-radius: var(--radius-md);
    background: #e6f5f1;
    box-shadow: 0 4px 16px rgba(8, 133, 109, 0.18);
    animation: widget-in 0.25s ease-out;
}
.widget-title {
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-teal);
}
.widget-card.hidden { display: none; }
/* the floating box */
#queue-indicator-widget {
    padding: 0.9rem 1rem;
    border: 1px solid var(--c-green);
    border-radius: var(--radius-md);
    background: #e6f5f1;
    box-shadow: 0 4px 16px rgba(8, 133, 109, 0.18);
    animation: widget-in 0.25s ease-out;
}
#queue-indicator-widget.hidden { display: none; }

.widget-info {
    margin: 0 0 0.7rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--c-text-muted);
}

.widget-status {
    font-size: 0.85rem;
    color: var(--c-teal);
}
.widget-status strong { font-size: 1.1rem; }

/* three dots that pulse one after another */
.dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.dots span {
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--c-green);
    animation: dot-pulse 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
#quota-text {
    white-space: pre-line;
}
@keyframes dot-pulse {
    0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}
@media (max-width: 1600px) {
    .widgets { display: none; }
}


/* widget user limit */
.quota-line { font-size: 0.78rem; color: var(--c-text-muted); margin-top: 0.5rem; }
.quota-line.hidden, .quota-link.hidden { display: none; }
.quota-link {
    margin-left: 0.5rem; padding: 0; background: none;
    color: var(--c-teal); font: inherit; text-decoration: underline; cursor: pointer;
}
/* guests: settings visible but locked to the defaults */
.guest-lock-notice {
    margin-bottom: 0.8rem; padding: 0.6rem 0.7rem;
    border: 1px solid var(--c-border); border-left: 4px solid var(--c-teal); border-radius: 7px;
    background: var(--c-bg-sunken); font-size: 0.8rem; color: var(--c-text-muted);
}
.guest-lock-notice .quota-link { margin-left: 0; }
.guest-locked .sidebar-panel > [inert],
#modality-select-wrap[inert] { opacity: 0.55; }

/* ---- queue: icon + name + status line + elapsed time, state is never shown by colour alone ---- */
h2.section-header { margin-top: 0; line-height: 1.3; }
.queue-summary {
    margin: 0 0 0.3rem;
    font-size: 0.9rem;
    color: var(--c-text);
}
.queue-summary:empty { display: none; }
.Queue .queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--c-text);
    background: var(--c-bg);
}
.queue-icon { width: 1.1rem; text-align: center; color: var(--c-teal); flex-shrink: 0; }
.queue-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; }
.queue-job-name {
    font-family: var(--font-mono);
    font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-status { font-size: 0.82rem; color: var(--c-text-muted); }
.queue-elapsed {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--c-text-muted);
    font-variant-numeric: tabular-nums;
}
.Queue .queue-item.running { border-left: 4px solid var(--c-green); }
.Queue .queue-item.running .queue-icon { color: var(--c-green); }
.Queue .queue-item.pending,
.Queue .queue-item.waiting,
.Queue .queue-item.sending { border-left: 4px solid var(--c-border); }
.Queue .queue-item.failed { border: 1px solid var(--c-red); border-left-width: 4px; background: rgba(138, 44, 34, 0.06); }
.Queue .queue-item.failed .queue-icon,
.Queue .queue-item.failed .queue-status { color: var(--c-red); }
.queue-dismiss {
    flex-shrink: 0;
    width: 2rem; height: 2rem;   /* comfortable touch target */
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: none; color: var(--c-red); cursor: pointer;
}
.queue-dismiss:hover { border-color: var(--c-red); }
.queue-dismiss:focus-visible { outline: 2px solid var(--c-red); outline-offset: 2px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
    .fa-spin, .dots span { animation: none; }
}
