/* ==========================================================================
   Pekofsky Gallery Portal, Shared UI System
   File: /assets/css/portal.css
   ========================================================================== */

:root {
    --bg: #0b0f17;
    --bg-elevated: #141a24;
    --bg-elevated-2: #1b2230;
    --bg-panel: #202636;
    --bg-panel-hover: #252c3d;
    --border: #2d3548;
    --border-strong: #3b4761;
    --text: #eef2fb;
    --text-soft: #c2cada;
    --text-muted: #8c96ab;
    --heading: #ffffff;
    --primary: #7c9cff;
    --primary-hover: #95adff;
    --primary-active: #698bf4;
    --accent: #52d0ff;
    --success: #29c47a;
    --warning: #f0b24f;
    --danger: #ef5d68;
    --danger-hover: #ff737d;
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.35);
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --container: 1360px;
    --content-narrow: 980px;
    --dashboard-content: 1220px;
    --transition: 0.18s ease;
    --font-stack: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    background: #0b0f17;
}

body {
    margin: 0;
    min-width: 320px;
    background-color: #0b0f17;
    background-image:
        radial-gradient(circle at 20% 0%, rgba(82, 208, 255, 0.06), transparent 26%),
        radial-gradient(circle at 80% 0%, rgba(124, 156, 255, 0.07), transparent 24%),
        radial-gradient(circle at 50% 18%, rgba(90, 120, 255, 0.05), transparent 30%),
        linear-gradient(180deg, #101622 0%, #0b0f17 38%, #0a0e16 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-stack);
    line-height: 1.55;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

svg {
    display: block;
}

a {
    color: var(--primary-hover);
    text-decoration: none;
    transition: color var(--transition), opacity var(--transition);
}

a:hover {
    color: #b2c2ff;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

code,
pre {
    font-family: Consolas, "Courier New", monospace;
}

::selection {
    background: rgba(124, 156, 255, 0.28);
    color: #fff;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.portal-shell,
.page-shell,
.container,
.portal-container,
.wrap {
    width: min(var(--container), calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

.container-narrow,
.page-narrow {
    width: min(var(--content-narrow), calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

.page-section {
    margin: 22px auto;
}

.stack-xs > * + * {
    margin-top: 8px;
}

.stack-sm > * + * {
    margin-top: 12px;
}

.stack-md > * + * {
    margin-top: 18px;
}

.stack-lg > * + * {
    margin-top: 26px;
}

.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-8 {
    gap: 8px;
}

.gap-10 {
    gap: 10px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.gap-20 {
    gap: 20px;
}

.gap-24 {
    gap: 24px;
}

.hidden {
    display: none !important;
}




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

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

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

.w-full {
    width: 100%;
}

.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-20 { margin-top: 20px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-20 { margin-bottom: 20px !important; }

/* ==========================================================================
   Typography
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 0.65em;
    color: var(--heading);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 700;
}

h1 {
    font-size: clamp(1.95rem, 2.6vw, 2.7rem);
}

h2 {
    font-size: clamp(1.5rem, 2.1vw, 2rem);
}

h3 {
    font-size: clamp(1.15rem, 1.55vw, 1.35rem);
}

h4 {
    font-size: 1.05rem;
}

p {
    margin: 0 0 1rem;
    color: var(--text-soft);
}

p:last-child {
    margin-bottom: 0;
}

ul,
ol {
    margin: 0 0 1rem 1.25rem;
    padding: 0;
    color: var(--text-soft);
}

li + li {
    margin-top: 0.3rem;
}

small,
.text-small {
    font-size: 0.92rem;
}

.text-muted,
.muted,
.help-text,
.note {
    color: var(--text-muted) !important;
}

.text-soft {
    color: var(--text-soft) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger,
.error-text {
    color: var(--danger) !important;
}

/* ==========================================================================
   Topbar / Header / Navigation
   ========================================================================== */

.portal-topbar,
.page-topbar,
header.portal-header,
.portal-header {
    position: sticky;
    top: 0;
    z-index: 120;
    backdrop-filter: blur(14px);
    background: rgba(12, 16, 24, 0.86);
    border-bottom: 1px solid rgba(59, 71, 97, 0.75);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

.portal-topbar-inner,
.portal-header-inner,
.page-topbar-inner,
.nav-wrap {
    width: min(var(--container), calc(100% - 32px));
    margin: 0 auto;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
}

.portal-brand,
.site-brand,
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.portal-brand-logo,
.brand-badge,
.site-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124, 156, 255, 0.25), rgba(82, 208, 255, 0.18));
    border: 1px solid rgba(124, 156, 255, 0.35);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
}

.portal-brand-text,
.brand-text {
    min-width: 0;
}

.portal-brand-title,
.brand-title {
    color: var(--heading);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
}

.portal-brand-subtitle,
.brand-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 2px 0 0;
}

.portal-nav,
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.portal-nav a,
.nav-links a,
.portal-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 999px;
    color: var(--text-soft);
    background: transparent;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.portal-nav a:hover,
.nav-links a:hover,
.portal-nav .nav-link:hover,
.portal-nav a.active,
.nav-links a.active,
.portal-nav .nav-link.active {
    background: rgba(124, 156, 255, 0.12);
    border-color: rgba(124, 156, 255, 0.22);
    color: #fff;
    transform: translateY(-1px);
}

/* ==========================================================================
   Cards / Panels
   ========================================================================== */

.card,
.panel,
.portal-card,
.admin-card,
.surface,
.content-panel {
    position: relative;
    background: linear-gradient(180deg, rgba(30, 36, 50, 0.96), rgba(21, 26, 38, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 22px;
    overflow: hidden;
}

.card::before,
.panel::before,
.portal-card::before,
.admin-card::before,
.surface::before,
.content-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    pointer-events: none;
}

.card-tight,
.panel-tight {
    padding: 16px;
}

.card-loose,
.panel-loose {
    padding: 28px;
}

.card-header,
.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.card-title,
.panel-title {
    margin: 0;
    font-size: 1.2rem;
}

.card-subtitle,
.panel-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.94rem;
}

.card-body,
.panel-body {
    min-width: 0;
}

.card-footer,
.panel-footer {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.section-header {
    margin-bottom: 18px;
}

.section-title {
    margin-bottom: 6px;
}

.section-intro {
    color: var(--text-muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn,
button.btn,
input[type="submit"].btn,
input[type="button"].btn,
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: linear-gradient(180deg, #262d3d, #212838);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
    box-shadow: var(--shadow-sm);
    transition:
        transform var(--transition),
        border-color var(--transition),
        background var(--transition),
        color var(--transition),
        box-shadow var(--transition),
        opacity var(--transition);
    user-select: none;
    white-space: nowrap;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
    transform: translateY(-1px);
    border-color: #51617f;
    background: linear-gradient(180deg, #2c3447, #242c3d);
    color: #fff;
}

.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid rgba(124, 156, 255, 0.72);
    outline-offset: 2px;
}

.btn:disabled,
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none !important;
}

.btn-primary,
button.btn-primary,
a.btn-primary {
    border-color: rgba(124, 156, 255, 0.42);
    background: linear-gradient(180deg, var(--primary), #6587ef);
    color: #ffffff;
}

.btn-primary:hover,
button.btn-primary:hover,
a.btn-primary:hover {
    background: linear-gradient(180deg, var(--primary-hover), #7597fb);
    border-color: rgba(149, 173, 255, 0.65);
}

.btn-secondary,
button.btn-secondary,
a.btn-secondary {
    background: linear-gradient(180deg, #2a3245, #232b3b);
    color: var(--text);
}

.btn-outline,
button.btn-outline,
a.btn-outline {
    background: rgba(124, 156, 255, 0.06);
    border-color: rgba(124, 156, 255, 0.26);
    color: var(--primary-hover);
    box-shadow: none;
}

.btn-outline:hover,
button.btn-outline:hover,
a.btn-outline:hover {
    background: rgba(124, 156, 255, 0.13);
    color: #fff;
}

.btn-success,
button.btn-success,
a.btn-success {
    background: linear-gradient(180deg, #2fc481, #1da766);
    border-color: rgba(41, 196, 122, 0.4);
    color: #fff;
}

.btn-warning,
button.btn-warning,
a.btn-warning {
    background: linear-gradient(180deg, #f4bb61, #d79b3a);
    border-color: rgba(240, 178, 79, 0.5);
    color: #161616;
}

.btn-danger,
button.btn-danger,
a.btn-danger {
    background: linear-gradient(180deg, #f06a74, #d94b56);
    border-color: rgba(239, 93, 104, 0.48);
    color: #fff;
}

.btn-danger:hover,
button.btn-danger:hover,
a.btn-danger:hover {
    background: linear-gradient(180deg, var(--danger-hover), #e05560);
}

.btn-ghost,
button.btn-ghost,
a.btn-ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--text-soft);
}

.btn-ghost:hover,
button.btn-ghost:hover,
a.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.92rem;
}

.btn-lg {
    min-height: 50px;
    padding: 14px 20px;
    border-radius: 14px;
}

.btn-block,
.w-full.btn {
    width: 100%;
}

/* ==========================================================================
   Alerts / Messages
   ========================================================================== */

.alert,
.notice,
.message,
.flash-message,
.status-message {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 14px 16px;
    margin: 0 0 16px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-soft);
}

.alert:last-child,
.notice:last-child,
.message:last-child {
    margin-bottom: 0;
}

.alert-success,
.notice-success,
.message-success {
    background: rgba(41, 196, 122, 0.11);
    border-color: rgba(41, 196, 122, 0.34);
    color: #d8ffea;
}

.alert-warning,
.notice-warning,
.message-warning {
    background: rgba(240, 178, 79, 0.12);
    border-color: rgba(240, 178, 79, 0.34);
    color: #ffe4b4;
}

.alert-danger,
.notice-danger,
.message-error,
.alert-error {
    background: rgba(239, 93, 104, 0.11);
    border-color: rgba(239, 93, 104, 0.32);
    color: #ffd8dd;
}

.alert-info,
.notice-info {
    background: rgba(82, 208, 255, 0.1);
    border-color: rgba(82, 208, 255, 0.28);
    color: #d7f6ff;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
}

.form-grid > .col-12 { grid-column: span 12; }
.form-grid > .col-9  { grid-column: span 9; }
.form-grid > .col-8  { grid-column: span 8; }
.form-grid > .col-7  { grid-column: span 7; }
.form-grid > .col-6  { grid-column: span 6; }
.form-grid > .col-5  { grid-column: span 5; }
.form-grid > .col-4  { grid-column: span 4; }
.form-grid > .col-3  { grid-column: span 3; }

.form-row,
.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.form-group,
.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

label,
.form-label,
.field-label {
    display: inline-block;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: #131823;
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        background var(--transition);
}

input[type="file"] {
    padding: 11px 12px;
}

textarea {
    min-height: 130px;
    resize: vertical;
    line-height: 1.55;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #c9d2e6 50%),
        linear-gradient(135deg, #c9d2e6 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="url"]:hover,
input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="file"]:hover,
select:hover,
textarea:hover {
    border-color: #4b5976;
}

input::placeholder,
textarea::placeholder {
    color: #707b91;
}

.form-actions,
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inline-field,
.checkbox-row,
.radio-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex: 0 0 auto;
}

/* ==========================================================================
   Tables / Admin Tables
   ========================================================================== */

.table-wrap,
.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(18, 22, 31, 0.65);
    box-shadow: var(--shadow-sm);
}

table,
.data-table,
.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

thead th {
    background: rgba(124, 156, 255, 0.08);
    color: #f2f5ff;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody td {
    padding: 13px 14px;
    border-top: 1px solid rgba(45, 53, 72, 0.9);
    vertical-align: top;
    color: var(--text-soft);
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

.table-compact thead th,
.table-compact tbody td {
    padding: 10px 12px;
}

/* ==========================================================================
   Dashboard / Stats / Utility Blocks
   ========================================================================== */

.stats-grid,
.metric-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stat-card,
.metric-card {
    background: linear-gradient(180deg, rgba(35, 41, 57, 0.95), rgba(27, 33, 46, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.stat-label,
.metric-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value,
.metric-value {
    color: var(--heading);
    font-size: clamp(1.4rem, 2vw, 2rem);
    font-weight: 700;
    line-height: 1.1;
}

.stat-help,
.metric-help {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ==========================================================================
   Dashboard Shared Layout
   ========================================================================== */

.dashboard-content {
    max-width: var(--dashboard-content);
    margin: 0 auto;
}

.dashboard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-top-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-intro {
    margin-bottom: 16px;
}

.dashboard-intro p {
    max-width: 760px;
}

.dashboard-admin-sticky {
    position: sticky;
    top: 84px;
    z-index: 95;
    margin-bottom: 16px;
}

.dashboard-admin-label {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    margin-right: 4px;
    white-space: nowrap;
}

.dashboard-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.dashboard-gallery-grid {
    margin-top: 0;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.dashboard-gallery-card {
    display: flex;
    flex-direction: column;
    min-height: 160px;
}

.dashboard-gallery-card .gallery-card-title {
    font-size: 1rem;
    line-height: 1.28;
}

.dashboard-gallery-card .gallery-card-meta {
    font-size: 0.93rem;
    line-height: 1.4;
}

.dashboard-gallery-card .gallery-card-actions {
    margin-top: auto;
}

.dashboard-gallery-card .btn {
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 11px;
    font-size: 0.95rem;
    font-weight: 700;
}

.dashboard-empty {
    margin-top: 0;
}

/* ==========================================================================
   Gallery Grid / Thumbnails / Photo Cards
   ========================================================================== */

.gallery-grid,
.photo-grid,
.thumb-grid,
.image-grid,
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.gallery-grid-tight,
.photo-grid-tight {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.gallery-card,
.photo-card,
.thumb-card,
.image-card {
    background: linear-gradient(180deg, rgba(31, 37, 50, 0.98), rgba(24, 29, 40, 0.98));
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
    min-width: 0;
}

.gallery-card:hover,
.photo-card:hover,
.thumb-card:hover,
.image-card:hover {
    transform: translateY(-2px);
    border-color: #465678;
    box-shadow: var(--shadow-md);
    background: linear-gradient(180deg, rgba(34, 40, 55, 0.99), rgba(26, 31, 44, 0.99));
}

.gallery-card-media,
.photo-card-media,
.thumb-card-media,
.image-card-media,
.gallery-thumb {
    position: relative;
    background: #0d1118;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.gallery-card-media img,
.photo-card-media img,
.thumb-card-media img,
.image-card-media img,
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-card-body,
.photo-card-body,
.thumb-card-body,
.image-card-body {
    padding: 14px;
}

.gallery-card-title,
.photo-card-title,
.thumb-card-title,
.image-card-title {
    margin: 0 0 6px;
    font-size: 1rem;
    color: #fff;
    line-height: 1.3;
    word-break: break-word;
}

.gallery-card-meta,
.photo-card-meta,
.thumb-card-meta,
.image-card-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.gallery-card-actions,
.photo-card-actions,
.thumb-card-actions,
.image-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 14px 14px;
}

.gallery-card-selected,
.photo-card-selected,
.thumb-card-selected,
.is-selected {
    border-color: rgba(124, 156, 255, 0.72) !important;
    box-shadow: 0 0 0 2px rgba(124, 156, 255, 0.18), var(--shadow-md) !important;
}

.image-checkbox,
.photo-checkbox,
.thumb-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: rgba(11, 15, 22, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
}

.image-badge,
.photo-badge,
.thumb-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(11, 15, 22, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Hero / Page Header Blocks
   ========================================================================== */

.hero-card,
.page-hero,
.portal-hero {
    position: relative;
    overflow: hidden;
    padding: 26px;
    border-radius: 20px;
    border: 1px solid rgba(124, 156, 255, 0.16);
    background:
        radial-gradient(circle at top right, rgba(124, 156, 255, 0.16), transparent 26%),
        radial-gradient(circle at bottom left, rgba(82, 208, 255, 0.12), transparent 20%),
        linear-gradient(180deg, rgba(29, 35, 49, 0.98), rgba(22, 27, 39, 0.99));
    box-shadow: var(--shadow-md);
}

.hero-card p,
.page-hero p,
.portal-hero p {
    max-width: 860px;
}

/* ==========================================================================
   Toolbar / Filters / Action Bars
   ========================================================================== */

.toolbar,
.action-toolbar,
.filter-bar,
.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: rgba(20, 25, 35, 0.7);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.toolbar-spacer {
    flex: 1 1 auto;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal,
.lightbox,
.dialog {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(6, 8, 12, 0.82);
    backdrop-filter: blur(8px);
}

.modal.is-open,
.lightbox.is-open,
.dialog.is-open,
.modal[aria-hidden="false"],
.lightbox[aria-hidden="false"] {
    display: flex;
}

.modal-dialog,
.modal-content,
.lightbox-content,
.dialog-panel {
    width: min(1100px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: 20px;
    border: 1px solid rgba(59, 71, 97, 0.95);
    background: linear-gradient(180deg, rgba(31, 36, 50, 0.99), rgba(21, 25, 35, 0.99));
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal-dialog.modal-sm,
.modal-content.modal-sm {
    width: min(560px, 100%);
}

.modal-dialog.modal-lg,
.modal-content.modal-lg {
    width: min(1280px, 100%);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    margin: 0;
    font-size: 1.2rem;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 20px;
    border-top: 1px solid var(--border);
}

.modal-close,
.lightbox-close,
.dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    box-shadow: none;
}

.modal-close:hover,
.lightbox-close:hover,
.dialog-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Lightbox / Single Image View
   ========================================================================== */

.lightbox-stage,
.modal-image-stage {
    display: flex;

    align-items: center;
    justify-content: center;
    background: #0b0e14;
    min-height: 300px;
    border-radius: 16px;
    overflow: hidden;
}

.lightbox-stage img,
.modal-image-stage img {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 220px);
    object-fit: contain;
}

/* ==========================================================================
   Progress / Upload
   ========================================================================== */

.progress,
.progress-bar-wrap,
.upload-progress {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-bar,
.upload-progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    transition: width 0.28s ease;
    box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.18);
}

.progress-meta,
.upload-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 8px;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state,
.no-results,
.blank-state {
    text-align: center;
    padding: 34px 20px;
    border: 1px dashed rgba(124, 156, 255, 0.22);
    border-radius: 18px;
    background: rgba(124, 156, 255, 0.04);
}

.empty-state h2,
.empty-state h3,
.no-results h2,
.no-results h3,
.blank-state h2,
.blank-state h3 {
    margin-bottom: 8px;
}

.empty-state p,
.no-results p,
.blank-state p {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Sticky Utility Bars
   ========================================================================== */

.sticky-actions,
.sticky-toolbar,
.sticky-panel {
    position: sticky;
    top: 84px;
    z-index: 80;
}

/* ==========================================================================
   Media Helpers
   ========================================================================== */

.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-4-3 {
    aspect-ratio: 4 / 3;
}

.aspect-16-9 {
    aspect-ratio: 16 / 9;
}

.object-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.object-contain {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ==========================================================================
   Scrollbars
   ========================================================================== */

* {
    scrollbar-width: thin;
    scrollbar-color: #475572 #11151d;
}

*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: #10141c;
}

*::-webkit-scrollbar-thumb {
    background: #475572;
    border-radius: 999px;
    border: 2px solid #10141c;
}

*::-webkit-scrollbar-thumb:hover {
    background: #5e7092;
}

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

@media (max-width: 1180px) {
    .stats-grid,
    .metric-grid,
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid > .col-9,
    .form-grid > .col-8,
    .form-grid > .col-7,
    .form-grid > .col-6,
    .form-grid > .col-5,
    .form-grid > .col-4,
    .form-grid > .col-3 {
        grid-column: span 12;
    }
}

@media (max-width: 1100px) {
    .dashboard-content {
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    .portal-topbar-inner,
    .portal-header-inner,
    .page-topbar-inner,
    .nav-wrap {
        min-height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    .portal-nav,
    .nav-links {
        width: 100%;
        justify-content: flex-start;
    }

    .gallery-grid,
    .photo-grid,
    .thumb-grid,
    .image-grid,
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .dashboard-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    }

    .dashboard-admin-sticky,
    .sticky-actions,
    .sticky-toolbar,
    .sticky-panel {
        top: 72px;
    }

    .card,
    .panel,
    .portal-card,
    .admin-card,
    .surface,
    .content-panel,
    .hero-card,
    .page-hero,
    .portal-hero {
        padding: 18px;
    }
}

@media (max-width: 640px) {
    .portal-shell,
    .page-shell,
    .container,
    .portal-container,
    .wrap,
    .container-narrow,
    .page-narrow {
        width: min(100%, calc(100% - 20px));
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    .stats-grid,
    .metric-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid,
    .photo-grid,
    .thumb-grid,
    .image-grid,
    .cards-grid,
    .gallery-grid-tight,
    .photo-grid-tight {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .dashboard-gallery-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-admin-sticky,
    .sticky-actions,
    .sticky-toolbar,
    .sticky-panel {
        top: 74px;
    }

    .dashboard-admin-label {
        width: 100%;
        margin-right: 0;
    }

    .dashboard-admin-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-top-links a,
    .dashboard-admin-actions .btn {
        width: 100%;
    }

    .card,
    .panel,
    .portal-card,
    .admin-card,
    .surface,
    .content-panel,
    .hero-card,
    .page-hero,
    .portal-hero,
    .toolbar,
    .action-toolbar,
    .filter-bar,
    .bulk-actions {
        padding: 14px;
        border-radius: 16px;
    }

    .btn,
    button.btn,
    input[type="submit"].btn,
    input[type="button"].btn,
    a.btn {
        width: 100%;
    }

    .form-actions,
    .actions-row,
    .gallery-card-actions,
    .photo-card-actions,
    .thumb-card-actions,
    .image-card-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .modal,
    .lightbox,
    .dialog {
        padding: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 14px;
        padding-right: 14px;
    }
}

@media (max-width: 460px) {
    .gallery-grid,
    .photo-grid,
    .thumb-grid,
    .image-grid,
    .cards-grid,
    .gallery-grid-tight,
    .photo-grid-tight {
        grid-template-columns: 1fr;
    }
}


/* =========================
   CHECKBOX UI (GLOBAL)
   ========================= */

.gallery-manager-check,
.manage-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    z-index: 2;
}

.gallery-manager-check input,
.manage-check input {
    opacity: 0;
    position: absolute;
    inset: 0;
    cursor: pointer;
    margin: 0;
}

.gallery-manager-checkmark,
.manage-checkmark {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.82);
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 6px 14px rgba(0,0,0,.28);
    transition: all 0.2s ease;
}

/* Checked states */
.gallery-manager-check input:checked + .gallery-manager-checkmark {
    background: var(--danger);
    border-color: var(--danger);
}

.manage-check input:checked + .manage-checkmark {
    background: var(--success);
    border-color: var(--success);
}

/* Check icon */
.gallery-manager-check input:checked + .gallery-manager-checkmark::after,
.manage-check input:checked + .manage-checkmark::after {
    content: "\2714";
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
}

/* =========================
   PASSWORD TOGGLE UI (GLOBAL)
   Safe shared styling for all login/admin password fields
   ========================= */

.password-field,
.password-wrap,
.password-input-wrap,
.input-with-icon,
.field-password,
.form-password {
    position: relative;
}

.password-field input[type="password"],
.password-field input[type="text"],
.password-wrap input[type="password"],
.password-wrap input[type="text"],
.password-input-wrap input[type="password"],
.password-input-wrap input[type="text"],
.input-with-icon input[type="password"],
.input-with-icon input[type="text"],
.field-password input[type="password"],
.field-password input[type="text"],
.form-password input[type="password"],
.form-password input[type="text"] {
    padding-right: 56px !important;
}

/* Hide native browser password reveal / credentials icons */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-textfield-decoration-container {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-caps-lock-indicator {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Prevent browser autofill from turning password fields white */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text) !important;
    caret-color: var(--text) !important;
    border: 1px solid var(--border-strong) !important;
    -webkit-box-shadow: 0 0 0 1000px #131823 inset !important;
    box-shadow: 0 0 0 1000px #131823 inset !important;
    background-color: #131823 !important;
    transition: background-color 9999s ease-in-out 0s !important;
}

/* Force dark background for password fields specifically */
input[type="password"],
input[type="text"].is-password-visible {
    background: #131823 !important;
    color: var(--text) !important;
}

.password-toggle,
.password-eye,
.toggle-password,
.show-password,
.password-visibility-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #dbe5ff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        opacity var(--transition);
    z-index: 4;
    appearance: none;
    -webkit-appearance: none;
}

.password-toggle:hover,
.password-eye:hover,
.toggle-password:hover,
.show-password:hover,
.password-visibility-toggle:hover,
.password-toggle:focus-visible,
.password-eye:focus-visible,
.toggle-password:focus-visible,
.show-password:focus-visible,
.password-visibility-toggle:focus-visible {
    transform: translateY(-50%);
    background: rgba(124, 156, 255, 0.12);
    border-color: rgba(124, 156, 255, 0.32);
    color: #ffffff !important;
    box-shadow: none;
}

.password-toggle:active,
.password-eye:active,
.toggle-password:active,
.show-password:active,
.password-visibility-toggle:active {
    transform: translateY(-50%);
}

.password-toggle::before,
.password-eye::before,
.toggle-password::before,
.show-password::before,
.password-visibility-toggle::before {
    content: none !important;
}

.password-toggle::after,
.password-eye::after,
.toggle-password::after,
.show-password::after,
.password-visibility-toggle::after {
    content: none !important;
}

.password-toggle svg,
.password-eye svg,
.toggle-password svg,
.show-password svg,
.password-visibility-toggle svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
    color: currentColor !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2;
}

.password-toggle i,
.password-eye i,
.toggle-password i,
.show-password i,
.password-visibility-toggle i {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: currentColor !important;
    font-style: normal;
    font-size: 18px;
    line-height: 1;
}

.password-toggle img,
.password-eye img,
.toggle-password img,
.show-password img,
.password-visibility-toggle img {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
    opacity: 1;
}

.password-toggle .eye-icon,
.password-eye .eye-icon,
.toggle-password .eye-icon,
.show-password .eye-icon,
.password-visibility-toggle .eye-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 1;
    color: currentColor !important;
}

.password-toggle[aria-pressed="true"],
.password-eye[aria-pressed="true"],
.toggle-password[aria-pressed="true"],
.show-password[aria-pressed="true"],
.password-visibility-toggle[aria-pressed="true"] {
    background: rgba(82, 208, 255, 0.12);
    border-color: rgba(82, 208, 255, 0.3);
    color: #ffffff !important;
}

@media (max-width: 640px) {
    .password-toggle,
    .password-eye,
    .toggle-password,
    .show-password,
    .password-visibility-toggle {
        right: 10px;
        width: 32px;
        height: 32px;
        min-height: 32px;
    }

    .password-field input[type="password"],
    .password-field input[type="text"],
    .password-wrap input[type="password"],
    .password-wrap input[type="text"],
    .password-input-wrap input[type="password"],
    .password-input-wrap input[type="text"],
    .input-with-icon input[type="password"],
    .input-with-icon input[type="text"],
    .field-password input[type="password"],
    .field-password input[type="text"],
    .form-password input[type="password"],
    .form-password input[type="text"] {
        padding-right: 50px !important;
	
    }
}

/* =========================
   UPLOAD FILE STATUS UI
   ========================= */

.upload-file-summary {
    margin-top: 12px;
    margin-bottom: 10px;
    font-size: 13px;
    color: rgba(255,255,255,.78);
}

.upload-file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.upload-file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.08);
}

.upload-file-name {
    min-width: 0;
    font-size: 13px;
    color: #fff;
    line-height: 1.35;
    word-break: break-word;
}

.upload-file-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    border: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
}

.upload-file-badge.new {
    background: rgba(16,185,129,.14);
    border-color: rgba(16,185,129,.34);
    color: #d1fae5;
}

.upload-file-badge.duplicate {
    background: rgba(245,158,11,.14);
    border-color: rgba(245,158,11,.34);
    color: #fde68a;
}

.upload-file-badge.skipped {
    background: rgba(239,93,104,.12);
    border-color: rgba(239,93,104,.3);
    color: #ffd8dd;
}

/* =========================
   HIGH-END PORTAL BUTTON SYSTEM (FINAL)
   ========================= */

.portal-btn,
button.portal-btn,
input[type="submit"].portal-btn,
input[type="button"].portal-btn,
a.portal-btn,
span.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 50px;
    padding: 14px 22px;
    border-radius: 14px;

    /* STRONGER DIAGONAL GRADIENT */
    background: linear-gradient(135deg, #5a5dff 0%, #2ea8f4 100%);

    border: 1px solid rgba(120, 170, 255, 0.28);
    color: #ffffff !important;
    text-decoration: none;

    font-weight: 700;
    font-size: 16px;
    line-height: 1.1;

    /* DEPTH IMPROVEMENT */
    box-shadow:
        0 14px 34px rgba(25, 94, 219, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);

    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        filter 0.22s ease,
        border-color 0.22s ease;

    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    appearance: none;
}

/* HOVER = POP */
.portal-btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.08);

    border-color: rgba(160, 200, 255, 0.45);

    box-shadow:
        0 18px 42px rgba(25, 94, 219, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ACTIVE */
.portal-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow:
        0 8px 20px rgba(25, 94, 219, 0.25);
}

/* =========================
   VARIANTS (MORE DISTINCT)
   ========================= */

.portal-btn-primary {
    background: linear-gradient(135deg, #5a5dff 0%, #2ea8f4 100%);
}

.portal-btn-secondary {
    background: linear-gradient(135deg, #3f46d8 0%, #2ea8f4 100%);
}

.portal-btn-success {
    background: linear-gradient(135deg, #00c27a 0%, #2ea8f4 100%);
}

.portal-btn-danger {
    background: linear-gradient(135deg, #ff4d6d 0%, #ff7b54 100%);
}

/* KEEP TEXT WHITE ALWAYS */
.portal-btn-primary,
.portal-btn-secondary,
.portal-btn-success,
.portal-btn-danger {
    color: #ffffff !important;
}

/* =========================
   SIZE MODIFIERS
   ========================= */

.portal-btn.portal-btn-sm {
    min-height: 40px;
    padding: 10px 14px;
    font-size: 0.94rem;
}

.portal-btn.portal-btn-lg {
    min-height: 56px;
    padding: 16px 26px;
    font-size: 17px;
}

/* =========================
   FULL WIDTH
   ========================= */

.portal-btn-block,
.portal-btn.w-full {
    width: 100%;
}



/* MANAGE GALLERIES LAYOUT FIX */

.manage-galleries-shell {
    width: min(1320px, calc(100% - 32px));
    margin: 22px auto 34px;
}

.manage-galleries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.manage-gallery-card {
    display: flex;
    flex-direction: column;
    padding: 22px;
    border-radius: 22px;
    height: 100%;
}

.manage-gallery-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.manage-gallery-title {
    font-size: 1.25rem;
    margin-bottom: 6px;
    min-height: 2.4em;
    line-height: 1.2;
    overflow: hidden;
}

.manage-gallery-slug {
    font-size: 0.9rem;
    color: var(--text-muted);
    min-height: 2.6em;
}

.manage-gallery-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.manage-gallery-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.manage-gallery-actions-row .portal-btn {
    width: 100%;
}

.manage-gallery-open {
    width: 100%;
}

.manage-gallery-delete {
    opacity: 0.85;
}

.manage-gallery-delete:hover {
    opacity: 1;
}



.upload-stats {
display: flex;
gap: 20px;
margin-top: 10px;
}

.upload-stat {
background: #111;
padding: 10px;
border-radius: 8px;
flex: 1;
text-align: center;
}

.upload-stat span {
display: block;
font-size: 12px;
opacity: 0.7;
}

.upload-stat strong {
font-size: 16px;
}

.upload-log {
margin-top: 15px;
max-height: 200px;
overflow-y: auto;
background: #0d0d0d;
padding: 10px;
border-radius: 8px;
font-size: 12px;
}

.upload-log-row {
padding: 4px 0;
border-bottom: 1px solid rgba(255,255,255,0.05);
}

.file-list {
max-height: 150px;
overflow-y: auto;
margin-bottom: 10px;
}


/* ==========================================================================
   Gallery Page
   ========================================================================== */

.gallery-password-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gallery-password-shell {
    width: 100%;
    max-width: 460px;
}

.gallery-password-card {
    padding: 28px;
}

.gallery-password-title {
    text-align: center;
    margin-bottom: 10px;
}

.gallery-password-subtitle {
    text-align: center;
    margin-bottom: 18px;
}

.gallery-password-actions {
    margin-top: 14px;
}

.gallery-password-links {
    text-align: center;
    margin-top: 16px;
}

.gallery-page,
.gallery-page-shell {
    min-height: 100vh;
}

.gallery-page-wrap {
    width: min(1380px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0 36px;
}

.gallery-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}

.gallery-header-copy {
    min-width: 0;
    flex: 1 1 520px;
}

.gallery-header-title {
    margin: 0;
    line-height: 1.05;
}

.gallery-header-copy p {
    margin: 8px 0 0;
    max-width: 920px;
}

.gallery-top-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.gallery-hero-card {
    margin-bottom: 18px;
    background:
        radial-gradient(circle at top right, rgba(124, 156, 255, 0.16), transparent 26%),
        radial-gradient(circle at bottom left, rgba(82, 208, 255, 0.10), transparent 22%),
        linear-gradient(180deg, rgba(30, 36, 50, 0.98), rgba(21, 26, 38, 0.98));
    border: 1px solid rgba(124, 156, 255, 0.16);
}

.gallery-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(330px, .7fr);
    gap: 16px;
    align-items: stretch;
}

.gallery-hero-summary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    min-width: 0;
}

.gallery-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.gallery-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(124, 156, 255, 0.12);
    border: 1px solid rgba(124, 156, 255, 0.24);
    color: #dbe8ff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .2px;
}

.gallery-count {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .2px;
}

.gallery-toolbar-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    min-width: 0;
}

.gallery-toolbar-card {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    height: 100%;
}

.gallery-toolbar-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.gallery-grid-custom {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.gallery-card-custom {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 0;
    overflow: hidden;
    transition: border-color .22s ease, box-shadow .22s ease, background .22s ease;
}

.gallery-card-custom::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.gallery-card-custom:hover {
    transform: none;
    border-color: rgba(124, 156, 255, 0.22);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.30);
    background: linear-gradient(180deg, rgba(34, 40, 55, 0.99), rgba(26, 31, 44, 0.99));
}

.gallery-card-link {
    display: block;
    color: inherit;
}

.gallery-card-link:hover {
    color: inherit;
}

.gallery-thumb-wrap {
    position: relative;
    background: linear-gradient(180deg, rgba(14, 19, 27, 0.98) 0%, rgba(10, 14, 20, 0.98) 100%);
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.gallery-thumb-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(255,255,255,0.02) 8%, rgba(255,255,255,0.08) 18%, rgba(255,255,255,0.02) 33%);
    background-size: 200% 100%;
    animation: galleryShimmer 1.4s linear infinite;
    opacity: .55;
    transition: opacity .22s ease;
}

.gallery-card-custom.is-loaded .gallery-thumb-wrap::before,
.gallery-thumb-wrap.is-loaded::before {
    opacity: 0;
    animation: none;
}

.gallery-thumb-media {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 10px;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.22));
    background: #000;
    opacity: .75;
    transform: scale(1);
    transition: transform .28s ease, opacity .22s ease, filter .22s ease;
}

.gallery-card-custom.is-loaded .gallery-thumb-media,
.gallery-thumb-media.is-loaded {
    opacity: 1;
}

.gallery-card-custom:hover .gallery-thumb-media {
    transform: scale(1.035);
    filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.28));
}

.gallery-video-pill {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .2px;
}

.gallery-card-actions-fixed {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    gap: 10px;
    padding: 14px;
    margin-top: auto;
    align-items: center;
}

.gallery-card-actions-fixed .portal-btn {
    min-height: 42px;
    font-size: 13px;
    font-weight: 700;
    transform: none;
}

.gallery-card-actions-fixed .portal-btn:hover {
    transform: translateY(-1px);
}

.gallery-btn-view {
    width: 100%;
    min-width: 0;
    border-radius: 12px;
    font-size: 14px;
    background: linear-gradient(135deg, #5a5dff 0%, #2ea8f4 100%);
    border: 1px solid rgba(120, 170, 255, 0.25);
    box-shadow: 0 10px 22px rgba(25, 94, 219, 0.20);
}

.gallery-btn-view:hover {
    filter: brightness(1.05);
    box-shadow: 0 14px 26px rgba(25, 94, 219, 0.28);
}

.gallery-btn-icon {
    width: 44px;
    height: 42px;
    min-width: 44px;
    min-height: 42px;
    padding: 0;
    border-radius: 10px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: none;
}

.gallery-btn-download {
    background: linear-gradient(180deg, #2c5ecf 0%, #234ca7 100%);
    border: 1px solid rgba(120, 170, 255, 0.20);
    color: #eaf2ff !important;
}

.gallery-btn-download:hover {
    background: linear-gradient(180deg, #3369e2 0%, #2757bf 100%);
    border-color: rgba(149, 173, 255, 0.34);
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(25, 94, 219, 0.22);
}

.gallery-btn-share {
    background: linear-gradient(180deg, #253142 0%, #1c2633 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #dbe5ff !important;
}

.gallery-btn-share:hover {
    background: linear-gradient(180deg, #2a3749 0%, #212c3b 100%);
    border-color: rgba(124, 156, 255, 0.22);
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.gallery-action-icon-svg {
    width: 17px;
    height: 17px;
    display: block;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
}

.gallery-btn-icon .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.gallery-btn-icon[title]::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    min-width: max-content;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(9, 13, 20, 0.96);
    border: 1px solid rgba(124, 156, 255, 0.18);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .2px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    z-index: 8;
    box-shadow: 0 12px 24px rgba(0,0,0,.22);
}

.gallery-btn-icon[title]:hover::after,
.gallery-btn-icon[title]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.gallery-empty {
    text-align: center;
    padding: 38px 20px;
    border: 1px dashed rgba(124, 156, 255, 0.22);
    border-radius: 18px;
    background: rgba(124, 156, 255, 0.04);
}

.gallery-empty h2 {
    margin-bottom: 8px;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 12, 0.96);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 12000;
    padding: 20px 70px;
}

.gallery-lightbox.active {
    display: flex;
}

.gallery-lightbox-media {
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 14px;
    opacity: 1;
    transition: opacity 0.35s ease-in-out;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.45);
    background: #000;
}

.gallery-lightbox-media.is-hidden {
    display: none;
}

.gallery-lightbox-media.fade-out {
    opacity: 0.15;
}

.gallery-lightbox-close {
    position: fixed;
    top: 20px;
    right: 34px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    cursor: pointer;
    color: #fff;
    z-index: 12001;
    line-height: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background 0.18s ease, transform 0.18s ease;
}

.gallery-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: scale(1.03);
}

.gallery-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.14);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 30px;
    color: #fff;
    cursor: pointer;
    z-index: 12001;
    transition: background 0.18s ease, transform 0.18s ease;
}

.gallery-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-50%) scale(1.03);
}

.gallery-lightbox-prev {
    left: 20px;
}

.gallery-lightbox-next {
    right: 20px;
}

.gallery-share-menu {
    position: fixed;
    inset: 0;
    background: rgba(2, 5, 9, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 12020;
    padding: 20px;
}

.gallery-share-menu.active {
    display: flex;
}

.gallery-share-box {
    width: 100%;
    max-width: 460px;
    padding: 22px;
}

.gallery-share-box h3 {
    margin: 0 0 16px;
    font-size: 24px;
    line-height: 1.2;
}

.gallery-share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.gallery-share-grid a,
.gallery-share-grid button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    background: linear-gradient(180deg, #263242 0%, #1d2732 100%);
    color: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    text-decoration: none;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition);
}

.gallery-share-grid a:hover,
.gallery-share-grid button:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #2b3a4d 0%, #212b38 100%);
    color: #fff;
}

.gallery-share-close {
    margin-top: 12px;
    width: 100%;
}

.gallery-download-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 12, 0.88);
    z-index: 13000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #fff;
    padding: 20px;
    text-align: center;
}

.gallery-download-overlay.active {
    display: flex;
}

.gallery-download-overlay h2 {
    margin: 0 0 6px;
    font-size: 28px;
}

.gallery-download-overlay p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
    max-width: 380px;
}

.gallery-download-bar-shell {
    width: 300px;
    max-width: 100%;
    background: #243040;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-download-bar {
    width: 0%;
    height: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    transition: width 0.3s;
}

.gallery-download-percent {
    margin-top: 10px;
    font-weight: 700;
    color: #fff;
}

.gallery-download-status {
    margin-top: 10px;
    color: #dbe8ff;
    font-size: 13px;
    font-weight: 700;
}

.gallery-download-close {
    margin-top: 18px;
    display: none;
}

.gallery-download-close.active {
    display: inline-flex;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes galleryShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@media (max-width: 1080px) {
    .gallery-hero-grid {
        grid-template-columns: 1fr;
    }

    .gallery-toolbar-card {
        justify-content: flex-start;
    }
}

@media (max-width: 900px) {
    .gallery-grid-custom {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 700px) {
    .gallery-page-wrap {
        width: min(100%, calc(100% - 20px));
        padding: 16px 0 28px;
    }

    .gallery-top-links {
        width: 100%;
        justify-content: flex-start;
    }

    .gallery-top-links .btn,
    .gallery-top-links .portal-btn {
        width: 100%;
    }

    .gallery-card-actions-fixed {
        grid-template-columns: minmax(0, 1fr) 44px 44px;
        gap: 8px;
    }

    .gallery-btn-icon {
        width: 44px;
        min-width: 44px;
        height: 40px;
        min-height: 40px;
    }

    .gallery-lightbox {
        padding: 20px;
    }

    .gallery-lightbox-close {
        top: 14px;
        right: 18px;
        font-size: 34px;
        width: 44px;
        height: 44px;
    }

    .gallery-lightbox-nav {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 520px) {
    .gallery-grid-custom {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .gallery-thumb-wrap {
        height: 160px;
    }

    .gallery-share-grid {
        grid-template-columns: 1fr;
    }

    .gallery-btn-icon::after {
        display: none;
    }
}

@media (max-width: 460px) {
    .gallery-grid-custom {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   Manage Users Final Product Polish
   ========================================================================== */

.manage-users-page .portal-topbar-inner {
    align-items: flex-start;
}

.manage-users-page .manage-users-top-links {
    justify-content: flex-end;
}

.manage-users-page .dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.manage-users-form-card,
.manage-users-list-card {
    min-height: 100%;
}

.manage-users-form-card .card-header,
.manage-users-list-card .card-header {
    margin-bottom: 16px;
}

.manage-users-page #userSearch {
    max-width: 460px;
}

.manage-users-mode-badge,
.manage-users-count-badge {
    min-height: 40px;
    padding: 10px 16px;
    font-size: 0.92rem;
}

.manage-users-page .table-wrap {
    border-radius: 20px;
    background: rgba(15, 20, 30, 0.72);
}

.manage-users-page .admin-table {
    min-width: 0;
}

.manage-users-page .admin-table thead th {
    padding: 14px 16px;
    font-size: 0.95rem;
}

.manage-users-page .admin-table tbody td {
    padding: 16px;
    vertical-align: middle;
}

.manage-users-table-row {
    transition: background var(--transition), box-shadow var(--transition);
}

.manage-users-table-row.is-editing {
    background: rgba(124, 156, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(124, 156, 255, 0.20);
}

.manage-users-table-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.manage-users-table-row.is-editing:hover {
    background: rgba(124, 156, 255, 0.10);
}

.manage-users-role-pill,
.manage-users-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.manage-users-role-pill-user {
    background: rgba(124, 156, 255, 0.08);
    color: #dbe5ff;
    border-color: rgba(124, 156, 255, 0.20);
}

.manage-users-role-pill-admin {
    background: rgba(82, 208, 255, 0.10);
    color: #e2fbff;
    border-color: rgba(82, 208, 255, 0.22);
}

.manage-users-status-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.manage-users-status-pill-current {
    background: rgba(41, 196, 122, 0.12);
    color: #caffdf;
    border-color: rgba(41, 196, 122, 0.26);
}

.manage-users-status-pill-editing {
    background: rgba(124, 156, 255, 0.10);
    color: #dbe5ff;
    border-color: rgba(124, 156, 255, 0.26);
}

.manage-users-status-pill-ready {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-soft);
    border-color: rgba(255, 255, 255, 0.10);
}

.manage-users-access-summary {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
}

.manage-users-access-detail {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.manage-users-row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.manage-users-delete-form {
    margin: 0;
}

.manage-users-action-btn {
    min-height: 36px !important;
    padding: 8px 12px !important;
    border-radius: 10px !important;
    font-size: 0.88rem !important;
    box-shadow: none !important;
}

.manage-users-action-edit {
    background: rgba(124, 156, 255, 0.10) !important;
    border: 1px solid rgba(124, 156, 255, 0.24) !important;
    color: #dbe5ff !important;
}

.manage-users-action-edit:hover {
    background: rgba(124, 156, 255, 0.16) !important;
    border-color: rgba(124, 156, 255, 0.34) !important;
    color: #ffffff !important;
}

.manage-users-action-edit.is-active {
    background: linear-gradient(135deg, #5a5dff 0%, #2ea8f4 100%) !important;
    border-color: rgba(120, 170, 255, 0.32) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 26px rgba(25, 94, 219, 0.24) !important;
}

.manage-users-action-delete {
    min-width: 78px;
}

.manage-users-form-actions {
    gap: 12px;
}

.manage-users-form-actions .portal-btn {
    min-width: 160px;
}

.manage-users-page #userEditBanner {
    border-color: rgba(124, 156, 255, 0.24);
}

.manage-users-page #galleryAccessGrid .gallery-card {
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.manage-users-page #galleryAccessGrid .gallery-card:hover {
    border-color: rgba(124, 156, 255, 0.28);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.20);
}

.manage-users-page #galleryAccessGrid .gallery-card:has(.gallery-access-option:checked) {
    border-color: rgba(124, 156, 255, 0.42);
    box-shadow: 0 0 0 1px rgba(124, 156, 255, 0.18), 0 14px 28px rgba(0, 0, 0, 0.22);
}

.manage-users-page .password-wrap {
    position: relative;
}

.manage-users-page .password-wrap input {
    padding-right: 52px;
}

.manage-users-page .password-toggle {
    right: 10px;
}

@media (max-width: 1100px) {
    .manage-users-page .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .manage-users-page .manage-users-top-links {
        width: 100%;
        justify-content: flex-start;
    }

    .manage-users-page .manage-users-top-links .portal-btn {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .manage-users-page .admin-table {
        min-width: 720px;
    }

    .manage-users-form-actions .portal-btn {
        min-width: 0;
        width: 100%;
    }

    .manage-users-row-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .manage-users-row-actions .portal-btn,
    .manage-users-row-actions form,
    .manage-users-row-actions button {
        width: 100%;
    }
}


/* ===== FIX ACTION BUTTON LAYOUT ===== */

.admin-table .form-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

/* Force buttons to same size */
.admin-table .form-actions .portal-btn {
    min-width: 70px;
    height: 34px;
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Edit = subtle */
.admin-table .portal-btn-secondary {
    background: rgba(124,156,255,0.12);
    border: 1px solid rgba(124,156,255,0.25);
}

.admin-table .portal-btn-secondary:hover {
    background: rgba(124,156,255,0.2);
}

/* Delete = danger but SAME SIZE */
.admin-table .portal-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
}

.admin-table .portal-btn-danger:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

/* ===== FORCE EDIT + DELETE INLINE ===== */

.admin-table .form-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

/* CRITICAL FIX */
.admin-table .form-actions form {
    display: inline-flex;
    margin: 0;
}

/* Make both buttons identical size */
.admin-table .form-actions .portal-btn {
    min-width: 72px;
    height: 34px;
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* ==========================================================================
   Manage Users, Final Inline Edit and Button Polish
   ========================================================================== */

.manage-users-top-links {
    gap: 10px 12px;
}

.manage-users-mode-badge,
.manage-users-count-badge {
    pointer-events: none;
    min-height: 40px !important;
    padding: 10px 16px !important;
    box-shadow: none !important;
}

.manage-users-form-card .card-header,
.manage-users-list-card .card-header {
    align-items: center;
}

.manage-users-form-card .card-subtitle,
.manage-users-list-card .card-subtitle {
    max-width: 560px;
}

.manage-users-table-row.is-editing {
    background: linear-gradient(180deg, rgba(124, 156, 255, 0.10), rgba(124, 156, 255, 0.05));
}

.manage-users-status-stack {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.manage-users-row-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 8px !important;
}

.manage-users-delete-form {
    display: inline-flex;
    margin: 0;
}

.manage-users-row-actions .portal-btn,
.manage-users-row-actions .manage-users-delete-form,
.manage-users-row-actions .manage-users-delete-form .portal-btn {
    width: auto !important;
}

.manage-users-action-btn {
    min-width: 76px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 7px 14px !important;
    border-radius: 10px !important;
    font-size: 0.86rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    justify-content: center !important;
    box-shadow: none !important;
    transform: none !important;
}

.manage-users-action-btn:hover {
    transform: translateY(-1px) !important;
}

.manage-users-action-edit {
    background: rgba(124, 156, 255, 0.10) !important;
    border: 1px solid rgba(124, 156, 255, 0.24) !important;
    color: #dbe5ff !important;
}

.manage-users-action-edit:hover {
    background: rgba(124, 156, 255, 0.16) !important;
    border-color: rgba(124, 156, 255, 0.34) !important;
    color: #ffffff !important;
}

.manage-users-action-edit.is-active {
    background: linear-gradient(135deg, #5a5dff 0%, #2ea8f4 100%) !important;
    border-color: rgba(120, 170, 255, 0.30) !important;
    color: #ffffff !important;
    box-shadow: 0 10px 22px rgba(25, 94, 219, 0.20) !important;
}

.manage-users-action-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    border: 1px solid rgba(255, 120, 120, 0.18) !important;
    color: #ffffff !important;
}

.manage-users-action-delete:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
}

.manage-users-role-pill,
.manage-users-status-pill {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
}

.manage-users-form-actions {
    gap: 12px;
}

.manage-users-form-actions .portal-btn {
    min-width: 154px;
}

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

.manage-users-page #galleryAccessGrid .gallery-card {
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), transform var(--transition);
}

.manage-users-page #galleryAccessGrid .gallery-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 156, 255, 0.28);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.20);
}

.manage-users-page #galleryAccessGrid .gallery-card:has(.gallery-access-option:checked) {
    border-color: rgba(124, 156, 255, 0.42);
    box-shadow: 0 0 0 1px rgba(124, 156, 255, 0.18), 0 14px 28px rgba(0, 0, 0, 0.22);
}

@media (max-width: 760px) {
    .manage-users-page .admin-table {
        min-width: 720px;
    }

    .manage-users-form-actions .portal-btn {
        min-width: 0;
        width: 100%;
    }
}

/* ==========================================================================
   Dashboard Profile / Edit Profile
   ========================================================================== */

.dashboard-user-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 16px;
    border: 1px solid rgba(124, 156, 255, 0.22);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.dashboard-profile-chip:hover {
    background: rgba(124, 156, 255, 0.10);
    color: #fff;
}

.dashboard-profile-chip-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124, 156, 255, 0.22), rgba(82, 208, 255, 0.22));
    border: 1px solid rgba(124, 156, 255, 0.3);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.dashboard-profile-chip-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dashboard-profile-chip-avatar span {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}

.dashboard-profile-chip-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.dashboard-profile-chip-text strong {
    color: #fff;
    font-size: 0.94rem;
}

.dashboard-profile-chip-text span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.edit-profile-layout {
    align-items: start;
}

.edit-profile-sidebar,
.edit-profile-main-card {
    height: 100%;
}

.edit-profile-avatar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.edit-profile-avatar-preview-wrap {
    width: 132px;
    height: 132px;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(124, 156, 255, 0.18), rgba(82, 208, 255, 0.18));
    border: 1px solid rgba(124, 156, 255, 0.3);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
}

.edit-profile-avatar-preview-wrap.has-image {
    background: #111824;
}

.edit-profile-avatar-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-profile-avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}

.edit-profile-name {
    margin-bottom: 0;
}

.edit-profile-email {
    color: var(--text-muted);
    text-align: center;
}

.edit-profile-info-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.edit-profile-info-item {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(124, 156, 255, 0.12);
}

.edit-profile-info-item strong {
    display: block;
    color: #fff;
    margin-bottom: 4px;
}

.edit-profile-info-item span {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.edit-profile-upload-card,
.edit-profile-password-card {
    background: rgba(255, 255, 255, 0.025);
}

.edit-profile-dropzone {
    margin-top: 16px;
    border: 1px dashed rgba(124, 156, 255, 0.35);
    border-radius: 18px;
    background: rgba(124, 156, 255, 0.04);
    padding: 28px 20px;
    text-align: center;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
    cursor: pointer;
}

.edit-profile-dropzone:hover,
.edit-profile-dropzone.is-dragover {
    border-color: rgba(124, 156, 255, 0.7);
    background: rgba(124, 156, 255, 0.10);
    transform: translateY(-1px);
}

.edit-profile-dropzone.has-file {
    border-style: solid;
}

.edit-profile-dropzone-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(124, 156, 255, 0.18);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.edit-profile-dropzone-copy strong {
    display: block;
    color: #fff;
    margin-bottom: 4px;
}

.edit-profile-dropzone-copy span,
.edit-profile-file-name {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.edit-profile-file-name {
    margin-top: 12px;
}

.edit-profile-actions {
    justify-content: flex-start;
}

@media (max-width: 900px) {
    .dashboard-user-topbar {
        justify-content: flex-start;
    }

    .dashboard-profile-chip {
        width: 100%;
        justify-content: flex-start;
    }
}



.dashboard-user-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dashboard-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.dashboard-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dashboard-avatar-fallback {
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-user-text h1 {
    margin: 0;
}

.dashboard-user-text p {
    margin: 0;
}


.edit-profile-card {
    padding: 24px;
}

.edit-profile-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 30px;
}

.edit-profile-left {
    text-align: center;
}

.edit-avatar-wrap {
    margin-bottom: 15px;
}

.edit-avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.edit-avatar-fallback {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-profile-right label {
    display: block;
    margin-top: 15px;
}

.edit-profile-actions {
    margin-top: 20px;
}

.edit-dropzone {
    border: 2px dashed #555;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    margin-top: 10px;
}

.edit-dropzone.dragover {
    border-color: #2563eb;
}

.edit-password-section {
    margin-top: 30px;
}


.gallery-logo-wrap {
    margin-bottom: 10px;
}

.gallery-logo {
    max-height: 60px;
    max-width: 200px;
    object-fit: contain;
}

.gallery-client-name {
    font-size: 14px;
    font-weight: 600;
    color: #9ca3af;
    margin-bottom: 5px;
}

.gallery-logo-wrap {
    margin-bottom: 10px;
}

.gallery-logo {
    max-height: 60px;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

.gallery-client-name {
    font-size: 14px;
    font-weight: 600;
    color: #9ca3af;
    margin: 0 0 6px 0;
}



.portal-topbar.has-cover {
    background-size: cover;
    background-position: center;
    position: relative;
}

.portal-topbar.has-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

.portal-topbar.has-cover .portal-topbar-inner {
    position: relative;
    z-index: 2;
}


/* FIX uneven gallery cards */
.gallery-card {
    display: flex;
    flex-direction: column;
}

/* normalize image area */
.gallery-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 12px;
}

/* REMOVE empty space under image */
.gallery-card .gallery-thumb-wrap,
.gallery-thumb-wrap {
    height: auto;
}

/* if wrapper exists, force it clean */
.gallery-thumb-wrap img {
    display: block;
}


/* Compact action layout */
.photo-actions-row {
    display: grid;
    grid-template-columns: 220px 1fr auto;
    gap: 16px;
    align-items: end;
}

/* Make secondary action buttons smaller */
.portal-btn-compact {
    padding: 8px 14px;
    font-size: 13px;
    min-height: auto;
}

/* Reduce input height slightly */
.form-group input,
.form-group select {
    height: 40px;
}

/* Keep rotate buttons tight */
.rotate-group {
    display: flex;
    gap: 10px;
}

/* Prevent wrapping under top buttons */
.card .form-grid {
    align-items: end;
}

.current-gallery-summary {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(120, 160, 255, 0.18);
    background: rgba(255, 255, 255, 0.03);
    min-height: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}