/* Color Palette */
:root {
    --bg-primary: #05060A;      /* Deep Night */
    --bg-secondary: #0F121C;    /* Eclipse */
    --surface: #141A26;         /* Dark Panel */
    --text-primary: #E9EDF5;    /* Ice White */
    --text-muted: #96A0B8;      /* Frosted Steel */
    --link-color: #5CA9FF;      /* Neon Azure */
    --link-strong: #8BCAFF;     /* Bright Azure */
    --header-bg: #0E1220;       /* Shadow Navy */
    --border-color: #202838;    /* Midnight Line */
    --hover-color: #84B7FF;     /* Soft Glow */
    --shadow-color: rgba(0, 0, 0, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ensure [hidden] always wins regardless of display value on the element */
[hidden] { display: none !important; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--link-strong);
}

/* Header Styles */
header {
    background-color: var(--header-bg);
    border-bottom: 2px solid var(--border-color);
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px var(--shadow-color);
    display: flex;
    align-items: center;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: none;
    margin: 0;
    padding: 0 20px;
    width: 100%;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    opacity: 0;
    animation: logoFadeBlink 1.4s ease forwards;
    animation-delay: 0.25s;
}

.logo-img {
    width: 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: color 1.2s ease, filter 1.2s ease;
}

.logo-svg {
    width: 23px;
    height: auto;
}

.logo-svg path {
    fill: currentColor;
    transition: fill 1.2s ease;
}

.logo-img.glow-active {
    color: var(--link-color);
    filter: drop-shadow(0 0 18px rgba(92, 169, 255, 0.65));
}

.site-title {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 700;
}

/* Main Content */
.work-area {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    overflow: hidden;
}

.center-column {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--gutter-left-width, 200px);
    right: var(--gutter-right-width, 200px);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    z-index: 21;
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    background-color: transparent;
    border-bottom: none;
    position: relative;
    z-index: 2;
}

.header-toolbar {
    margin-left: auto;
}

.center-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: 100%;
    padding: 4px 0;
    background: #0f1625;
    border-bottom: 1px solid #25324A;
    position: relative;
    z-index: 25;
}

.camera-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 6px;
    padding: 4px;
    border: 1px solid #2D405D;
    background: rgba(10, 16, 32, 0.85);
}

.camera-controls .grid-mode-btn {
    font-size: 14px;
    line-height: 1;
    font-weight: 600;
}

.grid-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.grid-toggle:hover {
    color: var(--link-strong);
}

.grid-toggle-floating {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 30;
    background: rgba(10, 16, 32, 0.8);
    border: 1px solid #2D405D;
    border-radius: 6px;
    padding: 5px;
}

.grid-mode-toggle {
    position: relative;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(10, 16, 32, 0.85);
    border: 1px solid #2D405D;
    border-radius: 0;
    padding: 4px;
    margin-left: 0;
}

.snap-toggle-btn {
    margin-right: 0;
}

.grid-mode-btn {
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #9CB5D8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.grid-mode-btn:hover {
    color: #D0E3FF;
    background: rgba(49, 77, 114, 0.34);
}

.grid-mode-btn.active {
    color: #EAF2FF;
    background: rgba(61, 117, 194, 0.45);
    border-color: #5CA9FF;
}

.gutter {
    background-color: var(--bg-secondary);
    position: absolute;
    padding: 1rem;
    overflow: hidden;
    text-align: right;
    user-select: none;
    top: 0;
    bottom: 0;
    z-index: 20;
}

.resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12px;
    background: repeating-linear-gradient(
        90deg,
        var(--border-color) 0px,
        var(--border-color) 2px,
        transparent 2px,
        transparent 4px
    );
    cursor: ew-resize;
    z-index: 1;
}

.gutter-left {
    left: 0;
    width: var(--gutter-left-width, 200px);
}

.gutter-left .resizer {
    right: 0;
}

.gutter-right {
    right: 0;
    width: var(--gutter-right-width, 200px);
}

.gutter-right .resizer {
    left: 0;
}

.gutter p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gutter-left p {
    position: absolute;
    right: 1rem;
    top: 1rem;
    bottom: 1rem;
    width: calc(100% - 1rem);
    text-align: right;
}

.gutter-right p {
    position: absolute;
    left: 1rem;
    top: 1rem;
    bottom: 1rem;
    width: calc(100% - 1rem);
    text-align: left;
}

.gutter-panel-stack {
    position: absolute;
    top: 8px;
    bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
    overflow: hidden;
}

.gutter-left .gutter-panel-stack {
    left: 8px;
    right: 16px;
}

.gutter-right .gutter-panel-stack {
    left: 16px;
    right: 8px;
}

.gutter-panel {
    min-height: 72px;
    background: #131a28;
    border: 1px solid #25324A;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gutter-panel-toolbar {
    min-height: 28px;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #0f1625;
    border-bottom: 1px solid #25324A;
}

.gutter-panel-select {
    flex: 1 1 auto;
    min-width: 0;
    height: 24px;
    background: #141d2d;
    color: #BFD6F4;
    border: 1px solid #2D405D;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 0 6px;
}

.gutter-panel-btn {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    background: #18263A;
    color: #D6E8FF;
    border: 1px solid #2D405D;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
}

.gutter-panel-btn:hover {
    background: #22344F;
}

.gutter-panel-btn.danger:hover {
    background: #452131;
}

.gutter-panel-btn.danger.confirming {
    color: #ff8888;
    border-color: rgba(255, 100, 100, 0.5);
    background: #3a1a1a;
}

@keyframes saveBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.15; }
}

.gutter-panel-btn.save-dirty {
    animation: saveBlink 0.85s ease-in-out infinite;
}

.gutter-panel-btn.save-locked {
    opacity: 0.3;
    cursor: not-allowed !important;
    pointer-events: none;
}

.up-not-saved {
    display: none;
    text-align: center;
    font-size: 9px;
    color: #e06c75;
    padding: 2px 0 3px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    flex: 0 0 auto;
    user-select: none;
}

.up-not-saved.visible {
    display: block;
}

.gutter-panel-body {
    position: relative;
    flex: 1;
    overflow: hidden;
    padding: 6px;
}

.cloud-word-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-content: space-between;
    gap: 4px 8px;
}

.cloud-word {
    display: inline-block;
    line-height: 1.08;
    letter-spacing: 0.2px;
    user-select: none;
    cursor: grab;
    white-space: nowrap;
    text-shadow: 0 0 9px rgba(92, 169, 255, 0.15);
    transition: transform 0.12s ease, color 0.12s ease;
}

.cloud-word:hover {
    transform: translateY(-1px);
    color: #D6E8FF !important;
}

.cloud-word:active {
    cursor: grabbing;
}

.gutter-panel-splitter {
    height: 6px;
    border-radius: 4px;
    background: repeating-linear-gradient(
        90deg,
        #2A3A58 0px,
        #2A3A58 2px,
        transparent 2px,
        transparent 4px
    );
    cursor: ns-resize;
    opacity: 0.75;
}

.gutter-panel-splitter:hover {
    opacity: 1;
}

/* ── User Prompts panel ──────────────────────────────────────────────── */
.user-prompts-panel {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    transition: background 0.15s ease;
}

.user-prompts-panel.drag-over {
    background: rgba(92, 169, 255, 0.08);
    outline: 2px dashed rgba(92, 169, 255, 0.45);
    outline-offset: -3px;
}

.up-header.gutter-panel-toolbar {
    gap: 2px;
    padding: 2px 3px;
}

.up-header .gutter-panel-btn {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    font-size: 10px;
}

.up-header .up-label {
    cursor: pointer;
    min-width: 18px;
}

.up-header {
    flex: 0 0 auto;
}

.up-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: default;
    outline: none;
    border-radius: 3px;
    padding: 1px 3px;
}

.up-label.editing {
    cursor: text;
    background: rgba(92, 169, 255, 0.1);
    outline: 1px solid rgba(92, 169, 255, 0.4);
    overflow: visible;
    white-space: nowrap;
    color: #e0edff;
}

.up-header-right {
    margin-left: auto;
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.up-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.gutter-panel-btn.confirming {
    color: #ff8888;
    border-color: rgba(255, 100, 100, 0.5);
}

.up-grid {
    flex: 1 1 auto;
    position: relative;
    overflow: hidden;
    padding-right: 8px;
}

.up-thumb {
    position: absolute;
    width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: grab;
}

.up-thumb:active {
    cursor: grabbing;
}

.up-thumb:hover .up-thumb-remove {
    opacity: 1;
}

.up-thumb-face {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(92, 169, 255, 0.2);
    background: #141d2d;
    flex-shrink: 0;
}

.up-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.up-thumb-initial {
    font-size: 28px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    line-height: 1;
}

.up-thumb-name {
    font-size: 10px;
    color: #9CB5D8;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.up-thumb-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #3a1a1a;
    color: #ff8888;
    border: 1px solid #5a2a2a;
    border-radius: 50%;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.12s ease;
    padding: 0;
}

.gutter-panel-btn.vis-private {
    color: #ffa070;
    border-color: rgba(255, 140, 80, 0.35);
}

.gutter-panel-btn.vis-private:hover {
    background: #2e1e10;
    color: #ffb990;
}

/* ── Panel browser overlay ───────────────────────────────────────────── */
.up-panel-browser {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: #0d1520;
}

.up-browser-header.gutter-panel-toolbar {
    gap: 2px;
    padding: 2px 3px;
    border-bottom: 1px solid #25324A;
    flex-shrink: 0;
}

.up-browser-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.up-browser-loading,
.up-browser-empty {
    padding: 18px 10px;
    color: #4a6480;
    font-size: 11px;
    text-align: center;
}

.up-browser-section-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #3a5470;
    padding: 8px 8px 3px;
    border-bottom: 1px solid #0f1a28;
}

.up-browser-card {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-bottom: 1px solid #0f1a28;
    cursor: default;
}

.up-browser-card:hover {
    background: rgba(92, 169, 255, 0.05);
}

.up-browser-card-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.up-browser-card-name {
    font-size: 11px;
    color: #C8DCF4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.up-browser-card-meta {
    font-size: 9px;
    color: #3a5070;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.up-thumb-remove:hover {
    background: #5a2020;
    color: #ffaaaa;
}

.wrangler {
    --line-grid-spacing: 36px;
    --camera-x: 0px;
    --camera-y: 0px;
    --camera-zoom: 1;
    background-image: url("data:image/svg+xml,%3csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3e%3cline x1='0' y1='0' x2='60' y2='0' stroke='%23202838' stroke-width='1'/%3e%3cline x1='0' y1='0' x2='0' y2='60' stroke='%23202838' stroke-width='1'/%3e%3cline x1='60' y1='0' x2='60' y2='60' stroke='%23202838' stroke-width='1'/%3e%3cline x1='0' y1='60' x2='60' y2='60' stroke='%23202838' stroke-width='1'/%3e%3c/svg%3e");
    background-repeat: repeat;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    transition: background-image 0.3s ease;
    overflow: hidden;
}

.wrangler.interact-pan {
    cursor: grab;
}

.wrangler.interact-pan:active {
    cursor: grabbing;
}

.wrangler > :not(#connection-canvas) {
    transform-origin: top left;
    transform: translate(var(--camera-x), var(--camera-y)) scale(var(--camera-zoom));
}

.wrangler.grid-mode-off {
    background-image: none;
}

.wrangler.grid-mode-grid {
    background-image: url("data:image/svg+xml,%3csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3e%3cline x1='0' y1='0' x2='60' y2='0' stroke='%23202838' stroke-width='1'/%3e%3cline x1='0' y1='0' x2='0' y2='60' stroke='%23202838' stroke-width='1'/%3e%3cline x1='60' y1='0' x2='60' y2='60' stroke='%23202838' stroke-width='1'/%3e%3cline x1='0' y1='60' x2='60' y2='60' stroke='%23202838' stroke-width='1'/%3e%3c/svg%3e");
}

.wrangler.grid-mode-lines {
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(32, 40, 56, 0.15) 0,
        rgba(32, 40, 56, 0.15) calc(var(--line-grid-spacing) - 1px),
        rgba(110, 128, 160, 0.45) calc(var(--line-grid-spacing) - 1px),
        rgba(110, 128, 160, 0.45) var(--line-grid-spacing)
    );
    background-size: 100% var(--line-grid-spacing);
    background-repeat: repeat;
}

.connection-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 8;
    background: transparent;
    pointer-events: none;
}

.node {
    position: absolute;
    min-width: 100px;
    max-width: 380px;
    min-height: 60px;
    background: #182133;
    border: 1px solid #2D405D;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    z-index: 12;
    padding: 26px 8px 0px;
}

.node textarea {
    width: 100%;
    height: 26px;
    resize: none;
    overflow: hidden;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font: 500 15px/1.3 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 26px;
    outline: none;
    padding: 0;
}

.word {
    position: absolute;
    z-index: 11;
    line-height: 1;
    cursor: grab;
    user-select: none;
    white-space: nowrap;
    text-shadow: 0 0 9px rgba(92, 169, 255, 0.16);
}

.word.editing {
    cursor: text;
}

.word-editor {
    display: block;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    color: #BFD6F4;
    font: 600 22px/1.1 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.2px;
    padding: 0;
}

.word:not(.editing) .word-editor {
    pointer-events: none;
}

.word.editing .word-editor {
    pointer-events: auto;
}

/* Group-local override: keep all words inside a group visually consistent. */
.group .word-editor {
    font-size: 18px !important;
    line-height: 1.1;
}

.word:active {
    cursor: grabbing;
}

/* Sentence word — contains spaces */
.word.sentence::before {
    content: '';
    position: absolute;
    inset: -3px -6px;
    background: rgba(30, 80, 160, 0.22);
    border-radius: 5px;
    box-shadow: 0 0 0 1.5px rgba(92, 169, 255, 0.28);
    z-index: -1;
    pointer-events: none;
}

/* Ghost rect for word-joiner drag */
.word-joiner-ghost {
    position: absolute;
    display: none;
    border: 1.5px dashed #A0C4FF;
    background: rgba(92, 169, 255, 0.06);
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

.pasted-image {
    display: block;
    max-width: 250px;
    max-height: 250px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.pasted-image-wrap {
    position: absolute;
    z-index: 10;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    cursor: grab;
    user-select: none;
    margin: 0;
    padding: 0;
}
.pasted-image-wrap:active {
    cursor: grabbing;
}

.pasted-image-caption {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #8CA4BF;
    max-width: 250px;
    word-break: break-word;
    line-height: 1.3;
    pointer-events: none;
}

.drag-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    cursor: move;
    background: #0E2C52;
    border-bottom: 1px solid #1D4678;
    border-radius: 10px 10px 0 0;
    padding: 0 8px;
}

.node-title {
    flex: 1;
    min-width: 0;
    color: #C8D7EE;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.settings-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9CB5D8;
    cursor: pointer;
    transition: color 0.15s ease;
    margin-left: auto;
}

.settings-icon:hover {
    color: #E16B6B;
}

.handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #0C1321;
    background: #5CA9FF;
    top: 50%;
    transform: translateY(-50%);
    cursor: crosshair;
}

.handle.left {
    left: -6px;
}

.handle.right {
    right: -6px;
}

/* ─── Group ──────────────────────────────────────────────────────────── */

.group {
    position: absolute;
    min-width: 80px;
    min-height: 80px;
    background: rgba(10, 22, 40, 0.45);
    border: 1.5px solid #1D4678;
    border-radius: 10px;
    z-index: 6;
}

.group-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 26px;
    background: #0B1E38;
    border-bottom: 1px solid #1D4678;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    padding: 0 8px;
    cursor: move;
    user-select: none;
}

.group-title {
    flex: 1;
    color: #9CB5D8;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-gear {
    flex-shrink: 0;
}

/* Ghost rect drawn while dragging to create a group */
.group-ghost {
    position: absolute;
    display: none;
    border: 1.5px dashed #5CA9FF;
    background: rgba(92, 169, 255, 0.07);
    border-radius: 6px;
    pointer-events: none;
    z-index: 5;
}

/* ─── Prompt Group ───────────────────────────────────────────────────── */

.pmt-group {
    position: absolute;
    background: rgba(8, 18, 34, 0.55);
    border: 1.5px solid #1D4678;
    border-radius: 8px;
    z-index: 6;
    cursor: move;
    box-sizing: border-box;
    user-select: none;
}

.pmt-group-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-left: 1px solid #1D4678;
    background: rgba(11, 30, 56, 0.55);
    border-radius: 0 8px 8px 0;
    pointer-events: auto;
}

.pmt-group-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5CA9FF;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.45;
    transition: opacity 0.12s, background 0.12s;
}

.pmt-group-icon:hover {
    opacity: 1;
    background: rgba(92, 169, 255, 0.12);
}

.pmt-group-icon.danger {
    color: #E16B6B;
}

.pmt-group-icon.danger:hover {
    background: rgba(225, 107, 107, 0.12);
}

.pmt-group .word {
    z-index: 1;
    cursor: grab;
}

/* ─── Login overlay ──────────────────────────────────────────────────── */

.login-overlay {
    position: fixed;
    /* Sits below the header (60px) so the header remains visible */
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 990;
    background: rgba(5, 6, 10, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.login-overlay--hidden {
    display: none;
}

.login-card {
    background: #0F121C;
    border: 1px solid #2D405D;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    padding: 40px 44px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 380px;
}

.login-logo {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5CA9FF;
    filter: drop-shadow(0 0 18px rgba(92, 169, 255, 0.55));
    margin-bottom: 4px;
}

.login-logo-svg {
    width: 52px;
    height: auto;
    fill: currentColor;
}

.login-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: #E9EDF5;
    margin: 0;
    letter-spacing: -0.01em;
}

.login-subtitle {
    font-size: 0.9rem;
    color: #7A90B0;
    margin: 0 0 8px;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 6px;
    padding: 10px 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: box-shadow 0.15s, background 0.15s;
}

.google-signin-btn:hover:not(:disabled) {
    background: #f8f8f8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.google-signin-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#gsi-signin-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 4px;
}

.login-verifying,
.login-error {
    font-size: 0.85rem;
    text-align: center;
    padding: 10px 0 6px;
    margin: 0;
}

.login-verifying {
    color: #7A90B0;
    animation: loginVerifyPulse 1.4s ease-in-out infinite;
}

.login-error { color: #e07070; }

@keyframes loginVerifyPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

/* ── Access blocked overlay ──────────────────────────────────────────── */
.access-blocked-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;   /* below header (1000) */
    background: #050608;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.access-blocked-stripe {
    position: absolute;
    top: 60px;      /* flush under header */
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        -55deg,
        #c89040 0, #c89040 10px,
        #1a1006 10px, #1a1006 20px
    );
}

.access-blocked-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
    max-width: 360px;
    padding: 40px 24px;
}

.access-blocked-icon {
    width: 52px;
    height: 52px;
    color: #c89040;
    filter: drop-shadow(0 0 14px rgba(200, 144, 64, 0.4));
}

.access-blocked-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #c89040;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0;
}

.access-blocked-msg {
    font-size: 0.875rem;
    color: #3a4560;
    line-height: 1.7;
    margin: 0;
}

/* ── Page view (hash-routed pages inside the center column) ─────────── */

.page-view {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    padding: 40px 24px;
    background: var(--bg-primary);
}

.page-view:not([hidden]) {
    display: flex;
}

.page-view-loading,
.page-view-error {
    color: #7A90B0;
    font-size: 0.95rem;
}

/* ── Toolbar separator ───────────────────────────────────────────────── */

.toolbar-sep {
    width: 1px;
    height: 20px;
    background: #25324A;
    flex-shrink: 0;
    margin: 0 2px;
}

/* ── Page nav (hash-route buttons in toolbar) ────────────────────────── */

.page-nav {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border: 1px solid #2D405D;
    background: rgba(10, 16, 32, 0.85);
}

.page-nav-btn.active {
    background: rgba(74, 140, 255, 0.18);
    color: #4A8CFF;
    border-color: rgba(74, 140, 255, 0.35);
}

/* ── Page content (fragments loaded into #page-view) ────────────────── */

.page-content-header {
    text-align: center;
    margin-bottom: 24px;
}

.page-content-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: #C8D8F0;
    margin: 0 0 6px;
}

.page-meta {
    font-size: 0.85rem;
    color: #5A7090;
    margin: 0;
}

.wrangler-embed {
    position: relative;
    width: 100%;
    flex: 1 1 0;
    background: #0a0e1a;
    border: 1px solid #25324A;
    border-radius: 6px;
    overflow: hidden;
    min-height: 300px;
}

/* ── Login confirmation ──────────────────────────────────────────────── */

.login-confirmation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #0F121C;
    border: 1px solid #2D405D;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    padding: 40px 44px 36px;
    min-width: 320px;
    max-width: 400px;
    width: 100%;
}

.lc-avatar-wrap {
    margin-bottom: 8px;
}

.lc-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid #2D405D;
    object-fit: cover;
}

.lc-avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #151C2D;
    border: 2px solid #2D405D;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4A6580;
}

.lc-avatar-placeholder svg {
    width: 36px;
    height: 36px;
}

.lc-heading {
    font-size: 1.35rem;
    font-weight: 700;
    color: #E9EDF5;
    margin: 0;
}

.lc-name {
    font-size: 1rem;
    font-weight: 600;
    color: #C5D5E8;
    margin: 0;
}

.lc-email {
    font-size: 0.85rem;
    color: #7A90B0;
    margin: 0 0 8px;
}

.lc-meta {
    width: 100%;
    background: #0B0F1A;
    border: 1px solid #1E2D42;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0 8px;
}

.lc-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.lc-meta-label {
    color: #4A6580;
}

.lc-meta-value {
    color: #8BCAFF;
}

.lc-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
}

.lc-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 7px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, box-shadow 0.15s;
}

.lc-btn-primary {
    background: #1D7ABF;
    color: #fff;
}

.lc-btn-primary:hover {
    opacity: 0.88;
    box-shadow: 0 2px 10px rgba(29,122,191,0.45);
}

.lc-btn-secondary {
    background: #151C2D;
    color: #7A90B0;
    border: 1px solid #2D405D;
}

.lc-btn-secondary:hover {
    color: #C5D5E8;
    border-color: #4A6580;
}

.google-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.login-setup-note {
    font-size: 11.5px;
    color: #556070;
    margin: 4px 0 0;
    text-align: center;
}

.login-setup-note code {
    color: #7A90B0;
    font-size: 11px;
}

/* Disabled toolbar buttons */
.center-toolbar button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Context menu ───────────────────────────────────────────────────── */

.wrangler-context-menu {
    position: fixed;
    z-index: 9999;
    background: #141A26;
    border: 1px solid #2D405D;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.55);
    min-width: 160px;
    padding: 4px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
}

.context-menu-item {
    padding: 7px 16px;
    color: #E9EDF5;
    cursor: pointer;
    transition: background 0.12s;
}

.context-menu-item:hover {
    background: #1D3252;
}

.context-menu-item.danger {
    color: #E16B6B;
}

.context-menu-item.danger:hover {
    background: #2A1515;
}

.context-menu-item.disabled {
    color: #6E7B93;
    cursor: default;
    pointer-events: none;
}

.context-menu-item.disabled:hover {
    background: transparent;
}

.context-menu-sep {
    height: 1px;
    background: #202838;
    margin: 4px 0;

.context-menu-header {
    padding: 6px 16px 4px;
    color: #7A9BBF;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    pointer-events: none;
    user-select: none;
}
}

/* ─── Panel-style sub-menus ─────────────────────────────────────────── */

.context-menu-item.has-panel {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.context-menu-item.cm-active {
    background: #1D3252;
}

.cm-panel {
    background: #0D1420;
    border-top: 1px solid #202838;
}

/* Rename panel */
.cm-rename-panel {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 12px;
}

.cm-input {
    flex: 1;
    min-width: 0;
    background: #182133;
    border: 1px solid #2D405D;
    border-radius: 5px;
    color: #E9EDF5;
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
    padding: 4px 8px;
    outline: none;
}

.cm-input:focus {
    border-color: #5CA9FF;
}

.cm-btn {
    flex-shrink: 0;
    background: #1D4678;
    border: none;
    border-radius: 5px;
    color: #E9EDF5;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 14px;
    line-height: 1.4;
}

.cm-btn:hover {
    background: #2D60A0;
}

/* Color swatch panel */
.cm-color-panel {
    padding: 10px;
}

.cm-swatches {
    display: grid;
    grid-template-columns: repeat(5, 22px);
    gap: 5px;
}

.cm-swatch {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
    transition: transform 0.1s, border-color 0.1s;
}

.cm-swatch:hover {
    transform: scale(1.18);
    border-color: #E9EDF5;
}

.cm-swatch.selected {
    border-color: #5CA9FF;
}

/* Font-size panel */
.cm-fontsize-panel {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 12px;
}

.cm-select {
    flex: 1;
    min-width: 0;
    background: #182133;
    border: 1px solid #2D405D;
    border-radius: 5px;
    color: #E9EDF5;
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
    padding: 3px 4px;
    outline: none;
    cursor: pointer;
}

.cm-select:focus {
    border-color: #5CA9FF;
}

.cm-spinner {
    width: 58px;
    flex-shrink: 0;
    background: #182133;
    border: 1px solid #2D405D;
    border-radius: 5px;
    color: #E9EDF5;
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
    padding: 3px 6px;
    outline: none;
}

.cm-spinner:focus {
    border-color: #5CA9FF;
}

/* ── User icon (header, right side) ─────────────────────────────────── */

.user-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(10, 16, 32, 0.7);
    border: 1px solid #2D405D;
    border-radius: 50%;
    color: #7A90B0;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
    flex-shrink: 0;
    overflow: hidden;
}

.user-icon-btn:hover {
    border-color: #4A8CFF;
    color: #C8D8F0;
    background: rgba(74, 140, 255, 0.12);
}

/* ── Admin icon button (header, right of user icon) ─────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: rgba(10, 16, 32, 0.7);
    border: 1px solid rgba(200, 140, 40, 0.4);
    border-radius: 6px;
    color: #c89040;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
    flex-shrink: 0;
}

.admin-btn:hover {
    border-color: #e8a840;
    color: #f0c060;
    background: rgba(200, 140, 40, 0.14);
}

.admin-btn-svg {
    width: 18px;
    height: 18px;
}

.user-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.user-icon-svg {
    width: 20px;
    height: 20px;
}

/* ── Modal overlay ───────────────────────────────────────────────────── */

.pw-modal {
    display: none;     /* JS removes [hidden]; CSS shows via :not([hidden]) */
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.pw-modal:not([hidden]) {
    display: flex;
}

.pw-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 18, 0.78);
    backdrop-filter: blur(3px);
}

.pw-modal-card {
    position: relative;
    z-index: 1;
    background: #0F121C;
    border: 1px solid #2D405D;
    border-radius: 14px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
    padding: 32px 36px 28px;
    min-width: 340px;
    max-width: 480px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
}

.pw-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: #5A7090;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.pw-modal-close:hover {
    color: #C8D8F0;
    background: rgba(255,255,255,0.06);
}

.pw-modal-loading,
.pw-modal-error {
    color: #7A90B0;
    font-size: 0.92rem;
    text-align: center;
    padding: 24px 0;
}

/* Prevent body scroll while modal is open */
body.pw-modal-open {
    overflow: hidden;
}

/* ── Wide modal variant (admin) ──────────────────────────────────────── */
.pw-modal-card--wide {
    max-width: min(1060px, 96vw);
    width: 96vw;
    height: min(720px, 90vh);
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pw-modal-card--wide .pw-modal-close {
    z-index: 10;
    top: 12px;
    right: 14px;
}

/* When the card is wide, its content wrapper must flex-fill */
.pw-modal-card--wide .pw-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ── Admin modal shell ───────────────────────────────────────────────── */
.pw-admin-modal {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Header row: title + tabs */
.adm-head {
    flex-shrink: 0;
    background: #080e1c;
    border-bottom: 1px solid #192538;
    padding: 0;
}

.adm-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 52px 12px 22px;
}

.adm-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 1rem;
    font-weight: 700;
    color: #c8ddf4;
    margin: 0;
    letter-spacing: -0.01em;
}

.adm-title-icon {
    color: #c89040;
    flex-shrink: 0;
}

/* Tab nav */
.adm-tabs {
    display: flex;
    gap: 0;
    padding: 0 0 0 10px;
}

.adm-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #3a5878;
    cursor: pointer;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    padding: 9px 16px 9px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    position: relative;
    bottom: -1px;
}

.adm-tab svg { width: 16px; height: 16px; flex-shrink: 0; }

.adm-tab:hover { color: #6a94bc; }

.adm-tab.active {
    color: #c8e4ff;
    border-bottom-color: #4a8cff;
}

/* Count pill on each tab */
.adm-tab-ct {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    padding: 0 5px;
    background: rgba(74,140,255,0.15);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    color: #5a9aee;
    line-height: 1;
}

.adm-tab-ct.visible { display: inline-flex; }

/* ── Content area ────────────────────────────────────────────────────── */
.adm-content {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* Each pane fills the content area; only one is shown at a time */
.adm-pane {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* relies on [hidden] { display:none !important } already in styles.css */
.adm-pane[hidden] { display: none !important; }

/* Add-bar (Allowed Users form strip at top of pane) */
.adm-add-bar {
    flex-shrink: 0;
    background: #080f1c;
    border-bottom: 1px solid #141e30;
    padding: 11px 18px;
}

.adm-add-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.adm-input {
    height: 32px;
    background: #0e1828;
    border: 1px solid #253848;
    border-radius: 5px;
    color: #d0e4f8;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    padding: 0 10px;
    outline: none;
    min-width: 190px;
}

.adm-input:focus {
    border-color: #4a8cff;
    box-shadow: 0 0 0 2px rgba(74,140,255,0.12);
}

.adm-input::placeholder { color: #2a4060; }

.adm-in-flex { flex: 1 1 auto; min-width: 130px; }

.adm-form-msg { font-size: 12px; flex-shrink: 0; }
.adm-form-ok  { color: #4ecb71; }
.adm-form-err { color: #e07070; }

/* Scrollable table area */
.adm-table-wrap {
    flex: 1 1 auto;
    overflow: auto;
}

/* ── Data table ──────────────────────────────────────────────────────── */
.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.adm-table thead tr {
    background: #080f1c;
}

.adm-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #080f1c;
    padding: 10px 14px;
    text-align: left;
    color: #587898;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #141e30;
    white-space: nowrap;
    user-select: none;
}

.adm-table th.sortable { cursor: pointer; }
.adm-table th.sortable:hover { color: #7aaace; }

.adm-table th.sort-asc::after  { content: ' ↑'; color: #5a9aff; }
.adm-table th.sort-desc::after { content: ' ↓'; color: #5a9aff; }

.adm-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.018); }
.adm-table tbody tr:hover td { background: rgba(74,140,255,0.07) !important; }

.adm-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #0d1824;
    color: #b8d0ec;
    vertical-align: middle;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-table tbody tr:last-child td { border-bottom: none; }

/* Column utility classes */
.adm-col-id     { width: 48px; }
.adm-col-id td,
td.adm-col-id   { color: #3a5878 !important; font-size: 12px; }

.adm-col-email td,
td.adm-col-email { color: #5888a8 !important; }

.adm-col-date   { width: 110px; }
.adm-col-date td,
td.adm-col-date { color: #4a6888 !important; font-size: 12px; }

.adm-col-action { width: 86px; text-align: right; }

/* State rows */
.adm-state-loading,
.adm-state-empty,
.adm-state-error {
    text-align: center;
    padding: 48px 20px;
    font-size: 13px;
}

.adm-state-loading { color: #4a6888; }
.adm-state-empty   { color: #3a5878; }
.adm-state-error   { color: #b06868; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.adm-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
}

.adm-badge-admin { background: rgba(200,144,64,0.15); color: #c89050; border: 1px solid rgba(200,144,64,0.28); }
.adm-badge-pub   { background: rgba(78,200,130,0.12); color: #4ecb82; border: 1px solid rgba(78,200,130,0.24); }
.adm-badge-priv  { background: rgba(90,90,110,0.18);  color: #7080a0; border: 1px solid rgba(90,90,110,0.3);  }

/* ── Inline action buttons ───────────────────────────────────────────── */
.adm-btn {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 12px;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.14s, border-color 0.14s, opacity 0.14s;
    flex-shrink: 0;
}

.adm-btn:disabled { opacity: 0.38; cursor: not-allowed; }

.adm-btn-primary {
    background: #163e6e;
    border-color: #2460b0;
    color: #c8e0ff;
}
.adm-btn-primary:hover:not(:disabled) { background: #1e58a8; border-color: #3878d0; }

.adm-btn-muted {
    background: #111d2e;
    border-color: #1e3048;
    color: #6a90b0;
}
.adm-btn-muted:hover:not(:disabled) { background: #1a2e48; color: #90b8d8; }

.adm-btn-grant {
    background: #0e2e14;
    border-color: #205830;
    color: #4eca70;
}
.adm-btn-grant:hover:not(:disabled) { background: #153e1c; }

.adm-btn-danger {
    background: #2a1010;
    border-color: #582020;
    color: #cc7070;
}
.adm-btn-danger:hover:not(:disabled) { background: #3c1414; border-color: #7a2c2c; }

/* ── Pending access requests section ─────────────────────────────────── */

.adm-attempts-wrap {
    border-bottom: 1px solid #1a3050;
    padding-bottom: 8px;
    margin-bottom: 4px;
}
.adm-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 6px;
}
.adm-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #5a8ab0;
}
.adm-ct-warn {
    background: rgba(200, 90, 60, 0.18) !important;
    color: #e07858 !important;
    border-color: rgba(200, 90, 60, 0.35) !important;
}

/* ── Profile modal content ───────────────────────────────────────────── */

.pw-profile-modal {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pm-section {
    padding: 16px 0;
    border-bottom: 1px solid #1E2D45;
}

.pm-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pm-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 0;
}

.pm-avatar-wrap {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    background: #1A2540;
    border: 1px solid #2D405D;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pm-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.pm-avatar-placeholder {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5A7090;
}

.pm-avatar-placeholder svg {
    width: 28px;
    height: 28px;
}

.pm-identity-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.pm-display-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: #C8D8F0;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-email {
    font-size: 0.82rem;
    color: #5A7090;
    margin: 0;
}

.pm-provider-badge {
    font-size: 0.72rem;
    color: #3D77CC;
    background: rgba(61, 119, 204, 0.12);
    border: 1px solid rgba(61, 119, 204, 0.25);
    border-radius: 4px;
    padding: 1px 7px;
    display: inline-block;
    margin-top: 2px;
    width: fit-content;
}

.pm-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #3A5070;
    margin: 0 0 12px;
}

.pm-field-row {
    display: flex;
    gap: 8px;
}

.pm-input {
    flex: 1;
    background: #0A0E1A;
    border: 1px solid #2D405D;
    border-radius: 6px;
    color: #C8D8F0;
    font-size: 0.9rem;
    padding: 7px 12px;
    outline: none;
    transition: border-color 0.15s;
}

.pm-input:focus {
    border-color: #4A8CFF;
}

.pm-btn {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.pm-btn-primary {
    background: rgba(74, 140, 255, 0.18);
    border-color: rgba(74, 140, 255, 0.35);
    color: #4A8CFF;
}

.pm-btn-primary:hover { background: rgba(74, 140, 255, 0.28); }
.pm-btn-primary:disabled { opacity: 0.5; cursor: default; }

.pm-btn-danger {
    background: rgba(220, 60, 60, 0.12);
    border-color: rgba(220, 60, 60, 0.3);
    color: #DC4444;
    width: 100%;
}

.pm-btn-danger:hover { background: rgba(220, 60, 60, 0.22); }
.pm-btn-danger:disabled { opacity: 0.5; cursor: default; }

.pm-field-msg {
    font-size: 0.82rem;
    margin: 6px 0 0;
}

.pm-field-msg--ok    { color: #3DB87A; }
.pm-field-msg--error { color: #DC4444; }

.pm-placeholder {
    color: #3A5070;
    font-size: 0.88rem;
    font-style: italic;
}

.pm-note {
    font-size: 0.85rem;
    color: #5A7090;
    margin: 0;
    line-height: 1.5;
}

.pm-link {
    color: #4A8CFF;
    text-decoration: none;
}

.pm-link:hover { text-decoration: underline; }

.pm-section-signout { padding-top: 20px; }

/* Footer */
footer {
    background-color: var(--header-bg);
    height: 60px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

footer .container {
    max-width: none;
    margin: 0;
    padding: 0 20px;
    width: 100%;
    text-align: center;
}

footer p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

@keyframes logoFadeBlink {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    20% {
        opacity: 1;
        transform: translateY(0);
    }
    30% {
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(35px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
        padding: 0 10px;
    }

    nav {
        gap: 1rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    section h2 {
        font-size: 2rem;
    }

    .service-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Touch / mobile support ──────────────────────────────────────────── */

/* Prevent browser default touch actions on interactive canvas elements */
.wrangler,
.wrangler .word,
.wrangler .node,
.wrangler .group,
.wrangler .pasted-image-wrap,
.wrangler .handle,
.wrangler .pmt-group,
.up-thumb,
.up-grid,
.resizer,
.gutter-panel-splitter {
    touch-action: none;
}

/* Active states (mirrors :hover for touch devices) */
.grid-mode-btn:active          { color: var(--link-strong); background: rgba(80, 160, 255, 0.08); }
.gutter-panel-btn:active       { background: #22344F; }
.gutter-panel-btn.danger:active { background: #452131; }
.cloud-word:active             { transform: translateY(-1px); }
.gutter-panel-splitter:active  { opacity: 1; }
.up-thumb-remove:active        { background: rgba(200,60,60,0.35); color: #fff; }
.settings-icon:active          { color: #E16B6B; }
.pmt-group-icon:active         { opacity: 1; background: rgba(80,160,255,0.12); }
.google-signin-btn:active      { background: rgba(66,133,244,0.08); box-shadow: 0 2px 8px rgba(66,133,244,0.25); }
.adm-btn:active                { opacity: 0.8; }
.adm-table th.sortable:active  { color: #8fc8ff; }
.up-browser-card:active        { background: rgba(80,160,255,0.08); }

/* Make touch targets large enough (44×44 minimum per Apple HIG) */
@media (pointer: coarse) {
    .settings-icon        { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
    .handle               { min-width: 28px; min-height: 28px; }
    .up-thumb-remove      { min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
    .group-gear           { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
    .gutter-panel-btn     { min-height: 36px; }
    .gutter-panel-splitter { min-height: 12px; }
    .resizer              { min-width: 12px; }
    .context-menu-item    { min-height: 40px; display: flex; align-items: center; }
    .grid-mode-btn        { min-height: 36px; padding: 6px 10px; }

    /* Show thumb remove button always (no hover on touch) */
    .up-thumb .up-thumb-remove { opacity: 0.7; }
}

