.status-hint-icon {
    color: var(--accent-orange) !important;
    margin-left: 6px;
    font-size: 1.1em;
    vertical-align: middle;
    cursor: pointer;
    border-radius: 50%;
    background: transparent;
    transition: color 0.18s;
}

.status-hint-icon:hover {
    color: #ffb300 !important;
    background: rgba(255, 193, 68, 0.08);
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-8px);
    }

    30% {
        transform: translateX(8px);
    }

    45% {
        transform: translateX(-6px);
    }

    60% {
        transform: translateX(6px);
    }

    75% {
        transform: translateX(-4px);
    }

    90% {
        transform: translateX(4px);
    }

    100% {
        transform: translateX(0);
    }
}

.shake {
    animation: shake 0.35s cubic-bezier(.36, .07, .19, .97) both;
}

/* Longer shake variant (approx 2 seconds) */
.shake-long {
    animation-name: shake;
    animation-duration: 0.35s;
    animation-timing-function: cubic-bezier(.36, .07, .19, .97);
    animation-iteration-count: 6;
    animation-fill-mode: both;
}

/* Bell-style swing animation (rotation around top) */

.notif,
.notif-bell,
.new-notif-icon {
    transform-origin: top center;
}

@keyframes bell {
    0% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(-18deg);
    }

    30% {
        transform: rotate(12deg);
    }

    45% {
        transform: rotate(-8deg);
    }

    60% {
        transform: rotate(6deg);
    }

    75% {
        transform: rotate(-4deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

.bell-shake {
    animation: bell 2s cubic-bezier(.36, .07, .19, .97) both;
}

.auth-viewport.shake {
    background: var(--error) !important;
    transition: background 0.2s;
}

:root {
    --bg: #262D33;

    --bg-selected: #638199;

    --panel-old: #575F66;

    --panel: #404d56;

    --border: #638199;

    --text: #eaf6ff;

    --muted: #638199;

    --hover: #638199;

    --tr-hover: #313a41;

    --button-bg: #404d56;

    --accent: #3FA9FF;

    --accent-orange: #ffc144;

    --error: #ff3b47;

    --active-green: #62e35d;
    --active-border: #314e30;
    --active-bg: #283f27;
    --local-site: #20555b;

}

/* Плашки статусов в таблицах */

.status-box {
    font-weight: bold;
    display: block;
    margin: auto;
    width: 90px;
    border-radius: 20px;
}

.status-box-icon {
    font-size: 10px;
    margin-right: 6px;
}

.ssl-icon {
    font-size: 12px;
    margin-right: 6px;
    color: var(--active-green);
}

.active-status {
    border: solid 1px var(--active-border);
    color: var(--active-green);
}


.renew-status {
    border: solid 1px var(--accent-orange);
    color: var(--accent-orange);
}

.urgent-renew,
.site-type-server,
.site-type-redirect {
    display: flex;
    color: #fff;
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 8px;
    font-size: 8px;
    position: absolute;
    line-height: 1.2;
    top: 4px;
    right: 4px;
    margin: 0;
}

.urgent-renew {
    background: var(--error);
}

.site-type-server {
    background: var(--local-site);
}

.site-type-redirect {
    background: var(--active-border);
}

.type-cell {
    position: relative;
}

/* Правое меню для доступа к вспомогательным страницам (настройки, логи, справка) */
.right-menu {
    position: absolute;
    top: 30px;
    right: 0px;
    z-index: 100;
    text-align: right;
}

.right-menu-container {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin: 0 30px;
    align-items: center;

}

.notif {
    position: relative;
    display: flex;
}

.new-notif {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 6px;
    background-color: var(--accent);
    border: solid 2px var(--tr-hover);
    transition: all 0.2s ease-in-out;
}

/* Keep the red dot above the bell even during transforms/animations */
.new-notif {
    z-index: 50;
}

/* Ensure the bell itself doesn't overlap the dot */
.notif-bell {
    z-index: 1;
}

.notif-messages {
    position: absolute;
    width: 360px;
    height: auto;
    background-color: var(--tr-hover);
    /* place below the bell */
    top: 8px;
    right: 8px;
    border-radius: 8px 16px;
    z-index: -10;
    /* below the bell */
    transform-origin: top right;
    transform: scale(0.1);
    opacity: 0;
    filter: blur(10px);
    transition: transform 300ms cubic-bezier(.2, .9, .2, 1), opacity 280ms ease, filter 380ms ease;
    pointer-events: none;
}

.notif-messages.open {
    filter: blur(0px);
    top: 0;
    right: 0;
    transform: scale(1);
    opacity: 1;
    z-index: 10;
    /* still below the bell */
    pointer-events: auto;
    -webkit-box-shadow: 0px 10px 40px 0px rgba(0, 0, 0, 0.4);
    box-shadow: 0px 10px 40px 0px rgba(0, 0, 0, 0.4);
}

.notif-messages-close {
    position: absolute;
    top: 6px;
    right: 12px;
}

.notif-messages-close i {
    font-size: 14px;
}

.notif-messages-close:hover {
    cursor: pointer;
}

.notif-messages-container {
    display: flex;
    align-items: start;
    padding: 8px 12px 12px 12px;
    flex-direction: column;
    text-align: left;
}

.notif-messages-readall {
    position: absolute;
    font-size: 11px;
    top: 6px;
    right: 34px;
    background-color: var(--button-bg);
    padding: 3px 6px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;

}

.notif-messages-readall:hover {
    background-color: var(--hover);
    cursor: pointer;
}

/* Hidden state for the read-all button (smooth hide/show) */
.notif-messages-readall.hidden {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

.notif-messages h4 {
    padding: 0;
    margin: 0;
    margin-bottom: 6px;
}

.notif-bell {
    width: 30px;
    height: 30px;
    background-color: var(--tr-hover);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    cursor: pointer;
}

.notif-messages-list {
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    width: 100%;
    max-height: 220px;
    overflow: auto;
    box-sizing: content-box;
    margin-right: -10px;
    padding-right: 10px;
}

/* Chrome / Edge / Safari (WebKit) */
.notif-messages-list::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.notif-messages-list::-webkit-scrollbar-track {
    background: transparent;
}

.notif-messages-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    border: 3px solid transparent;
    /* фиксирует визуальную ширину thumb */
    background-clip: padding-box;
    /* чтобы border не «растягивал» thumb */
}

.notif-messages-list::-webkit-scrollbar-thumb:hover,
.notif-messages-list::-webkit-scrollbar-thumb:active {
    background: rgba(0, 0, 0, 0.35);
    /* тот же цвет — при hover не изменится */
}

/* Firefox */
.notif-messages-list {
    scrollbar-width: thin;
    /* auto | thin | none */
    scrollbar-color: rgba(0, 0, 0, 0.35) transparent;
    /* thumb track */
}

.notif-message-row {
    text-align: left;
    padding: 6px 12px;
    background-color: var(--bg);
    border-radius: 6px;
    width: auto;
    position: relative;
}

.notif-message-row:hover {
    cursor: pointer;
}

/* Smooth removal animation when marking as read */
.notif-message-row {
    transition: opacity 220ms ease, transform 220ms ease;
}

.notif-message-row.removing {
    opacity: 0;
    transform: translateX(8px);
}

/* Remove-all modifier: apply same transition to all rows when clearing at once */
.notif-messages-list.removing-all .notif-message-row {
    opacity: 0;
    transform: translateX(8px);
}

.notif-message-eye {
    position: absolute;
    right: 6px;
    bottom: 4px;
    color: var(--button-bg);
    transition: all 0.2s ease-in-out;
}

.notif-message-row:hover .notif-message-eye {
    color: var(--accent);
}

.user-link {
    text-decoration: none;
    cursor: pointer;
}





/* Унифицированные стили для всех модальных окон */



.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    width: 100vw;
    min-height: 100vh;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    display: none;
}

.modal.active {
    display: flex !important;
}

.modal:not(.active) {
    display: none !important;
}

.modal-content {
    background: var(--panel, var(--bg));
    border-radius: 14px;
    max-width: 420px;
    width: 96vw;
    padding: 28px 28px 28px 28px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
    display: flex;
}

.modal-content,
.modal-images,
.modal-actions,
.modal-desc,
.modal-title {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-content {
    background: var(--bg);
    border-radius: 14px;
    align-items: stretch;
}

.modal-title {
    margin: 0 0 12px 0;
    font-size: 1.12em;
    font-weight: 600;
    text-align: left;
}

.modal-images {
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.modal-desc {
    font-size: 1em;
    color: var(--text);
    margin-top: 8px;
}

.modal-actions {
    flex-direction: row;
    gap: 8px;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.4em;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    transition: color 0.18s;
    z-index: 2;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(50%, -50%);
}


.flex-row,
.flex-column {
    display: flex;
}

.flex-row {
    flex-direction: row;
    gap: 6px;
    margin-top: 8px;
}

.flex-column {
    flex-direction: column;
    gap: 20px;
}


.cancel {
    background-color: var(--error) !important;
    color: var(--text) !important;
}

#flow_domain:hover {
    cursor: pointer;
}

/* FLOWS PAGE - additional styles for flow cards in flows.php */

.flow-url {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.flow-stats-cards {
    display: flex;
    gap: 12px;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
}

.flow-card {
    width: 100%;
    background: var(--panel, var(--bg));
    color: var(--text);
    border-radius: 6px;
    display: inline-block;
    min-width: 80px;
    text-align: center;
    font-size: 1.7em;
    height: 100%;
    /* Новое: растягивать карточку на всю высоту родителя */
    display: flex;
    /* Новое: для вертикального центрирования содержимого */
    flex-direction: column;
    justify-content: center;
}

/* Local font-face overrides (place your font files in public/fonts/)
     Expected files: /fonts/Geologica.woff2, /fonts/Geologica.woff,
                                     /fonts/Inter-Var.woff2, /fonts/Inter-Var.woff */
@font-face {
    font-family: 'Geologica Light';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('/fonts/Geologica-Light.woff2') format('woff2'),
        url('/fonts/Geologica-Light.woff') format('woff')
}

@font-face {
    font-family: 'Geologica Medium';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('/fonts/Geologica-Medium.woff2') format('woff2'),
        url('/fonts/Geologica-Medium.woff') format('woff')
}

/* Smooth theme transition: applied only to a small set of high-level elements
   to avoid expensive transitions on every single node (tables, lists, etc.). */
body.theme-transition .lk-menu,
body.theme-transition .page-header,
body.theme-transition .auth-header-inner,
body.theme-transition .card,
body.theme-transition table,
body.theme-transition pre {
    transition: background-color .28s ease, color .28s ease, border-color .28s ease, box-shadow .28s ease, opacity .28s ease;
}

html,
body {
    height: 100%
}

body {
    margin: 0px;
    padding: 0px;
    font-family: 'Geologica Light', sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    font-weight: 100;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.modal-open main {
    filter: blur(4px);
    pointer-events: none;
}

/* Modal window styles - unified for all modals */
#worker-log-modal,
#cf-zones-modal,
#config-modal {
    display: flex;
}


#cf-zones-modal>div,
#config-modal>div {
    background: var(--panel);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

#worker-log-modal>div {
    max-width: 460px;
    margin: 5vh auto;
    padding: 12px;
}

#cf-zones-modal>div {
    max-width: 600px;
    margin: 10vh auto;
    padding: 20px;
}

#config-modal>div {
    max-width: 1000px;
    margin: 50px auto;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.modal-title {
    margin: 0;
    color: var(--text);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
}

.modal-close-btn:hover {
    color: var(--text);
}

.modal-content-pre {
    background: var(--bg);
    color: var(--text);
    overflow-x: auto;
    max-height: 70vh;
    margin: 0;
}

#cleanup-result {
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}



/* Page-scoped global progress bar used by test-workers.php */
#global-progress-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 220ms ease;
}

#global-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent, #4caf50);
    transition: width 450ms ease;
    will-change: width;
}

/* Error states handled via CSS classes toggled from JS */
#global-progress-bar.error {
    background: var(--error, #e53e3e);
    transition: width 450ms ease, background-color 200ms ease;
}

#global-progress-bar.error-full {
    background: var(--error, #e53e3e);
    width: 100% !important;
}

/* Toggle visibility via class instead of inline styles */
#global-progress-wrap.visible {
    display: block;
    opacity: 1;
}

/* Helper to temporarily disable transitions when hiding instantly */
#global-progress-bar.no-transition {
    transition: none !important;
}

/* Log modal entry animation (scoped to existing #worker-log-modal) */
#worker-log-modal .log-entry {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 220ms ease, transform 220ms ease;
}

#worker-log-modal .log-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

h1 {
    font-size: 1.8rem;
    margin: 0 0 12px 0
}

/*--- menu and header styles ---*/
.menu {
    color: var(--text);
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
    height: 100vh;
    background: var(--bg);
    z-index: 10;
    transition: transform 0.3s ease, color 0.2s ease;
    position: fixed;
}

#toggleSidebar {
    position: absolute;
    right: 0;
    border: solid 2px #343f47;
    width: 18px;
    height: 18px;
    top: 64px;
    border-radius: 10px;
    display: flex;
    align-content: center;
    justify-content: center;
    justify-content: center;
    align-items: center;
    color: #343f47;
    transform: translateX(+50%);
}

#toggleSidebar,
#toggleSidebar i {
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    font-size: 14px;
}

#toggleSidebar:hover {
    color: var(--text);
    border: solid 2px var(--accent);
    background-color: var(--accent);
    cursor: pointer;
}


.card {
    padding: 20px 32px;
}

.container {
    display: flex;
    flex-direction: row;
}

.main-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
    scrollbar-gutter: stable;
    height: 100vh;
}

.mob-menu {
    width: 60px !important;
    transition: transform 0.3s ease, color 0.2s ease;
}

.burger-menu {
    position: relative;
    height: 0;
    width: 100%;
}

.admin-sidebar {
    width: 180px;
    /* background: #2c3e50; */
    color: var(--text);
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100vh;
}

.sidebar-menu {
    list-style: none;
    flex: 1;
    padding: 7px 0;
}

.sidebar-menu li {
    margin: 0;
    padding: 0;
}

.sidebar-header {
    /* background: linear-gradient(135deg, #888 0%, #666 100%); */
    /* padding: 20px; */
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
    font-size: 26px;
}

.sidebar-header h2 {
    font-size: 26px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.menu-text {
    font-size: 14px;
    font-weight: 500;
}

.menu-item.active {
    background: var(--button-bg);
    color: var(--text);
    border-left-color: var(--bg-selected);
    padding-left: 18px;

}

.menu-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 15px 20px;
    color: var(--text);
    text-decoration: none;
    border-left: 4px solid transparent;
    position: relative;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--bg-selected);
}

.menu-icon {
    font-size: 16px;
    min-width: 20px;
    text-align: center;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header previously inlined in auth.html */
.auth-header {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

.auth-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 30px 42px;
    box-sizing: border-box;
}

.auth-header h1 {
    margin: 0;
    /* match previous inline margin:0 */
}

/* Generic page header and action helpers for non-auth pages */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    justify-content: space-between;
    margin-bottom: 12px;
}

.header-lk {
    padding: 22px 32px;
}

.page-header h1 {
    margin: 0;
}

/* Small actions area for headers (used inside .auth-header-inner) */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* LK menu */

.lk-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}


/* Helper: add top padding to pages that need space for absolute header */
.with-header-padding {
    padding-top: 120px;
}

#fpCanvas {
    display: none
}

#loader {
    padding: 14px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    display: none;
    margin-bottom: 12px;
    color: var(--text);
}

#result {
    margin: 8px 0 12px 0
}

pre#details {
    background: var(--accent);
    color: var(--text);
    padding: 8px;
    /* border: 1px solid var(--border); */
    display: none;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
    border-radius: 8px;
}

a {
    color: var(--text)
}

button {
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-block;
    outline: none;
    padding: 0;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    text-size-adjust: none;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    touch-action: manipulation;
    transition-duration: .1s, .15s, .15s, .15s, .15s, .15s, .15s;
    transition-property: all, padding, margin, font-size, line-height, height, width;
    transition-timing-function: cubic-bezier(.45, 0, .55, 1), cubic-bezier(.81, 0, .04, 1), cubic-bezier(.81, 0, .04, 1), cubic-bezier(.81, 0, .04, 1), cubic-bezier(.81, 0, .04, 1), cubic-bezier(.81, 0, .04, 1), cubic-bezier(.81, 0, .04, 1);
    -webkit-user-select: none;
    user-select: none;
    transition: all 0.3s ease-in-out;
}





/* page-specific helpers */
#result {
    font-size: 110%;
    padding: 8px 0
}

.cf-token-select-actions {
    display: flex;
    gap: 12px;
}


/* Forbidden page (403) */
.forbidden-card {
    text-align: center;
    max-width: 600px;
    margin: 40px auto;
}

.forbidden-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
    color: var(--accent-orange);
}

.forbidden-card p {
    font-size: 16px;
    color: var(--text);
    margin: 12px 0;
    line-height: 1.6;
}

.forbidden-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 30px;
}

.forbidden-actions a {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--accent-blue);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.forbidden-actions a:hover {
    background-color: var(--accent-blue-hover);
    transform: translateY(-2px);
}

/* buttons */
.token-domains,
.get-ssl,
.button-danger,
.reload,
.cancel,
.upload-site,
.delete-site,
.log-site,
.create-site,
.create-flow,
.edit-flow,
.delete-flow,
.save-flow,
.save-token,
.save-urlsite,
.delete-token,
.show-worker-log,
.delete-domain,
.create-domain,
.cf-zones-modal,
.clicks-reload,
.view-config-btn,
.retry-bind,
.worker-log-refresh,
.worker-log-close {
    font-size: 14px;
    font-weight: 300;
    height: 31px;
    letter-spacing: -.02em;
    line-height: 17px;
    padding: 6px 8px;
    background-color: var(--button-bg);
    color: var(--text);
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.18s;
}

.token-domains:hover,
.get-ssl:hover,
.button-danger:hover,
.reload:hover,
.cancel:hover,
.upload-site:hover,
.delete-site:hover,
.log-site:hover,
.create-site:hover,
.create-flow:hover,
.edit-flow:hover,
.delete-flow:hover,
.save-flow:hover,
.save-token:hover,
.save-urlsite:hover,
.delete-token:hover,
.show-worker-log:hover,
.delete-domain:hover,
.create-domain:hover,
.cf-zones-modal:hover,
.clicks-reload:hover,
.view-config-btn:hover,
.retry-bind:hover,
.worker-log-refresh:hover,
.worker-log-close:hover {
    background-color: var(--hover);
}

.save-flow,
.token-domains,
.delete-token {
    width: 100% !important;
}

.cf-zones-box {
    display: none;
}

.cf-zones-box.visible {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    color: var(--text);
}



/* clicks table styles */

.table-label {
    margin-top: 0;
    padding: 0;
    margin-bottom: 6px;
}


table {
    border-collapse: collapse;
    width: 100%;
    min-width: 1200px;
    font-size: 0.8rem;
    line-height: 20px;
    table-layout: fixed;
}

thead th {
    border-color: var(--panel);
    background: var(--panel);
}

th {

    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

tr:hover {
    background: var(--tr-hover);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

th,
td {
    border: 1px solid var(--panel);
    padding: 6px;
    text-align: center;
    /* white-space: nowrap; */
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Domains table column widths (Domain, CF токен, Статус, Продлить, Создан, Действия) */





.table-domains th:nth-child(1),
.table-domains td:nth-child(1) {
    min-width: 200px;
    max-width: 100%;
    width: 200px;
    position: relative;
}

.table-domains th:nth-child(2),
.table-domains td:nth-child(2) {
    min-width: 160px;
    max-width: 240px;
    width: 160px;
}

.table-domains th:nth-child(3),
.table-domains td:nth-child(3) {
    min-width: 140px;
    width: 140px;
}

.table-domains th:nth-child(4),
.table-domains td:nth-child(4) {
    width: 130px;
    min-width: 130px;
}

.table-domains th:nth-child(5),
.table-domains td:nth-child(5) {
    width: 130px;
    min-width: 130px;
}

.table-domains th:nth-child(6),
.table-domains td:nth-child(6) {
    width: 160px;
    min-width: 160px;
}

.table-domains th:nth-child(7),
.table-domains td:nth-child(7) {
    width: 228px;
    min-width: 228px;
}


/* Fixed column widths for sites table */
.table-sites th:nth-child(1),
.table-sites td:nth-child(1) {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
}

/* # */
.table-sites th:nth-child(2),
.table-sites td:nth-child(2) {
    width: 200px;
    min-width: 200px;
}

/* Название */
.table-sites th:nth-child(3),
.table-sites td:nth-child(3) {
    width: 350px;
    min-width: 350px;
}

/* Ссылка предпросмотра */
.table-sites td:nth-child(3) a,
.table-sites th:nth-child(4) a {
    display: inline-block;
    word-break: break-all;
}

.table-sites th:nth-child(4),
.table-sites td:nth-child(4) {
    width: 350px;
    min-width: 350px;
}

.table-sites th:nth-child(5),
.table-sites td:nth-child(5) {
    width: 80px;
    min-width: 80px;
}

/* Статус */
.table-sites th:nth-child(6),
.table-sites td:nth-child(6) {
    width: 160px;
    min-width: 160px;
}

/* Добавлен */
.table-sites th:nth-child(7),
.table-sites td:nth-child(7) {
    width: 320px;
    min-width: 320px;
}

.action-row .ds-textfield {
    margin-bottom: 0 !important;
}

.redirect-type-select {
    cursor: pointer;
}

.w-30 {
    width: 30px !important;
}

/* Действия */

.actions-td {
    text-align: left;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-direction: row;
}

.cell-drag {
    cursor: move;
    background-color: var(--tr-hover);
}

.cell-drop-before {
    border-left: 2px solid var(--accent-orange);
}

.cell-drop-after {
    border-right: 2px solid var(--accent-orange);
}

.vh-100 {
    height: 100vh;
}

.button-container {
    display: flex;
    gap: 12px;
    position: relative;

}

.column-selection {
    position: absolute;
    z-index: 100;
    background-color: var(--tr-hover);
    padding: 12px;
    border-radius: 8px;
    top: 36px;
    left: 0px;
    -webkit-box-shadow: 0px 10px 40px 0px rgba(0, 0, 0, 0.4);
    box-shadow: 0px 10px 40px 0px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform-origin: top left;
    pointer-events: none;
    transform: scale(0.5);
    filter: blur(10px);
    transition: transform 300ms cubic-bezier(.2, .9, .2, 1), opacity 280ms ease, filter 380ms ease;
    z-index: 7;
}

#select-col-order {
    z-index: 8;
}

.column-selection.open {
    filter: blur(0px);
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    z-index: 10;
    width: 140px;
}

.set-kit-name {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
    gap: 6px;
}

.input-options {
    cursor: pointer;
}

.container-forms {
    width: 100%;
    display: flex;
    justify-content: end;
}

.select-cells {
    position: relative;
}

.table-clicks #date {
    width: 160px;
    min-width: 160px;
}

.table-clicks #flow {
    width: 160px;
    min-width: 160px;
}

.table-clicks #site {
    width: 200px;
    min-width: 200px;
}

.table-clicks #clicks,
.table-clicks #uniques,
.table-clicks #breakthrough,
.table-clicks #breakthrough_percent,
.table-clicks #cr,
.table-clicks #all_leads,
.table-clicks #valid_leads,
.table-clicks #new_leads,
.table-clicks #in_progress,
.table-clicks #approved,
.table-clicks #rejected,
.table-clicks #trash,
.table-clicks #expenses,
.table-clicks #revenue,
.table-clicks #profit,
.table-clicks #epc_total,
.table-clicks #epc_unique,
.table-clicks #roi,
.table-clicks #step {
    width: 80px;
    min-width: 80px;
}



/* Fixed column widths for sites table */
.table-flows th:nth-child(1),
.table-flows td:nth-child(1) {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
}

/* # */
.table-flows th:nth-child(2),
.table-flows td:nth-child(2) {
    width: 280px;
    min-width: 280px;
}

/* # */
.table-flows th:nth-child(3),
.table-flows td:nth-child(3) {
    width: 320px;
    min-width: 320px;
}

/* Название потока */
.table-flows th:nth-child(4),
.table-flows td:nth-child(4) {
    width: 100px;
    min-width: 100px;
}

/* Доход */
.table-flows th:nth-child(5),
.table-flows td:nth-child(5) {
    width: 100px;
    min-width: 100px;
}

/* Обновлён */
.table-flows th:nth-child(6),
.table-flows td:nth-child(6) {
    width: auto;
    min-width: 250px;
    text-align: left;
}

/* Статус */
.table-flows th:nth-child(7),
.table-flows td:nth-child(7) {
    width: 160px;
    min-width: 160px;
}

/* Добавлен */
.table-flows th:nth-child(8),
.table-flows td:nth-child(8) {
    width: 160px;
    min-width: 160px;
}

.table-paths th:nth-child(1),
.table-paths td:nth-child(1) {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
}

.table-paths th:nth-child(2),
.table-paths td:nth-child(2) {
    width: 280px;
    min-width: 280px;
}

.table-paths th:nth-child(3),
.table-paths td:nth-child(3) {
    width: 100%;
    min-width: 100px;
    text-align: left;
}

.table-paths th:nth-child(4),
.table-paths td:nth-child(4) {
    width: 160px;
    min-width: 160px;
}

.table-paths th:nth-child(5),
.table-paths td:nth-child(5) {
    width: 160px;
    min-width: 160px;
}



.table-cf_domains th:nth-child(1),
.table-cf_domains td:nth-child(1) {
    width: 200px;
    min-width: 200px;
    max-width: 100%;
}

.table-cf_domains th:nth-child(2),
.table-cf_domains td:nth-child(2) {
    width: 160px;
    min-width: 160px;
}

.table-cf_domains th:nth-child(3),
.table-cf_domains td:nth-child(3) {
    width: 160px;
    min-width: 160px;
}

.table-cf_domains th:nth-child(4),
.table-cf_domains td:nth-child(4) {
    width: 180px;
    min-width: 180px;
}

.table-cf_domains th:nth-child(5),
.table-cf_domains td:nth-child(5) {
    width: 180;
    min-width: 180px;
}

.table-cf_domains th:nth-child(6),
.table-cf_domains td:nth-child(6) {
    width: 180px;
    min-width: 180px;
}

.table-cf_domains th:nth-child(7),
.table-cf_domains td:nth-child(7) {
    width: 120px;
    min-width: 120px;
}

.table-cf_domains th:nth-child(8),
.table-cf_domains td:nth-child(8) {
    width: 180px;
    min-width: 180px;
}

.table-cf_domains th:nth-child(9),
.table-cf_domains td:nth-child(9) {
    width: 100%;
    min-width: 180px;
}




/* Действия */

.form-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.controls {
    display: flex;
    gap: 20px;
}

.color-blue {
    background-color: var(--accent-blue);
}

.color-red {
    background-color: var(--accent-red);
}

#limit {
    width: 62px
}


/* form input styles */
.ds-textfield {
    border: 1px solid #cbcdd6;
    border-radius: 8px;
    box-sizing: border-box;
    display: inline-block;
    outline: none;
    padding: 6px 8px;
    touch-action: manipulation;
    width: 100%;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
    background-color: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-weight: 300;
    letter-spacing: -.02em;
    line-height: 17px;
    transition: all .3s;
    margin-bottom: 6px;
    background-color: var(--bg);
}

.ds-textfield:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

.inline-edit-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    background-color: var(--bg);
}

.inline-edit-input:focus,
.inline-edit-input:active {
    border: none;
    outline: none;
}

#flow_url {
    border: none;
    outline: none;
    background-color: var(--panel);
    color: var(--text);
}

#flow_url:active,
#flow_url:focus {
    border: none;
    outline: none;
}

#flow_url:hover {
    cursor: pointer;
}



/*form*/

#registerForm {
    /* display: none; */
    /* TEMPORARILY DISABLED - registration is closed */
}

#switchRegister {
    /* display: none; */
    /* Hide authentication toggle buttons */
}

#registerForm,
#loginForm {
    max-width: 300px;
    margin: auto;
    flex-direction: column;
    text-align: center;
    /* border: solid 1px var(--border); */
    border-radius: 8px;
    padding: 26px;
}

#registerForm label,
#loginForm label {
    display: block;
    text-align: left;
    font-size: 0.75rem;
}

.form-border {
    padding: 20px;
    background-color: var(--bg);
    border: solid 1px var(--panel);
    border-radius: 12px;
    overflow: visible;
}



/* Domains page helper classes (migrated from inline styles) */

.msg-box {
    padding: 8px;
    margin-bottom: 12px;
    display: none;
}

.mb-12 {
    margin-bottom: 20px;
}

.cf-label {
    display: block;
    font-size: 13px;
}

.ip-box {
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--accent-orange);
}

.domain-cell {
    overflow: hidden;
}

.progress-wrap {
    margin-top: 8px;
    max-width: 100%;
    width: 100%;
}

.progress {
    background: #eee;
    border: 1px solid #ddd;
    height: 10px;
    width: 100%;
    position: relative;
}

.progress .bar {
    background: var(--accent, #4caf50);
    height: 100%;
    width: 0%;
    display: block;
    transition: width 450ms ease, background-color 180ms ease, opacity 180ms ease;
    will-change: width, background-color, opacity;
}

.progress-label {
    font-size: 11px;
    color: var(--text);
    text-align: center;
    margin-top: 4px;
}

.status-issued {
    color: var(--accent);
}

.status-none {
    color: var(--text);
}

.status-error {
    color: var(--error);
}

.bind-ok-icon {
    color: var(--text);
    font-size: 18px;
    line-height: 1;
}

.bind-fail-icon {
    color: var(--error);
    font-size: 18px;
    line-height: 1;
}

.bind-info {
    font-size: 11px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    overflow: hidden;
}

.td-row {
    display: flex;
    flex-direction: row;
    gap: 3px;
}


.center {
    text-align: center;
}

.inline-form {
    display: inline;
}

/* Cloudflare nameservers hint shown in status cell */
.cf-ns {
    font-size: 0.85em;
    color: var(--accent-orange);
    margin-top: 4px;
}

#registerForm input,
#loginForm input {
    /* margin-bottom: 12px; */
    text-align: center;
    font-size: 1rem;
}

#registerBtn,
#loginBtn,
#logoutBtn,
.captcha-modal__cancel,
.captcha-modal__ok {
    /* margin-top: 12px; */
    font-size: 14px;
    font-weight: 300;

    letter-spacing: -.02em;
    line-height: 17px;

    background-color: var(--bg);
    color: var(--text);

    border-radius: 8px;
}

#registerBtn,
#loginBtn,
#logoutBtn,
.captcha-modal__cancel,
.captcha-modal__ok {
    padding: 16px 28px;
}

#logoutBtn {
    padding: 8px 18px;
    text-decoration: none;
}

#registerBtn:hover,
#loginBtn:hover,
#logoutBtn:hover,
.captcha-modal__cancel:hover,
.captcha-modal__ok:hover {
    background-color: var(--hover);

}

/* Auth sliding container */
.auth-container {
    max-width: 420px;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 90%;
}

.auth-switch {
    display: inline-flex;
    gap: 6px;
    margin-bottom: 12px;
}

.auth-toggle {
    padding: 8px 14px;
    border-radius: 8px;
    background: transparent;
    /* border: 1px solid var(--hover); */
    color: var(--text);
}

.auth-toggle[aria-pressed="true"] {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border);
}

.auth-viewport {
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
}

.auth-strip {
    display: flex;
    width: 200%;
    transform: translateX(0%);
    transition: transform 600ms cubic-bezier(.2, .8, .2, 1);
    align-items: center;
}

.auth-panel {
    width: 50%;
    padding: 18px;
    box-sizing: border-box;
}

.auth-panel .card {
    border: none;
    padding: 0;
    box-shadow: none;
}

@media (max-width: 640px) {
    .auth-container {
        padding: 12px;
    }

    .auth-strip {
        width: 200%;
    }

    .auth-panel {
        width: 100%;
    }
}

/* Captcha modal styles (used by client-side auth modal) */
.captcha-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.captcha-modal__box {
    background: var(--panel);
    padding: 24px;
    border-radius: 8px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
}

.captcha-modal__input {
    width: 100%;
    padding: 8px;
    margin-bottom: 12px;
    margin-top: 12px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.captcha-modal__input.is-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.06);
}

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

.captcha-modal__ok {
    margin-left: 8px;
}

.captcha-modal__cancel {
    margin-right: 8px;
}

#worker-log-content {
    background: var(--bg);
    color: var(--text);
    border-radius: 6px;
    padding: 10px;
    margin: 0;
}

#cf-zones-list {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
}

#cf-zones-list p {
    color: var(--text);
}


.cf-token-inputs,
.cf-urlsite-inputs {
    display: flex;
    gap: 12px;
}

/* Whois spinner indicator next to domain name */
.whois-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-top-color: var(--accent);
    margin-left: 8px;
    vertical-align: middle;
    animation: whois-spin 900ms linear infinite;
}

.whois-spinner.hidden {
    display: none;
}

@keyframes whois-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Utility classes for sites.php */
.mb-8 {
    margin-bottom: 8px;
}

.mt-12 {
    margin-top: 12px;
}

.action-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Reduce vertical gap for buttons inside table action cells */
.table-container .action-row>* {
    margin-top: 0 !important;
}

.cleanup-result {
    padding: 12px;
    border-radius: 4px;
    margin-top: 12px;
    display: none;
}

.logs-container {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}

/* Notification area (top-right) */
#global-notifications {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 120000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

#global-notifications .notify {
    background: var(--panel);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    /* allow notifications to grow on wide screens but limit by viewport */
    max-width: 60vw;
    position: relative;
    /* start hidden; toggled visible by adding .show to trigger transition */
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 220ms cubic-bezier(.2, .9, .2, 1), transform 220ms cubic-bezier(.2, .9, .2, 1);
    word-break: break-word;
    overflow-wrap: anywhere;
}

#global-notifications .notify.show {
    opacity: 1;
    transform: translateY(0);
}

#global-notifications .notify.hide {
    opacity: 0;
    transform: translateY(-6px);
}

#global-notifications .notify.success {
    border-left: 4px solid var(--active-green);
}

#global-notifications .notify.error {
    border-left: 4px solid var(--error);
}

#global-notifications .notify.info {
    border-left: 4px solid var(--bg-selected);
}

#global-notifications .notify .notify-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: inherit;
    font-size: 14px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    z-index: 2;
}

/* Ensure inner message can wrap and preserve newlines */
#global-notifications .notify .notify-msg {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: inherit;
    /* keep message clear of the close button */
    padding-right: 40px;
}

/* Responsive: make table horizontally scrollable on small screens */
@media (max-width: 640px) {
    .main-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    th,
    td {
        white-space: nowrap;
    }
}

/* Remove table shadows project-wide and add bottom corner rounding */
table {
    box-shadow: none !important;
    /* collapse borders so adjacent 1px borders render as single 1px line */
    border-collapse: collapse;
    border-spacing: 0;
}

/* Ensure backgrounds don't paint under borders at rounded corners */
table,
table th,
table td {
    background-clip: padding-box;
}

.table-container {
    min-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    position: relative;
    width: 100%;
    text-align: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-radius: 8px;
}

.table-scroll>table {
    border-radius: 8px;
    background-clip: padding-box;
    overflow: hidden;
}

.table-scroll::-webkit-scrollbar {
    height: 12px;
    background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: #404d5659;
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.table-scroll::-webkit-scrollbar-thumb:hover,
.table-scroll::-webkit-scrollbar-thumb:active {
    background: #404d5673;
}

/* Firefox */
.table-scroll {
    scrollbar-width: thin;
    scrollbar-color: #404d5659 transparent;
}

/* Draw single 1px outer border INSIDE container without affecting cell borders */
.table-container::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px var(--panel);
    pointer-events: none;
}




/* Use internal grid lines generated from cell separators (no outer cell borders) */
.table-domains th,
.table-domains td {
    border: none;
}

/* vertical lines between columns */
.table-domains thead tr th+th,
.table-domains tbody tr td+td {
    border-left: 1px solid var(--panel);
}

/* horizontal lines between rows */
.table-domains tbody tr+tr td,
.table-domains tbody tr+tr th {
    border-top: 1px solid var(--panel);
}

/* Ensure cell content doesn't overflow rounded corners */
table td,
table th {
    overflow: hidden;
}

/* Round bottom-left and bottom-right corners on last row cells */
table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* Minimal styles for databases collapse button/state */
.db-table {
    margin-bottom: 14px;
}

.collapse-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.collapse-btn:hover {
    background: var(--hover);
}


.db-table.collapsed .muted {
    display: none;
}


.db-table.collapsed .table-container {
    display: none;
}


/* Database viewer specific adjustments: make dynamic tables readable */
.db-table .table-container {
    overflow-x: auto;
}

/* Database viewer specific adjustments: make dynamic tables readable */

.db-table table {
    table-layout: auto;
    width: 100%;
    min-width: 640px;
}

/* .db-table th,
.db-table td {
    white-space: normal;
    word-break: break-word;
    max-width: 640px;
} */

/* Prefer narrow first column (ids) and narrow last column (actions) when present */
.db-table th:first-child,
.db-table td:first-child {
    width: 80px;
    max-width: 160px;
}

.db-table th:last-child,
.db-table td:last-child {
    width: 120px;
    max-width: 220px;
}

.db-table td code,
.db-table th code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
}

table {
    border-radius: 8px;
    background-clip: padding-box;
}

/* Global font smoothing and weight settings */
body,
.main-content,
.card,
.menu,
.page-header,
.table-container,
table,
th,
td,
h1,
h2,
h3,
h4,
h5,
h6,
label,
.ds-textfield,
.button,
.menu-item,
.muted,
.status-cell,
.domain-cell,
.cf-label,
.modal,
.modal-content,
.modal-title,
.modal-desc,
.notify,
.notify-msg {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body[data-theme="dark"] {
    /* Белый текст на темном фоне — делаем тоньше и мягче */
    color-scheme: dark;
}

/* Back arrow for flow edit header */
#flow-edit-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

#back-to-flows {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    margin-right: 8px;
    transition: color 0.18s;
}

#back-to-flows:hover {
    color: var(--hover);
}

/* Drag & Drop columns for statistics table */
.th-dragging,
.td-dragging {
    background: #e0f0ff !important;
}

.th-drop-target,
.td-drop-target {
    box-shadow: 2px 0 0 0 #007bff inset;
    position: relative;
}

.th-drop-target-right,
.td-drop-target-right {
    box-shadow: -2px 0 0 0 #007bff inset;
    position: relative;
}

/* ===== Flows Page Styles ===== */

#flowsMain {
    display: block;
}

#flowsMain.hidden {
    display: none !important;
}

#flowEdit {
    display: none;
}

#flowEdit.visible {
    display: block !important;
}

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

.flex-row {
    display: flex;
    flex-direction: row;
}

.mb-12 {
    margin-bottom: 12px;
}

.w-30 {
    width: 30px;
}

/* Geo select wrapper and dropdown */
#geo-select-wrapper {
    position: relative;
    z-index: 100;
    overflow: visible;
}

#geo-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--tr-hover);
    max-height: 300px;
    overflow-y: auto;
    z-index: 10000;
    display: block;
    box-shadow: 0px 10px 40px 0px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

#geo-dropdown.hidden {
    display: none !important;
}

#geo-selected {
    margin-top: 12px;
    font-size: 14px;
    color: #666;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.geo-form-container {
    width: 420px;
    scrollbar-color: #404d5659 transparent;
}

#flow-geo-search {
    width: 100%;
}

#flow-geo-hidden {
    display: none;
}

/* Geo option in dropdown */
.geo-option {
    padding: 8px 12px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: background 0.2s !important;
}

.geo-option:hover {
    background: var(--button-bg) !important;
}

.geo-option:last-child {
    border-bottom: none !important;
}

.geo-option img {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
}

.geo-option span {
    flex: 1;
}

.geo-option-code {
    color: #999;
    font-size: 12px;
}

/* Geo selected display */
#geo-selected img,
.geo-selected-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: middle;
    display: inline-block;
}


.geo-remove-btn {
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--tr-hover);
    color: var(--text);
    border-radius: 6px;
}

.geo-selected-flag-wrap {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    padding: 6px;
    background-color: var(--panel);
    color: var(--text);
    border-radius: 8px;
}


/* Inline edit input */
.inline-edit-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--accent);
    border-radius: 3px;
    background: var(--button-bg);
    color: var(--text);
    font-family: inherit;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 4px;
}

/* Create flow message */
#create-flow-message {
    display: inline-block;
    margin-left: 12px;
    color: #1f2937;
}

/* Add path button */
#add-path-btn {
    cursor: pointer;
}

/* Site select in modal */
#site-select {
    width: 100%;
    margin-bottom: 12px;
}

/* Dropdown empty state message */
.geo-empty-message {
    padding: 8px;
    color: #999;
}

.add-step-section {
    padding: 6px;
    font-size: 0.8rem;
    line-height: 20px;
}

.add-step-section:hover {
    background: var(--tr-hover);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.flow-step-section h3 {
    text-align: left;
    padding-left: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
}

/* QR Codes List styles */
.qr-title {
    font-weight: 600;
    max-width: 200px;
    word-break: break-word;
}

.qr-url {
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
    max-width: 300px;
}

.qr-stats {
    text-align: center;
    font-weight: 500;
}

.qr-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.pagination {
    margin-top: 30px;
    text-align: center;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid var(--panel);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--hover);
    color: var(--text);
    border-color: var(--hover);
}

.pagination .active {
    background: var(--button-bg);
    color: var(--text);
    border-color: var(--button-bg);
}

.qr-actions a {
    height: auto;
}

/* QR-код генератор: стили вынесены из qrcoder.php */
.qr-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px auto;
    align-items: start;
}

.qr-form {
    background: var(--bg, #ffffff);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--panel, #e5e7eb);
}

.qr-right {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text, #1f2937);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border, #cbcdd6);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background-color: var(--bg, #ffffff);
    color: var(--text, #1f2937);
    font-family: inherit;
    transition: all 0.3s;
}

.form-group input[type="color"] {
    width: 100%;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--hover, #60a5fa);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px;
}

.button.secondary {
    background: var(--panel, #e5e7eb);
}

.button.secondary:hover {
    background: var(--hover, #60a5fa);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qr-result {
    text-align: center;
    background: var(--bg, #ffffff);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--panel, #e5e7eb);
    display: none;
    flex-grow: 1;
}

.qr-result.active {
    display: block;
}

#qr-placeholder {
    display: block;
}

.qr-image {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 4px;
    display: block;
    line-height: 0;
    font-size: 0;
}

.qr-content-wrapper {
    padding: 40px 30px;
    display: inline-block;
    background: transparent;
}

#qr-code {
    border: none;
    display: block;
    margin: 0;
    padding: 0;
    /* background: #f0f0f0; Визуализируем отступ серым фоном */
    border-radius: 4px;
    overflow: hidden;
}

.qr-url-display {
    word-break: break-all;
    font-size: 12px;
    color: var(--text, #1f2937);
}

.qr-info {
    font-size: 13px;
    color: var(--text, #1f2937);
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-row>.form-group {
    flex: 1;
    min-width: 200px;
}

.qr-code-wrapper {
    position: relative;
    display: inline-block;
    padding: 0;
    border-radius: 0;
    overflow: visible;
    /* Логотип на грани НЕ должен обрезаться */
    /* background-color: #f0f0f0; */
}

.qr-logo-container {
    position: absolute;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    /* Логотип ВСЕГДА над canvas */
}

.qr-logo-container img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 0 0 3px white;
}

.form-group label[style*="flex"] {
    color: var(--text);
    font-weight: 500;
    font-size: 13px;
}

.qr-warning {
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.qr-warning.show {
    display: block;
}

.qr-warning strong {
    color: #d39e00;
}