:root {
    --bg-main: #07111c;
    --bg-panel: rgba(10, 35, 58, 0.78);
    --bg-header: rgba(12, 43, 70, 0.88);
    --bg-hover: rgba(55, 148, 255, 0.16);

    --border: rgba(55, 148, 255, 0.32);

    --text-primary: #cccccc;
    --text-secondary: #9d9d9d;
    --text-heading: #f0f0f0;

    --accent: #3794ff;
    --accent-hover: #4da3ff;

    --danger: #f14c4c;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: var(--accent);
}

.admin-header {
    min-height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-title {
    margin: 0;
    color: var(--text-heading);
    font-size: 18px;
    font-weight: 600;
}

.admin-main {
    padding: 24px;
}

.admin-button {
    padding: 8px 14px;
    color: var(--accent);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.admin-button:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.admin-login-card {
    width: 100%;
    max-width: 420px;
}

.admin-login-card {
    width: 100%;
    max-width: 360px;
    padding: 32px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.admin-login-logo {
    display: block;
    width: 160px;
    height: auto;
    margin: 0 auto 24px;
}

.admin-login-card h1 {
    margin: 0 0 24px;
    color: var(--text-heading);
    font-size: 24px;
    text-align: center;
}

.admin-login-card form > div {
    margin-bottom: 16px;
}

.admin-login-card label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.admin-login-card input {
    width: 100%;
    padding: 9px 10px;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
}

.admin-login-card input:focus {
    border-color: var(--accent);
}

.admin-login-card button {
    width: 100%;
    padding: 9px 14px;
    color: #ffffff;
    background: var(--accent);
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.admin-login-card button:hover {
    background: var(--accent-hover);
}

.admin-header-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.admin-workspace {
    min-height: calc(100vh - 64px);
    display: flex;
}

.admin-sidebar {
    width: 220px;
    padding: 16px 0;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
}

.admin-sidebar a,
.admin-sidebar span {
    display: block;
    padding: 10px 18px;
    color: var(--text-primary);
    text-decoration: none;
}

.admin-sidebar a:hover {
    background: var(--bg-hover);
}

.admin-sidebar span {
    color: var(--text-secondary);
}

.admin-main {
    flex: 1;
    padding: 24px;
}

.admin-page-header {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.admin-page-header h2 {
    margin: 0;
    color: var(--text-heading);
}

.admin-page-header p {
    margin: 0;
    color: var(--text-secondary);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    color: var(--text-heading);
    background: var(--bg-header);
    font-weight: 600;
}

.admin-table tbody tr:hover {
    background: var(--bg-hover);
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}
.admin-success {
    margin-bottom: 16px;
    padding: 10px 12px;
    color: #b7f7c2;
    background: #19351f;
    border: 1px solid #2f6f3e;
    border-radius: 4px;
}

.admin-error {
    margin: 8px 0 14px;
    padding: 10px 12px;
    color: #ffb3b3;
    background: #3a1d1d;
    border: 1px solid #7a3434;
    border-radius: 4px;
}
/* Sortable table headers */
.admin-table th[data-sort] {
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}

.admin-table th[data-sort]::after {
    content: " \2195";
    color: var(--text-secondary);
    font-size: 12px;
}

.admin-table th[data-sort]:hover {
    color: var(--accent-hover);
}

/* Header Theme create/edit field alignment */
label[for="header_theme_id"],
label[for="image_url"] {
    display: inline-block;
    width: 110px;
}

#header_theme_id,
#image_url {
    width: 220px;
}

form[action*="header-themes"] > div {
    margin-bottom: 10px;
}

/* Background create/edit field alignment */
form[action*="backgrounds"] label {
    display: inline-block;
    width: 110px;
}

form[action*="backgrounds"] input[type="text"],
form[action*="backgrounds"] input[type="url"] {
    width: 220px;
}

form[action*="backgrounds"] > div {
    margin-bottom: 10px;
}

form[action*="backgrounds"] .admin-button[type="submit"] {
    margin-top: 10px;
}

/* Preset Image create/edit field alignment */
form[action*="bonus-images"] label {
    display: inline-block;
    width: 110px;
}

form[action*="bonus-images"] input[type="text"],
form[action*="bonus-images"] input[type="url"],
form[action*="bonus-images"] input[type="number"] {
    width: 220px;
}

form[action*="bonus-images"] > div {
    margin-bottom: 10px;
}

form[action*="bonus-images"] .admin-button[type="submit"] {
    margin-top: 10px;
}

/* Preset create/edit form alignment */
form[action*="preset-tables"] .admin-field {
    margin-bottom: 12px;
}

form[action*="preset-tables"] .admin-field > label {
    display: inline-block;
    width: 105px;
    vertical-align: top;
    padding-top: 4px;
}

form[action*="preset-tables"] .admin-field > input[type="text"],
form[action*="preset-tables"] .admin-field > textarea {
    width: 280px;
}

form[action*="preset-tables"] .admin-button[type="submit"] {
    margin-top: 12px;
}

/* Preset table column sizing */
.preset-table-list {
    table-layout: fixed;
}

.preset-table-list th:nth-child(1),
.preset-table-list td:nth-child(1) {
    width: 13%;
}

.preset-table-list th:nth-child(2),
.preset-table-list td:nth-child(2) {
    width: 12%;
}

.preset-table-list th:nth-child(3),
.preset-table-list td:nth-child(3) {
    width: 9%;
}

.preset-table-list th:nth-child(5),
.preset-table-list td:nth-child(5) {
    width: 145px;
}

.preset-table-list td:nth-child(4) code {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Keep Preset action buttons side-by-side */
.preset-table-list th:nth-child(5),
.preset-table-list td:nth-child(5) {
    width: 180px;
    white-space: nowrap;
}

.preset-table-list td:nth-child(5) form {
    display: inline-block !important;
}

/* Tighten Preset Table ID column */
.preset-table-list th:nth-child(1),
.preset-table-list td:nth-child(1) {
    width: 9%;
}

/* Tighten App Tab column */
.preset-table-list th:nth-child(3),
.preset-table-list td:nth-child(3) {
    width: 6%;
}

/* Preset table compact action icons - Actions column first */
.preset-table-list th:nth-child(1),
.preset-table-list td:nth-child(1) {
    width: 70px;
    white-space: nowrap;
}

.preset-table-list th:nth-child(2),
.preset-table-list td:nth-child(2) {
    width: 9%;
}

.preset-table-list th:nth-child(3),
.preset-table-list td:nth-child(3) {
    width: 12%;
}

.preset-table-list th:nth-child(4),
.preset-table-list td:nth-child(4) {
    width: 6%;
}

.preset-table-list td:nth-child(5) code {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-table-list .preset-actions form {
    display: inline-block !important;
    margin: 0;
}

.preset-table-list .preset-icon-action {
    display: inline-flex;
    width: 24px;
    height: 24px;
    padding: 2px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    vertical-align: middle;
}

.preset-table-list .preset-icon-action svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.preset-table-list .preset-icon-edit {
    color: var(--accent);
}

.preset-table-list .preset-icon-edit:hover {
    color: var(--accent-hover);
}

.preset-table-list .preset-icon-delete {
    color: var(--danger);
}

.preset-table-list .preset-icon-delete:hover {
    opacity: 0.8;
}

/* Compact Preset table columns and shift content left */
.preset-table-list {
    table-layout: auto;
}

.preset-table-list th:nth-child(1),
.preset-table-list td:nth-child(1),
.preset-table-list th:nth-child(2),
.preset-table-list td:nth-child(2),
.preset-table-list th:nth-child(3),
.preset-table-list td:nth-child(3),
.preset-table-list th:nth-child(4),
.preset-table-list td:nth-child(4) {
    width: 1%;
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 8px;
}

.preset-table-list th:nth-child(5),
.preset-table-list td:nth-child(5) {
    width: auto;
}

/* AccessID table compact action icons */
.access-id-table {
    table-layout: auto;
}

.access-id-table th:nth-child(1),
.access-id-table td:nth-child(1),
.access-id-table th:nth-child(2),
.access-id-table td:nth-child(2) {
    width: 1%;
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 8px;
}

.access-id-table .access-actions form {
    display: inline-block !important;
    margin: 0;
}

.access-id-table .access-icon-action {
    display: inline-flex;
    width: 24px;
    height: 24px;
    padding: 2px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    vertical-align: middle;
}

.access-id-table .access-icon-action svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.access-id-table .access-icon-edit {
    color: var(--accent);
}

.access-id-table .access-icon-edit:hover {
    color: var(--accent-hover);
}

.access-id-table .access-icon-delete {
    color: var(--danger);
}

.access-id-table .access-icon-delete:hover {
    opacity: 0.8;
}

/* Tighten AccessID table and shift everything left */
.access-id-table th:nth-child(1),
.access-id-table td:nth-child(1) {
    width: 1%;
    white-space: nowrap;
    padding-left: 6px;
    padding-right: 4px;
}

.access-id-table th:nth-child(2),
.access-id-table td:nth-child(2) {
    width: 1%;
    white-space: nowrap;
    padding-left: 6px;
    padding-right: 8px;
}

.access-id-table .access-icon-action {
    width: 20px;
    height: 20px;
    padding: 1px;
    margin: 0 1px;
}

.access-id-table .access-icon-action svg {
    width: 15px;
    height: 15px;
}

/* Keep AccessID table compact on the left */
.access-id-table {
    width: auto;
    table-layout: auto;
}

.access-id-table th,
.access-id-table td {
    white-space: nowrap;
}

.access-id-table th:nth-child(1),
.access-id-table td:nth-child(1) {
    width: 60px;
    padding-left: 6px;
    padding-right: 4px;
}

.access-id-table th:nth-child(2),
.access-id-table td:nth-child(2) {
    width: 110px;
    padding-left: 6px;
    padding-right: 8px;
}

.access-id-table .access-icon-action {
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0 1px;
}

.access-id-table .access-icon-action svg {
    width: 14px;
    height: 14px;
}

/* Give AccessID table a little more breathing room */
.access-id-table th:nth-child(1),
.access-id-table td:nth-child(1) {
    width: 75px;
    padding-left: 8px;
    padding-right: 10px;
}

.access-id-table th:nth-child(2),
.access-id-table td:nth-child(2) {
    width: 125px;
    padding-left: 10px;
    padding-right: 12px;
}

/* Enlarge AccessID action icons */
.access-id-table .access-icon-action {
    width: 24px;
    height: 24px;
}

.access-id-table .access-icon-action svg {
    width: 18px;
    height: 18px;
}

/* Header Theme table action icons */
.header-theme-table .header-theme-actions {
    width: 80px;
    white-space: nowrap;
}

.header-theme-table .header-theme-actions form {
    display: inline-block !important;
    margin: 0;
}

.header-theme-table .header-theme-icon-action {
    display: inline-flex;
    width: 28px;
    height: 28px;
    padding: 2px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    vertical-align: middle;
}

.header-theme-table .header-theme-icon-action svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.header-theme-table .header-theme-icon-edit {
    color: var(--accent);
}

.header-theme-table .header-theme-icon-edit:hover {
    color: var(--accent-hover);
}

.header-theme-table .header-theme-icon-delete {
    color: var(--danger);
}

.header-theme-table .header-theme-icon-delete:hover {
    opacity: 0.8;
}

/* Background table action icons */
.background-table .background-actions {
    width: 80px;
    white-space: nowrap;
}

.background-table .background-actions form {
    display: inline-block !important;
    margin: 0;
}

.background-table .background-icon-action {
    display: inline-flex;
    width: 28px;
    height: 28px;
    padding: 2px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    vertical-align: middle;
}

.background-table .background-icon-action svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.background-table .background-icon-edit {
    color: var(--accent);
}

.background-table .background-icon-edit:hover {
    color: var(--accent-hover);
}

.background-table .background-icon-delete {
    color: var(--danger);
}

.background-table .background-icon-delete:hover {
    opacity: 0.8;
}

/* Enlarge Preset table action icons to match other tables */
.preset-table-list .preset-icon-action {
    width: 28px;
    height: 28px;
    padding: 2px;
}

.preset-table-list .preset-icon-action svg {
    width: 20px;
    height: 20px;
}

/* Firmware Update form alignment */
form[action*="firmware-update"] .admin-field {
    margin-bottom: 10px;
}

form[action*="firmware-update"] .admin-field > label {
    display: inline-block;
    width: 125px;
}

form[action*="firmware-update"] .admin-field > input {
    width: 260px;
}

form[action*="firmware-update"] .admin-button[type="submit"] {
    margin-top: 10px;
}

/* Bonus Image table action icons */
.bonus-image-table .bonus-image-actions {
    width: 80px;
    white-space: nowrap;
}

.bonus-image-table .bonus-image-actions form {
    display: inline-block !important;
    margin: 0;
}

.bonus-image-table .bonus-image-icon-action {
    display: inline-flex;
    width: 28px;
    height: 28px;
    padding: 2px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    vertical-align: middle;
}

.bonus-image-table .bonus-image-icon-action svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.bonus-image-table .bonus-image-icon-edit {
    color: var(--accent);
}

.bonus-image-table .bonus-image-icon-edit:hover {
    color: var(--accent-hover);
}

.bonus-image-table .bonus-image-icon-delete {
    color: var(--danger);
}

.bonus-image-table .bonus-image-icon-delete:hover {
    opacity: 0.8;
}

/* Make Dashboard sidebar link slightly larger */
.admin-sidebar a:first-child {
    font-size: 16px;
    font-weight: 600;
}

/* Picture View URL edit form alignment */
.picture-view-form .admin-field {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.picture-view-form .admin-field > label {
    width: 150px;
    padding-top: 0;
}

.picture-view-form .admin-field > input[type="text"],
.picture-view-form .admin-field > input[type="url"] {
    width: 500px;
    box-sizing: border-box;
}

.picture-view-form .admin-button[type="submit"] {
    margin-top: 10px;
}
/* ZLEDS blue glass panel treatment */
.admin-header,
.admin-sidebar,
.admin-table,
.admin-button,
.admin-login-card {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Picture View URL full-form glass panel */
.picture-view-form {
    display: inline-block;
    padding: 24px;
    background: rgba(10, 35, 58, 0.78);
    border: 1px solid rgba(55, 148, 255, 0.32);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Picture View URL field styling */
.picture-view-form .admin-field > input[type="text"],
.picture-view-form .admin-field > input[type="url"] {
    padding: 8px 10px;
    color: var(--text-primary);
    background: rgba(5, 20, 34, 0.82);
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
}

/* Picture View URL focused field */
.picture-view-form .admin-field > input[type="text"]:focus,
.picture-view-form .admin-field > input[type="url"]:focus {
    border-color: var(--accent);
}

/* Read-only PresetID styling */
.picture-view-form .admin-field > input[readonly] {
    color: var(--text-secondary);
    background: rgba(5, 20, 34, 0.55);
}
/* ZLEDS API background image */
html {
    background: #030912;
}

body {
    background-color: #030912;
    background-image:
        linear-gradient(rgba(2, 9, 18, 0.30), rgba(2, 9, 18, 0.30)),
        url('/images/api_background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.admin-workspace,
.admin-main {
    background: transparent;
}
/* Picture View table action icons */
.picture-view-table .picture-view-actions {
    width: 80px;
    white-space: nowrap;
}

.picture-view-table .picture-view-actions form {
    display: inline-block !important;
    margin: 0;
}

.picture-view-table .picture-view-icon-action {
    display: inline-flex;
    width: 28px;
    height: 28px;
    padding: 2px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.picture-view-table .picture-view-icon-action svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.picture-view-table .picture-view-icon-edit {
    color: var(--accent);
}

.picture-view-table .picture-view-icon-edit:hover {
    color: var(--accent-hover);
}

.picture-view-table .picture-view-icon-delete {
    color: var(--danger);
}

.picture-view-table .picture-view-icon-delete:hover {
    opacity: 0.8;
}
/* ZLEDS 404 error page */
.admin-error-page {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.admin-error-container {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 28px 34px;
    background: rgba(10, 35, 58, 0.78);
    border: 1px solid rgba(55, 148, 255, 0.40);
    border-radius: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.admin-error-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 50%;
    font-size: 28px;
    font-weight: 700;
}

.admin-error-message {
    display: flex;
    align-items: center;
    gap: 18px;
}

.admin-error-code {
    color: var(--text-heading);
    font-size: 22px;
    font-weight: 700;
}

.admin-error-divider {
    width: 1px;
    height: 34px;
    background: rgba(55, 148, 255, 0.55);
}

.admin-error-text {
    color: var(--text-heading);
    font-size: 20px;
}

@media (max-width: 520px) {
    .admin-error-container {
        gap: 16px;
        padding: 22px;
    }

    .admin-error-message {
        gap: 12px;
    }
}
/* AccessID image URL editor - wide URL rows */
.picture-view-form {
    display: block !important;
    width: 1000px !important;
    max-width: calc(100vw - 280px) !important;
    box-sizing: border-box !important;
}

.picture-view-form .admin-field {
    width: 100% !important;
}

.picture-view-form .admin-field > label {
    flex: 0 0 150px !important;
}

.picture-view-form .admin-field > div {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    align-items: center !important;
    gap: 12px !important;
}

.picture-view-form .admin-field > div > input[type="url"] {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
}

.picture-view-form .admin-field > div > a {
    flex: 0 0 56px !important;
}

/* Preset create/edit form icon controls */
.preset-form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.preset-form-icon-action {
    display: inline-flex;
    width: 34px;
    height: 34px;
    padding: 5px;
    margin: 0;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    color: var(--accent);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
}

.preset-form-icon-action:hover {
    color: var(--accent-hover);
    background: var(--bg-hover);
    border-color: var(--accent);
}

.preset-form-icon-action svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.preset-form-icon-save {
    margin-top: 12px;
}

.preset-form-actions .preset-form-icon-save {
    margin-top: 0;
}
/* Dashboard maintenance controls */
.dashboard-maintenance-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-maintenance-actions form {
    margin: 0;
}

.admin-button-danger {
    color: var(--danger);
}

.admin-button-danger:hover {
    color: var(--danger);
    border-color: var(--danger);
}
/* Media Library */
.media-upload-form {
    display: inline-block;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.media-upload-form .admin-field {
    margin-bottom: 12px;
}

.media-upload-form label {
    display: inline-block;
    width: 110px;
}

.media-library-table {
    width: 100%;
}

.media-library-actions {
    width: 60px;
}

.media-library-delete {
    width: 30px;
    height: 30px;
    padding: 4px;
    color: var(--danger);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.media-library-delete svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.media-library-delete:hover {
    opacity: 0.8;
}

.media-library-preview {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: contain;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.media-library-url {
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-library-url input {
    width: 360px;
    max-width: 100%;
}
/* Reusable Media Library URL picker */
.media-picker-row {
    margin-top: 6px;
}

.media-library-picker {
    width: 100%;
    max-width: 520px;
}
/* Preset Submission Review Queue */
.preset-submission-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.preset-submission-table {
    width: 100%;
}

.preset-submission-data {
    width: 320px;
    min-height: 110px;
    resize: vertical;
    font-family: monospace;
}

.preset-submission-table td {
    vertical-align: top;
}

.preset-submission-table form {
    margin-bottom: 8px;
}

.preset-submission-table form textarea {
    display: block;
    width: 220px;
    min-height: 54px;
    margin-bottom: 6px;
}

/* ============================================================
   PRESET LINEAR VIEW
   Shared read-only renderer for Cloud Presets and submissions.
   ============================================================ */

.preset-linear-view {
    width: 100%;
    min-width: 0;
}

.preset-linear-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: 8px;
    color: #9dc6d8;
    font-size: 11px;
}

.preset-linear-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #173d53;
    border-radius: 6px;
    background: #07121c;
}

.preset-linear-frame-list {
    width: max-content;
    min-width: 100%;
    padding: 6px 0;
}

.preset-linear-row {
    display: grid;
    grid-template-columns: 42px max-content;
    align-items: center;
    min-width: max-content;
    min-height: 24px;
}

.preset-linear-row + .preset-linear-row {
    border-top: 1px solid rgba(38, 211, 255, 0.08);
}

.preset-linear-frame-column {
    position: sticky;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 24px;
    background: #07121c;
}

.preset-linear-frame-index {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid #ED5E68;
    border-radius: 4px;
    color: #ED5E68;
    background: #101923;
    font-size: 9px;
    font-weight: 700;
}

.preset-linear-frame-switchback {
    border-color: #26D3FF;
    color: #26D3FF;
}

.preset-linear-track {
    position: relative;
    width: max-content;
    height: 24px;
    margin-right: 8px;
}

.preset-linear-selectors,
.preset-linear-overlays {
    display: grid;
    grid-template-columns: repeat(44, 24px);
    gap: 2px;
    width: max-content;
    height: 24px;
}

.preset-linear-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    border: 1px solid #294352;
    border-radius: 50%;
    background: #101923;
    color: #C0C0C0;
    font-size: 8px;
    font-weight: 600;
    line-height: 1;
}

.preset-linear-selector-on {
    border-color: #ED5E68;
    background: rgba(237, 94, 104, 0.46);
    color: #FFFFFF;
    box-shadow: inset 0 0 6px rgba(237, 94, 104, 0.42);
}

.preset-linear-selector-b {
    border-color: #1F6F89;
}

.preset-linear-overlays {
    position: absolute;
    inset: 0 auto auto 0;
    z-index: 2;
    pointer-events: none;
}

.preset-linear-overlay {
    display: flex;
    grid-row: 1;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 24px;
    min-width: 0;
    overflow: hidden;
    padding: 0 4px;
    border: 1px solid #26D3FF;
    border-radius: 4px;
    background: rgba(22, 37, 48, 0.96);
    color: #26D3FF;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-linear-overlay-advanced {
    background: rgba(22, 37, 48, 0.97);
}

.preset-linear-error {
    padding: 8px 10px;
    border: 1px solid #ED5E68;
    border-radius: 5px;
    background: rgba(237, 94, 104, 0.08);
    color: #ED5E68;
    font-size: 9px;
}
/* Preset Submission Review - embedded read-only Linear View. */
.preset-submission-linear-view {
    width: 520px;
    max-width: 62vw;
    margin-top: 10px;
}

.preset-submission-linear-view-title {
    margin-bottom: 6px;
    color: #26D3FF;
    font-size: 9px;
    font-weight: 600;
}
/* Preset Submission Review - side-by-side raw data and compact Linear View. */
.preset-submission-data-layout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: nowrap;
    min-width: max-content;
}

.preset-submission-data-pane {
    flex: 0 0 auto;
}

.preset-submission-data-pane .preset-submission-data {
    width: 190px;
    min-width: 190px;
    height: 150px;
}

.preset-submission-linear-pane {
    flex: 0 0 auto;
}

.preset-submission-linear-view {
    width: 430px;
    max-width: none;
    margin-top: 0;
}

.preset-submission-linear-view-title {
    margin-bottom: 4px;
    color: #26D3FF;
    font-size: 11px;
    font-weight: 600;
}

.preset-submission-linear-view .preset-linear-summary {
    gap: 4px 10px;
    margin-bottom: 6px;
    font-size: 10px;
}

.preset-submission-linear-view .preset-linear-row {
    grid-template-columns: 34px max-content;
    min-height: 24px;
}

.preset-submission-linear-view .preset-linear-frame-column {
    width: 34px;
    height: 24px;
}

.preset-submission-linear-view .preset-linear-frame-index {
    width: 20px;
    height: 20px;
    font-size: 9px;
}

.preset-submission-linear-view .preset-linear-track {
    height: 20px;
}

.preset-submission-linear-view .preset-linear-selectors,
.preset-submission-linear-view .preset-linear-overlays {
    grid-template-columns: repeat(44, 20px);
    gap: 2px;
    height: 20px;
}

.preset-submission-linear-view .preset-linear-selector {
    width: 20px;
    height: 20px;
    font-size: 7px;
}

.preset-submission-linear-view .preset-linear-overlay {
    height: 20px;
    padding: 0 3px;
    font-size: 8px;
}

@media (max-width: 1500px) {
    .preset-submission-data-layout {
        flex-wrap: wrap;
    }
}
/* Preset Submission Review - compact left-side actions. */
.preset-submission-actions-heading,
.preset-submission-actions-cell {
    width: 62px;
    min-width: 62px;
    padding-left: 6px !important;
    padding-right: 6px !important;
    text-align: center;
}

.preset-submission-icon-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
}

.preset-submission-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 25px;
    height: 25px;
    padding: 4px;
    border: 1px solid #1f6fb2;
    border-radius: 4px;
    background: #071a29;
    cursor: pointer;
}

.preset-submission-icon-button svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.preset-submission-icon-approve {
    color: #26D3FF;
}

.preset-submission-icon-approve:hover {
    border-color: #26D3FF;
    background: rgba(38, 211, 255, 0.12);
}

.preset-submission-icon-reject {
    color: #ED5E68;
}

.preset-submission-icon-reject:hover {
    border-color: #ED5E68;
    background: rgba(237, 94, 104, 0.12);
}

.preset-submission-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    font-size: 15px;
    font-weight: 700;
}

.preset-submission-status-approved {
    color: #26D3FF;
}

.preset-submission-status-rejected {
    color: #ED5E68;
}
/* Preset Submission Review - let Linear View fill all remaining row space. */
.preset-submission-data-layout {
    width: 100%;
    min-width: 0;
}

.preset-submission-data-pane {
    flex: 0 0 190px;
}

.preset-submission-linear-pane {
    flex: 1 1 auto;
    min-width: 0;
}

.preset-submission-linear-view {
    width: 100%;
    max-width: none;
}

.preset-submission-linear-view .preset-linear-scroll {
    width: 100%;
}
/* Preset Submission Review - stretch raw preset data to Linear View height. */
.preset-submission-data-layout {
    align-items: stretch;
}

.preset-submission-data-pane {
    display: flex;
    align-self: stretch;
}

.preset-submission-data-pane .preset-submission-data {
    height: auto;
    min-height: 100%;
    align-self: stretch;
    resize: none;
}
/* Cloud Preset Management - raw data + shared compact Linear View. */
.preset-manager-data-layout {
    display: flex;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.preset-manager-raw-pane {
    flex: 0 0 190px;
    width: 190px;
    min-width: 190px;
    overflow-wrap: anywhere;
}

.preset-manager-raw-pane code {
    display: block;
    height: 100%;
    min-height: 100%;
    padding: 6px;
    border: 1px solid #173d53;
    border-radius: 5px;
    background: #07121c;
    white-space: normal;
    overflow-wrap: anywhere;
}

.preset-manager-linear-pane {
    flex: 1 1 auto;
    min-width: 0;
}

.preset-manager-linear-title {
    margin-bottom: 4px;
    color: #26D3FF;
    font-size: 11px;
    font-weight: 600;
}

.preset-manager-linear-pane .preset-linear-view {
    width: 100%;
    max-width: none;
}

.preset-manager-linear-pane .preset-linear-row {
    grid-template-columns: 34px max-content;
    min-height: 24px;
}

.preset-manager-linear-pane .preset-linear-frame-column {
    width: 34px;
    height: 24px;
}

.preset-manager-linear-pane .preset-linear-frame-index {
    width: 20px;
    height: 20px;
    font-size: 9px;
}

.preset-manager-linear-pane .preset-linear-track {
    height: 20px;
}

.preset-manager-linear-pane .preset-linear-selectors,
.preset-manager-linear-pane .preset-linear-overlays {
    grid-template-columns: repeat(44, 20px);
    gap: 2px;
    height: 20px;
}

.preset-manager-linear-pane .preset-linear-selector {
    width: 20px;
    height: 20px;
    font-size: 7px;
}

.preset-manager-linear-pane .preset-linear-overlay {
    height: 20px;
    padding: 0 3px;
    font-size: 8px;
}

/* Firmware Update OTA upload */
.firmware-info-panel {
    margin-bottom: 20px;
    padding: 12px 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.firmware-upload-form {
    max-width: 760px;
    margin-bottom: 32px;
    padding: 18px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.firmware-upload-form .admin-field > label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.firmware-upload-form input[type="text"],
.firmware-upload-form input[type="number"],
.firmware-upload-form input[type="file"],
.firmware-upload-form textarea {
    width: 100%;
    padding: 9px 10px;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
}

.firmware-upload-form input:focus,
.firmware-upload-form textarea:focus {
    border-color: var(--accent);
}

.firmware-upload-form textarea {
    resize: vertical;
}

.firmware-section {
    margin-top: 28px;
}

.firmware-section h3 {
    color: var(--text-heading);
}

.firmware-detail-table {
    width: auto;
    min-width: 680px;
}

.firmware-detail-table th {
    width: 210px;
    white-space: nowrap;
}

.firmware-detail-table code {
    word-break: break-all;
}

.firmware-muted {
    color: var(--text-secondary);
}
