/* Licensing admin — overrides on top of TailAdmin theme/style.css */

.licensing-mono {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.85rem;
}

.licensing-mono-small {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.78rem;
}

/* TOTP enrollment QR */
.licensing-totp-qr-wrap {
    background: #fff;
}

.licensing-totp-qr-svg {
    display: block;
    max-width: 200px;
    height: auto;
}

.dark .licensing-totp-qr-wrap {
    background: #fff;
}

.licensing-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.licensing-actions-row form.inline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
}

.licensing-actions .btn-xs {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    height: 1.75rem;
    line-height: 1;
}

.licensing-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #465fff;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.licensing-icon-btn:hover {
    border-color: #a5b4fc;
    background: #f8fafc;
    color: #3641f5;
}

.dark .licensing-icon-btn {
    border-color: #374151;
    background: #1f2937;
    color: #818cf8;
}

.dark .licensing-icon-btn:hover {
    border-color: #6366f1;
    background: rgba(255, 255, 255, 0.05);
    color: #a5b4fc;
}

.licensing-days-input {
    width: 3rem;
    max-width: 3rem;
    height: 1.75rem;
    padding: 0.125rem 0.375rem;
    margin: 0;
}

.licensing-form-field {
    margin-bottom: 1rem;
}

.licensing-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.licensing-form-row .licensing-form-field {
    flex: 1 1 12rem;
    margin-bottom: 0;
}

.licensing-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.licensing-checkbox input {
    width: auto;
    max-width: none;
}

.licensing-hint {
    color: #64748b;
    font-size: 0.875rem;
}

.dark .licensing-hint {
    color: #94a3b8;
}

.licensing-nav-back {
    margin-top: 1.25rem;
    font-size: 0.875rem;
}

.licensing-nav-back a {
    color: #475569;
}

.dark .licensing-nav-back a {
    color: #94a3b8;
}

.licensing-inline-form {
    margin-top: 0.75rem;
}

details.licensing-advanced {
    margin-top: 1rem;
}

details.licensing-advanced summary {
    cursor: pointer;
    color: #475569;
    font-size: 0.9rem;
}

.dark details.licensing-advanced summary {
    color: #94a3b8;
}

code.licensing-code {
    background: #f1f5f9;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}

.dark code.licensing-code {
    background: rgba(255, 255, 255, 0.08);
}

.licensing-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: #dc2626;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
    transition: background 0.15s;
}

.licensing-btn-danger:hover {
    background: #b91c1c;
}

.licensing-btn-muted {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
}

.dark .licensing-btn-muted {
    border-color: #374151;
    background: #1f2937;
    color: #d1d5db;
}

.licensing-link {
    color: #465fff;
    font-size: 0.875rem;
}

.dark .licensing-link {
    color: #818cf8;
}

.licensing-link:hover {
    text-decoration: underline;
}

/* Dark sidebar — always charcoal, not theme-dependent */
aside.licensing-sidebar.sidebar,
aside.licensing-sidebar.sidebar:hover {
    width: 290px !important;
    min-width: 290px;
    flex-shrink: 0;
}

aside.licensing-sidebar.sidebar:hover .logo {
    display: flex !important;
}

.licensing-sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.licensing-sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.licensing-sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
}

aside.licensing-sidebar.sidebar {
    background-color: #1a2231 !important;
}

.licensing-sidebar .menu-item-inactive {
    color: #9ca3af !important;
    background-color: transparent !important;
}

.licensing-sidebar .menu-item-inactive:hover {
    color: #e5e7eb !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.licensing-sidebar .menu-item-active {
    color: #fff !important;
    background-color: rgba(70, 95, 255, 0.15) !important;
}

.licensing-sidebar .menu-item-icon-inactive,
.licensing-sidebar .menu-item-icon-inactive path {
    fill: #9ca3af !important;
    color: #9ca3af !important;
}

.licensing-sidebar .menu-item-icon-active,
.licensing-sidebar .menu-item-icon-active path {
    fill: #818cf8 !important;
    color: #818cf8 !important;
}

.licensing-sidebar .menu-item-arrow-inactive {
    color: #9ca3af !important;
}

.licensing-sidebar .menu-item-arrow-active {
    color: #fff !important;
}

.licensing-sidebar .menu-dropdown-item-inactive {
    color: #9ca3af !important;
    background-color: transparent !important;
}

.licensing-sidebar .menu-dropdown-item-inactive:hover {
    color: #e5e7eb !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.licensing-sidebar .menu-dropdown-item-active {
    color: #fff !important;
    background-color: rgba(70, 95, 255, 0.15) !important;
}

/* Sidebar application rows with per-app delete button */
.licensing-sidebar-app {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.licensing-sidebar-app .menu-dropdown-item {
    flex: 1 1 auto;
    min-width: 0;
}

.licensing-sidebar-app-delete {
    display: inline-flex;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.licensing-sidebar-app-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.licensing-sidebar-app-delete-btn svg {
    display: block;
    pointer-events: none;
}

.licensing-sidebar-app-delete-btn:hover {
    color: #fff;
    background: rgba(220, 38, 38, 0.35);
}

/* Centered confirmation modal (replaces native confirm()) */
.licensing-confirm {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.licensing-confirm-open {
    display: flex;
}

.licensing-confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}

.licensing-confirm-card {
    position: relative;
    width: 100%;
    max-width: 26rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    text-align: center;
    animation: licensing-confirm-pop 0.15s ease-out;
}

.dark .licensing-confirm-card {
    border-color: #374151;
    background: #1f2937;
}

@keyframes licensing-confirm-pop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.licensing-confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    margin-bottom: 1rem;
    background: #fef2f2;
    color: #dc2626;
}

.dark .licensing-confirm-icon {
    background: rgba(220, 38, 38, 0.15);
}

.licensing-confirm-title {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.dark .licensing-confirm-title {
    color: #fff;
}

.licensing-confirm-message {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #4b5563;
    overflow-wrap: break-word;
}

.dark .licensing-confirm-message {
    color: #d1d5db;
}

.licensing-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.licensing-confirm-actions .licensing-btn-muted,
.licensing-confirm-actions .licensing-btn-danger,
.licensing-confirm-actions .licensing-btn-primary {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Primary action inside a dialog (Confirm / OK). Same shape as the other modal buttons. */
.licensing-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: #465fff;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
    transition: background 0.15s;
}

.licensing-btn-primary:hover {
    background: #3a4fd8;
}

.licensing-btn-primary[disabled],
.licensing-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Icon variants, so one dialog component covers confirm / progress / success / failure. */
.licensing-confirm-icon--info {
    background: #eef2ff;
    color: #465fff;
}

.dark .licensing-confirm-icon--info {
    background: rgba(70, 95, 255, 0.18);
}

.licensing-confirm-icon--success {
    background: #ecfdf5;
    color: #059669;
}

.dark .licensing-confirm-icon--success {
    background: rgba(5, 150, 105, 0.18);
}

.licensing-confirm-icon--error {
    background: #fef2f2;
    color: #dc2626;
}

.dark .licensing-confirm-icon--error {
    background: rgba(220, 38, 38, 0.18);
}

/*
 * Result dialog ships BOTH glyphs and the modifier class on the wrapper decides which is
 * visible. The `hidden` attribute cannot be used here: an <svg> element ignores it, so both
 * icons rendered side by side and a failed publish showed a green tick next to the warning.
 * The attribute rule keeps the class-less default (before the script runs) to the tick.
 */
#licensing-result-icon>svg[data-result-glyph] {
    display: none;
}

#licensing-result-icon.licensing-confirm-icon--success>svg[data-result-glyph="success"],
#licensing-result-icon.licensing-confirm-icon--error>svg[data-result-glyph="error"] {
    display: block;
}

/* Upload / publish progress inside a dialog. */
.licensing-confirm-note {
    margin: -0.75rem 0 1.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: #6b7280;
    overflow-wrap: anywhere;
}

.dark .licensing-confirm-note {
    color: #9ca3af;
}

.licensing-confirm-progress {
    width: 100%;
    height: 0.5rem;
    margin-bottom: 0.75rem;
    border: none;
    border-radius: 9999px;
    background: #e5e7eb;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
}

.licensing-confirm-progress::-webkit-progress-bar {
    background: #e5e7eb;
    border-radius: 9999px;
}

.licensing-confirm-progress::-webkit-progress-value {
    background: #465fff;
    border-radius: 9999px;
    transition: width 0.2s ease;
}

.licensing-confirm-progress::-moz-progress-bar {
    background: #465fff;
    border-radius: 9999px;
}

.dark .licensing-confirm-progress,
.dark .licensing-confirm-progress::-webkit-progress-bar {
    background: #374151;
}

.licensing-confirm-status {
    margin-bottom: 1.5rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #4b5563;
    overflow-wrap: anywhere;
}

.dark .licensing-confirm-status {
    color: #d1d5db;
}

.licensing-confirm-status[data-state="error"] {
    color: #b91c1c;
}

.dark .licensing-confirm-status[data-state="error"] {
    color: #fca5a5;
}

.licensing-confirm-status[data-state="success"] {
    color: #047857;
}

.dark .licensing-confirm-status[data-state="success"] {
    color: #6ee7b7;
}

/*
 * Storage readiness indicator - a coloured dot to the LEFT of a short label, used in the
 * Updates configuration panel. Replaces the full-width red banner: an operator looking at the
 * settings wants a yes/no at a glance, stated next to the thing it describes.
 *
 * The colours are the theme's own success/error values so this cannot drift from the other
 * status lines in the same panel (see --color-success-600: #039855, --color-error-600: #d92d20).
 */
.licensing-storage-state {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

.licensing-storage-state::before {
    content: "";
    flex: none;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 9999px;
    background: currentColor;
    /* A soft halo keeps the dot readable on white and on the dark surface. */
    box-shadow: 0 0 0 3px rgba(3, 152, 85, 0.18);
}

.licensing-storage-state--ok {
    color: var(--color-success-600, #039855);
}

.dark .licensing-storage-state--ok {
    color: var(--color-success-500, #12b76a);
}

.licensing-storage-state--bad {
    color: var(--color-error-600, #d92d20);
}

.licensing-storage-state--bad::before {
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.18);
}

.dark .licensing-storage-state--bad {
    color: var(--color-error-500, #f04438);
}

body.licensing-modal-lock {
    overflow: hidden;
}

/* Live / Beta feed choice in the release history table. */
.licensing-feed-form {
    margin: 0;
}

.licensing-feed-choice {
    display: inline-flex;
    gap: 0.125rem;
    padding: 0.125rem;
    margin: 0;
    min-inline-size: 0;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.licensing-feed-option {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.21rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.licensing-feed-option input[type="radio"],
.licensing-feed-option input[type="checkbox"] {
    width: 0.875rem;
    height: 0.875rem;
    margin: 0;
    accent-color: #465fff;
    cursor: pointer;
}

.licensing-feed-option.is-active {
    background: #eef2ff;
    color: #1d4ed8;
}

.licensing-feed-option:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
}

.dark .licensing-feed-choice {
    border-color: #374151;
}

.dark .licensing-feed-option {
    color: #9ca3af;
}

.dark .licensing-feed-option.is-active {
    background: rgba(70, 95, 255, 0.18);
    color: #c7d2fe;
}

.licensing-sidebar h3 {
    color: #6b7280 !important;
}

/* Pill sun/moon theme toggle */
.licensing-theme-toggle {
    position: relative;
    display: inline-flex;
    width: 4.5rem;
    height: 2.75rem;
    flex-shrink: 0;
    align-items: center;
    border: none;
    border-radius: 9999px;
    background-color: #e5e7eb;
    padding: 0.25rem;
    cursor: pointer;
}

.dark .licensing-theme-toggle {
    background-color: #374151;
}

.licensing-theme-toggle__knob {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
    z-index: 2;
}

.licensing-theme-toggle__knob.is-dark {
    transform: translateX(2rem);
}

.licensing-theme-toggle__icon {
    position: absolute;
    top: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
}

.licensing-theme-toggle__icon--sun {
    left: 0.65rem;
}

.licensing-theme-toggle__icon--moon {
    right: 0.65rem;
}

/* Dashboard metric cards — TailAdmin-style row */
.licensing-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .licensing-metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .licensing-metric-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.licensing-metric-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.dark .licensing-metric-card {
    border-color: rgba(255, 255, 255, 0.08);
    background-color: rgba(255, 255, 255, 0.03);
}

.licensing-metric-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 8px rgba(16, 24, 40, 0.08);
}

.licensing-metric-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background-color: #ecf3ff;
    color: #465fff;
}

.dark .licensing-metric-card__icon {
    background-color: rgba(70, 95, 255, 0.12);
    color: #818cf8;
}

.licensing-metric-card__body {
    min-width: 0;
}

.licensing-metric-card__label {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
}

.dark .licensing-metric-card__label {
    color: #94a3b8;
}

.licensing-metric-card__value {
    margin: 0.25rem 0 0;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.licensing-metric-value--default { color: #1e293b; }
.licensing-metric-value--trial { color: #3b82f6; }
.licensing-metric-value--active { color: #16a34a; }
.licensing-metric-value--expired { color: #dc2626; }
.licensing-metric-value--disabled { color: #64748b; }
.licensing-metric-value--blocked { color: #b91c1c; }

.dark .licensing-metric-value--default { color: rgba(255, 255, 255, 0.9); }
.dark .licensing-metric-value--trial { color: #60a5fa; }
.dark .licensing-metric-value--active { color: #4ade80; }
.dark .licensing-metric-value--expired { color: #f87171; }
.dark .licensing-metric-value--disabled { color: #94a3b8; }
.dark .licensing-metric-value--blocked { color: #fca5a5; }

.licensing-table td,
.licensing-table th {
    vertical-align: middle;
}

.licensing-actions {
    min-width: 12rem;
}
