.character-sheet.char-edit-foundry-shell {
    --char-edit-bg: #050610;
    --char-edit-surface: rgba(6, 7, 16, 0.96);
    --char-edit-surface-2: rgba(8, 9, 18, 0.96);
    --char-edit-surface-3: rgba(6, 7, 16, 0.78);
    --char-edit-border: rgba(240, 195, 93, 0.24);
    --char-edit-border-soft: rgba(240, 195, 93, 0.16);
    --char-edit-border-strong: rgba(240, 195, 93, 0.34);
    --char-edit-panel-border: rgba(240, 195, 93, 0.24);
    --char-edit-panel-header: linear-gradient(90deg, rgba(31, 36, 75, 0.96), rgba(42, 29, 78, 0.9));
    --char-edit-card-bg: rgba(6, 7, 16, 0.58);
    --char-edit-card-bg-hover: rgba(16, 15, 30, 0.66);
    --char-edit-gold: var(--admin-gold, #f0c35d);
    --char-edit-gold-soft: #f3dfb5;
    --char-edit-blue: #7db6ff;
    --char-edit-cyan: #63d7ff;
    --char-edit-red: #ff5d79;
    --char-edit-green: #5be2a3;
    --char-edit-text: #e8ecff;
    --char-edit-muted: #9ba8ce;
    --char-edit-field: rgba(6, 7, 16, 0.82);
    --char-edit-radius: 14px;

    position: relative;
    isolation: isolate;
    max-width: 1220px;
    margin: 0 auto;
    padding: 6px 14px 28px;
    color: var(--char-edit-text);
    font-family: "Alegreya Sans", "Trebuchet MS", "Segoe UI", sans-serif;
}

.character-sheet.char-edit-foundry-shell .char-edit-window {
    min-height: calc(100vh - 18px);
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(4, 5, 12, 0.98), rgba(3, 4, 10, 0.99)),
        #050610;
    border: 1px solid rgba(240, 195, 93, 0.34);
    border-radius: 13px;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.58),
        inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.character-sheet.char-edit-foundry-shell .char-edit-window-bar {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 12px 7px 16px;
    background:
        linear-gradient(90deg, rgba(112, 70, 151, 0.95), rgba(59, 33, 99, 0.92) 52%, rgba(28, 22, 56, 0.96));
    border-bottom: 1px solid rgba(240, 195, 93, 0.24);
    color: #f8efff;
}

.character-sheet.char-edit-foundry-shell .char-edit-window-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.character-sheet.char-edit-foundry-shell .char-edit-window-title-main {
    max-width: 48vw;
    overflow: hidden;
    color: #fff;
    font-size: 1rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-sheet.char-edit-foundry-shell .char-edit-window-title-sub {
    color: rgba(255, 244, 205, 0.86);
    font-size: 0.76rem;
    font-weight: 800;
}

.character-sheet.char-edit-foundry-shell .char-edit-window-body {
    padding: 16px 16px 0;
}

.character-sheet.char-edit-foundry-shell .char-edit-window-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding: 10px 14px;
    background:
        linear-gradient(180deg, rgba(5, 6, 13, 0), rgba(5, 6, 13, 0.95) 22%),
        rgba(5, 6, 13, 0.96);
    border-top: 1px solid rgba(240, 195, 93, 0.18);
}

.character-sheet.char-edit-foundry-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 16% 0%, rgba(126, 109, 216, 0.18), transparent 34%),
        radial-gradient(circle at 82% 12%, rgba(240, 195, 93, 0.09), transparent 28%),
        linear-gradient(135deg, rgba(7, 8, 20, 0.94), rgba(15, 13, 31, 0.96) 48%, rgba(9, 12, 25, 0.96));
}

.character-sheet.char-edit-foundry-shell #characterForm {
    display: block;
}

.character-sheet.char-edit-foundry-shell .card {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 246, 220, 0.022), transparent 36%),
        linear-gradient(145deg, rgba(8, 10, 18, 0.98), rgba(3, 4, 10, 0.98)),
        var(--char-edit-surface) !important;
    border: 1px solid rgba(240, 195, 93, 0.22) !important;
    border-radius: 12px !important;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.character-sheet.char-edit-foundry-shell .card::before {
    display: none !important;
}

.character-sheet.char-edit-foundry-shell .card > * {
    position: relative;
    z-index: 1;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type {
    border: 1px solid rgba(240, 195, 93, 0.22) !important;
    border-radius: 12px !important;
    background:
        radial-gradient(circle at 78% 22%, rgba(240, 195, 93, 0.1), transparent 22%),
        linear-gradient(90deg, rgba(22, 28, 58, 0.97), rgba(23, 18, 45, 0.94) 52%, rgba(7, 8, 15, 0.97)),
        var(--char-edit-surface-2) !important;
}

.character-sheet.char-edit-foundry-shell .char-panel--hero {
    margin-bottom: 12px !important;
}

.character-sheet.char-edit-foundry-shell .char-panel--hero #charName {
    width: 100%;
    max-width: none;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid rgba(240, 195, 93, 0.2) !important;
    border-radius: 10px;
    background: rgba(7, 9, 18, 0.9) !important;
    color: var(--char-edit-gold-soft) !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(0.86rem, 1vw, 1rem);
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2) !important;
}

.character-sheet.char-edit-foundry-shell .char-panel--hero #charName::placeholder {
    color: rgba(243, 223, 181, 0.76);
}

.character-sheet.char-edit-foundry-shell .char-panel--hero label[for],
.character-sheet.char-edit-foundry-shell .char-panel--hero .col-md-4:first-child > label {
    display: none;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type::before {
    opacity: 0.6;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .card-body > .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(310px, 430px);
    gap: 24px;
    align-items: start !important;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .card-body > .row > .col-md-8,
.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .card-body > .row > .col-md-4 {
    width: auto;
    max-width: none;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .card-body > .row > .col-md-4 {
    padding: 18px;
    border-radius: 10px;
    background: rgba(6, 8, 18, 0.42);
}

.character-sheet.char-edit-foundry-shell .card-header {
    background:
        linear-gradient(90deg, rgba(28, 35, 70, 0.98), rgba(37, 25, 70, 0.92)) !important;
    border-bottom: 1px solid rgba(240, 195, 93, 0.24) !important;
    color: #ffe19b !important;
    font-size: 0.84rem;
    font-weight: 800 !important;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

.character-sheet.char-edit-foundry-shell .card-body {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(0, 0, 0, 0));
}

.character-sheet.char-edit-foundry-shell label,
.character-sheet.char-edit-foundry-shell .text-muted.small {
    color: var(--char-edit-muted) !important;
    font-weight: 700;
}

.character-sheet.char-edit-foundry-shell .text-warning,
.character-sheet.char-edit-foundry-shell .text-primary,
.character-sheet.char-edit-foundry-shell .text-success,
.character-sheet.char-edit-foundry-shell h6.text-light {
    color: var(--char-edit-gold-soft) !important;
}

.character-sheet.char-edit-foundry-shell .text-light,
.character-sheet.char-edit-foundry-shell .form-check-label {
    color: var(--char-edit-text) !important;
}

.character-sheet.char-edit-foundry-shell .form-control,
.character-sheet.char-edit-foundry-shell .form-select,
.character-sheet.char-edit-foundry-shell .cell-input,
.character-sheet.char-edit-foundry-shell .note-editor.note-frame {
    min-height: 42px;
    background: var(--char-edit-field) !important;
    border: 1px solid var(--char-edit-border-soft) !important;
    border-radius: 10px;
    color: var(--char-edit-text) !important;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.26);
}

.character-sheet.char-edit-foundry-shell .char-stat-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(116px, 1fr));
    gap: 7px !important;
}

.character-sheet.char-edit-foundry-shell .char-stat-grid--hp {
    grid-template-columns: repeat(4, minmax(106px, 1fr));
}

.character-sheet.char-edit-foundry-shell .char-stat-cell {
    position: relative;
    width: auto !important;
    max-width: none !important;
    min-height: 58px;
    padding: 7px 11px 6px !important;
    overflow: hidden;
    border: 0 !important;
    border-radius: 8px;
    background: var(--char-edit-card-bg);
    box-shadow: none;
}

.character-sheet.char-edit-foundry-shell .char-stat-cell--wide {
    grid-column: span 2;
}

.character-sheet.char-edit-foundry-shell .char-stat-cell--shield input,
.character-sheet.char-edit-foundry-shell .char-stat-cell--shield span {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem !important;
}

.character-sheet.char-edit-foundry-shell .char-stat-cell label {
    display: block;
    margin-bottom: 0.18rem;
    color: rgba(248, 250, 255, 0.9) !important;
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.035em;
    line-height: 1.05;
    text-transform: uppercase;
}

.character-sheet.char-edit-foundry-shell .char-stat-cell .form-control,
.character-sheet.char-edit-foundry-shell .char-stat-cell .form-select,
.character-sheet.char-edit-foundry-shell .char-stat-cell input,
.character-sheet.char-edit-foundry-shell .char-stat-cell select {
    min-height: 22px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    color: #fff4cd !important;
    font-size: 1rem;
    font-weight: 850;
    line-height: 1.1;
    box-shadow: none !important;
}

.character-sheet.char-edit-foundry-shell .char-stat-cell .d-flex {
    gap: 7px !important;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .form-control,
.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .form-select {
    min-height: 46px;
    border-color: rgba(240, 195, 93, 0.22) !important;
    background: rgba(5, 7, 16, 0.74) !important;
}

.character-sheet.char-edit-foundry-shell textarea.form-control {
    min-height: 92px;
}

.character-sheet.char-edit-foundry-shell .form-control-sm {
    min-height: 34px;
}

.character-sheet.char-edit-foundry-shell .form-control-lg {
    min-height: 52px;
}

.character-sheet.char-edit-foundry-shell .form-control::placeholder,
.character-sheet.char-edit-foundry-shell textarea::placeholder {
    color: rgba(155, 168, 206, 0.62);
}

.character-sheet.char-edit-foundry-shell .form-control:focus,
.character-sheet.char-edit-foundry-shell .form-select:focus,
.character-sheet.char-edit-foundry-shell .cell-input:focus {
    border-color: rgba(240, 195, 93, 0.68) !important;
    box-shadow:
        0 0 0 0.2rem rgba(240, 195, 93, 0.12),
        inset 0 0 0 1px rgba(240, 195, 93, 0.18);
}

.character-sheet.char-edit-foundry-shell input[readonly],
.character-sheet.char-edit-foundry-shell textarea[readonly] {
    color: rgba(232, 236, 255, 0.72) !important;
    background: rgba(7, 9, 18, 0.62) !important;
}

.character-sheet.char-edit-foundry-shell .img-thumbnail {
    padding: 3px;
    background: var(--char-edit-bg) !important;
    border: 1px solid rgba(240, 195, 93, 0.28) !important;
    border-radius: 8px;
    box-shadow: none;
}

.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark {
    position: relative;
    min-height: 116px;
    padding: 16px 14px 12px !important;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(6, 7, 16, 0.66), rgba(6, 7, 16, 0.86)),
        var(--char-edit-surface-3) !important;
    border: 0 !important;
    border-radius: 8px !important;
}

.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark::before {
    display: none !important;
}

.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark > * {
    position: relative;
    z-index: 1;
}

.character-sheet.char-edit-foundry-shell .stat-input {
    display: block;
    width: 100%;
    margin: 4px auto 0;
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    color: var(--char-edit-gold-soft) !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0;
    box-shadow: none !important;
}

.character-sheet.char-edit-foundry-shell .stat-input:focus {
    box-shadow: none !important;
    outline: 0;
}

.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark .d-flex:first-child .text-warning {
    color: var(--char-edit-gold) !important;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark .d-flex:last-child {
    margin-top: 10px !important;
    align-items: center;
}

.character-sheet.char-edit-foundry-shell .badge.bg-secondary {
    background: rgba(126, 109, 216, 0.26) !important;
    border: 1px solid rgba(126, 109, 216, 0.42);
    color: var(--char-edit-text);
}

.character-sheet.char-edit-foundry-shell .skill-toggle,
.character-sheet.char-edit-foundry-shell .sort-toggle,
.character-sheet.char-edit-foundry-shell .btn {
    border-radius: 10px;
    font-weight: 800;
}

.character-sheet.char-edit-foundry-shell .btn-outline-secondary,
.character-sheet.char-edit-foundry-shell .btn-outline-info,
.character-sheet.char-edit-foundry-shell .btn-outline-primary,
.character-sheet.char-edit-foundry-shell .btn-outline-warning,
.character-sheet.char-edit-foundry-shell .btn-outline-success {
    background: rgba(10, 12, 24, 0.74);
    border-color: rgba(126, 109, 216, 0.48);
    color: var(--char-edit-text);
}

.character-sheet.char-edit-foundry-shell .char-magic-action-row {
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.character-sheet.char-edit-foundry-shell .char-magic-action-row > .d-flex {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(100%, 540px);
    align-items: stretch;
    gap: 8px !important;
}

.character-sheet.char-edit-foundry-shell .char-magic-btn-group {
    display: contents;
}

.character-sheet.char-edit-foundry-shell .char-magic-btn,
.character-sheet.char-edit-foundry-shell .sort-toggle.char-magic-btn {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 44px;
    height: 100%;
    padding: 7px 8px;
    border-color: rgba(240, 195, 93, 0.48) !important;
    border-radius: 10px !important;
    background: rgba(8, 10, 20, 0.88) !important;
    color: var(--char-edit-gold-soft) !important;
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

.character-sheet.char-edit-foundry-shell .char-magic-btn:hover,
.character-sheet.char-edit-foundry-shell .sort-toggle.char-magic-btn.active {
    background: rgba(240, 195, 93, 0.18) !important;
    border-color: rgba(240, 195, 93, 0.72) !important;
    color: #fff4cd !important;
}

.character-sheet.char-edit-foundry-shell .btn-outline-warning {
    border-color: rgba(240, 195, 93, 0.52);
    color: var(--char-edit-gold-soft);
}

.character-sheet.char-edit-foundry-shell .btn-outline-info,
.character-sheet.char-edit-foundry-shell .btn-outline-primary {
    border-color: rgba(99, 215, 255, 0.46);
    color: #c9f3ff;
}

.character-sheet.char-edit-foundry-shell .btn-outline-success {
    border-color: rgba(91, 226, 163, 0.46);
    color: #c4ffe0;
}

.character-sheet.char-edit-foundry-shell .btn:hover,
.character-sheet.char-edit-foundry-shell .sort-toggle.active,
.character-sheet.char-edit-foundry-shell .skill-toggle[data-state="1"],
.character-sheet.char-edit-foundry-shell .skill-toggle[data-state="2"] {
    background: rgba(240, 195, 93, 0.14) !important;
    border-color: rgba(240, 195, 93, 0.62) !important;
    color: var(--char-edit-gold-soft) !important;
}

.character-sheet.char-edit-foundry-shell .btn-danger,
.character-sheet.char-edit-foundry-shell .remove-spell {
    background: rgba(255, 93, 121, 0.16) !important;
    border-color: rgba(255, 93, 121, 0.42) !important;
    color: #ffd5dc !important;
}

.character-sheet.char-edit-foundry-shell .alignment-grid {
    gap: 8px;
}

.character-sheet.char-edit-foundry-shell .alignment-option {
    min-height: 44px;
    background:
        linear-gradient(180deg, rgba(36, 27, 64, 0.42), rgba(8, 10, 18, 0.78)),
        rgba(9, 11, 23, 0.82);
    border-color: var(--char-edit-border-soft);
    color: var(--char-edit-text);
    border-radius: 12px;
    font-weight: 700;
}

.character-sheet.char-edit-foundry-shell .alignment-option:hover,
.character-sheet.char-edit-foundry-shell .alignment-option.is-active {
    border-color: rgba(240, 195, 93, 0.6);
    box-shadow: inset 0 0 0 1px rgba(240, 195, 93, 0.16), 0 0 18px rgba(240, 195, 93, 0.08);
}

.character-sheet.char-edit-foundry-shell .alert-info,
.character-sheet.char-edit-foundry-shell .alert-dark {
    background: rgba(99, 215, 255, 0.08);
    border-color: rgba(99, 215, 255, 0.22);
    color: #d6f6ff;
}

.character-sheet.char-edit-foundry-shell .table-responsive {
    border-radius: 12px;
    background: rgba(6, 8, 18, 0.44);
    box-shadow: inset 0 0 0 1px rgba(240, 195, 93, 0.1);
}

.character-sheet.char-edit-foundry-shell .table,
.character-sheet.char-edit-foundry-shell .weapon-table,
.character-sheet.char-edit-foundry-shell .spell-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--char-edit-text);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.025);
    --bs-table-striped-color: var(--char-edit-text);
    color: var(--char-edit-text);
    margin-bottom: 0;
}

.character-sheet.char-edit-foundry-shell .table thead th,
.character-sheet.char-edit-foundry-shell .weapon-table thead th,
.character-sheet.char-edit-foundry-shell .spell-table thead th {
    background: rgba(240, 195, 93, 0.09);
    border-bottom: 1px solid rgba(240, 195, 93, 0.24) !important;
    color: var(--char-edit-gold-soft);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.character-sheet.char-edit-foundry-shell .table td,
.character-sheet.char-edit-foundry-shell .table th,
.character-sheet.char-edit-foundry-shell .weapon-table td,
.character-sheet.char-edit-foundry-shell .weapon-table th,
.character-sheet.char-edit-foundry-shell .spell-table td,
.character-sheet.char-edit-foundry-shell .spell-table th {
    border-color: rgba(126, 109, 216, 0.18) !important;
    vertical-align: middle;
}

.character-sheet.char-edit-foundry-shell .spell-description-row td {
    padding-top: 0 !important;
}

.character-sheet.char-edit-foundry-shell .spell-description-input {
    width: 100%;
    min-height: 96px;
    resize: vertical;
    line-height: 1.35;
}

.character-sheet.char-edit-foundry-shell hr.border-secondary {
    border-color: rgba(240, 195, 93, 0.18) !important;
    opacity: 1;
}

.character-sheet.char-edit-foundry-shell .note-editor.note-frame {
    overflow: hidden;
}

.character-sheet.char-edit-foundry-shell .note-editor .note-toolbar {
    background: rgba(240, 195, 93, 0.1);
    border-bottom: 1px solid rgba(240, 195, 93, 0.2);
}

.character-sheet.char-edit-foundry-shell .note-editor .note-editable {
    background: rgba(7, 9, 18, 0.86);
    color: var(--char-edit-text);
}

.character-sheet.char-edit-foundry-shell #saveCharacterBtn {
    width: 100%;
    min-height: 40px;
    background: #15905d !important;
    border: 1px solid rgba(91, 226, 163, 0.42) !important;
    border-radius: 10px;
    color: #fff !important;
    font-weight: 900;
    box-shadow: none;
}

.character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 {
    display: grid;
    grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
    gap: 1.15rem;
}

.character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 > [class*="col-"] {
    display: flex;
    flex-direction: column;
    width: auto;
    max-width: none;
    padding: 0;
}

.character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 > [class*="col-"] > .card {
    margin-bottom: 1.35rem !important;
}

.character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 > [class*="col-"]:nth-child(2) {
    display: grid;
    grid-template-columns: repeat(2, minmax(270px, 1fr));
    align-content: start;
    gap: 1.15rem;
}

.character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 > [class*="col-"]:nth-child(2) > .card {
    margin-bottom: 0 !important;
}

.character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 > [class*="col-"]:nth-child(2) > .card:not(.char-panel--combat):not(.char-panel--hp) {
    grid-column: 1 / -1;
}

.character-sheet.char-edit-foundry-shell .char-panel--combat .char-stat-grid,
.character-sheet.char-edit-foundry-shell .char-panel--hp .char-stat-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.character-sheet.char-edit-foundry-shell .char-panel--combat .char-stat-cell--wide {
    grid-column: 1 / -1;
}

/* Full character view reuses the same flat modal visual layer as create/edit. */
.character-sheet.char-show-full-sheet {
    max-width: 1220px;
}

.character-sheet.char-show-full-sheet .char-show-edit-window-body {
    padding-bottom: 0;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .card-body > .row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(310px, 430px);
    gap: 8px 24px;
    align-items: start;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .card-body > .row > .col-md-6:first-child {
    width: auto;
    max-width: none;
    grid-column: 1 / span 2;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .card-body > .row > .col-md-6:nth-child(2) {
    display: contents;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero-media {
    width: auto;
    max-width: none;
    grid-column: 4;
    grid-row: 1 / span 3;
    padding: 18px;
    border-radius: 10px;
    background: rgba(6, 8, 18, 0.42);
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-show-edit-name-field {
    margin-bottom: 8px;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-inline-field--title {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    overflow: hidden;
    border: 1px solid rgba(240, 195, 93, 0.22) !important;
    border-radius: 10px;
    background: rgba(5, 7, 16, 0.74) !important;
    color: var(--char-edit-gold-soft) !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem !important;
    font-weight: 900;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .badge,
.character-sheet.char-show-full-sheet .char-show-edit-hero .char-hero-author,
.character-sheet.char-show-full-sheet .char-show-edit-hero .char-edit-hint {
    display: none;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .row.g-2 {
    display: contents;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .row.g-2 > [class*="col-"] {
    width: auto;
    max-width: none;
    padding: 0;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-inline-field--meta {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    overflow: hidden;
    border: 1px solid rgba(240, 195, 93, 0.22) !important;
    border-radius: 10px;
    background: rgba(5, 7, 16, 0.74) !important;
    color: var(--char-edit-text) !important;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-overview-media-stack {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 24px;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-overview-media-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-overview-media-card img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 1px solid rgba(240, 195, 93, 0.28);
    border-radius: 8px;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-overview-media-card--avatar img {
    width: 200px;
    height: 200px;
}

.character-sheet.char-show-full-sheet .char-show-edit-hero .char-overview-media-card span,
.character-sheet.char-show-full-sheet .char-show-edit-hero .char-overview-media-card a {
    color: var(--char-edit-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.character-sheet.char-show-full-sheet .char-show-edit-main-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
    gap: 1.15rem;
    margin: 0;
}

.character-sheet.char-show-full-sheet .char-show-edit-main-grid > [class*="col-"] {
    display: flex;
    flex-direction: column;
    width: auto;
    max-width: none;
    padding: 0;
}

.character-sheet.char-show-full-sheet .char-show-edit-main-grid .char-panel--abilities { order: 1; }
.character-sheet.char-show-full-sheet .char-show-edit-main-grid .char-panel--skills { order: 2; }
.character-sheet.char-show-full-sheet .char-show-edit-main-grid .char-panel--weapons { order: 3; }
.character-sheet.char-show-full-sheet .char-show-edit-main-grid .char-panel--class-features { order: 4; }
.character-sheet.char-show-full-sheet .char-show-edit-main-grid .char-panel--other-features { order: 5; }
.character-sheet.char-show-full-sheet .char-show-edit-main-grid .char-panel--custom-skills { order: 6; }
.character-sheet.char-show-full-sheet .char-show-edit-main-grid .char-panel--equipment { order: 7; }

.character-sheet.char-show-full-sheet .char-show-edit-mechanics {
    display: grid;
    grid-template-columns: repeat(2, minmax(270px, 1fr));
    gap: 1.15rem;
    order: 0;
}

.character-sheet.char-show-full-sheet .char-main-stack > .char-panel--magic { order: 1; }
.character-sheet.char-show-full-sheet .char-main-stack > .char-panel--story { order: 2; }
.character-sheet.char-show-full-sheet .char-main-stack > .char-panel--currency { order: 3; }
.character-sheet.char-show-full-sheet .char-main-stack > .char-panel--proficiency { order: 4; }
.character-sheet.char-show-full-sheet .char-main-stack > .char-panel--notes { order: 5; }

.character-sheet.char-show-full-sheet .char-show-edit-mechanics .char-panel--combat,
.character-sheet.char-show-full-sheet .char-show-edit-mechanics .char-panel--hp {
    margin-bottom: 0 !important;
}

.character-sheet.char-show-full-sheet .char-show-edit-mechanics .char-panel--combat .char-stat-grid,
.character-sheet.char-show-full-sheet .char-show-edit-mechanics .char-panel--hp .char-stat-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.character-sheet.char-show-full-sheet .char-show-edit-mechanics .char-panel--combat .char-stat-cell--wide {
    grid-column: 1 / -1;
}

.character-sheet.char-show-full-sheet .char-show-edit-mechanics .char-vital-meter {
    margin-bottom: 8px;
}

.character-sheet.char-show-full-sheet .char-panel--abilities .char-ability-card {
    min-height: 116px;
    padding: 16px 14px 12px;
    background:
        linear-gradient(180deg, rgba(6, 7, 16, 0.66), rgba(6, 7, 16, 0.86)),
        var(--char-edit-surface-3);
}

.character-sheet.char-show-full-sheet .char-sheet-frame {
    display: block;
    min-height: calc(100vh - 18px);
    overflow: visible;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(4, 5, 12, 0.98), rgba(3, 4, 10, 0.99)),
        #050610;
    border: 1px solid rgba(240, 195, 93, 0.34);
    border-radius: 13px;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.58),
        inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.character-sheet.char-show-full-sheet .char-sheet-body {
    display: block;
    min-width: 0;
}

.character-sheet.char-show-full-sheet .char-panel[data-char-tab-panel] {
    display: block !important;
}

.character-sheet.char-show-full-sheet .char-panel::before,
.character-sheet.char-show-full-sheet .char-ability-card::before,
.character-sheet.char-show-full-sheet .char-stat-cell::before {
    display: none !important;
}

.character-sheet.char-show-full-sheet .char-panel {
    overflow: hidden;
    border: 1px solid rgba(240, 195, 93, 0.22) !important;
    border-radius: 12px !important;
    background:
        linear-gradient(180deg, rgba(255, 246, 220, 0.022), transparent 36%),
        linear-gradient(145deg, rgba(8, 10, 18, 0.98), rgba(3, 4, 10, 0.98)) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.character-sheet.char-show-full-sheet .char-panel--hero {
    background:
        linear-gradient(90deg, rgba(22, 28, 58, 0.97), rgba(23, 18, 45, 0.94) 52%, rgba(7, 8, 15, 0.97)) !important;
}

.character-sheet.char-show-full-sheet .char-ability-card {
    min-height: 94px;
    padding: 12px;
    border: 0 !important;
    border-radius: 8px;
    background: var(--char-edit-card-bg);
    box-shadow: none !important;
}

.character-sheet.char-show-full-sheet .char-ability-card:hover {
    background: var(--char-edit-card-bg-hover);
    box-shadow: none !important;
}

.character-sheet.char-show-full-sheet .char-stat-cell {
    border: 0 !important;
    border-radius: 8px;
    background: var(--char-edit-card-bg);
    box-shadow: none !important;
}

/* VTT module palette contract for direct create/edit/show sheets.
   Presentation-only: does not affect sheet ids, save payloads, or VTT embed contracts. */
.character-sheet.char-edit-foundry-shell .char-edit-window,
.character-sheet.char-edit-foundry-shell .char-sheet-frame {
    background:
        linear-gradient(90deg, rgba(20, 18, 39, 0.86), rgba(6, 7, 16, 0.96) 36%, rgba(6, 7, 16, 0.98)),
        var(--char-edit-bg) !important;
    border-color: rgba(198, 153, 96, 0.38) !important;
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.52) !important;
}

.character-sheet.char-edit-foundry-shell .card,
.character-sheet.char-edit-foundry-shell .char-panel {
    background: var(--char-edit-surface) !important;
    border: 1px solid var(--char-edit-panel-border) !important;
    box-shadow: none !important;
}

.character-sheet.char-edit-foundry-shell .card-header,
.character-sheet.char-edit-foundry-shell .char-panel .card-header {
    background: var(--char-edit-panel-header) !important;
    border-bottom: 1px solid rgba(240, 195, 93, 0.2) !important;
    color: #ffd87a !important;
    letter-spacing: 0.055em;
}

.character-sheet.char-edit-foundry-shell .card-body,
.character-sheet.char-edit-foundry-shell .char-panel .card-body {
    background: transparent !important;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type,
.character-sheet.char-edit-foundry-shell .char-panel--hero,
.character-sheet.char-show-full-sheet .char-panel--hero {
    background:
        linear-gradient(90deg, rgba(20, 18, 39, 0.7), rgba(6, 7, 16, 0.94) 40%, rgba(6, 7, 16, 0.98)),
        var(--char-edit-surface) !important;
}

.character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .card-body > .row > .col-md-4,
.character-sheet.char-show-full-sheet .char-show-edit-hero-media {
    background: rgba(6, 7, 16, 0.5) !important;
    border: 1px solid rgba(240, 195, 93, 0.16);
}

.character-sheet.char-edit-foundry-shell .form-control,
.character-sheet.char-edit-foundry-shell .form-select,
.character-sheet.char-edit-foundry-shell .cell-input,
.character-sheet.char-edit-foundry-shell .readonly-field,
.character-sheet.char-edit-foundry-shell .char-inline-field--meta,
.character-sheet.char-edit-foundry-shell .char-inline-field--title,
.character-sheet.char-show-full-sheet .char-show-edit-hero .char-inline-field--meta,
.character-sheet.char-show-full-sheet .char-show-edit-hero .char-inline-field--title {
    background: var(--char-edit-card-bg) !important;
    border: 1px solid var(--char-edit-border-soft) !important;
    box-shadow: none !important;
}

.character-sheet.char-edit-foundry-shell .char-stat-cell,
.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark,
.character-sheet.char-edit-foundry-shell .char-ability-card,
.character-sheet.char-edit-foundry-shell .char-currency-chip,
.character-sheet.char-edit-foundry-shell .char-feature-card,
.character-sheet.char-edit-foundry-shell .embed-summary-row,
.character-sheet.char-edit-foundry-shell .char-traits-grid > div,
.character-sheet.char-edit-foundry-shell .note-editor.note-frame {
    border: 1px solid rgba(240, 195, 93, 0.16) !important;
    border-radius: 10px !important;
    background: rgba(6, 7, 16, 0.58) !important;
    box-shadow: none !important;
}

.character-sheet.char-edit-foundry-shell .char-stat-cell:hover,
.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark:hover,
.character-sheet.char-edit-foundry-shell .char-ability-card:hover,
.character-sheet.char-edit-foundry-shell .char-feature-card:hover,
.character-sheet.char-edit-foundry-shell .readonly-field:hover {
    transform: none !important;
    border-color: rgba(240, 195, 93, 0.34) !important;
    background: var(--char-edit-card-bg-hover) !important;
}

.character-sheet.char-edit-foundry-shell .char-panel--abilities .char-ability-card,
.character-sheet.char-show-full-sheet .char-panel--abilities .char-ability-card {
    min-height: 96px;
    padding: 12px 14px;
}

.character-sheet.char-edit-foundry-shell .char-ability-label,
.character-sheet.char-edit-foundry-shell .border.border-secondary.rounded.p-2.bg-dark .d-flex:first-child .text-warning {
    color: var(--char-edit-gold) !important;
}

.character-sheet.char-edit-foundry-shell .char-vital-meter {
    border: 1px solid rgba(240, 195, 93, 0.16) !important;
    background: rgba(6, 7, 16, 0.58) !important;
    box-shadow: none !important;
}

.character-sheet.char-edit-foundry-shell .table-responsive {
    background: rgba(6, 7, 16, 0.5) !important;
    border: 1px solid rgba(240, 195, 93, 0.12);
    box-shadow: none !important;
}

@media (min-width: 1200px) {
    .character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 {
        --bs-gutter-x: 0;
    }

    .character-sheet.char-edit-foundry-shell .card-body {
        padding: 1.15rem;
    }
}

@media (max-width: 991.98px) {
    .character-sheet.char-edit-foundry-shell {
        max-width: 100%;
        padding-inline: 8px;
    }

    .character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .d-flex.gap-4 {
        justify-content: flex-start !important;
        flex-wrap: wrap;
        margin-top: 16px;
    }

    .character-sheet.char-edit-foundry-shell #characterForm > .card:first-of-type .card-body > .row {
        grid-template-columns: 1fr;
    }

    .character-sheet.char-edit-foundry-shell .char-stat-grid,
    .character-sheet.char-edit-foundry-shell .char-stat-grid--hp {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .character-sheet.char-edit-foundry-shell #characterForm > .row.g-4,
    .character-sheet.char-edit-foundry-shell #characterForm > .row.g-4 > [class*="col-"]:nth-child(2) {
        grid-template-columns: 1fr;
    }

    .character-sheet.char-show-full-sheet .char-show-edit-hero .card-body > .row,
    .character-sheet.char-show-full-sheet .char-show-edit-main-grid,
    .character-sheet.char-show-full-sheet .char-show-edit-mechanics {
        grid-template-columns: 1fr;
    }

    .character-sheet.char-show-full-sheet .char-show-edit-hero .card-body > .row > .col-md-6:first-child,
    .character-sheet.char-show-full-sheet .char-show-edit-hero .card-body > .row > .col-md-6:nth-child(2) {
        display: block;
        grid-column: 1;
    }

    .character-sheet.char-show-full-sheet .char-show-edit-hero .row.g-2 {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .character-sheet.char-show-full-sheet .char-show-edit-hero-media {
        grid-column: 1;
        grid-row: auto;
    }

    .character-sheet.char-show-full-sheet .char-show-edit-hero .char-overview-media-stack {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .character-sheet.char-edit-foundry-shell {
        padding: 4px;
    }

    .character-sheet.char-edit-foundry-shell .char-edit-window-bar {
        flex-wrap: wrap;
    }

    .character-sheet.char-edit-foundry-shell .card {
        border-radius: 12px !important;
    }

    .character-sheet.char-edit-foundry-shell .card-header {
        align-items: flex-start !important;
        gap: 10px;
    }

    .character-sheet.char-edit-foundry-shell .card-header.d-flex,
    .character-sheet.char-edit-foundry-shell .d-flex.align-items-center.justify-content-between {
        flex-wrap: wrap;
    }

    .character-sheet.char-edit-foundry-shell .alignment-grid {
        grid-template-columns: 1fr;
    }

    .character-sheet.char-edit-foundry-shell .sort-toggle {
        min-width: 92px;
    }

    .character-sheet.char-edit-foundry-shell .char-stat-grid,
    .character-sheet.char-edit-foundry-shell .char-stat-grid--hp {
        grid-template-columns: 1fr;
    }

    .character-sheet.char-edit-foundry-shell .char-stat-cell--wide {
        grid-column: auto;
    }

    .character-sheet.char-show-full-sheet .char-show-edit-hero .row.g-2 {
        grid-template-columns: 1fr;
    }
}
