/* Savage SLA Operative Sheet - CSS Design System */
:root {
    color-scheme: dark;
    --bg-dark: #090d16;
    --card-bg: rgba(18, 24, 38, 0.88);
    --border-color: rgba(56, 189, 248, 0.4);
    --border-hover: rgba(56, 189, 248, 0.8);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #38bdf8;
    --accent-purple: #c084fc;
    --accent-pink: #f472b6;
    --accent-red: #f43f5e;
    --accent-green: #34d399;
    --sidebar-bg: #0f172a;
    --input-bg: rgba(15, 23, 42, 0.75);
    --input-border: rgba(56, 189, 248, 0.3);
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Outfit", "Segoe UI", sans-serif;
}

/* Classic Paper White Theme */
body.theme-paper {
    color-scheme: light;
    --bg-dark: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #000000;
    --border-hover: #1e293b;
    --text-main: #0f172a;
    --text-muted: #475569;
    --primary: #0284c7;
    --accent-purple: #9333ea;
    --accent-pink: #db2777;
    --accent-red: #e11d48;
    --accent-green: #059669;
    --sidebar-bg: #ffffff;
    --input-bg: #f1f5f9;
    --input-border: #94a3b8;
    background-image: none;
}

* {
    box-sizing: border-box;
}

/* Universal Form Elements Cross-Browser Contrast & Dark Mode Protection */
input, select, textarea, button, optgroup, option {
    font-family: inherit;
    color: var(--text-main);
    -webkit-text-fill-color: var(--text-main);
}

body.theme-paper input,
body.theme-paper select,
body.theme-paper textarea,
body.theme-paper button,
body.theme-paper optgroup,
body.theme-paper option {
    color: #0f172a;
    -webkit-text-fill-color: #0f172a;
}

/* Placeholder Styling Across All Browsers */
input::placeholder,
textarea::placeholder,
.field-input::placeholder,
.table-input::placeholder,
.desc-textarea::placeholder,
.bio-textarea::placeholder {
    color: var(--text-muted) !important;
    -webkit-text-fill-color: var(--text-muted) !important;
    opacity: 0.85;
}

/* Chrome/Safari/Edge Autofill Override (Fixes dark text on dark bg upon autocomplete) */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
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-main) !important;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
    box-shadow: 0 0 0px 1000px #0f172a inset !important;
    transition: background-color 5000s ease-in-out 0s;
    color: var(--text-main) !important;
}

body.theme-paper input:-webkit-autofill,
body.theme-paper textarea:-webkit-autofill,
body.theme-paper select:-webkit-autofill {
    -webkit-text-fill-color: #0f172a !important;
    -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
    box-shadow: 0 0 0px 1000px #ffffff inset !important;
    color: #0f172a !important;
}

/* Disabled & Readonly Input Contrast Fix */
input:disabled, textarea:disabled, select:disabled,
input[readonly], textarea[readonly], select[readonly] {
    color: var(--text-main) !important;
    -webkit-text-fill-color: var(--text-main) !important;
    opacity: 0.95;
}

body.theme-paper input:disabled, 
body.theme-paper textarea:disabled, 
body.theme-paper select:disabled,
body.theme-paper input[readonly], 
body.theme-paper textarea[readonly], 
body.theme-paper select[readonly] {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(192, 132, 252, 0.04) 0%, transparent 40%);
}

/* Sidebar Navigation & Collapsible Accordion */
.sidebar {
    width: 270px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.2rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.8rem;
}

.sidebar-header .logo {
    margin-bottom: 0;
}

/* Toggle Knap Placeret Inde i Hovedmenuen */
.sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 800;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
    border-color: var(--primary);
}

.sidebar-collapse-btn .toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

/* Mini-Ikon Rail Tilstand (Når Menuen Er Kollapset Inde i Siden) */
.sidebar.collapsed {
    width: 68px !important;
    padding: 1.8rem 0.6rem !important;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .menu-title,
.sidebar.collapsed .item-text,
.sidebar.collapsed .chevron-icon {
    display: none !important;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    flex-direction: column-reverse;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.sidebar.collapsed .sidebar-collapse-btn .toggle-icon {
    transform: rotate(180deg);
}

.sidebar.collapsed .menu-item a {
    justify-content: center;
    padding: 0.65rem 0;
    font-size: 1.2rem;
}


.logo {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 1.8rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo .badge {
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
}

.menu-section {
    margin-bottom: 1.5rem;
}

.menu-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    padding-left: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Fold-out Collapsible Accordion Button Title */
.menu-title.collapsible-title {
    width: 100%;
    background: none;
    border: none;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.35rem;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
    text-align: left;
}

.menu-title.collapsible-title:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

body.theme-paper .menu-title.collapsible-title:hover {
    background: rgba(0, 0, 0, 0.05);
}

.menu-title.collapsible-title .chevron-icon {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    display: inline-block;
}

.menu-title.collapsible-title.collapsed .chevron-icon {
    transform: rotate(-90deg);
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: all 0.3s ease;
}

.menu-list.collapsible-list {
    overflow: hidden;
}

.menu-list.collapsible-list.collapsed {
    display: none;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0.85rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.menu-item a:hover {
    background-color: rgba(125, 125, 125, 0.1);
    color: var(--text-main);
}

.menu-item.active a {
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary);
    border: 1px solid var(--border-color);
    font-weight: 600;
}

/* Main Container */
.main-content {
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 1240px;
}

/* Control Bar (Top) */
.control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.2rem 1.8rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.control-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.select-input, .btn-action {
    background: var(--input-bg);
    color: var(--text-main);
    border: 1.5px solid var(--input-border);
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-input:focus, .btn-action:hover {
    border-color: var(--primary);
    outline: none;
}

.btn-action.primary {
    background: var(--primary);
    color: #0f172a;
    font-weight: 700;
    border: none;
}

.btn-action.primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Admin & Værktøjer Undermenu Dropdown */
.admin-dropdown-container {
    position: relative;
    display: inline-block;
}

.admin-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem;
    min-width: 230px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(0, 0, 0, 0.2);
    z-index: 500;
    flex-direction: column;
    gap: 0.35rem;
}

body.theme-paper .admin-dropdown-menu {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.admin-dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
    width: 100%;
}

body.theme-paper .dropdown-item {
    color: #1e293b;
}

.dropdown-item:hover {
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
}

body.theme-paper .dropdown-item:hover {
    background: rgba(2, 132, 199, 0.12);
    color: #0284c7;
}

.dropdown-item.danger {
    color: var(--accent-red);
}

.dropdown-item.danger:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-red);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Character Sheet Grid & Boxes */
.sheet-header {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    background: var(--card-bg);
    margin-bottom: 2rem;
    position: relative;
}

.header-main-layout {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.header-left-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    min-width: 0;
}

.sheet-title {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Dynamic Single-Row Aligned Header Fields */
.header-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: flex-end;
    width: 100%;
}

@media (max-width: 900px) {
    .header-main-layout {
        flex-direction: column-reverse;
        align-items: center;
    }
}

/* Larger Operative ID Badge Frame in Top Header Card (115px x 115px) */
.mini-portrait-box {
    width: 115px;
    height: 115px;
    min-width: 115px;
    min-height: 115px;
    border: 2.5px solid var(--primary);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 0 14px rgba(56, 189, 248, 0.25);
    transition: all 0.25s ease;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.2rem;
}

.mini-portrait-box:hover {
    transform: scale(1.06);
    border-color: var(--accent-pink);
    box-shadow: 0 6px 20px rgba(217, 70, 239, 0.45);
}

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

.mini-portrait-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
}

body.theme-paper .mini-portrait-box {
    border-color: #0284c7;
    background: #f1f5f9;
}

.field-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.35rem;
    min-width: 0;
}

.field-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    height: 18px;
    line-height: 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    white-space: nowrap;
}

.field-input {
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-main);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.field-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Credits Row Layout Inside Header Field Group */
.credits-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Character Portrait Frame */
.portrait-container {
    width: 100%;
    height: 320px;
    border: 2.5px dashed var(--border-color);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}

.portrait-container:hover {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.08);
}

.portrait-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

/* Auto-expanding Biography, Background & Note Textareas (NUL SCROLLBAR!) */
.bio-textarea {
    width: 100%;
    min-height: 90px;
    height: auto;
    max-height: none !important; /* Vokser automatisk med indholdet uden begrænsning */
    resize: none !important; /* Fjern manuel resize-håndtag */
    overflow: hidden !important; /* SKJUL AL SCROLLBAR DA BOKSEN UDVIDER SIG HERTIL! */
    overflow-y: hidden !important;
    line-height: 1.45;
    font-size: 0.95rem;
    padding: 0.65rem 0.85rem;
    transition: border-color 0.2s;
}

/* Vertikalt Ekspanderende Beskrivelsesfelter (Maks 3 linjer højde for tabeller) */
/* SCROLLBAR SKJULES SOM STANDARD OG VISES KUN NÅR MUSEN ER OVER FELTET! */
.desc-textarea {
    width: 100%;
    min-height: 36px;
    max-height: 74px; /* Maks 3 linjer højde */
    resize: vertical;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.35;
    padding: 0.4rem 0.6rem;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-main);
    border-radius: 6px;
    overflow-y: auto;
    scrollbar-width: none; /* Skjul scrollbar i Firefox som standard */
    transition: border-color 0.2s, scrollbar-color 0.2s;
}

/* Skjul WebKit/Chrome/Edge scrollbar som standard */
.desc-textarea::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.desc-textarea::-webkit-scrollbar-track {
    background: transparent;
}

.desc-textarea::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

/* Vis kun mørk/stilfuld slank scrollbar ved HOVER eller FOCUS */
.desc-textarea:hover, .desc-textarea:focus {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.desc-textarea:hover::-webkit-scrollbar,
.desc-textarea:focus::-webkit-scrollbar {
    width: 6px;
}

.desc-textarea:hover::-webkit-scrollbar-thumb,
.desc-textarea:focus::-webkit-scrollbar-thumb {
    background: var(--input-border);
}

.desc-textarea:hover::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.desc-textarea:focus, .bio-textarea:focus {
    border-color: var(--primary);
    outline: none;
}

select,
select.table-input, 
select.field-input,
select.select-input,
select.table-die-select,
select.attach-select {
    background-color: var(--input-bg);
    color: var(--text-main) !important;
    -webkit-text-fill-color: var(--text-main) !important;
    cursor: pointer;
}

select option, 
select optgroup,
select.table-input option, 
select.field-input option,
select.select-input option {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    -webkit-text-fill-color: #f1f5f9 !important;
    padding: 6px;
}

body.theme-paper select,
body.theme-paper select.table-input, 
body.theme-paper select.field-input,
body.theme-paper select.select-input,
body.theme-paper select.table-die-select,
body.theme-paper select.attach-select {
    background-color: #f1f5f9;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body.theme-paper select option, 
body.theme-paper select optgroup,
body.theme-paper select.table-input option, 
body.theme-paper select.field-input option,
body.theme-paper select.select-input option {
    background-color: #ffffff !important;
    color: #1e293b !important;
    -webkit-text-fill-color: #1e293b !important;
}

/* Credits Calculator Inline Controls (+ and - Compact Buttons) */
.calc-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calc-input {
    width: 65px;
    padding: 0.35rem 0.4rem;
    font-size: 0.82rem;
    border-radius: 6px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-main);
    font-family: inherit;
    transition: border-color 0.2s;
}

.calc-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Skjul lys/hvid browser-spinner på tal-input felter (f.eks. Credits & XP regner) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.btn-calc {
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-main);
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-calc.add { color: var(--accent-green); border-color: rgba(52, 211, 153, 0.6); }
.btn-calc.sub { color: var(--accent-red); border-color: rgba(244, 63, 94, 0.6); }

.btn-calc:hover {
    transform: scale(1.12);
}

/* Bennies Interactive Counter */
.counter-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-counter {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-counter:hover {
    background: var(--primary);
    color: #0f172a;
}

.btn-daily-bennies {
    font-size: 1.1rem;
    margin-left: 2px;
    transition: all 0.2s ease;
}

.btn-daily-bennies:hover {
    background: rgba(234, 179, 8, 0.2);
    border-color: #eab308;
    color: #fde047;
    transform: scale(1.08);
}

/* 2-Column Section Layout (Strict Equal 50/50 Split & No Horizontal Overflow) */
.section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.8rem;
    margin-bottom: 1.8rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 960px) {
    .section-grid {
        grid-template-columns: 1fr;
    }
}

/* Dynamic Table Delete Button (🗑️ / ❌) */
.btn-del-row {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    opacity: 0.6;
}

.btn-del-row:hover {
    opacity: 1;
    color: var(--accent-red);
    background: rgba(244, 63, 94, 0.2);
    transform: scale(1.2);
}

body.theme-paper .btn-del-row:hover {
    color: #e11d48;
    background: #ffe4e6;
}

/* Possessions & Equipment Table Column Split (Full Width) */
#possession-table {
    table-layout: fixed;
    width: 100%;
}

#possession-table th:nth-child(1), #possession-table td:nth-child(1) { width: 20%; }
#possession-table th:nth-child(2), #possession-table td:nth-child(2) { width: 56%; }
#possession-table th:nth-child(3), #possession-table td:nth-child(3) { width: 10%; }
#possession-table th:nth-child(4), #possession-table td:nth-child(4) { width: 10%; }
#possession-table th:nth-child(5), #possession-table td:nth-child(5) { width: 4%; }

/* Hindrance & Edge Table Column Split */
#hindrance-table, #edge-table {
    table-layout: fixed;
    width: 100%;
}

#hindrance-table th:nth-child(1), #hindrance-table td:nth-child(1),
#edge-table th:nth-child(1), #edge-table td:nth-child(1) { width: 17%; }

#hindrance-table th:nth-child(2), #hindrance-table td:nth-child(2),
#edge-table th:nth-child(2), #edge-table td:nth-child(2) { width: 10%; }

#hindrance-table th:nth-child(3), #hindrance-table td:nth-child(3),
#edge-table th:nth-child(3), #edge-table td:nth-child(3) { width: 17%; }

#hindrance-table th:nth-child(4), #hindrance-table td:nth-child(4),
#edge-table th:nth-child(4), #edge-table td:nth-child(4) { width: 7%; }

#hindrance-table th:nth-child(5), #hindrance-table td:nth-child(5),
#edge-table th:nth-child(5), #edge-table td:nth-child(5) { width: 22%; }

#hindrance-table th:nth-child(6), #hindrance-table td:nth-child(6),
#edge-table th:nth-child(6), #edge-table td:nth-child(6) { width: 23%; }

#hindrance-table th:nth-child(7), #hindrance-table td:nth-child(7),
#edge-table th:nth-child(7), #edge-table td:nth-child(7) { width: 4%; }

/* Linked Modifier Pills & Badges System (Dedicated Right-Aligned Column) */
.modifier-pills-container {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0;
    padding-left: 0.5rem;
}

.modifier-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.73rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    background: rgba(56, 189, 248, 0.12);
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.modifier-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.modifier-pill.positive {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.6);
    color: var(--accent-green);
}

.modifier-pill.negative {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.6);
    color: var(--accent-red);
}

.modifier-pill.disabled {
    opacity: 0.45;
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    color: var(--text-muted);
    text-decoration: line-through;
}

body.theme-paper .modifier-pill.positive {
    background: rgba(5, 150, 105, 0.12);
    border-color: #059669;
    color: #047857;
}

body.theme-paper .modifier-pill.negative {
    background: rgba(225, 29, 72, 0.12);
    border-color: #e11d48;
    color: #be123c;
}

.box {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.4rem;
    margin-bottom: 1.8rem;
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.box-header {
    font-size: 1.2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--primary);
}

/* Stat Row & 5-Pip Dice Source Matrix */
.stat-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.35rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
    gap: 0.45rem;
}

body.theme-paper .stat-row {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* 1. Terning (5-pip matrix / .dice-pips-box) on far left */
.dice-pips-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 2.5px;
    box-sizing: border-box;
    flex-shrink: 0;
    margin-left: 0;
    margin-right: 2px;
    position: relative;
    cursor: help;
    transition: all 0.2s ease;
}

.dice-pips-box:hover {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    transform: scale(1.1);
}

.dice-pips-box .pip {
    width: 3.5px;
    height: 3.5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    justify-self: center;
    align-self: center;
    transition: all 0.25s ease;
    display: block;
}

/* 5-Pip Quincunx Dice Positions */
.dice-pips-box .pip-1 { grid-area: 1 / 1; } /* d4  - Top Left */
.dice-pips-box .pip-2 { grid-area: 1 / 3; } /* d6  - Top Right */
.dice-pips-box .pip-3 { grid-area: 2 / 2; } /* d8  - Center */
.dice-pips-box .pip-4 { grid-area: 3 / 1; } /* d10 - Bottom Left */
.dice-pips-box .pip-5 { grid-area: 3 / 3; } /* d12 - Bottom Right */

/* Glowing Color States (Point Sources) */
/* 🔵 Blue: Start Creation Points (Standard Point-Buy) */
.dice-pips-box .pip.pip-blue {
    background: #38bdf8;
    box-shadow: 0 0 6px #38bdf8, 0 0 10px rgba(56, 189, 248, 0.9);
}

/* 🟢 Green: Hindrance Points Conversion */
.dice-pips-box .pip.pip-green {
    background: #10b981;
    box-shadow: 0 0 6px #10b981, 0 0 10px rgba(16, 185, 129, 0.9);
}

/* 🔴 Red: XP / Advance */
.dice-pips-box .pip.pip-red {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444, 0 0 10px rgba(239, 68, 68, 0.9);
}

/* 🟣 Purple: Free Racial Baseline or Core Skill Starting d4 */
.dice-pips-box .pip.pip-purple {
    background: #c084fc;
    box-shadow: 0 0 5px #c084fc, 0 0 8px rgba(192, 132, 252, 0.85);
}

/* Paper Theme Adjustments */
body.theme-paper .dice-pips-box {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

body.theme-paper .dice-pips-box .pip {
    background: rgba(0, 0, 0, 0.15);
}

body.theme-paper .dice-pips-box .pip.pip-blue {
    background: #0284c7;
    box-shadow: 0 0 4px rgba(2, 132, 199, 0.6);
}

body.theme-paper .dice-pips-box .pip.pip-green {
    background: #059669;
    box-shadow: 0 0 4px rgba(5, 150, 105, 0.6);
}

body.theme-paper .dice-pips-box .pip.pip-red {
    background: #dc2626;
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.6);
}

body.theme-paper .dice-pips-box .pip.pip-purple {
    background: #9333ea;
    box-shadow: 0 0 4px rgba(147, 51, 234, 0.6);
}

/* 2. Skillenavn / Stat name */
.stat-name {
    font-weight: 700;
    font-size: 0.92rem;
    width: 145px;
    min-width: 145px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.custom-skill-name-input {
    width: 145px !important;
    min-width: 145px !important;
    flex-shrink: 0 !important;
}

/* 3. SVG Polyhedral Dice Selectors (Fixed Column Width & Position) */
.dice-selector {
    display: inline-flex;
    gap: 2px;
    align-items: center;
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
}

/* Dedicated Reset / Untrained Button (🚫) */
.dice-btn.reset-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: 0.8rem;
    border: 1.5px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-muted);
    opacity: 0.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    margin-right: 2px;
}

.dice-btn.reset-btn:hover {
    opacity: 1;
    color: var(--accent-red);
    border-color: var(--accent-red);
    background: rgba(244, 63, 94, 0.18);
    transform: scale(1.1);
}

body.theme-paper .dice-btn.reset-btn {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #64748b;
}

body.theme-paper .dice-btn.reset-btn:hover {
    color: #e11d48;
    border-color: #e11d48;
    background: #ffe4e6;
}

/* Uvalgte terninger er skaleret ned for minimal forstyrrelse */
.dice-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    opacity: 0.38;
    transform: scale(0.52);
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dice-svg {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Default Unselected Dice: Sharp Cyan Outline, NO square drop-shadow box! */
.dice-svg polygon, .dice-svg rect {
    stroke: var(--primary);
    stroke-width: 2.8;
    fill: rgba(56, 189, 248, 0.12);
    transition: all 0.2s ease;
    filter: none !important;
}

.dice-svg text {
    fill: var(--text-main);
    font-size: 11px;
    font-weight: 900;
    font-family: var(--font-family);
    pointer-events: none;
}

body.theme-paper .dice-svg polygon, body.theme-paper .dice-svg rect {
    stroke: #0284c7;
    fill: #e0f2fe;
    stroke-width: 3;
    filter: none !important;
}

body.theme-paper .dice-svg text {
    fill: #0369a1;
}

/* Hover state on unselected die */
.dice-btn:hover {
    opacity: 0.78;
    transform: scale(0.85);
}

.dice-btn:hover .dice-svg polygon, .dice-btn:hover .dice-svg rect {
    stroke: #ffffff;
    fill: rgba(56, 189, 248, 0.35);
    filter: none !important;
}

/* Valgt terning: FREMHÆVET OG STOR (scale 1.22) for krystalklar læsbarhed */
.dice-btn.selected {
    opacity: 1 !important;
    transform: scale(1.22) !important;
}

.dice-btn.selected .dice-svg polygon, .dice-btn.selected .dice-svg rect {
    stroke: #ffffff;
    stroke-width: 2.8;
    fill: #d946ef; /* Strålende lyserød/lilla neonglød KUN inde i polygonens geometri */
    filter: none !important; /* Ingen firkantet skyggeboks uden om terningen! */
}

.dice-btn.selected .dice-svg text {
    fill: #ffffff;
    font-weight: 900;
}

body.theme-paper .dice-btn.selected .dice-svg polygon, body.theme-paper .dice-btn.selected .dice-svg rect {
    stroke: #7e22ce;
    fill: #a855f7;
    filter: none !important;
}

body.theme-paper .dice-svg text {
    fill: #ffffff;
}

/* Attributes & Skills List Layout med Dedikerede Kolonner */
.stat-row {
    display: flex;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 0.6rem;
}

body.theme-paper .stat-row {
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.stat-name, .stat-row > .field-label, .stat-row > .custom-skill-name-input {
    width: 140px;
    min-width: 140px;
    flex-shrink: 0;
}

.stat-name {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: help;
}

.stat-tag {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent-purple);
    background: rgba(192, 132, 252, 0.15);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

/* Instant Roll Toast Popup Banner (Over/Under Layout) */
.roll-toast-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border: 2.5px solid var(--primary);
    color: var(--text-main);
    padding: 1.2rem 2.2rem;
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.4);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 320px;
}

.roll-toast-banner.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.roll-toast-title {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 0.4rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
}

.roll-toast-result {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--accent-green);
    text-align: center;
    margin-bottom: 0.6rem;
}

.toast-result-num {
    color: var(--accent-green);
    font-size: 1.7rem;
    font-weight: 900;
}

.roll-toast-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
}

.die-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.die-result-row span {
    color: var(--text-muted);
    font-weight: 600;
}

.die-result-row strong {
    color: var(--text-main);
    font-weight: 800;
}

/* Paper Theme - Original Rich Dark Casino Felt Green & Glowing Yellow Gold Result Number */
body.theme-paper .roll-toast-banner {
    background: linear-gradient(135deg, #064e3b, #022c22) !important; /* Den oprindelige mørke casino-dug grøn */
    border-color: #34d399 !important;
    color: #ffffff !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(52, 211, 153, 0.4) !important;
}

body.theme-paper .roll-toast-title {
    color: #ffffff !important;
    border-bottom-color: rgba(255, 255, 255, 0.25) !important;
}

body.theme-paper .roll-toast-result {
    color: #ffffff !important; /* Hvid "Resultat:" tekst */
}

body.theme-paper .toast-result-num {
    color: #facc15 !important; /* MEGET LYS STRÅLENDE GULD/GUL FOR SELVE TALLET (F.EKS. 11)! Ingen mørkegrøn! */
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

body.theme-paper .roll-drawer {
    background: linear-gradient(135deg, #064e3b, #022c22) !important;
    border-color: #34d399 !important;
    color: #ffffff !important;
}

body.theme-paper .roll-drawer-header {
    color: #ffffff !important;
}

body.theme-paper .roll-entry {
    background: rgba(2, 44, 34, 0.9) !important;
    border-color: rgba(52, 211, 153, 0.4) !important;
    color: #ffffff !important;
}

body.theme-paper .roll-stacked-lines {
    color: #e2e8f0 !important;
}

body.theme-paper .roll-stacked-lines span {
    color: #e2e8f0 !important;
}

/* Buff Armour Body Location Interactive Diagram */
.armour-legend-bar {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    display: flex;
    gap: 1.8rem;
    align-items: center;
    justify-content: center;
}

.sq-legend-icon {
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(56, 189, 248, 0.15);
}

.rd-legend-icon {
    color: var(--accent-purple);
    border: 1.5px solid var(--accent-purple);
    padding: 2px 7px;
    border-radius: 14px;
    background: rgba(192, 132, 252, 0.15);
}

.armour-body-wrapper {
    position: relative;
    width: 380px;
    height: 380px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.5);
    border: 1.5px solid var(--input-border);
    border-radius: 16px;
    padding: 10px;
}

@media (max-width: 480px) {
    .armour-body-wrapper {
        width: 100%;
        height: 360px;
    }
}

.armour-svg-diagram {
    width: 100%;
    height: 100%;
}

.armour-part {
    stroke: var(--primary);
    fill: rgba(56, 189, 248, 0.12);
    stroke-width: 2.8;
    transition: all 0.2s ease;
}

/* Positioned Location Badges */
.loc-badge {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    z-index: 10;
}

.loc-label {
    font-size: 0.65rem;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(15, 23, 42, 0.95);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.btn-repair-all-icon {
    background: rgba(34, 197, 94, 0.18);
    border: 1.5px solid #22c55e;
    color: #4ade80;
    font-size: 1.1rem;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.btn-repair-all-icon:hover {
    background: #22c55e;
    color: #0f172a;
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
}

.loc-toughness-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.armour-adjust-btn {
    width: 26px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-size: 0.55rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1;
}

.armour-adjust-btn:hover {
    transform: scale(1.2);
}

.btn-armour-down:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}

.btn-armour-up:hover {
    background: #22c55e !important;
    color: #ffffff !important;
    border-color: #22c55e !important;
}

/* PERFEKT Rund Cirkel (Total Toughness inc. Armour) */
.loc-input.rd {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    text-align: center;
    font-weight: 900;
    font-size: 0.88rem;
    padding: 0;
    border: 2px solid var(--accent-purple);
    background: rgba(192, 132, 252, 0.25);
    color: var(--text-main);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), 0 0 10px rgba(192, 132, 252, 0.4);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.loc-input.rd.damaged {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.35) !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.9) !important;
    animation: pulseDamage 1.5s infinite alternate;
}

@keyframes pulseDamage {
    0% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
    100% { box-shadow: 0 0 16px rgba(239, 68, 68, 1); }
}

body.theme-paper .loc-input.rd {
    border-color: #9333ea;
    background: #f3e8ff;
    color: #581c87;
}

body.theme-paper .loc-input.rd.damaged {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
    color: #991b1b !important;
}

/* Precise Positions: 
   - HEAD centered ABOVE robot head with horizontal side arrows (top: 4px; left: 50%; transform: translateX(-50%);)
   - TORSO moved UP inside chest (top: 114px)
   - ARMS outside shoulders (top: 130px; left: 8px; right: 8px;)
   - LEGS closer to legs (bottom: 25px; left: 70px; right: 70px;)
*/
.loc-badge.head-c { top: -1px; left: 50%; transform: translateX(-50%); }

.loc-badge.l-arm  { top: 130px; left: 8px; }
.loc-badge.torso  { top: 114px; left: 50%; transform: translateX(-50%); } /* INSIDE CHEST */
.loc-badge.r-arm  { top: 130px; right: 8px; }

.loc-badge.l-leg  { bottom: 25px; left: 70px; }
.loc-badge.r-leg  { bottom: 25px; right: 70px; }

.loc-toughness-control.horiz {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.loc-toughness-control.horiz .armour-adjust-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* Suit Details & Summary Fields Moved BELOW Character Diagram */
.armour-bottom-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1.5px dashed var(--border-color);
}

/* Wounds & Fatigue Checkboxes & Causes */
.wounds-fatigue-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.shaken-section {
    flex: 0 0 auto;
}

.shaken-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

#shaken-box.checked {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #0f172a !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
    animation: pulseDamage 1.5s infinite alternate;
}

.btn-roll-unshake {
    background: rgba(192, 132, 252, 0.15);
    color: var(--accent-purple);
    border: 1.5px solid var(--accent-purple);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    user-select: none;
    height: 28px;
}

.btn-roll-unshake:hover {
    background: var(--accent-purple);
    color: #0f172a;
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.5);
    transform: scale(1.04);
}

body.theme-paper .btn-roll-unshake {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #9333ea;
}

body.theme-paper .btn-roll-unshake:hover {
    background: #9333ea;
    color: #ffffff;
}

.btn-roll-stress {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1.5px solid rgba(239, 68, 68, 0.6);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    user-select: none;
    height: 28px;
}

.btn-roll-stress:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
    transform: scale(1.04);
}

.btn-roll-stress-release {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1.5px solid rgba(34, 197, 94, 0.6);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    user-select: none;
    height: 28px;
}

.btn-roll-stress-release:hover {
    background: #22c55e;
    color: #0f172a;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
    transform: scale(1.04);
}

#stressed-box.checked {
    background: #38bdf8 !important;
    border-color: #38bdf8 !important;
    color: #0f172a !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.wounds-section {
    flex: 0 0 auto;
}

.fatigue-section {
    flex: 1 1 auto;
}

.fatigue-rows {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.fatigue-row {
    display: flex;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 0.5rem;
    white-space: nowrap;
}

.fatigue-source-input {
    width: 150px;
    max-width: 180px;
    flex: 0 1 150px;
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    box-sizing: border-box;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.custom-checkbox {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 900;
    font-size: 0.9rem;
    user-select: none;
    transition: all 0.2s ease;
}

.custom-checkbox.checked {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

/* Add Row Buttons (+ Tilføj) */
.btn-add-skill, .btn-add-row {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border: 1.5px dashed var(--border-color);
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    margin-top: 0.8rem;
    transition: all 0.2s ease;
}

.btn-add-skill:hover, .btn-add-row:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Tables for Possessions, Edges, Hindrances, Vehicles, Weapons */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.data-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.theme-paper .data-table td {
    border-bottom: 1px solid #cbd5e1;
}

.table-input {
    width: 100%;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-main);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.table-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Floating Roll Log Drawer */
.roll-drawer {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    z-index: 999;
    transition: padding 0.2s ease, width 0.2s ease;
}

.roll-drawer.collapsed {
    padding: 0.5rem 0.9rem;
    width: auto;
}

.roll-drawer.collapsed .roll-history {
    display: none;
}

.roll-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 800;
    font-size: 0.92rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
}

.btn-clear-log {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(244, 63, 94, 0.4);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-log:hover {
    background: var(--accent-red);
    color: #ffffff;
}

.roll-history {
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.roll-entry {
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
}

.roll-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-weight: 800;
}

.roll-total-badge {
    background: var(--primary);
    color: #0f172a;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    font-weight: 900;
    font-size: 0.92rem;
    white-space: nowrap;
}

.roll-stacked-lines {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.roll-stacked-lines div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

/* Tooltip Popup */
.tooltip-popup {
    position: absolute;
    background: #0f172a;
    color: #f8fafc;
    border: 1.5px solid var(--primary);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 1000;
    max-width: 320px;
    white-space: pre-wrap;
    word-break: break-word;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip-popup.active {
    opacity: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border-color); padding: 1rem; }
    .main-content { padding: 1.5rem 1rem; }
    .roll-drawer { width: calc(100% - 2rem); left: 1rem; right: 1rem; }
}

/* 🖨️ PRINT & PDF STYLESHEET ENGINE (Fold ALL textareas completely out) */
@media print {
    @page {
        size: A4 portrait;
        margin: 1.2cm;
    }

    /* Force background graphic colors to print cleanly */
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        display: block !important;
    }

    /* Hide Non-Printable Elements */
    .sidebar,
    .control-bar,
    .roll-drawer,
    .roll-toast-banner,
    .tooltip-popup,
    .btn-add-skill,
    .btn-add-row,
    .btn-calc,
    .btn-counter,
    .btn-clear-log,
    .reset-btn,
    #upload-portrait-btn,
    #remove-portrait-btn,
    .portrait-placeholder span:nth-child(2),
    .portrait-placeholder span:nth-child(3) {
        display: none !important;
    }

    .main-content {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .box, .sheet-header {
        background: #ffffff !important;
        border: 1.5px solid #000000 !important;
        color: #000000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .box-header {
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
    }

    .field-input, .table-input {
        background: #ffffff !important;
        color: #000000 !important;
        border: 1px solid #666666 !important;
    }

    /* FOLD ALLE BESKRIVELSESFELTER OG BIOGRAFIFELTER 100% UD VED UDSKRIVNING */
    .desc-textarea, .bio-textarea {
        background: #ffffff !important;
        color: #000000 !important;
        border: 1px solid #666666 !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        white-space: pre-wrap !important;
        word-break: break-word !important;
        resize: none !important;
    }

    /* Rustningsdiagram & Badges */
    .armour-body-wrapper {
        background: #f8fafc !important;
        border-color: #000000 !important;
    }

    .armour-part {
        stroke: #000000 !important;
        fill: #f1f5f9 !important;
    }

    .loc-label {
        background: #ffffff !important;
        color: #000000 !important;
        border-color: #000000 !important;
    }

    .loc-input.sq {
        background: #ffffff !important;
        color: #000000 !important;
        border-color: #000000 !important;
    }

    .loc-input.rd {
        background: #e9d5ff !important;
        color: #581c87 !important;
        border-color: #7e22ce !important;
    }

    .dice-svg polygon, .dice-svg rect {
        stroke: #000000 !important;
    }

    .dice-btn.selected .dice-svg polygon, .dice-btn.selected .dice-svg rect {
        fill: #a855f7 !important;
        stroke: #000000 !important;
    }

    .dice-btn.selected .dice-svg text {
        fill: #ffffff !important;
    }

    .portrait-container {
        border-color: #000000 !important;
        background: #ffffff !important;
        height: 280px !important;
    }
}

/* =========================================================================
   DRAG-AND-DROP LAYOUT EDITOR
   ========================================================================= */

/* Edit Mode Styles */
body.layout-edit-mode .box {
    border: 2px dashed var(--primary);
    background: rgba(56, 189, 248, 0.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

body.theme-paper.layout-edit-mode .box {
    background: rgba(2, 132, 199, 0.03);
}

body.layout-edit-mode .box-header {
    cursor: grab;
}

body.layout-edit-mode .box-header:active {
    cursor: grabbing;
}

/* Drag Handle */
.drag-handle {
    display: none;
    cursor: grab;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: bold;
    padding: 0 0.5rem;
    user-select: none;
    transition: transform 0.2s;
}

.drag-handle:hover {
    transform: scale(1.2);
}

body.layout-edit-mode .drag-handle {
    display: inline-block;
}

/* Dragging States */
.box.dragging {
    opacity: 0.5;
    border: 2px solid var(--accent-pink) !important;
    transform: scale(0.98);
}

.layout-column {
    min-height: 100px;
    border-radius: 12px;
    transition: background-color 0.2s;
}

body.layout-edit-mode .layout-column {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
}

body.theme-paper.layout-edit-mode .layout-column {
    border-color: rgba(0, 0, 0, 0.1);
}

.layout-column.drag-over {
    background: rgba(56, 189, 248, 0.05);
}

body.theme-paper .layout-column.drag-over {
    background: rgba(2, 132, 199, 0.05);
}

/* Linked Modifier Pills & Table Cell Alignment Styling */
.modifier-pills-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
}

.modifier-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modifier-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.modifier-pill.positive {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.45);
}

.modifier-pill.positive:hover {
    background: rgba(34, 197, 94, 0.35);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.modifier-pill.negative {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.45);
}

.modifier-pill.negative:hover {
    background: rgba(239, 68, 68, 0.35);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.modifier-pill.disabled {
    opacity: 0.35;
    filter: grayscale(0.8);
    text-decoration: line-through;
    box-shadow: none !important;
}

.data-table td.has-modifier-pills {
    display: flex;
    align-items: center;
    gap: 6px;
}

.data-table td.has-modifier-pills input {
    flex: 1;
    min-width: 80px;
}

/* Modal Overlay & Dialog Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 999999 !important;
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
}

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

.modal-card {
    background: var(--card-bg, #1e293b);
    border: 1.5px solid var(--border-color, #334155);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    padding: 1.5rem 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.modal-desc {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.modal-choices-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0.5rem 0;
}

.choice-option-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.choice-option-card:hover {
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--primary);
}

.choice-option-card.selected {
    background: rgba(56, 189, 248, 0.16);
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.choice-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.choice-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.choice-req {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
}

/* Powered Armor Power Toggle Micro Flip-Switch */
.btn-armour-power {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 1px 6px;
    height: 18px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--primary);
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    line-height: 1;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.2);
    flex-shrink: 0;
}

.btn-armour-power:hover {
    background: rgba(56, 189, 248, 0.3);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
    transform: scale(1.05);
}

.btn-armour-power.depowered {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.3) !important;
}

.btn-armour-power.depowered:hover {
    background: rgba(239, 68, 68, 0.35) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.55) !important;
    transform: scale(1.05);
}

/* ==========================================================================
   CHEMICAL & DRUG ADDICTION TRACKER STYLES
   ========================================================================== */
.drugs-tracker-box {
    margin-top: 1.5rem;
    border-color: rgba(56, 189, 248, 0.3) !important;
}

.drugs-status-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.drugs-status-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
}

.status-card-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.gauge-bar-outer {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.gauge-bar-inner.medical-bar {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #3b82f6, #ef4444);
    transition: width 0.3s ease;
}

.taste-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    flex: 1;
    text-align: center;
}

.taste-pill.active {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);

}

.taste-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
}

.taste-val {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text-main);
}

.taste-pill.active .taste-val {
    color: #ef4444;
}

.flush-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
}

.flush-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.drugs-dose-panel {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.panel-subtitle {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.dose-form-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr;
    gap: 12px;
}

@media (max-width: 768px) {
    .dose-form-grid {
        grid-template-columns: 1fr;
    }
}

.active-hits-container, .addictions-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-hits-msg {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

.hit-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
}

.hit-card.waiting {
    border-left: 4px solid #f59e0b;
}

.hit-card.active {
    border-left: 4px solid #10b981;
}

.hit-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    width: 100%;
}

.hit-name {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-main);
}

.hit-status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
}

.hit-card.waiting .hit-status-badge {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.hit-card.active .hit-status-badge {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
}

.hit-effect {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.addiction-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
}

.addiction-card.withdrawal {
    border-left: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

.addiction-card.suppressed {
    border-left: 4px solid #10b981;
}

.addiction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.addiction-title {
    font-size: 0.9rem;
    color: var(--text-main);
}

.addiction-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

/* Compact, Right-Aligned Trashcan Delete Row Button */
.btn-del-row {
    background: transparent !important;
    border: none !important;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px !important;
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1;
    transition: all 0.2s ease;
    margin-left: auto !important; /* Pushes button all the way to the right edge */
    flex-shrink: 0;
    width: auto !important;
    max-width: fit-content !important;
    box-shadow: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-del-row:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    transform: scale(1.15);
}

.daily-dose-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-main);
    cursor: pointer;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-info {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Collapsible Drug Tracker Box */
.drugs-tracker-box.collapsed .drugs-status-section,
.drugs-tracker-box.collapsed .drugs-dose-panel,
.drugs-tracker-box.collapsed .drugs-active-hits-section,
.drugs-tracker-box.collapsed .drugs-addictions-section {
    display: none !important;
}

.drugs-tracker-box.collapsed {
    padding-bottom: 0.6rem !important;
    margin-bottom: 1rem !important;
}

.drugs-tracker-box.collapsed .box-header {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Custom Cyberpunk Modal Overlay & Popup Cards */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem !important;
    box-sizing: border-box !important;
}

.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"] {
    display: none !important;
}

/* =========================================================================
   1-HANDED & 2-HANDED WEAPON HAND BADGES & ICONS
   ========================================================================= */
.hand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    user-select: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    vertical-align: middle;
}

.hand-badge:hover {
    transform: scale(1.08);
    filter: brightness(1.25);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.hand-badge:active {
    transform: scale(0.95);
}

/* 1-Handed Badge (Single Hand ✋) */
.hand-badge.one-hand {
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* 2-Handed Badge (Two Overlapping Hands 👐 / †) */
.hand-badge.two-hand {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.2);
}

.hand-badge .hand-icon {
    display: inline-block;
    font-size: 0.85rem;
    margin-right: 2px;
}

/* Overlapping Dual-Hand Effect */
.hand-badge.two-hand .two-hands-container {
    display: inline-flex;
    align-items: center;
    position: relative;
    width: 18px;
    height: 14px;
    margin-right: 2px;
}

.hand-badge.two-hand .two-hands-container .h-left {
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.75rem;
    z-index: 1;
}

.hand-badge.two-hand .two-hands-container .h-right {
    position: absolute;
    left: 6px;
    top: 0;
    font-size: 0.75rem;
    z-index: 2;
    transform: scaleX(-1);
    opacity: 0.9;
}

/* Weapon Data Tables Layout Improvements */
.weapon-name-cell {
    position: relative;
}

.weapon-autocomplete-wrap {
    position: relative;
    width: 100%;
}

.armour-preset-dropdown {
    width: 100%;
    margin-bottom: 0.6rem;
}

/* =========================================================================
   AMMUNITION INVENTORY & SHOOTING BURST CONTROLS (HARDWARE PAGE 25 & 12)
   ========================================================================= */
.ammo-inventory-section {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 1.2rem;
}

body.theme-paper .ammo-inventory-section {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.loaded-shots-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    padding: 2px 4px;
}

body.theme-paper .loaded-shots-wrap {
    background: #ffffff;
    border-color: #cbd5e1;
}

.loaded-shots-input {
    width: 36px !important;
    padding: 2px 4px !important;
    text-align: center !important;
    font-weight: 800 !important;
    font-size: 0.85rem !important;
    border: none !important;
    background: transparent !important;
}

.max-shots-input {
    width: 32px !important;
    padding: 2px 4px !important;
    text-align: center !important;
    font-size: 0.78rem !important;
    color: var(--text-muted) !important;
    border: none !important;
    background: transparent !important;
}

.btn-shoot-single, .btn-shoot-burst, .btn-shoot-auto, .btn-reload-gun {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    height: 22px;
    white-space: nowrap;
}

.weapon-action-btn-group {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    margin-top: 3px;
}

.btn-toggle-attach {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--text-muted);
    transition: all 0.2s ease;
    height: 22px;
    width: 100%;
    margin-top: 3px;
    white-space: nowrap;
}
.btn-toggle-attach:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-roll-dam, .btn-roll-fight {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
    transition: all 0.2s ease;
    height: 22px;
    white-space: nowrap;
}
.btn-roll-dam:hover, .btn-roll-fight:hover {
    background: var(--primary);
    color: #0f172a;
    transform: scale(1.05);
}

#ranged-table tbody td, #melee-table tbody td {
    vertical-align: top;
    padding: 6px 3px;
}

.btn-shoot-single {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-shoot-single:hover {
    background: var(--primary);
    color: #0f172a;
    transform: scale(1.05);
}

.btn-shoot-burst {
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid #f59e0b;
    color: #fbbf24;
}
.btn-shoot-burst:hover {
    background: #f59e0b;
    color: #0f172a;
    transform: scale(1.05);
}

.btn-shoot-auto {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid #ef4444;
    color: #f87171;
}
.btn-shoot-auto:hover {
    background: #ef4444;
    color: #ffffff;
    transform: scale(1.05);
}

.btn-reload-gun {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid #22c55e;
    color: #4ade80;
    margin-top: 3px;
}
.btn-reload-gun:hover {
    background: #22c55e;
    color: #0f172a;
    transform: scale(1.05);
}

.ammo-stepper-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-ammo-step {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: var(--primary);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 800;
}
.btn-ammo-step:hover {
    background: var(--primary);
    color: #0f172a;
}

/* =========================================================================
   WEAPON DAMAGE TOAST & BREAKDOWN CARD STYLING (Human-friendly readability)
   ========================================================================= */
.damage-toast-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px 12px;
}

.damage-breakdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--text-main);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
    padding-bottom: 4px;
}

.damage-breakdown-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.damage-breakdown-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 600;
}

.damage-breakdown-val {
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}

.damage-ap-pill {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-red);
    border: 1px solid rgba(244, 63, 94, 0.4);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    margin-left: 6px;
    display: inline-block;
    vertical-align: middle;
}

/* =========================================================================
   CUSTOM DICE ROLL BUILDER & FLOATING EDGE TAB TRIGGER
   ========================================================================= */

/* Floating Right Edge Tab Trigger */
.custom-roller-tab-trigger {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1.5px solid var(--primary);
    border-right: none;
    border-radius: 10px 0 0 10px;
    color: var(--primary);
    padding: 0.75rem 0.55rem;
    cursor: pointer;
    z-index: 999;
    box-shadow: -4px 0 16px rgba(56, 189, 248, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.custom-roller-tab-trigger:hover {
    background: var(--primary);
    color: #0f172a;
    box-shadow: -6px 0 22px rgba(56, 189, 248, 0.6);
    padding-right: 0.85rem;
}

.custom-roller-tab-trigger.drawer-open {
    right: 360px; /* Slides along with drawer */
    box-shadow: -4px 0 16px rgba(56, 189, 248, 0.4);
}

.custom-roller-tab-trigger .trigger-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.custom-roller-tab-trigger .trigger-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    font-weight: 900;
}

.custom-roller-tab-trigger.hidden {
    display: none !important;
}

body.theme-paper .custom-roller-tab-trigger {
    background: #ffffff;
    border-color: #0284c7;
    color: #0284c7;
    box-shadow: -3px 0 12px rgba(2, 132, 199, 0.2);
}

body.theme-paper .custom-roller-tab-trigger:hover {
    background: #0284c7;
    color: #ffffff;
}

/* Slide-Out Drawer from Right Screen Edge */
.custom-roller-drawer {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(105%); /* Hidden off-screen right */
    width: 360px;
    max-width: calc(100vw - 3.5rem);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-right: none;
    border-radius: 16px 0 0 16px;
    padding: 1.1rem;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    z-index: 998;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}

.custom-roller-drawer.open {
    transform: translateY(-50%) translateX(0); /* Slides right out from edge! */
    opacity: 1;
    pointer-events: auto;
}

.custom-roller-drawer.hidden {
    display: none !important;
}

.custom-roller-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--primary);
    margin-bottom: 0.7rem;
}

.custom-roller-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-roller-control {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--primary);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
    transition: all 0.2s ease;
}

.btn-roller-control:hover {
    background: var(--primary);
    color: #0f172a;
}

/* Mode Selector Tabs */
.roller-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
    margin-bottom: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px;
    border-radius: 8px;
}

.roller-tab-btn {
    background: transparent;
    border: none;
    padding: 0.45rem 0.3rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.roller-tab-btn.active {
    background: var(--primary);
    color: #0f172a;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

body.theme-paper .roller-tab-btn.active {
    background: #0284c7;
    color: #ffffff;
}

/* =========================================================================
   ROLL TABLE (TENS & ONES - 2 DISTINCT COLORS)
   ========================================================================= */
.roller-table-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0.85rem;
}

.table-dice-preview {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.table-plus-separator {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--text-muted);
    text-align: center;
}

.table-die-box {
    border-radius: 12px;
    padding: 0.7rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

/* Tens Die (Color A: Vibrant Purple) */
.table-die-box.tens-die {
    background: rgba(168, 85, 247, 0.12);
    border: 2px solid #a855f7;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.25);
}

.table-die-box.tens-die .table-die-tag {
    background: #a855f7;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.table-die-box.tens-die .table-die-val {
    font-size: 2rem;
    font-weight: 900;
    color: #c084fc;
    line-height: 1;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* Ones Die (Color B: Vibrant Emerald / Green) */
.table-die-box.ones-die {
    background: rgba(16, 185, 129, 0.12);
    border: 2px solid #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.table-die-box.ones-die .table-die-tag {
    background: #10b981;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.table-die-box.ones-die .table-die-val {
    font-size: 2rem;
    font-weight: 900;
    color: #34d399;
    line-height: 1;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.table-die-select {
    width: 100%;
    font-size: 0.78rem;
    height: 28px;
    padding: 2px 4px;
    text-align: center;
}

.table-quick-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.btn-table-preset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.35rem 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-table-preset:hover {
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-table-preset.active {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

/* Dice Pool Grid - 5 Savage Worlds Dice (d4, d6, d8, d10, d12) */
.roller-dice-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 0.85rem;
}

.roller-die-chip {
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    padding: 0.5rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    user-select: none;
    transition: all 0.2s ease;
}

.roller-die-chip.has-dice {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.08);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.roller-die-chip .die-icon {
    font-size: 1.1rem;
    line-height: 1;
    margin-bottom: 2px;
}

.roller-die-chip .die-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-main);
}

.roller-die-chip .die-count-badge {
    position: absolute;
    top: 4px;
    right: 5px;
    background: var(--primary);
    color: #0f172a;
    font-size: 0.72rem;
    font-weight: 900;
    min-width: 17px;
    height: 17px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1px;
}

.roller-die-chip.has-dice .die-count-badge {
    display: flex;
}

.chip-steppers {
    display: flex;
    gap: 4px;
    margin-top: 5px;
    width: 100%;
}

.btn-step {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 2px 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-step:hover {
    background: var(--primary);
    color: #0f172a;
}

/* Parameters Row */
.roller-params-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 0.85rem;
}

.roller-params-row .param-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.roller-params-row .param-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.param-input {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    height: 32px;
}

.mod-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-mod-btns {
    display: flex;
    gap: 2px;
}

.btn-quick-mod {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-quick-mod:hover {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
}

/* Action Bar */
.roller-action-bar {
    display: flex;
    gap: 8px;
}

.btn-roller-clear {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.4);
    color: var(--accent-red);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.55rem 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-roller-clear:hover {
    background: var(--accent-red);
    color: #ffffff;
}

.btn-roller-exec {
    flex: 1;
    background: var(--primary);
    color: #0f172a;
    border: none;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 800;
    padding: 0.55rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
    transition: all 0.2s ease;
}

.btn-roller-exec:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
}

.formula-preview-text {
    font-size: 0.8rem;
    opacity: 0.85;
    font-weight: normal;
}

@media (max-width: 1200px) {
    .custom-roller-drawer {
        right: 1.5rem;
        bottom: calc(340px + 2rem);
    }
}

/* =========================================================================
   EBB POWERS & DEATHSUIT BOND SECTION STYLES
   ========================================================================= */
#box-ebb-powers {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.1);
}

.ebb-race-badge {
    background: rgba(168, 85, 247, 0.15);
    border: 1.5px solid #a855f7;
    color: #c084fc;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}

body.theme-paper .ebb-race-badge {
    background: rgba(147, 51, 234, 0.1);
    color: #7e22ce;
    border-color: #7e22ce;
}

/* Ebb Top Dashboard: 2-Column Grid (Flux Pool vs Deathsuit Bond) */
.ebb-top-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1rem;
}

@media (max-width: 860px) {
    .ebb-top-dashboard {
        grid-template-columns: 1fr;
    }
}

/* Flux Pool Energy Card */
.ebb-flux-panel {
    background: var(--input-bg);
    border: 1.5px solid rgba(56, 189, 248, 0.35);
    border-radius: 10px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flux-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flux-title {
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 0.04em;
}

.flux-regen-tag {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
}

.flux-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-flux-step {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 900;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-flux-step:hover {
    background: var(--primary);
    color: #0f172a;
}

.flux-values-display {
    display: flex;
    align-items: center;
    gap: 4px;
}

.flux-input-num {
    width: 48px;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--primary);
    height: 32px;
    padding: 2px;
}

.flux-divider {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-muted);
}

.flux-quick-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.btn-flux-quick {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 7px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-flux-quick:hover {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
    border-color: var(--primary);
}

/* Deathsuit Bond Status Card */
.ebb-deathsuit-panel {
    background: var(--input-bg);
    border: 1.5px solid rgba(168, 85, 247, 0.35);
    border-radius: 10px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deathsuit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deathsuit-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #c084fc;
}

.deathsuit-stats-pill {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid #a855f7;
    color: #e9d5ff;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
}

.deathsuit-details-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.deathsuit-perk-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
}

.deathsuit-perk-item strong {
    color: var(--text-main);
}

.deathsuit-override-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

/* Unlocked Disciplines Bar */
.ebb-disciplines-bar {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.disciplines-bar-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.unlocked-disciplines-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.discipline-tag-chip {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid #a855f7;
    color: #c084fc;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: default;
}

.btn-remove-discipline {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-remove-discipline:hover {
    color: var(--accent-red);
}

.btn-unlock-discipline {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-unlock-discipline:hover {
    background: var(--primary);
    color: #0f172a;
}

/* Ebb Power Table Row Specifics */
.ebb-power-roll-btn {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.15s ease;
}

.ebb-power-roll-btn:hover {
    background: var(--primary);
    color: #0f172a;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.ebb-power-expand-row td {
    background: rgba(0, 0, 0, 0.25) !important;
    padding: 0.6rem 0.9rem !important;
    border-bottom: 1.5px solid var(--border-color);
}

body.theme-paper .ebb-power-expand-row td {
    background: rgba(0, 0, 0, 0.04) !important;
}

.ebb-power-detail-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-main);
}

.ebb-detail-raise {
    color: #34d399;
    font-weight: 700;
}

.ebb-detail-augmentations {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ebb-aug-item {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

.ebb-aug-item strong {
    color: var(--primary);
}

/* Ebb Discipline Modal Card Styling */
.ebb-disc-choice-card {
    background: var(--input-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.2s ease;
}

.ebb-disc-choice-card:hover:not(.disabled) {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.08);
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.2);
}

.ebb-disc-choice-card.unlocked {
    border-color: rgba(52, 211, 153, 0.5);
    background: rgba(52, 211, 153, 0.05);
}

.ebb-disc-choice-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ebb-disc-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.ebb-disc-header-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ebb-disc-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-main);
}

.ebb-disc-tag {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.ebb-disc-tag.ebon {
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.ebb-disc-tag.waster {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.ebb-disc-innate {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.btn-unlock-choice {
    background: rgba(168, 85, 247, 0.2);
    border: 1.5px solid #a855f7;
    color: #e9d5ff;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-unlock-choice:hover:not(:disabled) {
    background: #a855f7;
    color: #0f172a;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.btn-unlock-choice:disabled {
    background: rgba(52, 211, 153, 0.2);
    border-color: #10b981;
    color: #34d399;
    cursor: default;
}

/* =========================================================================
   COMPENDIUM / LIBRARY MODAL POPUP & BROWSE BUTTONS
   ========================================================================= */

.table-actions-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.table-actions-row .btn-add-row {
    flex: 1;
    margin-top: 0;
}

.btn-browse-compendium {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-browse-compendium:hover {
    background: var(--primary);
    color: #0f172a;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

.compendium-modal-card {
    max-width: 860px;
    width: 95vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 1.4rem;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.compendium-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.compendium-count-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.compendium-search-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0.8rem 0 1rem 0;
}

.compendium-search-input-wrap {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.compendium-search-input-wrap .search-icon {
    position: absolute;
    left: 12px;
    font-size: 0.95rem;
    pointer-events: none;
    opacity: 0.7;
}

.compendium-search-input {
    width: 100%;
    padding: 0.65rem 2.2rem 0.65rem 2.4rem;
    font-size: 0.88rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

.compendium-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.btn-search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
}

.btn-search-clear:hover {
    color: var(--accent-red);
}

.compendium-filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.compendium-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compendium-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

.compendium-chip.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 800;
}

.compendium-modal-list {
    overflow-y: auto;
    max-height: 60vh;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.compendium-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
}

.compendium-card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.03);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.compendium-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.compendium-card-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.compendium-card-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.compendium-tag {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.compendium-tag.category {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.compendium-tag.rank {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.compendium-tag.cost {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.compendium-pills-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.compendium-stat-pill {
    font-size: 0.74rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.compendium-stat-pill strong {
    color: var(--primary);
}

.compendium-card-desc {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.45;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.compendium-card-req {
    font-size: 0.76rem;
    color: #f59e0b;
    font-weight: 700;
}

.btn-compendium-add {
    background: rgba(56, 189, 248, 0.15);
    border: 1.5px solid var(--primary);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-compendium-add:hover {
    background: var(--primary);
    color: #0f172a;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

.btn-compendium-add.added {
    background: rgba(52, 211, 153, 0.2);
    border-color: #10b981;
    color: #34d399;
}

/* =========================================================================
   WEAPON ATTACHMENTS & AMMO DRAWER (OPTION 1)
   ========================================================================= */

.btn-toggle-attach {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-toggle-attach:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-toggle-attach.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 800;
}

.weapon-subrow {
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.weapon-subrow td {
    padding: 0.5rem 0.8rem !important;
}

.weapon-attachments-panel {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.78rem;
}

.attach-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.attach-label {
    font-weight: 800;
    color: var(--text-muted);
    font-size: 0.74rem;
    white-space: nowrap;
}

.attach-select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.76rem;
    padding: 3px 6px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.attach-select:focus {
    border-color: var(--primary);
}

.attach-badges-display {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.attach-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.attach-badge.ammo-he {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.attach-badge.ammo-ap {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

.attach-badge.baffling {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.3);
}

/* =========================================================================
   HINDRANCE POINTS DASHBOARD & ALLOCATION WIDGET
   ========================================================================= */
.hindrance-points-dashboard {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
}

.hp-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.hp-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
}

.hp-badge {
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-weight: 800;
}

.hp-badge.warning {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.hp-badge.complete {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
}

.btn-hp-ledger {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-hp-ledger:hover {
    background: rgba(56, 189, 248, 0.25);
    transform: translateY(-1px);
}

.hp-allocations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.hp-alloc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 4px 8px;
}

.hp-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.hp-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-hp-step {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--primary);
    border-radius: 4px;
    font-weight: 900;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.btn-hp-step:hover {
    background: var(--primary);
    color: #0f172a;
}

.hp-alloc-input {
    width: 26px;
    text-align: center;
    background: transparent;
    border: none;
    color: #fff;
    font-weight: 900;
    font-size: 0.85rem;
    outline: none;
}

/* =========================================================================
   POINT-BUY & ADVANCEMENT LEDGER MODAL
   ========================================================================= */
.point-ledger-modal {
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 12px;
    width: 90vw;
    max-width: 950px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.point-ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(30, 41, 59, 0.8);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.point-ledger-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.point-ledger-body {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.point-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.point-summary-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.point-summary-card.active {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.08);
}

.point-card-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

.point-card-value {
    font-size: 1.25rem;
    font-weight: 900;
    color: #fff;
}

.point-card-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.point-ledger-section {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 1rem;
}

.point-section-title {
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.ledger-table th {
    text-align: left;
    padding: 6px 8px;
    color: var(--text-muted);
    font-weight: 800;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.ledger-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ledger-table tr:hover {
    background: rgba(56, 189, 248, 0.05);
}

.ledger-stepper-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-start;
}

.btn-ledger-step {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: var(--primary);
    border-radius: 5px;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    user-select: none;
}

.btn-ledger-step:hover {
    background: var(--primary);
    color: #0f172a;
    border-color: var(--primary);
    transform: scale(1.15);
}

body.theme-paper .btn-ledger-step {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #38bdf8;
}

body.theme-paper .btn-ledger-step:hover {
    background: #0284c7;
    color: #ffffff;
}
