
:root {
    --sidebar-width: 260px;
    --header-height: 60px;
    --sidebar-bg: #ffffff;
    --sidebar-text: #292929;
    --sidebar-active: var(--org-accent, #0d6efd);
    --sidebar-hover-bg: rgba(255,255,255,0.05);
    --brand-color: var(--org-accent, #0d6efd);
    --transition: 0.2s ease;
    --content-bg: #f8f9fa;
    --card-bg: #ffffff;
    --card-border: #e9ecef;
    --header-bg: var(--org-primary, #0d6efd);
    --content-text: #292929;
}

/* Organisation branding: --org-primary / --org-accent (and their -contrast text colours) are set on <html>
   by scripts/org-branding.js from the organisation's PrimaryColor / AccentColor. Every use falls back to
   the default blue, so an organisation without colours looks as before. Theme overrides for Bootstrap and
   Syncfusion are in org-theme.css (generated). */

/* Dark-mode values for the variables above live in app_dark.css (loaded and
   toggled together with the data-bs-theme="dark" attribute — see
   wwwroot/scripts/theme-basic.js). */

/* Smooth theme transitions */
*, *::before, *::after {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.1s ease;
}

/* Prevent transition on layout-critical elements */
.sidebar, .sidebar * {
    transition: none !important;
}

html, body {
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---- Page background ---- */
body {
    background-color: var(--content-bg) !important;
}

/* Icon refinements */
h5 > i {
    margin-right: 10px;
}
button > i {
    margin-right: 10px;
}
span > i {
    margin-right: 10px;
}
button.header-icon-btn > i {
    margin-right: 0px;
}
button.e-control {
    margin-right: 10px;
}

/* Loading animation for the logo */
.komuniti-logo-mark {
    display: inline-flex;
    width: 100px;
    height: 100px;
    flex: none;
    transform-origin: center;
    animation: komuniti-logo-spin-down 3.6s cubic-bezier(0.12, 0.76, 0.18, 1) both;
}

.komuniti-logo-mark-image {
    display: block;
    width: 100%;
    height: 100%;
}

@keyframes komuniti-logo-spin-down {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

@media (prefers-reduced-motion: reduce) {
    .komuniti-logo-mark {
        animation: none;
        transform: none;
    }
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    text-decoration: none;
    min-height: var(--header-height);
    background-color: var(--header-bg);
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    /*background: var(--brand-color);*/
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.sidebar-brand .brand-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
}

.sidebar-brand .brand-tagline {
    font-size: 0.65rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-section {
    padding: 1rem 0 0.25rem;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 1.2rem 0.5rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 1.2rem;
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 0;
    text-decoration: none;
    position: relative;
}

.sidebar-nav .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-active);
}

.sidebar-nav .nav-link.active {
    background: color-mix(in srgb, var(--org-accent, #0d6efd) 15%, transparent);
    color: var(--org-accent, #4d94ff);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--sidebar-active);
    border-radius: 0 2px 2px 0;
}

/* ---- Main Content ---- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--content-bg);
}

/* ---- Top Header ---- */
.top-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    /*border-bottom: 1px solid var(--card-border);*/
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 0.75rem;
}

.top-header .page-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Sidebar toggle (mobile) ----
   Hidden by default (desktop always shows the sidebar); the "max-width: 768px"
   media query below switches it to display:flex, alongside the .sidebar /
   .main-wrapper rules that actually do the slide. */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--light);
    font-size: 1.15rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sidebar-toggle-btn:hover {
    background: rgba(255,255,255,0.12);
}

/* Dims the page behind the sidebar while it's open on mobile and closes it
   on click -- same overlay convention as .flyout-backdrop/.invisible-backdrop
   above. Only actually rendered as a full-screen overlay under the mobile
   media query below; hidden otherwise so it can never interfere on desktop
   even if the sidebar happens to be left "open" from a narrower viewport. */
.sidebar-backdrop {
    display: none;
}

/* ---- Page Content ---- */
.page-content {
    flex: 1;
    padding: 1.5rem;
    color: var(--content-text);
    background-color: var(--content-bg);
}

.page-content h3 {
    color: var(--org-accent, #4d94ff);
}

/* ---- Stat Cards ---- */
.stat-card {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    background: var(--card-bg);
    transition: box-shadow 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* ---- Data Tables ---- */
.data-table-card {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
}

.data-table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--card-bg);
}

.table-responsive .table {
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
    border-bottom-width: 1px;
    padding: 0.75rem 1rem;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: var(--bs-tertiary-bg);
}

/* ---- Code/Monospace tags ---- */
code {
    background: var(--bs-tertiary-bg);
    color: var(--bs-primary);
    padding: 0.15em 0.45em;
    border-radius: 4px;
    font-size: 0.8em;
}

/* Dark-mode code color override lives in app_dark.css. */

/* ---- Tenant & Role Switcher ---- */
.role-badge {
    font-size: 0.7rem;
    padding: 0.25em 0.6em;
    font-weight: 600;
}

/* ---- Avatar ---- */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---- Bronze loyalty tier (not a BS class) ---- */
.bg-bronze {
    background-color: #cd7f32 !important;
}

/* ---- Badge improvements ---- */
.badge {
    font-size: 0.7rem;
    padding: 0.3em 0.65em;
    border-radius: 20px;
    font-weight: 600;
}

/* ---- Blazor Error UI ---- */
#blazor-error-ui {
    background: #ff4444;
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.3);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle-btn {
        display: flex;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        /* Below .sidebar's 1040 (so the open sidebar stays on top of it) but
           above .top-header's 1030 (so it dims the header too while open --
           same "dim everything but the panel itself" behavior as
           .flyout-backdrop). */
        z-index: 1035;
    }
}

/* ---- Misc ---- */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   Header — right-side user controls
   ============================================================ */

/* Thin vertical rule separating theme toggle from avatar */
.header-vr {
    width: 1px;
    height: 22px;
    background: var(--card-border);
    flex-shrink: 0;
}

/* Icon-only button variant for theme toggle */
.header-icon-btn.e-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* User avatar button */
.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.user-avatar-btn:hover {
    background: var(--bs-tertiary-bg);
}

.user-avatar-btn:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    text-align: left;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.user-sub {
    font-size: 0.7rem;
    color: white;
    white-space: nowrap;
}

.user-chevron {
    font-size: 0.65rem;
    color: var(--bs-secondary-color);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.user-chevron.rotated {
    transform: rotate(180deg);
}

/* ============================================================
   User dropdown menu
   ============================================================ */

/* Transparent full-screen layer to capture outside clicks */
.invisible-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1049;
    background: transparent;
}

.user-dropdown-menu {
    position: fixed;
    top: calc(var(--header-height) + 6px);
    right: 1.5rem;
    width: 230px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 1050;
    overflow: hidden;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.user-menu-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-menu-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bs-body-color);
    line-height: 1.2;
}

.user-menu-email {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.user-menu-divider {
    height: 1px;
    background: var(--card-border);
    margin: 0.25rem 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: background 0.12s ease;
}

.user-menu-item:hover {
    background: var(--bs-tertiary-bg);
}

.user-menu-item .menu-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
}

.user-menu-item.danger {
    color: #dc3545;
}

.user-menu-item.danger:hover {
    background: rgba(220,53,69,0.08);
}

.user-menu-item.danger .menu-icon {
    color: #dc3545;
}

/* ============================================================
   Flyout panels — slide in from right
   ============================================================ */

.flyout-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
    z-index: 1055;
}

.flyout-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 95vw;
    background: var(--card-bg);
    border-left: 1px solid var(--card-border);
    box-shadow: -8px 0 40px rgba(0,0,0,0.2);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.flyout-panel.open {
    transform: translateX(0);
}

/* Flyout header */
.flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
    background: var(--card-bg);
}

.flyout-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bs-body-color);
    display: flex;
    align-items: center;
}

.flyout-close {
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.flyout-close:hover {
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

/* Flyout body */
.flyout-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Flyout footer */
.flyout-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--card-border);
    flex-shrink: 0;
    background: var(--card-bg);
}

/* Horizontal rule inside flyout body */
.flyout-divider {
    border-color: var(--card-border);
    margin: 1.1rem 0;
}

/* Named sections inside flyout body */
.flyout-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.flyout-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.flyout-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bs-secondary-color);
    margin-bottom: 0.85rem;
}

/* Row in Profile Settings with label + switch */
.flyout-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--card-border);
}

.flyout-setting-row:last-of-type {
    border-bottom: none;
}

/* Avatar section in Edit Profile */
.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
}

.profile-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Dark-mode overrides for the header/dropdown/flyout text above live in
   app_dark.css. */

/* ============================================================
   Label Designer — full-bleed 3-panel layout
   ============================================================ */

/* Escape the page-content padding and fill the viewport below the header */
.ld-container {
    display: flex;
    margin: -1.5rem;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
    background: var(--content-bg);
}

/* ── Left panel: Symbol Palette ────────────────────────────── */
.ld-palette-panel {
    width: 218px;
    min-width: 218px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-right: 1px solid var(--card-border);
    overflow: hidden;
}

.ld-palette-body {
    flex: 1;
    overflow: hidden;
}

/* ── Middle panel: Canvas ───────────────────────────────────── */
.ld-canvas-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.ld-toolbar {
    height: 46px;
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
}

.ld-tool-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--bs-body-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.ld-tool-btn:hover {
    background: color-mix(in srgb, var(--org-accent, #0d6efd) 10%, transparent);
    color: var(--org-accent, #4d94ff);
}

.ld-tool-btn.ld-tool-danger:hover {
    background: rgba(220,53,69,0.1);
    color: #dc3545;
}

.ld-sep {
    width: 1px;
    height: 20px;
    background: var(--card-border);
    margin: 0 4px;
    flex-shrink: 0;
}

.ld-zoom-chip {
    font-size: 0.72rem;
    font-weight: 600;
    min-width: 42px;
    text-align: center;
    color: var(--bs-body-color);
    letter-spacing: 0.02em;
}

.ld-canvas-badge {
    font-size: 0.68rem;
    color: var(--bs-secondary-color);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.ld-diagram-area {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ── Right panel: Properties ────────────────────────────────── */
.ld-props-panel {
    width: 272px;
    min-width: 272px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-left: 1px solid var(--card-border);
    overflow: hidden;
}

.ld-props-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Shared panel header ─────────────────────────────────────── */
.ld-panel-header {
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

/* ── Property groups ─────────────────────────────────────────── */
.ld-prop-group {
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
}

.ld-prop-group:last-child {
    border-bottom: none;
}

.ld-prop-group-title {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bs-secondary-color);
    margin-bottom: 10px;
}

.ld-prop-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.ld-prop-field:last-child {
    margin-bottom: 0;
}

.ld-prop-field label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin: 0;
}

/* Two-column grid for paired fields */
.ld-prop-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

/* Color picker row */
.ld-color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
}

.ld-color-swatch {
    width: 32px;
    height: 28px;
    border-radius: 5px;
    border: 1px solid var(--card-border);
    padding: 2px;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}

.ld-color-hex {
    font-size: 0.72rem;
    font-family: monospace;
    color: var(--bs-secondary-color);
}

/* Multiline text input */
.ld-text-area .e-control {
    min-height: 64px !important;
    resize: vertical !important;
}

/* Bold / Italic toggle buttons */
.ld-fmt-btn {
    width: 30px;
    height: 28px;
    border: 1px solid var(--card-border);
    border-radius: 5px;
    background: transparent;
    color: var(--bs-body-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ld-fmt-btn:hover {
    background: color-mix(in srgb, var(--org-accent, #0d6efd) 8%, transparent);
    border-color: var(--org-accent, #4d94ff);
    color: var(--org-accent, #4d94ff);
}

.ld-fmt-btn.ld-fmt-active {
    background: color-mix(in srgb, var(--org-accent, #0d6efd) 15%, transparent);
    border-color: var(--org-accent, #4d94ff);
    color: var(--org-accent, #4d94ff);
}

/* Empty / no-selection state */
.ld-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 16px;
    gap: 10px;
}

.ld-empty-icon {
    font-size: 2.2rem;
    color: var(--bs-secondary-color);
    opacity: 0.4;
}

.ld-empty-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--bs-body-color);
}

.ld-empty-sub {
    font-size: 0.73rem;
    color: var(--bs-secondary-color);
    line-height: 1.55;
}

/* ── Syncfusion Diagram — canvas neutral background ─────────── */
.ld-diagram-area .e-diagram-container,
.ld-diagram-area .e-diagram {
    background: var(--content-bg) !important;
}

/* ── Syncfusion Symbol Palette — palette styles ─────────────── */
.ld-palette-body .e-symbol-palette {
    background: transparent !important;
}

.ld-palette-body .e-palette-header {
    background: transparent !important;
    color: var(--bs-secondary-color) !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    border-bottom: 1px solid var(--card-border) !important;
}

.ld-palette-body .e-symbol-tile {
    border: 1px solid var(--card-border) !important;
    border-radius: 6px !important;
    background: var(--content-bg) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.ld-palette-body .e-symbol-tile:hover {
    border-color: var(--org-accent, #4d94ff) !important;
    box-shadow: 0 0 0 2px rgba(77,148,255,0.18) !important;
}

/* Palette description label (shape name below thumbnail) */
.ld-palette-body .e-symbol-info {
    font-size: 0.68rem !important;
    color: var(--bs-secondary-color) !important;
    font-weight: 500 !important;
}

/* Dark-mode overrides for the Label Designer panel text above live in
   app_dark.css. */

/* ── Label Designer: Image upload panel ──────────────────────────────────── */
.ld-img-preview {
    width: 100%;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    background: repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 0 0 / 12px 12px;
}

.ld-img-preview img {
    display: block;
    width: 100%;
    max-height: 120px;
    object-fit: contain;
}

/* Barcode panel hint text */
.ld-barcode-hint {
    margin-top: 6px;
    padding: 6px 8px;
    font-size: 0.73rem;
    color: #64748b;
    background: rgba(99,102,241,0.05);
    border-left: 3px solid #818cf8;
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
}

/* Native file picker button */
.ld-file-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--card-border);
    border-radius: 5px;
    background: var(--card-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.ld-file-label:hover {
    background: color-mix(in srgb, var(--org-accent, #0d6efd) 7%, transparent);
    border-color: var(--org-accent, #4d94ff);
    color: var(--org-accent, #4d94ff);
}

.ld-file-label.ld-file-uploading {
    opacity: 0.7;
    cursor: default;
}

.ld-file-hidden {
    display: none !important;
}

.ld-upload-error {
    margin-top: 4px;
    font-size: 0.74rem;
    color: #ef4444;
    word-break: break-word;
}

@keyframes ld-spin {
    to {
        transform: rotate(360deg);
    }
}

.ld-spin {
    display: inline-block;
    animation: ld-spin 0.9s linear infinite;
}

/* Dark-mode overrides for ld-barcode-hint / ld-file-label / ld-img-preview
   above live in app_dark.css. */

/* Additional css below for natPOS */

@media(min-width: 1024px) {

    .search-label {
        width: 25%;
    }

    .e-outline.e-input-group:not(.e-success):not(.e-warning):not(.e-error), .e-outline.e-input-group.e-control-wrapper:not(.e-success):not(.e-warning):not(.e-error) {
        width: 50%;
    }

    .e-ddl.e-input-group.e-outline {
        width: 20% !important;
    }

    .e-ddl.e-input-group.e-outline.e-second-ddl {
        width: 28.7% !important;
    }

    .search-criteria-panel {
        margin: 0 0 10px 0;
    }

    .modal-dialog {
        max-width: 1000px;
    }

    .e-ddl.e-input-group.e-outline.e-ddl-popup {
        width: 100% !important;
    }
}

@media(min-width: 1400px) {

    .modal-dialog {
        max-width: 1500px;
    }
}

/* ---------------------------------------------------------------------------------------------
   Dashboard panel size picker (Shared/PersonalizedDashboard + DashboardPanel + DashboardPanelSizeTool)
   --------------------------------------------------------------------------------------------- */
.kd-panel {
    position: relative;
    height: 100%;
}

/* No transform here: it would turn the position:fixed backdrop into a panel-sized box. */
.kd-size-tool {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.kd-size-tool > * {
    pointer-events: auto;
}

/* A small grip tab hanging from the panel's top edge - sits in the card padding, clear of headers. */
.kd-size-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 1rem;
    padding: 0;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-secondary-color, #6c757d);
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.kd-size-trigger i {
    font-size: 0.9rem;
}

.e-panel:hover .kd-size-trigger,
.kd-size-trigger:focus-visible,
.kd-size-tool.is-open .kd-size-trigger {
    opacity: 1;
}

.kd-size-trigger:hover,
.kd-size-tool.is-open .kd-size-trigger {
    color: var(--bs-primary, #4f46e5);
}

@media (hover: none) {
    .kd-size-trigger { opacity: 0.85; }
}

/* Panels stack in a single column on small screens, so sizing doesn't apply there. */
@media (max-width: 600px) {
    .kd-size-tool { display: none; }
}

.kd-size-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: transparent;
}

.kd-size-picker {
    position: absolute;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 0.6rem 0.7rem 0.5rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.6rem;
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.kd-size-picker-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
    font-size: 0.8rem;
}

.kd-size-picker-label small {
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.7rem;
}

.kd-size-grid {
    display: grid;
    gap: 0.2rem;
}

.kd-size-cell {
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: 0.25rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    cursor: pointer;
}

.kd-size-cell.is-current {
    border-color: var(--bs-primary, #4f46e5);
    background: color-mix(in srgb, var(--bs-primary, #4f46e5) 15%, transparent);
}

.kd-size-cell.is-preview {
    border-color: var(--bs-primary, #4f46e5);
    background: var(--bs-primary, #4f46e5);
}

.kd-size-cell:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.kd-size-cell:focus-visible {
    outline: 2px solid var(--bs-primary, #4f46e5);
    outline-offset: 1px;
}

.kd-size-reset {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.2rem 0;
    border: none;
    background: none;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.75rem;
    text-align: center;
    cursor: pointer;
}

.kd-size-reset:hover {
    color: var(--bs-primary, #4f46e5);
}

/* While a picker is open, lift its panel above its neighbours and let the picker overflow it
   (a 1x1 panel can be shorter than the picker). */
.e-dashboardlayout .e-panel:has(.kd-size-tool.is-open) {
    z-index: 1000 !important;
    overflow: visible !important;
}

.e-dashboardlayout .e-panel:has(.kd-size-tool.is-open) .e-panel-container,
.e-dashboardlayout .e-panel:has(.kd-size-tool.is-open) .e-panel-content {
    overflow: visible !important;
}

/* ---- Organisation header colours ----
   Text and icons on the header (--org-primary) switch to dark text when the organisation's primary colour
   is light; the fallbacks are the original colours. */
.sidebar-brand .brand-icon,
.sidebar-brand .brand-name,
.sidebar-brand .brand-tagline,
.top-header .user-name,
.top-header .user-sub {
    color: var(--org-primary-contrast, white);
}

.top-header .page-title,
.top-header .sidebar-toggle-btn {
    color: var(--org-primary-contrast, var(--light));
}

.top-header .user-chevron {
    color: var(--org-primary-contrast, var(--bs-secondary-color));
}

/* Text on accent-coloured buttons stays readable when the organisation's accent is light. */
.e-btn.e-primary,
.e-css.e-btn.e-primary,
.btn-primary {
    color: var(--org-accent-contrast, #fff);
}
