:root { --afn-admin-header: 76px; }

body.afn-admin-shell { background: #f4f7f9; }

#mainNav {
    min-height: var(--afn-admin-header);
    padding: .55rem clamp(.75rem, 2vw, 1.5rem);
    border-bottom: 1px solid rgba(15, 52, 67, .1);
    box-shadow: 0 8px 28px rgba(15, 52, 67, .08);
}

#mainNav .navbar-brand {
    flex: 0 0 auto;
    gap: .55rem;
    margin-right: 1rem;
    padding: .42rem .7rem;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #123d4b, #1d6873);
}

#mainNav .navbar-brand .nav-logo { width: 35px; height: 35px; object-fit: contain; }
#mainNav .navbar-brand b { margin: 0 !important; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; }
#navbardDiv, #navbarSupportedContent { min-width: 0; }
#navbarSupportedContent > .navbar-nav:first-child { align-items: center; min-width: 0; }
#mainNav .nav-link { white-space: nowrap; }
#mainNav .dropdown-menu { max-height: min(70vh, 580px); overflow-y: auto; }
#mainNav .dropdown-item svg { width: 16px; margin-right: .4rem; }

body.afn-admin-shell > main.container { margin-top: calc(var(--afn-admin-header) + 28px) !important; }
body.afn-admin-shell .table-responsive { overflow-x: auto !important; overflow-y: visible !important; background: #fff; }
body.afn-admin-shell .dataTables_scrollBody { max-height: none !important; overflow-x: auto !important; overflow-y: visible !important; }

body.afn-admin-shell .table td,
body.afn-admin-shell .table th {
    max-width: 340px;
    padding: .7rem .75rem !important;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

body.afn-admin-shell .table thead th { white-space: nowrap; }
body.afn-admin-shell .table-action-cell { min-width: 138px; padding: .55rem !important; gap: 4px; }
body.afn-admin-shell .table-action-cell .btn { min-height: 32px; padding: .32rem .6rem; font-size: .76rem; }

body.afn-admin-shell .admin-table-tools {
    position: sticky;
    top: calc(var(--afn-admin-header) + 8px);
    z-index: 4;
    padding: .75rem;
    border: 1px solid var(--afn-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 22px rgba(15, 52, 67, .06);
    backdrop-filter: blur(12px);
}

body.afn-admin-shell #cookie-popup { max-width: 380px; padding: 14px; font-size: .86rem; }
body.afn-admin-shell #cookie-popup p { margin-bottom: .55rem; }

body.afn-admin-shell form .form-control,
body.afn-admin-shell form .select2-selection { min-height: 42px; border-color: #cbd8dd; border-radius: 10px; }

body.afn-admin-shell form .form-control:focus { border-color: var(--afn-brand); box-shadow: 0 0 0 3px rgba(178, 31, 91, .13); }

/* Text editing needs a real working area. This deliberately follows the generic
   .form-control rule so textareas cannot collapse back to single-line height. */
body.afn-admin-shell form textarea,
body.afn-admin-shell form textarea.form-control {
    width: 100%;
    min-height: 180px;
    padding: .85rem 1rem;
    resize: vertical;
    line-height: 1.55;
}

body.afn-admin-shell form textarea.wysiwyg-input,
body.afn-admin-shell form textarea#htmlEditor,
body.afn-admin-shell form textarea#contentInput,
body.afn-admin-shell form textarea#descriptionHtmlEditor {
    min-height: 520px;
}

body.afn-admin-shell .sun-editor,
body.afn-admin-shell .note-editor {
    width: 100% !important;
    overflow: hidden;
    border: 1px solid #cbd8dd !important;
    border-radius: 12px;
    background: #fff;
}

body.afn-admin-shell .sun-editor .se-wrapper-inner,
body.afn-admin-shell .sun-editor .sun-editor-editable,
body.afn-admin-shell .note-editor .note-editable {
    min-height: 520px !important;
    padding: 1.1rem 1.2rem;
    font-size: 1rem;
    line-height: 1.65;
}

body.afn-admin-shell .sun-editor .se-toolbar,
body.afn-admin-shell .note-editor .note-toolbar {
    position: sticky;
    top: var(--afn-admin-header);
    z-index: 3;
    background: #f8fafb;
}

body.afn-admin-shell .affiliate-link-status {
    display: grid;
    gap: .15rem;
    margin: -.2rem 0 1rem;
    padding: .75rem .9rem;
    border: 1px solid #ccd7dc;
    border-left-width: 4px;
    border-radius: 10px;
    background: #f8fafb;
    color: #294650;
    font-size: .86rem;
}

body.afn-admin-shell .affiliate-link-status strong { color: inherit; }
body.afn-admin-shell .affiliate-link-status span { opacity: .86; }
body.afn-admin-shell .affiliate-link-status--missing { border-left-color: #c0392b; background: #fff5f4; color: #8d291f; }
body.afn-admin-shell .affiliate-link-status--placeholder { border-left-color: #d68b00; background: #fff9e9; color: #775008; }
body.afn-admin-shell .affiliate-link-status--active { border-left-color: #27845b; background: #f0faf5; color: #176743; }

body.afn-admin-shell .condition-validation-summary { margin: 1rem 0; padding: .8rem 1rem; border-radius: 10px; font-size: .88rem; }
body.afn-admin-shell .condition-validation-summary ul { margin: .4rem 0 0; padding-left: 1.2rem; }
body.afn-admin-shell .condition-validation-summary--warning { border: 1px solid #e6c26d; background: #fff9e9; color: #775008; }
body.afn-admin-shell .condition-validation-summary--valid { border: 1px solid #8acbad; background: #f0faf5; color: #176743; }
body.afn-admin-shell .condition-editor-card { background: #fff; border-color: #d6e0e4 !important; box-shadow: 0 5px 16px rgba(15, 52, 67, .04); }
body.afn-admin-shell .condition-editor-card--required { border-left: 4px solid var(--afn-brand) !important; }
body.afn-admin-shell .condition-editor-card--invalid { border-color: #d68b00 !important; background: #fffdf7; }
body.afn-admin-shell .condition-required-marker { color: var(--afn-brand); font-weight: 800; }
body.afn-admin-shell .condition-inline-feedback { color: #8a5a00; font-size: .8rem; font-weight: 600; }

body.afn-admin-shell .catalog-workflow-steps { display: grid; grid-template-columns: repeat(6, minmax(115px, 1fr)); gap: .5rem; margin: 1rem 0 1.25rem; padding: 0; list-style: none; overflow-x: auto; }
body.afn-admin-shell .catalog-workflow-steps li { min-width: 115px; padding: .65rem .7rem; border: 1px solid #d6e0e4; border-radius: 10px; background: #f8fafb; color: #506972; font-size: .78rem; font-weight: 650; }
body.afn-admin-shell .catalog-workflow-steps li span { display: inline-block; width: 8px; height: 8px; margin-right: .4rem; border-radius: 50%; background: #a9bbc2; }
body.afn-admin-shell .catalog-workflow-steps li.is-current { border-color: var(--afn-brand); background: rgba(178, 31, 91, .07); color: var(--afn-brand); }
body.afn-admin-shell .catalog-workflow-steps li.is-current span { background: var(--afn-brand); }

body.afn-admin-shell #offerEditTabs {
    position: sticky;
    top: calc(var(--afn-admin-header) + 4px);
    z-index: 5;
    padding-top: .4rem;
    background: #f4f7f9;
}

@media (max-width: 1199.98px) {
    #mainNav .navbar-brand b { display: none; }
    #mainNav .nav-link { padding-inline: .55rem; font-size: .8rem; }
}

@media (max-width: 767.98px) {
    :root { --afn-admin-header: 66px; }
    #mainNav .navbar-brand b { display: inline; }
    #navbardDiv, #navbarSupportedContent { width: 100%; }
    #navbarSupportedContent > .navbar-nav, #navbarSupportedContent > .navbar-right { width: 100%; align-items: stretch !important; }
    #mainNav .nav-link, #mainNav .dropdown-item { width: 100%; padding: .7rem .8rem; }
    #mainNav .dropdown-menu { position: static !important; width: 100%; margin: .25rem 0 .5rem; box-shadow: none; }
    body.afn-admin-shell .admin-table-tools { position: static; }
    body.afn-admin-shell #cookie-popup { inset: auto 8px 8px; max-width: none; }
    body.afn-admin-shell form textarea,
    body.afn-admin-shell form textarea.form-control { min-height: 150px; }
    body.afn-admin-shell form textarea.wysiwyg-input,
    body.afn-admin-shell form textarea#htmlEditor,
    body.afn-admin-shell form textarea#contentInput,
    body.afn-admin-shell form textarea#descriptionHtmlEditor,
    body.afn-admin-shell .sun-editor .se-wrapper-inner,
    body.afn-admin-shell .sun-editor .sun-editor-editable,
    body.afn-admin-shell .note-editor .note-editable { min-height: 360px !important; }
}

.provider-logo-editor{display:grid;grid-template-columns:minmax(120px,220px) 1fr;align-items:center;gap:1rem;margin:.5rem 0 1.25rem;padding:1rem;border:1px solid #dbe4e8;border-radius:14px;background:#f7faf9}.provider-logo-editor img{display:block;width:100%;height:112px;object-fit:contain;border:1px solid #e3e8e6;border-radius:10px;background:#fff}@media(max-width:767px){.provider-logo-editor{grid-template-columns:1fr}.provider-logo-editor img{height:96px}}
