/* ============================================
   Settings Panel — refined visual layer
   ============================================ */

.settings-layout {
    padding: 4px 0 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
}

/* ---- Card shell ---- */
.settings-card {
    grid-column: span 6;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(216, 201, 184, 0.42);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 253, 252, 0.9) 100%);
    box-shadow: var(--shadow-card);
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-normal) var(--ease-smooth),
                transform var(--transition-normal) var(--ease-smooth);
}

.settings-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}


.settings-card > * {
    position: relative;
    z-index: 1;
}

.settings-card--wide {
    grid-column: 1 / -1;
}

.settings-card--danger {
    border-color: rgba(196, 69, 54, 0.22);
}

/* ---- Card header ---- */
.settings-card-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 0;
}

.settings-card-header-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.settings-card-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 7px;
}

.settings-card-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--color-brand-light);
    color: var(--color-brand-dark);
    font-size: 12px;
    flex-shrink: 0;
}

.settings-card-meta {
    font-size: 11px;
    color: var(--color-text-tertiary);
    line-height: 1.35;
}

/* ---- Card body ---- */
.settings-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.settings-card-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
    line-height: 1.45;
}

.settings-card-hint code {
    font-family: var(--font-family-mono);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(248, 243, 238, 0.7);
    color: var(--color-text-secondary);
}

/* ---- Field row ---- */
.settings-field-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.settings-field-label {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ---- Actions ---- */
.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

.settings-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 2px;
}

/* ---- Toggle switch (replaces checkbox) ---- */
.settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 0;
    border: none;
    background: none;
    border-radius: 0;
    user-select: none;
}

.settings-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: rgba(137, 111, 94, 0.22);
    border: 1px solid rgba(137, 111, 94, 0.16);
    cursor: pointer;
    position: relative;
    transition: background var(--transition-fast) var(--ease-smooth),
                border-color var(--transition-fast) var(--ease-smooth);
    flex-shrink: 0;
    margin: 0;
}

.settings-toggle input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform var(--transition-fast) var(--ease-spring);
}

.settings-toggle input[type="checkbox"]:checked {
    background: var(--color-brand);
    border-color: var(--color-brand);
}

.settings-toggle input[type="checkbox"]:checked::after {
    transform: translateX(18px);
}

.settings-toggle input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

.settings-toggle span {
    font-size: var(--font-size-secondary);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-body);
}

/* ---- Retention row ---- */
.settings-retention-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(216, 201, 184, 0.4);
    background: rgba(248, 243, 238, 0.6);
}

.settings-retention-input {
    width: 64px;
    padding: 4px 8px;
    border: 1px solid rgba(216, 201, 184, 0.6);
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    font-weight: 600;
    color: var(--color-text-primary);
    background: var(--color-surface);
    transition: border-color var(--transition-fast) var(--ease-smooth);
}

.settings-retention-input:focus {
    border-color: var(--color-brand);
    outline: none;
    box-shadow: 0 0 0 3px var(--color-brand-light);
}

/* ---- Backup grid ---- */
.settings-backup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.settings-backup-slot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(247, 240, 233, 0.45);
    border: 1px solid var(--color-border-soft);
    transition: border-color var(--transition-fast) var(--ease-smooth);
}

.settings-backup-slot:hover {
    border-color: var(--color-border);
}

.settings-backup-slot-label {
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-secondary);
    color: var(--color-text-muted);
    letter-spacing: 0.03em;
}

/* ---- Trash config grid ---- */
.settings-trash-config-grid {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---- Subtab bar ---- */
.settings-subtabs-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 22px;
    padding: 4px;
    background: rgba(247, 240, 233, 0.4);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-soft);
}

.settings-subtab {
    position: relative;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: var(--font-weight-secondary);
    transition: all var(--transition-fast) var(--ease-smooth);
    letter-spacing: 0.01em;
}

.settings-subtab:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.6);
}

.settings-subtab.active {
    color: var(--color-brand-dark);
    font-weight: 700;
    background: var(--color-surface);
    box-shadow: var(--shadow-subtle);
}

/* ---- Buttons inside cards ---- */
.settings-card .btn-tool {
    width: auto;
    max-width: 100%;
}

/* ---- Mobile ---- */
@media (max-width: 860px) {
    .settings-card {
        grid-column: 1 / -1;
    }
    .settings-field-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .settings-backup-grid {
        grid-template-columns: 1fr;
    }
    .settings-trash-config-grid {
        flex-direction: column;
        align-items: stretch;
    }
    .settings-subtabs-bar {
        gap: 2px;
    }
    .settings-subtab {
        padding: 8px 14px;
        font-size: 12px;
    }
}
